How to make a new value in List Box Choice (Discuz!)

  • >> Ayl_X <<
  • Newbie
  • Newbie
  • >> Ayl_X <<
  • Posts: 6

Post 3+ Months Ago

memcp.php
Code: [ Select ]
<?php

/*
    [DISCUZ!] memcp.php - member's control panel
    This is NOT a freeware, use is subject to license terms

    Version: 2.0.0
    Author: Crossday (info@discuz.net)
    Copyright: Crossday Studio (www.crossday.com)
    Last Modified: 2002/12/6 17:00
*/

require './include/common.php';

$discuz_action = 7;

if(!$discuz_user || !$discuz_pw) {
    showmessage('not_loggedin');
}

if(!isset($action)) {

    $query = $db->query("SELECT avatar FROM $table_members WHERE username='$discuz_user'");
    $avatar = $db->result($query, 0);

    $buddyonline = $buddyoffline = array();
    $query = $db->query("SELECT b.*, s.username AS onlineuser, s.invisible FROM $table_buddys b LEFT JOIN $table_sessions s ON s.username=b.buddyname WHERE b.username='$discuz_user'");
    while($buddy = $db->fetch_array($query)) {
        $buddyuser = array('buddy' => $buddy['buddyname'], 'buddyenc' => rawurlencode($buddy['buddyname']));
        if($buddy['onlineuser'] && ($isadmin || !$buddy['invisible'])) {
            $buddyonline[] = $buddyuser;
        } else {
            $buddyoffline[] = $buddyuser;
        }
    }

    $avatar = $avatar ? image($avatar) : "&";

    $msgexists = 0;
    $msglist = array();
    $query = $db->query("SELECT * FROM $table_pm WHERE msgto='$discuz_user' AND folder='inbox' ORDER BY dateline DESC LIMIT 0, 5");
    while($message = $db->fetch_array($query)) {
        $msgexists = 1;
        $message['dateline'] = gmdate("$dateformat $timeformat", $message['dateline'] + $timeoffset * 3600);
        $message['subject'] = $message['new'] ? "<b>$message[subject]</b>" : $message['subject'];

        $msglist[] = $message;
    }

    $subsexists = 0;
    $subslist = array();
    $query = $db->query("SELECT t.*, f.name FROM $table_subscriptions s, $table_threads t, $table_forums f WHERE t.tid=s.tid AND f.fid=t.fid AND s.username='$discuz_user' ORDER BY t.lastpost DESC LIMIT 0, 5");
    while($subs = $db->fetch_array($query)) {
        $subsexists = 1;
        $subs['lastposterenc'] = rawurlencode($subs['lastposter']);
        $subs['lastpost'] = gmdate("$dateformat $timeformat", $subs['lastpost'] + $timeoffset * 3600);

        $subslist[] = $subs;
    }

    include template('memcp_home');

} elseif($action == 'profile') {

    if(!$editsubmit) {

        $query = $db->query("SELECT * FROM $table_members WHERE username='$discuz_user'");
        $member = $db->fetch_array($query);

        $emailchecked = $member['showemail'] ? 'checked="checked"' : NULL;
        $newschecked = $member['newsletter'] ? 'checked="checked"' : NULL;
        $tppchecked = array($member['tpp'] => 'selected="selected"');
        $pppchecked = array($member['ppp'] => 'selected="selected"');
        
        $currtime = gmdate($timeformat);

        if($member['gender'] == 1) {
            $checkmale = 'checked';
        } elseif($member[gender] == 2) {
            $checkfemale = 'checked';
        } else {
            $checkunknown = 'checked';
        }

        $styleselect = '';
        $query = $db->query("SELECT styleid, name FROM $table_styles WHERE available='1'");
        while($style = $db->fetch_array($query)) {
            $styleselect .= "<option value=\"$style[styleid]\" ".
                ($style['styleid'] == $member['styleid'] ? 'selected="selected"' : NULL).
                ">$style[name]</option>\n";
        }

        $bday = explode('-', $member['bday']);
        $bday[0] = $bday[0] == '0000' ? '' : $bday[0];
        $month = array(intval($bday[1]) => "selected=\"selected\"");

        for($num = 1; $num <= 31; $num++) {
            $dayselect .= "<option value=\"$num\" ".
                ($bday[2] == $num ? 'selected="selected"' : NULL).
                ">$num</option>\n";
        }

        $member['dateformat'] = str_replace('n', 'mm', $member['dateformat']);
        $member['dateformat'] = str_replace('j', 'dd', $member['dateformat']);
        $member['dateformat'] = str_replace('y', 'yy', $member['dateformat']);
        $member['dateformat'] = str_replace('Y', 'yyyy', $member['dateformat']);
        $member['timeformat'] == 'H:i' ? $check24 = 'checked="checked"' : $check12 = 'checked="checked"';

        $imgcodeis = $allowsigimgcode ? 'On' : 'Off';
        $bbcodeis = $allowsigbbcode ? 'On' : 'Off';

        include template('memcp_profile');

    } else {

        if($newpassword) {
            if(md5($oldpassword) != $discuz_pw) {
                showmessage('profile_passwd_wrong');
            } elseif(ereg('"', $newpassword) || ereg("'", $newpassword)) {
                showmessage('profile_passwd_illegal');
            }
            $newpassword = md5($newpassword);
            $newpasswdadd = ", password='$newpassword'";
        } else {
            $newpassword = $discuz_pw;
            $newpasswdadd = "";
        }

        if($maxsigsize && strlen($signew) > $maxsigsize) {
            showmessage('profile_sig_toolang');
        }
        if($allowavatar == 2 && $avatarnew) {
            if($maxavatarsize) {
                if(strstr($avatarnew, ',')) {
                    $avatarinfo = explode(',', $avatarnew);
                    if(trim($avatarinfo[1]) > $maxavatarsize || trim($avatarinfo[2]) > $maxavatarsize) {
                        showmessage('profile_avatar_toobig');
                    }
                } elseif($image_size = @getimagesize($avatarnew)) {
                    if($image_size[0] > $maxavatarsize || $image_size[1] > $maxavatarsize) {
                        showmessage('profile_avatar_toobig');
                    }
                }
            }
            $avatarnew = dhtmlspecialchars($avatarnew);
            $avataradd = ", avatar='$avatarnew'";
        } else {
//            $avataradd = ', avatar=\'\'';
        }

        $locationnew = dhtmlspecialchars($locationnew);
        $icqnew = dhtmlspecialchars($icqnew);
        $yahoonew = dhtmlspecialchars($yahoonew);
        $oicqnew = dhtmlspecialchars($oicqnew);
        $emailnew = dhtmlspecialchars($emailnew);
        $sitenew = dhtmlspecialchars($sitenew);
        $bionew = dhtmlspecialchars($bionew);
        $bdaynew = dhtmlspecialchars($bdaynew);
        $cstatusnew = $allowcstatus ? dhtmlspecialchars($cstatusnew) : '';
        $timeformatnew = $timeformatnew == '12' ? 'h:i A' : 'H:i';

        $bdaynew = ($month && $day && $year) ? "$year-$month-$day" : '';

        $dateformatnew = str_replace('mm', 'n', $dateformatnew);
        $dateformatnew = str_replace('dd', 'j', $dateformatnew);
        $dateformatnew = str_replace('yyyy', 'Y', $dateformatnew);
        $dateformatnew = str_replace('yy', 'y', $dateformatnew);

        if($regverify == 1) {
            $query = $db->query("SELECT email FROM $table_members WHERE username='$discuz_user'");
            if($emailnew != $db->result($query, 0)) {
                if(!$doublee) {
                    $query = $db->query("SELECT COUNT(*) FROM $table_members WHERE email='$emailnew'");
                    if($db->result($query, 0)) {
                        showmessage('profile_email_duplicate');
                    }
                }                    
                $newpassword = random(8);
                $newpasswdadd = ", password='".md5($newpassword)."'";
                sendmail($emailnew, 'email_verify_subject', 'email_verify_content');
            }
        }

        $db->query("UPDATE $table_members SET gender='$gendernew', email='$emailnew', site='$sitenew', oicq='$oicqnew',
            location='$locationnew', bio='$bionew', signature='$signew', showemail='$showemailnew', timeoffset='$timeoffsetnew',
            icq='$icqnew', yahoo='$yahoonew', styleid='$styleidnew', bday='$bdaynew', tpp='$tppnew', ppp='$pppnew',
            ".($allowcstatus ? "customstatus='$cstatusnew', " : '')." newsletter='$newsletternew', timeformat='$timeformatnew', nickname='$nicknamenew', height='$heightnew', msn='$msnnew',
            dateformat='$dateformatnew', pwdrecover='', pwdrcvtime='' $avataradd $newpasswdadd WHERE username='$discuz_user'");

        $discuz_pw = $newpassword;
        $styleid = $styleidnew;

        if($regverify == 1 && $emailnew != $email) {
            showmessage('profile_email_identify');
        } else {
            showmessage('profile_succeed', 'memcp.php');
        }
    }

} elseif($action == 'favorites') {

    if($favadd && !$favsubmit) {

        $query = $db->query("SELECT tid FROM $table_favorites WHERE tid='$favadd' AND username='$discuz_user'");
        if($db->num_rows($query)) {
            showmessage('favorite_exists');
        } else {
            $db->query("INSERT INTO $table_favorites (tid, username)
                VALUES ('$favadd', '$discuz_user')");
            showmessage('favorite_add_succeed', $referer);
        }

    } elseif(!$favadd && !$favsubmit) {

        $query = $db->query("SELECT t.*, f.name FROM $table_favorites fav, $table_threads t, $table_forums f WHERE fav.tid=t.tid AND fav.username='$discuz_user' AND t.fid=f.fid ORDER BY t.lastpost DESC");
        if($db->num_rows($query)) {
            $favexists = 1;
            $favlist = array();
            while($fav = $db->fetch_array($query)) {
                $fav['lastposterenc'] = rawurlencode($fav['lastposter']);
                $fav['lastpost'] = gmdate("$dateformat $timeformat", $fav['lastpost'] + $timeoffset * 3600);

                $favlist[] = $fav;
            }
        } else {
            $favexists = 0;
        }

        include template('memcp_misc');

    } elseif(!$favadd && $favsubmit) {

        $ids = $comma = '';
        if(is_array($delete)) {
            foreach($delete as $deleteid) {
                $ids .= $comma.$deleteid;
                $comma = ', ';
            }
        }

        if($ids) {
            $db->query("DELETE FROM $table_favorites WHERE username='$discuz_user' AND tid IN ($ids)");
        }
        showmessage('favorite_update_succeed', $referer);
    }

} elseif($action == 'subscriptions') {

    if($subadd && !$subsubmit) {

        $query = $db->query("SELECT tid FROM $table_subscriptions WHERE tid='$subadd' AND username='$discuz_user'");
        if($db->num_rows($query)) {
            showmessage('subscription_exists');
        } else {
            $db->query("INSERT INTO $table_subscriptions (username, email, tid, lastnotify)
                VALUES ('$discuz_user', '$email', '$subadd', '')");
            showmessage('subscription_add_succeed', $referer);
        }

    } elseif(!$subadd && !$subsubmit) {

        $query = $db->query("SELECT t.*, f.name FROM $table_subscriptions s, $table_threads t, $table_forums f WHERE t.tid=s.tid AND f.fid=t.fid AND s.username='$discuz_user' ORDER BY t.lastpost DESC");
        if($db->num_rows($query)) {
            $subsexists = 1;
            $sublist = array();
            while($subs = $db->fetch_array($query)) {
                $subs['lastposterenc'] = rawurlencode($subs['lastposter']);
                $subs['lastpost'] = gmdate("$dateformat $timeformat", $subs['lastpost'] + $timeoffset * 3600);

                $subslist[] = $subs;
            }
        } else {
            $subsexists = 0;
        }

        include template('memcp_misc');

    } elseif(!$subadd && $subsubmit) {

        $ids = $comma = '';
        if(is_array($delete)) {
            foreach($delete as $deleteid) {
                $ids .= "$comma$deleteid";
                $comma = ", ";
            }
        }

        if($ids) {
            $db->query("DELETE FROM $table_subscriptions WHERE username='$discuz_user' AND tid IN ($ids)");
        }
        showmessage('subscription_update_succeed', $referer);
    }

} elseif($action == 'viewavatars') {

    if(!$avasubmit) {

        $app = 16;
        $avatarsdir = $discuz_root.'./images/avatars';
        if(!$page) {
            $page = 1;
        }

        $query = $db->query("SELECT avatar FROM $table_members WHERE username='$discuz_user'");
        $member = $db->fetch_array($query);
        $avatarlist = "";
        $num = 1;
        if(is_dir($avatarsdir)) {
            $adir = dir($avatarsdir);
            while($entry = $adir->read()) {
                if ($entry != '.' && $entry != '..') {
                    if (is_file("$avatarsdir/$entry")) {
                        $avatars[$num] = $entry;
                        $num++;
                    }
                }
            }
            $adir->close();
            $num--;
        } else {
            showmessage('profile_avatardir_nonexistence');
        }

        $start = ($page - 1) * $app;
        $end = ($start + $app > $num) ? ($num - 1) : ($start + $app - 1);

        $multipage = multi($num, $app, $page, "memcp.php?action=viewavatars");
        for($i = $start; $i <= $end; $i += 4) {
            $avatarlist .= "<tr>\n";
            for($j = 0; $j < 4; $j++) {
                $thisbg = ($thisbg == ALTBG1) ? ALTBG2 : ALTBG1;
                $avatarlist .= "<td bgcolor=\"$thisbg\" width=\"25%\" align=\"center\">";
                if($avatars[$i + $j] && ($i + $j)) {
                    $avatarlist .= "<img src=\"images/avatars/".$avatars[$i + $j]."\"></td>\n";
                } else {
                    $avatarlist .= "&</td>\n";
                }
            }
            $avatarlist .= "</tr><tr>\n";
            for($j = 0; $j < 4; $j++) {
                $avatarlist .= "<td bgcolor=\"$thisbg\" width=\"25%\" align=\"center\">";
                if($avatars[$i + $j] && ($i + $j)) {
                    if(strpos($member['avatar'], $avatars[$i + $j])) {
                        $checked = "checked";
                    } else {
                        $checked = "";
                    }
                    $avatarlist .= "<input type=\"radio\" value=\"images/avatars/".$avatars[$i + $j]."\" name=\"avatarnew\" $checked>".$avatars[$i + $j]."\n";
                } elseif($i + $j == 0) {
                    if(!$member['avatar']) {
                        $checked = "checked";
                    }
                    $avatarlist .= "<input type=\"radio\" value=\"\" name=\"avatarnew\" $checked><span class=\"bold\">不使用頭像</span>\n";
                } else {
                    $avatarlist .= "&</td>\n";
                }
                $thisbg = ($thisbg == ALTBG1) ? ALTBG2 : ALTBG1;
            }
            $avatarlist .= "</tr><tr><td bgcolor=\"".ALTBG1."\" colspan=\"4\" height=\"1\"></td></tr>\n\n";
        }

        include template('memcp_misc');

    } elseif($avasubmit) {

        $db->query("UPDATE $table_members SET avatar='$avatarnew' WHERE username='$discuz_user'");
        showmessage('profile_avatar_succeed', 'memcp.php?action=profile');

    }

} elseif($action == 'buddylist') {

    if(empty($delete)) {
        $buddy = trim($buddy);
        $query = $db->query("SELECT COUNT(*) FROM $table_buddys WHERE username='$discuz_user' AND buddyname='$buddy'");
        if($db->result($query, 0)) {
            showmessage('buddy_add_invalid');
        }
        $query = $db->query("SELECT username FROM $table_members WHERE username='$buddy'");
        $buddy = addslashes($db->result($query, 0));
        if(empty($buddy)) {
            showmessage('buddy_add_nonexistence');
        }
        $db->query("INSERT INTO $table_buddys VALUES ('$discuz_user', '$buddy')");
        showmessage('buddy_add_succeed', 'memcp.php');
    } else {
        $db->query("DELETE FROM $table_buddys WHERE username='$discuz_user' AND buddyname='$delete'");
        showmessage('buddy_delete_succeed', 'memcp.php');
    }
}
elseif($action == 'permission'){
    $query = $db ->query("SELECT $table_usergroups.* FROM $table_usergroups
                                            LEFT JOIN $table_members ON ($table_usergroups.status=$table_members.status AND ($table_usergroups.creditshigher='0' AND $table_usergroups.creditslower='0' AND $table_usergroups.specifiedusers='')) OR ($table_members.credit>=$table_usergroups.creditshigher AND $table_members.credit<$table_usergroups.creditslower)
                                            WHERE $table_members.username = '$discuz_user'");
    $permission = $db->fetch_array($query);
    $permission['allowvisit'] = $permission['allowvisit'] == "1" ? "√" : "<font color=red>×</font>";
    $permission['ismoderator'] = $permission['ismoderator'] == "1" ? "√" : "<font color=red>×</font>";
    $permission['issupermod'] = $permission['issupermod'] == "1" ? "√" : "<font color=red>×</font>";
    $permission['isadmin'] = $permission['isadmin'] == "1" ? "√" : "<font color=red>×</font>";
    $permission['allowviewstats'] = $permission['allowviewstats'] == "1" ? "√" : "<font color=red>×</font>";
    $permission['allowview'] = $permission['allowview'] == "1" ? "√" : "<font color=red>×</font>";
  $permission['allowpost'] = $permission['allowpost'] == "1" ? "√" : "<font color=red>×</font>";
    $permission['allowsetviewperm'] = $permission['allowsetviewperm'] == "1" ? "√" : "<font color=red>×</font>";
    $permission['allowpostpoll'] = $permission['allowpostpoll'] == "1" ? "√" : "<font color=red>×</font>";
    $permission['allowvote'] = $permission['allowvote'] == "1" ? "√" : "<font color=red>×</font>";
    $permission['allowgetattach'] = $permission['allowgetattach'] == "1" ? "√" : "<font color=red>×</font>";
    $permission['allowpostattach'] = $permission['allowpostattach'] == "1" ? "√" : "<font color=red>×</font>";
    $permission['allowsetattachperm'] = $permission['allowsetattachperm'] == "1" ? "√" : "<font color=red>×</font>";
    $permission['attachextensions'] = $permission['attachextensions'] ? $permission['attachextensions'] : "允許所有附件類型";
    $permission['allowcstatus'] = $permission['allowcstatus'] == "1" ? "√" : "<font color=red>×</font>";
    $permission['allowkarma'] = $permission['allowkarma'] == "1" ? "√" : "<font color=red>×</font>";
    $permission['allowsigimgcode'] = $permission['allowsigimgcode'] == "1" ? "√" : "<font color=red>×</font>";
    $permission['allowsigbbcode'] = $permission['allowsigbbcode'] == "1" ? "√" : "<font color=red>×</font>";
    include template('memcp_permission');
} elseif($action == 'credits') {

    include template('header');
    echo base64_decode('PGNlbnRlcj48c3BhbiBjbGFzcz1cIm1lZGl1bXR4dFwiIHN0eWxlPVwiZm9udC1zaXplOiAyMHB4OyBmb250LXdlaWdodDogYm9sZFwiPkRpc2N1eiEgQ3JlZGl0czwvc3Bhbj48YnI+PGJyPjx0YWJsZSBjZWxsc3BhY2luZz1cIjBcIiBjZWxscGFkZGluZz1cIjBcIiBib3JkZXI9XCIwXCIgd2lkdGg9XCI0MDBcIiBhbGlnbj1cImNlbnRlclwiPjx0cj48dGQgYmdjb2xvcj1cIiRib3JkZXJjb2xvclwiPjx0YWJsZSBib3JkZXI9XCIwXCIgY2VsbHNwYWNpbmc9XCIkYm9yZGVyd2lkdGhcIiBjZWxscGFkZGluZz1cIiR0YWJsZXNwYWNlXCIgd2lkdGg9XCIxMDAlXCI+PHRyIGNsYXNzPVwiaGVhZGVyXCI+PHRkIGNvb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ubGluZS5jb21cIiB0YXJnZXQ9XCJfYmxhbmtcIj7OtMP7seLW2zwvYT4sIDxhIGhyZWY9XCJodHRwOi8vM3B1bmsuY29tXCIgdGFyZ2V0PVwiX2JsYW5rXCI+M3B1bms8L2E+LCA8YSBocmVmPVwiaHR0cDovL3d3dy5wdWZmZXIuaWR2LnR3L2NkYlwiIHRhcmdldD1cIl9ibGFua1wiPnB1ZmZlcjwvYT48L3RkPjwvdHI+PC90YWJsZT48L3RkPjwvdHI+PC90YWJsZT48YnI+PGJyPg==');
    include template('footer');

}

?>
  1. <?php
  2. /*
  3.     [DISCUZ!] memcp.php - member's control panel
  4.     This is NOT a freeware, use is subject to license terms
  5.     Version: 2.0.0
  6.     Author: Crossday (info@discuz.net)
  7.     Copyright: Crossday Studio (www.crossday.com)
  8.     Last Modified: 2002/12/6 17:00
  9. */
  10. require './include/common.php';
  11. $discuz_action = 7;
  12. if(!$discuz_user || !$discuz_pw) {
  13.     showmessage('not_loggedin');
  14. }
  15. if(!isset($action)) {
  16.     $query = $db->query("SELECT avatar FROM $table_members WHERE username='$discuz_user'");
  17.     $avatar = $db->result($query, 0);
  18.     $buddyonline = $buddyoffline = array();
  19.     $query = $db->query("SELECT b.*, s.username AS onlineuser, s.invisible FROM $table_buddys b LEFT JOIN $table_sessions s ON s.username=b.buddyname WHERE b.username='$discuz_user'");
  20.     while($buddy = $db->fetch_array($query)) {
  21.         $buddyuser = array('buddy' => $buddy['buddyname'], 'buddyenc' => rawurlencode($buddy['buddyname']));
  22.         if($buddy['onlineuser'] && ($isadmin || !$buddy['invisible'])) {
  23.             $buddyonline[] = $buddyuser;
  24.         } else {
  25.             $buddyoffline[] = $buddyuser;
  26.         }
  27.     }
  28.     $avatar = $avatar ? image($avatar) : "&";
  29.     $msgexists = 0;
  30.     $msglist = array();
  31.     $query = $db->query("SELECT * FROM $table_pm WHERE msgto='$discuz_user' AND folder='inbox' ORDER BY dateline DESC LIMIT 0, 5");
  32.     while($message = $db->fetch_array($query)) {
  33.         $msgexists = 1;
  34.         $message['dateline'] = gmdate("$dateformat $timeformat", $message['dateline'] + $timeoffset * 3600);
  35.         $message['subject'] = $message['new'] ? "<b>$message[subject]</b>" : $message['subject'];
  36.         $msglist[] = $message;
  37.     }
  38.     $subsexists = 0;
  39.     $subslist = array();
  40.     $query = $db->query("SELECT t.*, f.name FROM $table_subscriptions s, $table_threads t, $table_forums f WHERE t.tid=s.tid AND f.fid=t.fid AND s.username='$discuz_user' ORDER BY t.lastpost DESC LIMIT 0, 5");
  41.     while($subs = $db->fetch_array($query)) {
  42.         $subsexists = 1;
  43.         $subs['lastposterenc'] = rawurlencode($subs['lastposter']);
  44.         $subs['lastpost'] = gmdate("$dateformat $timeformat", $subs['lastpost'] + $timeoffset * 3600);
  45.         $subslist[] = $subs;
  46.     }
  47.     include template('memcp_home');
  48. } elseif($action == 'profile') {
  49.     if(!$editsubmit) {
  50.         $query = $db->query("SELECT * FROM $table_members WHERE username='$discuz_user'");
  51.         $member = $db->fetch_array($query);
  52.         $emailchecked = $member['showemail'] ? 'checked="checked"' : NULL;
  53.         $newschecked = $member['newsletter'] ? 'checked="checked"' : NULL;
  54.         $tppchecked = array($member['tpp'] => 'selected="selected"');
  55.         $pppchecked = array($member['ppp'] => 'selected="selected"');
  56.         
  57.         $currtime = gmdate($timeformat);
  58.         if($member['gender'] == 1) {
  59.             $checkmale = 'checked';
  60.         } elseif($member[gender] == 2) {
  61.             $checkfemale = 'checked';
  62.         } else {
  63.             $checkunknown = 'checked';
  64.         }
  65.         $styleselect = '';
  66.         $query = $db->query("SELECT styleid, name FROM $table_styles WHERE available='1'");
  67.         while($style = $db->fetch_array($query)) {
  68.             $styleselect .= "<option value=\"$style[styleid]\" ".
  69.                 ($style['styleid'] == $member['styleid'] ? 'selected="selected"' : NULL).
  70.                 ">$style[name]</option>\n";
  71.         }
  72.         $bday = explode('-', $member['bday']);
  73.         $bday[0] = $bday[0] == '0000' ? '' : $bday[0];
  74.         $month = array(intval($bday[1]) => "selected=\"selected\"");
  75.         for($num = 1; $num <= 31; $num++) {
  76.             $dayselect .= "<option value=\"$num\" ".
  77.                 ($bday[2] == $num ? 'selected="selected"' : NULL).
  78.                 ">$num</option>\n";
  79.         }
  80.         $member['dateformat'] = str_replace('n', 'mm', $member['dateformat']);
  81.         $member['dateformat'] = str_replace('j', 'dd', $member['dateformat']);
  82.         $member['dateformat'] = str_replace('y', 'yy', $member['dateformat']);
  83.         $member['dateformat'] = str_replace('Y', 'yyyy', $member['dateformat']);
  84.         $member['timeformat'] == 'H:i' ? $check24 = 'checked="checked"' : $check12 = 'checked="checked"';
  85.         $imgcodeis = $allowsigimgcode ? 'On' : 'Off';
  86.         $bbcodeis = $allowsigbbcode ? 'On' : 'Off';
  87.         include template('memcp_profile');
  88.     } else {
  89.         if($newpassword) {
  90.             if(md5($oldpassword) != $discuz_pw) {
  91.                 showmessage('profile_passwd_wrong');
  92.             } elseif(ereg('"', $newpassword) || ereg("'", $newpassword)) {
  93.                 showmessage('profile_passwd_illegal');
  94.             }
  95.             $newpassword = md5($newpassword);
  96.             $newpasswdadd = ", password='$newpassword'";
  97.         } else {
  98.             $newpassword = $discuz_pw;
  99.             $newpasswdadd = "";
  100.         }
  101.         if($maxsigsize && strlen($signew) > $maxsigsize) {
  102.             showmessage('profile_sig_toolang');
  103.         }
  104.         if($allowavatar == 2 && $avatarnew) {
  105.             if($maxavatarsize) {
  106.                 if(strstr($avatarnew, ',')) {
  107.                     $avatarinfo = explode(',', $avatarnew);
  108.                     if(trim($avatarinfo[1]) > $maxavatarsize || trim($avatarinfo[2]) > $maxavatarsize) {
  109.                         showmessage('profile_avatar_toobig');
  110.                     }
  111.                 } elseif($image_size = @getimagesize($avatarnew)) {
  112.                     if($image_size[0] > $maxavatarsize || $image_size[1] > $maxavatarsize) {
  113.                         showmessage('profile_avatar_toobig');
  114.                     }
  115.                 }
  116.             }
  117.             $avatarnew = dhtmlspecialchars($avatarnew);
  118.             $avataradd = ", avatar='$avatarnew'";
  119.         } else {
  120. //            $avataradd = ', avatar=\'\'';
  121.         }
  122.         $locationnew = dhtmlspecialchars($locationnew);
  123.         $icqnew = dhtmlspecialchars($icqnew);
  124.         $yahoonew = dhtmlspecialchars($yahoonew);
  125.         $oicqnew = dhtmlspecialchars($oicqnew);
  126.         $emailnew = dhtmlspecialchars($emailnew);
  127.         $sitenew = dhtmlspecialchars($sitenew);
  128.         $bionew = dhtmlspecialchars($bionew);
  129.         $bdaynew = dhtmlspecialchars($bdaynew);
  130.         $cstatusnew = $allowcstatus ? dhtmlspecialchars($cstatusnew) : '';
  131.         $timeformatnew = $timeformatnew == '12' ? 'h:i A' : 'H:i';
  132.         $bdaynew = ($month && $day && $year) ? "$year-$month-$day" : '';
  133.         $dateformatnew = str_replace('mm', 'n', $dateformatnew);
  134.         $dateformatnew = str_replace('dd', 'j', $dateformatnew);
  135.         $dateformatnew = str_replace('yyyy', 'Y', $dateformatnew);
  136.         $dateformatnew = str_replace('yy', 'y', $dateformatnew);
  137.         if($regverify == 1) {
  138.             $query = $db->query("SELECT email FROM $table_members WHERE username='$discuz_user'");
  139.             if($emailnew != $db->result($query, 0)) {
  140.                 if(!$doublee) {
  141.                     $query = $db->query("SELECT COUNT(*) FROM $table_members WHERE email='$emailnew'");
  142.                     if($db->result($query, 0)) {
  143.                         showmessage('profile_email_duplicate');
  144.                     }
  145.                 }                    
  146.                 $newpassword = random(8);
  147.                 $newpasswdadd = ", password='".md5($newpassword)."'";
  148.                 sendmail($emailnew, 'email_verify_subject', 'email_verify_content');
  149.             }
  150.         }
  151.         $db->query("UPDATE $table_members SET gender='$gendernew', email='$emailnew', site='$sitenew', oicq='$oicqnew',
  152.             location='$locationnew', bio='$bionew', signature='$signew', showemail='$showemailnew', timeoffset='$timeoffsetnew',
  153.             icq='$icqnew', yahoo='$yahoonew', styleid='$styleidnew', bday='$bdaynew', tpp='$tppnew', ppp='$pppnew',
  154.             ".($allowcstatus ? "customstatus='$cstatusnew', " : '')." newsletter='$newsletternew', timeformat='$timeformatnew', nickname='$nicknamenew', height='$heightnew', msn='$msnnew',
  155.             dateformat='$dateformatnew', pwdrecover='', pwdrcvtime='' $avataradd $newpasswdadd WHERE username='$discuz_user'");
  156.         $discuz_pw = $newpassword;
  157.         $styleid = $styleidnew;
  158.         if($regverify == 1 && $emailnew != $email) {
  159.             showmessage('profile_email_identify');
  160.         } else {
  161.             showmessage('profile_succeed', 'memcp.php');
  162.         }
  163.     }
  164. } elseif($action == 'favorites') {
  165.     if($favadd && !$favsubmit) {
  166.         $query = $db->query("SELECT tid FROM $table_favorites WHERE tid='$favadd' AND username='$discuz_user'");
  167.         if($db->num_rows($query)) {
  168.             showmessage('favorite_exists');
  169.         } else {
  170.             $db->query("INSERT INTO $table_favorites (tid, username)
  171.                 VALUES ('$favadd', '$discuz_user')");
  172.             showmessage('favorite_add_succeed', $referer);
  173.         }
  174.     } elseif(!$favadd && !$favsubmit) {
  175.         $query = $db->query("SELECT t.*, f.name FROM $table_favorites fav, $table_threads t, $table_forums f WHERE fav.tid=t.tid AND fav.username='$discuz_user' AND t.fid=f.fid ORDER BY t.lastpost DESC");
  176.         if($db->num_rows($query)) {
  177.             $favexists = 1;
  178.             $favlist = array();
  179.             while($fav = $db->fetch_array($query)) {
  180.                 $fav['lastposterenc'] = rawurlencode($fav['lastposter']);
  181.                 $fav['lastpost'] = gmdate("$dateformat $timeformat", $fav['lastpost'] + $timeoffset * 3600);
  182.                 $favlist[] = $fav;
  183.             }
  184.         } else {
  185.             $favexists = 0;
  186.         }
  187.         include template('memcp_misc');
  188.     } elseif(!$favadd && $favsubmit) {
  189.         $ids = $comma = '';
  190.         if(is_array($delete)) {
  191.             foreach($delete as $deleteid) {
  192.                 $ids .= $comma.$deleteid;
  193.                 $comma = ', ';
  194.             }
  195.         }
  196.         if($ids) {
  197.             $db->query("DELETE FROM $table_favorites WHERE username='$discuz_user' AND tid IN ($ids)");
  198.         }
  199.         showmessage('favorite_update_succeed', $referer);
  200.     }
  201. } elseif($action == 'subscriptions') {
  202.     if($subadd && !$subsubmit) {
  203.         $query = $db->query("SELECT tid FROM $table_subscriptions WHERE tid='$subadd' AND username='$discuz_user'");
  204.         if($db->num_rows($query)) {
  205.             showmessage('subscription_exists');
  206.         } else {
  207.             $db->query("INSERT INTO $table_subscriptions (username, email, tid, lastnotify)
  208.                 VALUES ('$discuz_user', '$email', '$subadd', '')");
  209.             showmessage('subscription_add_succeed', $referer);
  210.         }
  211.     } elseif(!$subadd && !$subsubmit) {
  212.         $query = $db->query("SELECT t.*, f.name FROM $table_subscriptions s, $table_threads t, $table_forums f WHERE t.tid=s.tid AND f.fid=t.fid AND s.username='$discuz_user' ORDER BY t.lastpost DESC");
  213.         if($db->num_rows($query)) {
  214.             $subsexists = 1;
  215.             $sublist = array();
  216.             while($subs = $db->fetch_array($query)) {
  217.                 $subs['lastposterenc'] = rawurlencode($subs['lastposter']);
  218.                 $subs['lastpost'] = gmdate("$dateformat $timeformat", $subs['lastpost'] + $timeoffset * 3600);
  219.                 $subslist[] = $subs;
  220.             }
  221.         } else {
  222.             $subsexists = 0;
  223.         }
  224.         include template('memcp_misc');
  225.     } elseif(!$subadd && $subsubmit) {
  226.         $ids = $comma = '';
  227.         if(is_array($delete)) {
  228.             foreach($delete as $deleteid) {
  229.                 $ids .= "$comma$deleteid";
  230.                 $comma = ", ";
  231.             }
  232.         }
  233.         if($ids) {
  234.             $db->query("DELETE FROM $table_subscriptions WHERE username='$discuz_user' AND tid IN ($ids)");
  235.         }
  236.         showmessage('subscription_update_succeed', $referer);
  237.     }
  238. } elseif($action == 'viewavatars') {
  239.     if(!$avasubmit) {
  240.         $app = 16;
  241.         $avatarsdir = $discuz_root.'./images/avatars';
  242.         if(!$page) {
  243.             $page = 1;
  244.         }
  245.         $query = $db->query("SELECT avatar FROM $table_members WHERE username='$discuz_user'");
  246.         $member = $db->fetch_array($query);
  247.         $avatarlist = "";
  248.         $num = 1;
  249.         if(is_dir($avatarsdir)) {
  250.             $adir = dir($avatarsdir);
  251.             while($entry = $adir->read()) {
  252.                 if ($entry != '.' && $entry != '..') {
  253.                     if (is_file("$avatarsdir/$entry")) {
  254.                         $avatars[$num] = $entry;
  255.                         $num++;
  256.                     }
  257.                 }
  258.             }
  259.             $adir->close();
  260.             $num--;
  261.         } else {
  262.             showmessage('profile_avatardir_nonexistence');
  263.         }
  264.         $start = ($page - 1) * $app;
  265.         $end = ($start + $app > $num) ? ($num - 1) : ($start + $app - 1);
  266.         $multipage = multi($num, $app, $page, "memcp.php?action=viewavatars");
  267.         for($i = $start; $i <= $end; $i += 4) {
  268.             $avatarlist .= "<tr>\n";
  269.             for($j = 0; $j < 4; $j++) {
  270.                 $thisbg = ($thisbg == ALTBG1) ? ALTBG2 : ALTBG1;
  271.                 $avatarlist .= "<td bgcolor=\"$thisbg\" width=\"25%\" align=\"center\">";
  272.                 if($avatars[$i + $j] && ($i + $j)) {
  273.                     $avatarlist .= "<img src=\"images/avatars/".$avatars[$i + $j]."\"></td>\n";
  274.                 } else {
  275.                     $avatarlist .= "&</td>\n";
  276.                 }
  277.             }
  278.             $avatarlist .= "</tr><tr>\n";
  279.             for($j = 0; $j < 4; $j++) {
  280.                 $avatarlist .= "<td bgcolor=\"$thisbg\" width=\"25%\" align=\"center\">";
  281.                 if($avatars[$i + $j] && ($i + $j)) {
  282.                     if(strpos($member['avatar'], $avatars[$i + $j])) {
  283.                         $checked = "checked";
  284.                     } else {
  285.                         $checked = "";
  286.                     }
  287.                     $avatarlist .= "<input type=\"radio\" value=\"images/avatars/".$avatars[$i + $j]."\" name=\"avatarnew\" $checked>".$avatars[$i + $j]."\n";
  288.                 } elseif($i + $j == 0) {
  289.                     if(!$member['avatar']) {
  290.                         $checked = "checked";
  291.                     }
  292.                     $avatarlist .= "<input type=\"radio\" value=\"\" name=\"avatarnew\" $checked><span class=\"bold\">不使用頭像</span>\n";
  293.                 } else {
  294.                     $avatarlist .= "&</td>\n";
  295.                 }
  296.                 $thisbg = ($thisbg == ALTBG1) ? ALTBG2 : ALTBG1;
  297.             }
  298.             $avatarlist .= "</tr><tr><td bgcolor=\"".ALTBG1."\" colspan=\"4\" height=\"1\"></td></tr>\n\n";
  299.         }
  300.         include template('memcp_misc');
  301.     } elseif($avasubmit) {
  302.         $db->query("UPDATE $table_members SET avatar='$avatarnew' WHERE username='$discuz_user'");
  303.         showmessage('profile_avatar_succeed', 'memcp.php?action=profile');
  304.     }
  305. } elseif($action == 'buddylist') {
  306.     if(empty($delete)) {
  307.         $buddy = trim($buddy);
  308.         $query = $db->query("SELECT COUNT(*) FROM $table_buddys WHERE username='$discuz_user' AND buddyname='$buddy'");
  309.         if($db->result($query, 0)) {
  310.             showmessage('buddy_add_invalid');
  311.         }
  312.         $query = $db->query("SELECT username FROM $table_members WHERE username='$buddy'");
  313.         $buddy = addslashes($db->result($query, 0));
  314.         if(empty($buddy)) {
  315.             showmessage('buddy_add_nonexistence');
  316.         }
  317.         $db->query("INSERT INTO $table_buddys VALUES ('$discuz_user', '$buddy')");
  318.         showmessage('buddy_add_succeed', 'memcp.php');
  319.     } else {
  320.         $db->query("DELETE FROM $table_buddys WHERE username='$discuz_user' AND buddyname='$delete'");
  321.         showmessage('buddy_delete_succeed', 'memcp.php');
  322.     }
  323. }
  324. elseif($action == 'permission'){
  325.     $query = $db ->query("SELECT $table_usergroups.* FROM $table_usergroups
  326.                                             LEFT JOIN $table_members ON ($table_usergroups.status=$table_members.status AND ($table_usergroups.creditshigher='0' AND $table_usergroups.creditslower='0' AND $table_usergroups.specifiedusers='')) OR ($table_members.credit>=$table_usergroups.creditshigher AND $table_members.credit<$table_usergroups.creditslower)
  327.                                             WHERE $table_members.username = '$discuz_user'");
  328.     $permission = $db->fetch_array($query);
  329.     $permission['allowvisit'] = $permission['allowvisit'] == "1" ? "√" : "<font color=red>×</font>";
  330.     $permission['ismoderator'] = $permission['ismoderator'] == "1" ? "√" : "<font color=red>×</font>";
  331.     $permission['issupermod'] = $permission['issupermod'] == "1" ? "√" : "<font color=red>×</font>";
  332.     $permission['isadmin'] = $permission['isadmin'] == "1" ? "√" : "<font color=red>×</font>";
  333.     $permission['allowviewstats'] = $permission['allowviewstats'] == "1" ? "√" : "<font color=red>×</font>";
  334.     $permission['allowview'] = $permission['allowview'] == "1" ? "√" : "<font color=red>×</font>";
  335.   $permission['allowpost'] = $permission['allowpost'] == "1" ? "√" : "<font color=red>×</font>";
  336.     $permission['allowsetviewperm'] = $permission['allowsetviewperm'] == "1" ? "√" : "<font color=red>×</font>";
  337.     $permission['allowpostpoll'] = $permission['allowpostpoll'] == "1" ? "√" : "<font color=red>×</font>";
  338.     $permission['allowvote'] = $permission['allowvote'] == "1" ? "√" : "<font color=red>×</font>";
  339.     $permission['allowgetattach'] = $permission['allowgetattach'] == "1" ? "√" : "<font color=red>×</font>";
  340.     $permission['allowpostattach'] = $permission['allowpostattach'] == "1" ? "√" : "<font color=red>×</font>";
  341.     $permission['allowsetattachperm'] = $permission['allowsetattachperm'] == "1" ? "√" : "<font color=red>×</font>";
  342.     $permission['attachextensions'] = $permission['attachextensions'] ? $permission['attachextensions'] : "允許所有附件類型";
  343.     $permission['allowcstatus'] = $permission['allowcstatus'] == "1" ? "√" : "<font color=red>×</font>";
  344.     $permission['allowkarma'] = $permission['allowkarma'] == "1" ? "√" : "<font color=red>×</font>";
  345.     $permission['allowsigimgcode'] = $permission['allowsigimgcode'] == "1" ? "√" : "<font color=red>×</font>";
  346.     $permission['allowsigbbcode'] = $permission['allowsigbbcode'] == "1" ? "√" : "<font color=red>×</font>";
  347.     include template('memcp_permission');
  348. } elseif($action == 'credits') {
  349.     include template('header');
  350.     echo base64_decode('PGNlbnRlcj48c3BhbiBjbGFzcz1cIm1lZGl1bXR4dFwiIHN0eWxlPVwiZm9udC1zaXplOiAyMHB4OyBmb250LXdlaWdodDogYm9sZFwiPkRpc2N1eiEgQ3JlZGl0czwvc3Bhbj48YnI+PGJyPjx0YWJsZSBjZWxsc3BhY2luZz1cIjBcIiBjZWxscGFkZGluZz1cIjBc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ly93d3cub3VycGhwLmNvbVwiIHRhcmdldD1cIl9ibGFua1wiPlNoYXJteTwvYT4sIDxhIGhyZWY9XCJodHRwOi8vd3d3LmVhY2h1LmNvbVwiIHRhcmdldD1cIl9ibGFua1wiPlIuQzwvYT4sIDxhIGhyZWY9XCJodHRwOi8vd3d3Lmp1bm9tYXkuY29tXCIgdGFyZ2V0PVwiX2JsYW5rXCI+QVNVUkE8L2E+LCA8YSBocmVmPVwiaHR0cDovL3d3dy5IYWtrYU9ubGluZS5jb21cIiB0YXJnZXQ9XCJfYmxhbmtcIj7OtMP7seLW2zwvYT4sIDxhIGhyZWY9XCJodHRwOi8vM3B1bmsuY29tXCIgdGFyZ2V0PVwiX2JsYW5rXCI+M3B1bms8L2E+LCA8YSBocmVmPVwiaHR0cDovL3d3dy5wdWZmZXIuaWR2LnR3L2NkYlwiIHRhcmdldD1cIl9ibGFua1wiPnB1ZmZlcjwvYT48L3RkPjwvdHI+PC90YWJsZT48L3RkPjwvdHI+PC90YWJsZT48YnI+PGJyPg==');
  351.     include template('footer');
  352. }
  353. ?>
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • >> Ayl_X <<
  • Newbie
  • Newbie
  • >> Ayl_X <<
  • Posts: 6

Post 3+ Months Ago

register.php
Code: [ Select ]
<?php

/*
    [DISCUZ!] register.php - new member registration
    This is NOT a freeware, use is subject to license terms

    Version: 2.0.0
    Author: Crossday (info@discuz.net)
    Copyright: Crossday Studio (www.crossday.com)
    Last Modified: 2002/12/6 17:00
*/

require './include/common.php';

$discuz_action = 5;

if(!$regstatus) {
    showmessage('register_disable');
}

$query = $db->query("SELECT censoruser, doublee, bbrules, bbrulestxt, welcommsg, welcommsgtxt FROM $table_settings");
extract($db->fetch_array($query), EXTR_OVERWRITE);

$query = $db->query("SELECT allowcstatus, allowavatar FROM $table_usergroups WHERE creditshigher<=0 AND 0<creditslower");
$groupinfo = $db->fetch_array($query);

if(!$regsubmit) {

    if($bbrules && !$rulesubmit) {
        $bbrulestxt = nl2br("\n".$bbrulestxt."\n\n");
    } else {
        $styleselect = $dayselect = '';
        $query = $db->query("SELECT styleid, name FROM $table_styles WHERE available='1'");
        while($styleinfo = $db->fetch_array($query)) {
            $styleselect .= '<option value="'.$styleinfo['styleid'].'">'.$styleinfo['name'].'</option>'."\n";
        }

        for($num = 1; $num <= 31; $num++) {
            $dayselect .= '<option value="'.$num.'">'.$num.'</option>';
        }

        $bbcodeis = $allowsigbbcode ? 'On' : 'Off';
        $imgcodeis = $allowsigimgcode ? 'On' : 'Off';
        $currtime = gmdate($timeformat);

        $dateformatorig = $dateformat;
        $dateformatorig = str_replace('n', 'mm', $dateformatorig);
        $dateformatorig = str_replace('j', 'dd', $dateformatorig);
        $dateformatorig = str_replace('y', 'yy', $dateformatorig);
        $dateformatorig = str_replace('Y', 'yyyy', $dateformatorig);

    }

    include template('register');

} else {

    $referer = $referer ? $referer : 'index.php';

    $email = trim($email);
    if(!$doublee && strstr($email, '@')) {
        $emailadd = "OR email='$email'";
    }

    $username = trim($username);

    if(strlen($username) > 15) {
        showmessage('profile_username_toolang');
    }

    if($password != $password2) {
        showmessage('profile_passwd_notmatch');
    }

    if(htmlspecialchars($username) != $username || preg_match("/^$|^c:\\con\\con$|﹛|[,\"\s\t\<\>&]|^遊客|^Guest/is", $username) || @eregi(str_replace(',', '|', "^(".str_replace(' ', '', addslashes($censoruser)).")$"), $username)) {
        showmessage('profile_username_illegal');
    }

    if($regverify != 1 && (!$password || $password != addslashes($password))) {
        showmessage('profile_passwd_illegal');
    }

    if(!strstr($email, '@') || $email != addslashes($email) || $email != htmlspecialchars($email)) {
        showmessage('profile_email_illegal');
    }

    if($maxsigsize && strlen($sig) > $maxsigsize) {
        showmessage('regsister_sig_toolang');
    }

    $query = $db->query("SELECT COUNT(*) FROM $table_members WHERE username='$username' $emailadd");
    if($db->result($query, 0)) {
        showmessage('profile_account_duplicate');
    }

    if($allowavatar == 2 && $avatar) {
        if($maxavatarsize) {
            if(strstr($avatar, ',')) {
                $avatarinfo = explode(',', $avatar);
                if(trim($avatarinfo[1]) > $maxavatarsize || trim($avatarinfo[2]) > $maxavatarsize) {
                    showmessage('profile_avatar_toobig');
                }
            } elseif($image_size = @getimagesize($avatar)) {
                if($image_size[0] > $maxavatarsize || $image_size[1] > $maxavatarsize) {
                    showmessage('profile_avatar_toobig');
                }
            }
        }
    } else {
        $avatar = '';
    }

    if($regverify == 1){
        $password2 = random(8);
        $password = md5($password2);
    } else {
        $password = md5($password);
    }

    if(!$groupinfo[allowcstatus]) {
        $cstatus = '';
    }

    $bday = "$year-$month-$day";

    if(!$month || !$day || !$year) {
        $bday = '';
    }

    $dateformatnew = str_replace('mm', 'n', $dateformatnew);
    $dateformatnew = str_replace('dd', 'j', $dateformatnew);
    $dateformatnew = str_replace('yyyy', 'Y', $dateformatnew);
    $dateformatnew = str_replace('yy', 'y', $dateformatnew);
    $timeformatnew = $timeformatnew == '24' ? 'H:i' : 'h:i A';

    $avatar = dhtmlspecialchars($avatar);
    $locationnew = dhtmlspecialchars($locationnew);
    $icq = dhtmlspecialchars($icq);
    $yahoo = dhtmlspecialchars($yahoo);
    $oicq = dhtmlspecialchars($oicq);
    $email = dhtmlspecialchars($email);
    $site = dhtmlspecialchars($site);
    $bio = dhtmlspecialchars($bio);
    $bday = dhtmlspecialchars($bday);
    $cstatus = dhtmlspecialchars($cstatus);

    if($welcommsg && !empty($welcommsgtxt)) {
        $welcomtitle = "Welcome to $bbname!";
        $welcommsgtxt = addslashes($welcommsgtxt);
        $db->query("INSERT INTO $table_pm (msgto, msgfrom, folder, new, subject, dateline, message)
            VALUES ('$username', 'System Message', 'inbox', '1', '$welcomtitle', '$timestamp','$welcommsgtxt')");
    }

    $status = $regverify == 2 ? 'Inactive' : 'Member';
    $db->query("INSERT INTO $table_members (username, password, gender, status, regip, regdate, lastvisit, postnum, credit, email, site, icq, yahoo, msn, location, bday, bio, avatar, signature, customstatus, tpp, ppp, styleid, dateformat, timeformat, showemail, newsletter, timeoffset, height, oicq, nickname)
        VALUES ('$username', '$password', '$gendernew', '$status', '$onlineip', '$timestamp', '$timestamp', '0', '0', '$email', '$site', '$icq', '$yahoo', '$msn', '$locationnew', '$bday', '$bio', '$avatar', '$sig', '$cstatus', '$tppnew', '$pppnew', '$styleidnew', '$dateformatnew', '$timeformatnew', '$showemail', '$newsletter', '$timeoffsetnew', '$heightnew', '$oicq', '$nickname')");
    $db->query("UPDATE $table_settings SET lastmember='$username', totalmembers=totalmembers+1");

    
    // added by Crossday, written by pk0909
    if($welcommsg && !empty($welcommsgtxt)) {
        $db->query("UPDATE $table_members set newpm='1' where username='$username'");
    }
    // ended

    require $discuz_root.'./include/cache.php';
    updatecache('settings');

    if($regverify == 1){

        sendmail($email, 'activation_subject', 'activation_content');
        showmessage('profile_email_identify');

    } else {
        $query = $db->query("SELECT m.username as discuz_user, m.password as discuz_pw, u.*, u.specifiedusers LIKE '%\t$username\t%' AS specifieduser
            FROM $table_members m LEFT JOIN $table_usergroups u ON u.specifiedusers LIKE '%\t$username\t%' OR (u.status=m.status
            AND ((u.creditshigher='0' AND u.creditslower='0' AND u.specifiedusers='') OR (m.credit>=u.creditshigher AND m.credit<u.creditslower)))
            WHERE username='$username' AND password='$password' ORDER BY specifieduser DESC");
        @extract($db->fetch_array($query));
        $discuz_userss = $discuz_user;
        $discuz_user = addslashes($discuz_user);
        $styleid = $styleid ? $styleid : $_DCACHE['settings']['styleid'];

        setcookie('cookietime', 2592000, $timestamp + 86400 * 365, $cookiepath, $cookiedomain);
        setcookie('_discuz_user', $discuz_userss, $timestamp + 2592000, $cookiepath, $cookiedomain);
        setcookie('_discuz_pw', $discuz_pw, $timestamp + 2592000, $cookiepath, $cookiedomain);

        showmessage('register_succeed', $referer);
    }
}

?>
  1. <?php
  2. /*
  3.     [DISCUZ!] register.php - new member registration
  4.     This is NOT a freeware, use is subject to license terms
  5.     Version: 2.0.0
  6.     Author: Crossday (info@discuz.net)
  7.     Copyright: Crossday Studio (www.crossday.com)
  8.     Last Modified: 2002/12/6 17:00
  9. */
  10. require './include/common.php';
  11. $discuz_action = 5;
  12. if(!$regstatus) {
  13.     showmessage('register_disable');
  14. }
  15. $query = $db->query("SELECT censoruser, doublee, bbrules, bbrulestxt, welcommsg, welcommsgtxt FROM $table_settings");
  16. extract($db->fetch_array($query), EXTR_OVERWRITE);
  17. $query = $db->query("SELECT allowcstatus, allowavatar FROM $table_usergroups WHERE creditshigher<=0 AND 0<creditslower");
  18. $groupinfo = $db->fetch_array($query);
  19. if(!$regsubmit) {
  20.     if($bbrules && !$rulesubmit) {
  21.         $bbrulestxt = nl2br("\n".$bbrulestxt."\n\n");
  22.     } else {
  23.         $styleselect = $dayselect = '';
  24.         $query = $db->query("SELECT styleid, name FROM $table_styles WHERE available='1'");
  25.         while($styleinfo = $db->fetch_array($query)) {
  26.             $styleselect .= '<option value="'.$styleinfo['styleid'].'">'.$styleinfo['name'].'</option>'."\n";
  27.         }
  28.         for($num = 1; $num <= 31; $num++) {
  29.             $dayselect .= '<option value="'.$num.'">'.$num.'</option>';
  30.         }
  31.         $bbcodeis = $allowsigbbcode ? 'On' : 'Off';
  32.         $imgcodeis = $allowsigimgcode ? 'On' : 'Off';
  33.         $currtime = gmdate($timeformat);
  34.         $dateformatorig = $dateformat;
  35.         $dateformatorig = str_replace('n', 'mm', $dateformatorig);
  36.         $dateformatorig = str_replace('j', 'dd', $dateformatorig);
  37.         $dateformatorig = str_replace('y', 'yy', $dateformatorig);
  38.         $dateformatorig = str_replace('Y', 'yyyy', $dateformatorig);
  39.     }
  40.     include template('register');
  41. } else {
  42.     $referer = $referer ? $referer : 'index.php';
  43.     $email = trim($email);
  44.     if(!$doublee && strstr($email, '@')) {
  45.         $emailadd = "OR email='$email'";
  46.     }
  47.     $username = trim($username);
  48.     if(strlen($username) > 15) {
  49.         showmessage('profile_username_toolang');
  50.     }
  51.     if($password != $password2) {
  52.         showmessage('profile_passwd_notmatch');
  53.     }
  54.     if(htmlspecialchars($username) != $username || preg_match("/^$|^c:\\con\\con$|﹛|[,\"\s\t\<\>&]|^遊客|^Guest/is", $username) || @eregi(str_replace(',', '|', "^(".str_replace(' ', '', addslashes($censoruser)).")$"), $username)) {
  55.         showmessage('profile_username_illegal');
  56.     }
  57.     if($regverify != 1 && (!$password || $password != addslashes($password))) {
  58.         showmessage('profile_passwd_illegal');
  59.     }
  60.     if(!strstr($email, '@') || $email != addslashes($email) || $email != htmlspecialchars($email)) {
  61.         showmessage('profile_email_illegal');
  62.     }
  63.     if($maxsigsize && strlen($sig) > $maxsigsize) {
  64.         showmessage('regsister_sig_toolang');
  65.     }
  66.     $query = $db->query("SELECT COUNT(*) FROM $table_members WHERE username='$username' $emailadd");
  67.     if($db->result($query, 0)) {
  68.         showmessage('profile_account_duplicate');
  69.     }
  70.     if($allowavatar == 2 && $avatar) {
  71.         if($maxavatarsize) {
  72.             if(strstr($avatar, ',')) {
  73.                 $avatarinfo = explode(',', $avatar);
  74.                 if(trim($avatarinfo[1]) > $maxavatarsize || trim($avatarinfo[2]) > $maxavatarsize) {
  75.                     showmessage('profile_avatar_toobig');
  76.                 }
  77.             } elseif($image_size = @getimagesize($avatar)) {
  78.                 if($image_size[0] > $maxavatarsize || $image_size[1] > $maxavatarsize) {
  79.                     showmessage('profile_avatar_toobig');
  80.                 }
  81.             }
  82.         }
  83.     } else {
  84.         $avatar = '';
  85.     }
  86.     if($regverify == 1){
  87.         $password2 = random(8);
  88.         $password = md5($password2);
  89.     } else {
  90.         $password = md5($password);
  91.     }
  92.     if(!$groupinfo[allowcstatus]) {
  93.         $cstatus = '';
  94.     }
  95.     $bday = "$year-$month-$day";
  96.     if(!$month || !$day || !$year) {
  97.         $bday = '';
  98.     }
  99.     $dateformatnew = str_replace('mm', 'n', $dateformatnew);
  100.     $dateformatnew = str_replace('dd', 'j', $dateformatnew);
  101.     $dateformatnew = str_replace('yyyy', 'Y', $dateformatnew);
  102.     $dateformatnew = str_replace('yy', 'y', $dateformatnew);
  103.     $timeformatnew = $timeformatnew == '24' ? 'H:i' : 'h:i A';
  104.     $avatar = dhtmlspecialchars($avatar);
  105.     $locationnew = dhtmlspecialchars($locationnew);
  106.     $icq = dhtmlspecialchars($icq);
  107.     $yahoo = dhtmlspecialchars($yahoo);
  108.     $oicq = dhtmlspecialchars($oicq);
  109.     $email = dhtmlspecialchars($email);
  110.     $site = dhtmlspecialchars($site);
  111.     $bio = dhtmlspecialchars($bio);
  112.     $bday = dhtmlspecialchars($bday);
  113.     $cstatus = dhtmlspecialchars($cstatus);
  114.     if($welcommsg && !empty($welcommsgtxt)) {
  115.         $welcomtitle = "Welcome to $bbname!";
  116.         $welcommsgtxt = addslashes($welcommsgtxt);
  117.         $db->query("INSERT INTO $table_pm (msgto, msgfrom, folder, new, subject, dateline, message)
  118.             VALUES ('$username', 'System Message', 'inbox', '1', '$welcomtitle', '$timestamp','$welcommsgtxt')");
  119.     }
  120.     $status = $regverify == 2 ? 'Inactive' : 'Member';
  121.     $db->query("INSERT INTO $table_members (username, password, gender, status, regip, regdate, lastvisit, postnum, credit, email, site, icq, yahoo, msn, location, bday, bio, avatar, signature, customstatus, tpp, ppp, styleid, dateformat, timeformat, showemail, newsletter, timeoffset, height, oicq, nickname)
  122.         VALUES ('$username', '$password', '$gendernew', '$status', '$onlineip', '$timestamp', '$timestamp', '0', '0', '$email', '$site', '$icq', '$yahoo', '$msn', '$locationnew', '$bday', '$bio', '$avatar', '$sig', '$cstatus', '$tppnew', '$pppnew', '$styleidnew', '$dateformatnew', '$timeformatnew', '$showemail', '$newsletter', '$timeoffsetnew', '$heightnew', '$oicq', '$nickname')");
  123.     $db->query("UPDATE $table_settings SET lastmember='$username', totalmembers=totalmembers+1");
  124.     
  125.     // added by Crossday, written by pk0909
  126.     if($welcommsg && !empty($welcommsgtxt)) {
  127.         $db->query("UPDATE $table_members set newpm='1' where username='$username'");
  128.     }
  129.     // ended
  130.     require $discuz_root.'./include/cache.php';
  131.     updatecache('settings');
  132.     if($regverify == 1){
  133.         sendmail($email, 'activation_subject', 'activation_content');
  134.         showmessage('profile_email_identify');
  135.     } else {
  136.         $query = $db->query("SELECT m.username as discuz_user, m.password as discuz_pw, u.*, u.specifiedusers LIKE '%\t$username\t%' AS specifieduser
  137.             FROM $table_members m LEFT JOIN $table_usergroups u ON u.specifiedusers LIKE '%\t$username\t%' OR (u.status=m.status
  138.             AND ((u.creditshigher='0' AND u.creditslower='0' AND u.specifiedusers='') OR (m.credit>=u.creditshigher AND m.credit<u.creditslower)))
  139.             WHERE username='$username' AND password='$password' ORDER BY specifieduser DESC");
  140.         @extract($db->fetch_array($query));
  141.         $discuz_userss = $discuz_user;
  142.         $discuz_user = addslashes($discuz_user);
  143.         $styleid = $styleid ? $styleid : $_DCACHE['settings']['styleid'];
  144.         setcookie('cookietime', 2592000, $timestamp + 86400 * 365, $cookiepath, $cookiedomain);
  145.         setcookie('_discuz_user', $discuz_userss, $timestamp + 2592000, $cookiepath, $cookiedomain);
  146.         setcookie('_discuz_pw', $discuz_pw, $timestamp + 2592000, $cookiepath, $cookiedomain);
  147.         showmessage('register_succeed', $referer);
  148.     }
  149. }
  150. ?>
  • >> Ayl_X <<
  • Newbie
  • Newbie
  • >> Ayl_X <<
  • Posts: 6

Post 3+ Months Ago

memcp_profile.htm
Code: [ Select ]
{template header}
{template memcp_navbar}
<form method="post" action="memcp.php?action=profile" name="reg">
<table cellspacing="0" cellpadding="0" border="0" width="{TABLEWIDTH}" align="center">
<tr><td bgcolor="{BORDERCOLOR}">
<table border="0" cellspacing="{BORDERWIDTH}" cellpadding="{TABLESPACE}" width="100%">
<tr>
<td colspan="2" class="header">{lang memcp_profile} - {lang required_info}</td>
</tr>

<tr>
<td bgcolor="{ALTBG1}">{lang old_password}:</td>
<td bgcolor="{ALTBG2}"><input type="password" name="oldpassword" size="25"> {lang memcp_profile_passwd_comment}</td>
</tr>

<tr>
<td bgcolor="{ALTBG1}">{lang new_password}:</td>
<td bgcolor="{ALTBG2}"><input type="password" name="newpassword" size="25"> {lang memcp_profile_passwd_comment}</td>
</tr>

<tr>
<td bgcolor="{ALTBG1}" width="21%">{lang email}:</td>
<td bgcolor="{ALTBG2}"><input type="text" name="emailnew" size="25" value="$member[email]">
<!--{if $emailcheck}--> <b>{lang memcp_profile_email_comment}</b><!--{/if}-->
</td></tr>

<tr>
<td colspan="2" class="header">{lang memcp_profile} - {lang optional_info}</td>
</tr>

<tr>
<td bgcolor="{ALTBG1}" width="21%">{lang nickname}:</td>
<td bgcolor="{ALTBG2}"><input type="text" name="nicknamenew" size="10" value="$member[nickname]"></td>

<tr>
<td bgcolor="{ALTBG1}" width="21%">{lang gender}:</td>
<td bgcolor="{ALTBG2}">
<input type="radio" name="gendernew" value="1" $checkmale checked> {lang male} &
<input type="radio" name="gendernew" value="2" $checkfemale> {lang female}
</td></tr>

<tr>
<td bgcolor="{ALTBG1}">{lang birthday}:</td>
<td bgcolor="{ALTBG2}">
<input type="text" name="year" size="4" value="$bday[0]"> {lang year}
<select name="month">
<option value="" $month[0]>&</option>
<option value="1" $month[1]>1</option>
<option value="2" $month[2]>2</option>
<option value="3" $month[3]>3</option>
<option value="4" $month[4]>4</option>
<option value="5" $month[5]>5</option>
<option value="6" $month[6]>6</option>
<option value="7" $month[7]>7</option>
<option value="8" $month[8]>8</option>
<option value="9" $month[9]>9</option>
<option value="10" $month[10]>10</option>
<option value="11" $month[11]>11</option>
<option value="12" $month[12]>12</option>
</select> {lang month}
<select name="day">
<option value="">&</option>
$dayselect
</select> {lang day}
</td></tr>


<tr>
<td bgcolor="{ALTBG1}" width="21%">{lang height}:</td>
<td bgcolor="{ALTBG2}"><input type="text" name="heightnew" size="3" value="$member[height]"> {lang cm}</td>
</tr>

<tr>
<td bgcolor="{ALTBG1}" width="21%">{lang location}:</td>
<td bgcolor="{ALTBG2}">
    <select name="locationnew" value="$locationnew">
<option value="保密">&</option>
    <option value="香港島">香港島</option>
    <option value="九龍半島">九龍半島</option>
    <option value="新界區">新界區</option>
    <option value="離島區">離島區</option>
    <option value="澳門">澳門</option>
    <option value="台灣">台灣</option>
    <option value="中國">中國</option>
    <option value="其他">其他</option></select>
</td>
</tr>

<tr>
<td bgcolor="{ALTBG1}" width="21%">ICQ:</td>
<td bgcolor="{ALTBG2}"><input type="text" name="icqnew" size="25" value="$member[icq]"></td>
</tr>

<tr>
<td bgcolor="{ALTBG1}" width="21%">Yahoo:</td>
<td bgcolor="{ALTBG2}"><input type="text" name="yahoonew" size="25" value="$member[yahoo]"></td>
</tr>

<tr>
<td bgcolor="{ALTBG1}" width="21%">MSN:</td>
<td bgcolor="{ALTBG2}"><input type="text" name="msnnew" size="25" value="$member[msn]"></td>
</tr>

<tr>
<td bgcolor="{ALTBG1}" width="21%">{lang homepage}:</td>
<td bgcolor="{ALTBG2}"><input type="text" name="sitenew" size="25" value="$member[site]">
</td>
</tr>

<tr>
<td bgcolor="{ALTBG1}" width="21%" valign="top">{lang bio}:</td>
<td bgcolor="{ALTBG2}"><textarea rows="5" cols="30" name="bionew">$member[bio]</textarea></td>
</tr>

<tr>
<td colspan="2" class="header">{lang memcp_profile} - {lang board_options}</td>
</tr>

<tr>
<td bgcolor="{ALTBG1}">{lang style}:</td>
<td bgcolor="{ALTBG2}"><select name="styleidnew">
<option value="">{lang use_default}</option>
$styleselect</select></td>
</tr>

<tr>
<td bgcolor="{ALTBG1}">{lang tpp}:</td>
<td bgcolor="{ALTBG2}"><select name="tppnew">
<option value="0" $tppchecked[0]>{lang use_default}</option>
<option value="10" $tppchecked[10]>10</option>
<option value="20" $tppchecked[20]>20</option>
<option value="30" $tppchecked[30]>30</option>
</select></td>
</tr>

<tr>
<td bgcolor="{ALTBG1}">{lang ppp}:</td>
<td bgcolor="{ALTBG2}"><select name="pppnew">
<option value="0" $pppchecked[0]>{lang use_default}</option>
<option value="5" $pppchecked[5]>5</option>
<option value="10" $pppchecked[10]>10</option>
<option value="15" $pppchecked[15]>15</option>
</select></td>
</tr>

<tr>
<td bgcolor="{ALTBG1}">{lang timeformat}:</td>
<td bgcolor="{ALTBG2}"><input type="radio" value="24" name="timeformatnew" $check24>24 {lang hour}
<input type="radio" value="12" name="timeformatnew" $check12>12 {lang hour}</td>
</tr>

<!--{if $allowcstatus}-->
    <tr>
    <td bgcolor="{ALTBG1}" width="21%">{lang custom_status}:</td>
    <td bgcolor="{ALTBG2}">
    <input type="text" name="cstatusnew" size="25" value="$member[customstatus]"></td>
    </tr>
<!--{/if}-->

<tr>
<td bgcolor="{ALTBG1}">{lang dateformat}:<br><span class="smalltxt">(yyyy/mm/dd,mm/dd/yy {lang etc})</span></td>
<td bgcolor="{ALTBG2}"><input type="text" name="dateformatnew" size="25" value="$member[dateformat]"></td>
</tr>

<tr>
<td bgcolor="{ALTBG1}">{lang other_options}:</td>
<td bgcolor="{ALTBG2}">
<input type="checkbox" name="showemailnew" value="1" $emailchecked> {lang show_email_addr}<br>
<input type="checkbox" name="newsletternew" value="1" $newschecked> {lang allow_newsletter}<br>
<input type="text" name="timeoffsetnew" size="3" value="$member[timeoffset]"> {lang timeoffset}
</td></tr>

<!--{if $allowavatar == 1}-->
    <tr>
    <td bgcolor="{ALTBG1}">{lang avatar}:</td>
    <td bgcolor="{ALTBG2}"><input type="button" value="{lang memcp_avatar_list}" onclick="window.location=('memcp.php?action=viewavatars&sid=$sid')"></td>
    </tr>
<!--{elseif $allowavatar == 2}-->
    <tr>
    <td bgcolor="{ALTBG1}">{lang avatar}:</td>
    <td bgcolor="{ALTBG2}"><input type="text" name="avatarnew" size="25" value="$member[avatar]">&&<input type="button" value="{lang memcp_avatar_list}" onclick="window.location=('memcp.php?action=viewavatars&sid=$sid')">
    <br><span class="smalltxt">{lang image_comment}</span></td>
    </tr>
<!--{/if}-->

<tr>
<td bgcolor="{ALTBG1}">{lang signature}<!--{if $maxsigsize}--> ($maxsigsize {lang bytes_limited})<!--{/if}-->:<br><br>
<span class="smalltxt">
<a href="faq.php?page=misc#1" target="_blank">{lang post_discuzcode}</a> {lang is} $bbcodeis<br>
{lang post_imgcode} {lang is} $imgcodeis
</span></td>
<td bgcolor="{ALTBG2}"><textarea rows="4" cols="30" name="signew">$member[signature]</textarea></td>
</tr>

</table>
</td></tr></table><br>
<center><input type="submit" name="editsubmit" value="{lang memcp_profile}"></center>
</form>
{template footer}
  1. {template header}
  2. {template memcp_navbar}
  3. <form method="post" action="memcp.php?action=profile" name="reg">
  4. <table cellspacing="0" cellpadding="0" border="0" width="{TABLEWIDTH}" align="center">
  5. <tr><td bgcolor="{BORDERCOLOR}">
  6. <table border="0" cellspacing="{BORDERWIDTH}" cellpadding="{TABLESPACE}" width="100%">
  7. <tr>
  8. <td colspan="2" class="header">{lang memcp_profile} - {lang required_info}</td>
  9. </tr>
  10. <tr>
  11. <td bgcolor="{ALTBG1}">{lang old_password}:</td>
  12. <td bgcolor="{ALTBG2}"><input type="password" name="oldpassword" size="25"> {lang memcp_profile_passwd_comment}</td>
  13. </tr>
  14. <tr>
  15. <td bgcolor="{ALTBG1}">{lang new_password}:</td>
  16. <td bgcolor="{ALTBG2}"><input type="password" name="newpassword" size="25"> {lang memcp_profile_passwd_comment}</td>
  17. </tr>
  18. <tr>
  19. <td bgcolor="{ALTBG1}" width="21%">{lang email}:</td>
  20. <td bgcolor="{ALTBG2}"><input type="text" name="emailnew" size="25" value="$member[email]">
  21. <!--{if $emailcheck}--> <b>{lang memcp_profile_email_comment}</b><!--{/if}-->
  22. </td></tr>
  23. <tr>
  24. <td colspan="2" class="header">{lang memcp_profile} - {lang optional_info}</td>
  25. </tr>
  26. <tr>
  27. <td bgcolor="{ALTBG1}" width="21%">{lang nickname}:</td>
  28. <td bgcolor="{ALTBG2}"><input type="text" name="nicknamenew" size="10" value="$member[nickname]"></td>
  29. <tr>
  30. <td bgcolor="{ALTBG1}" width="21%">{lang gender}:</td>
  31. <td bgcolor="{ALTBG2}">
  32. <input type="radio" name="gendernew" value="1" $checkmale checked> {lang male} &
  33. <input type="radio" name="gendernew" value="2" $checkfemale> {lang female}
  34. </td></tr>
  35. <tr>
  36. <td bgcolor="{ALTBG1}">{lang birthday}:</td>
  37. <td bgcolor="{ALTBG2}">
  38. <input type="text" name="year" size="4" value="$bday[0]"> {lang year}
  39. <select name="month">
  40. <option value="" $month[0]>&</option>
  41. <option value="1" $month[1]>1</option>
  42. <option value="2" $month[2]>2</option>
  43. <option value="3" $month[3]>3</option>
  44. <option value="4" $month[4]>4</option>
  45. <option value="5" $month[5]>5</option>
  46. <option value="6" $month[6]>6</option>
  47. <option value="7" $month[7]>7</option>
  48. <option value="8" $month[8]>8</option>
  49. <option value="9" $month[9]>9</option>
  50. <option value="10" $month[10]>10</option>
  51. <option value="11" $month[11]>11</option>
  52. <option value="12" $month[12]>12</option>
  53. </select> {lang month}
  54. <select name="day">
  55. <option value="">&</option>
  56. $dayselect
  57. </select> {lang day}
  58. </td></tr>
  59. <tr>
  60. <td bgcolor="{ALTBG1}" width="21%">{lang height}:</td>
  61. <td bgcolor="{ALTBG2}"><input type="text" name="heightnew" size="3" value="$member[height]"> {lang cm}</td>
  62. </tr>
  63. <tr>
  64. <td bgcolor="{ALTBG1}" width="21%">{lang location}:</td>
  65. <td bgcolor="{ALTBG2}">
  66.     <select name="locationnew" value="$locationnew">
  67. <option value="保密">&</option>
  68.     <option value="香港島">香港島</option>
  69.     <option value="九龍半島">九龍半島</option>
  70.     <option value="新界區">新界區</option>
  71.     <option value="離島區">離島區</option>
  72.     <option value="澳門">澳門</option>
  73.     <option value="台灣">台灣</option>
  74.     <option value="中國">中國</option>
  75.     <option value="其他">其他</option></select>
  76. </td>
  77. </tr>
  78. <tr>
  79. <td bgcolor="{ALTBG1}" width="21%">ICQ:</td>
  80. <td bgcolor="{ALTBG2}"><input type="text" name="icqnew" size="25" value="$member[icq]"></td>
  81. </tr>
  82. <tr>
  83. <td bgcolor="{ALTBG1}" width="21%">Yahoo:</td>
  84. <td bgcolor="{ALTBG2}"><input type="text" name="yahoonew" size="25" value="$member[yahoo]"></td>
  85. </tr>
  86. <tr>
  87. <td bgcolor="{ALTBG1}" width="21%">MSN:</td>
  88. <td bgcolor="{ALTBG2}"><input type="text" name="msnnew" size="25" value="$member[msn]"></td>
  89. </tr>
  90. <tr>
  91. <td bgcolor="{ALTBG1}" width="21%">{lang homepage}:</td>
  92. <td bgcolor="{ALTBG2}"><input type="text" name="sitenew" size="25" value="$member[site]">
  93. </td>
  94. </tr>
  95. <tr>
  96. <td bgcolor="{ALTBG1}" width="21%" valign="top">{lang bio}:</td>
  97. <td bgcolor="{ALTBG2}"><textarea rows="5" cols="30" name="bionew">$member[bio]</textarea></td>
  98. </tr>
  99. <tr>
  100. <td colspan="2" class="header">{lang memcp_profile} - {lang board_options}</td>
  101. </tr>
  102. <tr>
  103. <td bgcolor="{ALTBG1}">{lang style}:</td>
  104. <td bgcolor="{ALTBG2}"><select name="styleidnew">
  105. <option value="">{lang use_default}</option>
  106. $styleselect</select></td>
  107. </tr>
  108. <tr>
  109. <td bgcolor="{ALTBG1}">{lang tpp}:</td>
  110. <td bgcolor="{ALTBG2}"><select name="tppnew">
  111. <option value="0" $tppchecked[0]>{lang use_default}</option>
  112. <option value="10" $tppchecked[10]>10</option>
  113. <option value="20" $tppchecked[20]>20</option>
  114. <option value="30" $tppchecked[30]>30</option>
  115. </select></td>
  116. </tr>
  117. <tr>
  118. <td bgcolor="{ALTBG1}">{lang ppp}:</td>
  119. <td bgcolor="{ALTBG2}"><select name="pppnew">
  120. <option value="0" $pppchecked[0]>{lang use_default}</option>
  121. <option value="5" $pppchecked[5]>5</option>
  122. <option value="10" $pppchecked[10]>10</option>
  123. <option value="15" $pppchecked[15]>15</option>
  124. </select></td>
  125. </tr>
  126. <tr>
  127. <td bgcolor="{ALTBG1}">{lang timeformat}:</td>
  128. <td bgcolor="{ALTBG2}"><input type="radio" value="24" name="timeformatnew" $check24>24 {lang hour}
  129. <input type="radio" value="12" name="timeformatnew" $check12>12 {lang hour}</td>
  130. </tr>
  131. <!--{if $allowcstatus}-->
  132.     <tr>
  133.     <td bgcolor="{ALTBG1}" width="21%">{lang custom_status}:</td>
  134.     <td bgcolor="{ALTBG2}">
  135.     <input type="text" name="cstatusnew" size="25" value="$member[customstatus]"></td>
  136.     </tr>
  137. <!--{/if}-->
  138. <tr>
  139. <td bgcolor="{ALTBG1}">{lang dateformat}:<br><span class="smalltxt">(yyyy/mm/dd,mm/dd/yy {lang etc})</span></td>
  140. <td bgcolor="{ALTBG2}"><input type="text" name="dateformatnew" size="25" value="$member[dateformat]"></td>
  141. </tr>
  142. <tr>
  143. <td bgcolor="{ALTBG1}">{lang other_options}:</td>
  144. <td bgcolor="{ALTBG2}">
  145. <input type="checkbox" name="showemailnew" value="1" $emailchecked> {lang show_email_addr}<br>
  146. <input type="checkbox" name="newsletternew" value="1" $newschecked> {lang allow_newsletter}<br>
  147. <input type="text" name="timeoffsetnew" size="3" value="$member[timeoffset]"> {lang timeoffset}
  148. </td></tr>
  149. <!--{if $allowavatar == 1}-->
  150.     <tr>
  151.     <td bgcolor="{ALTBG1}">{lang avatar}:</td>
  152.     <td bgcolor="{ALTBG2}"><input type="button" value="{lang memcp_avatar_list}" onclick="window.location=('memcp.php?action=viewavatars&sid=$sid')"></td>
  153.     </tr>
  154. <!--{elseif $allowavatar == 2}-->
  155.     <tr>
  156.     <td bgcolor="{ALTBG1}">{lang avatar}:</td>
  157.     <td bgcolor="{ALTBG2}"><input type="text" name="avatarnew" size="25" value="$member[avatar]">&&<input type="button" value="{lang memcp_avatar_list}" onclick="window.location=('memcp.php?action=viewavatars&sid=$sid')">
  158.     <br><span class="smalltxt">{lang image_comment}</span></td>
  159.     </tr>
  160. <!--{/if}-->
  161. <tr>
  162. <td bgcolor="{ALTBG1}">{lang signature}<!--{if $maxsigsize}--> ($maxsigsize {lang bytes_limited})<!--{/if}-->:<br><br>
  163. <span class="smalltxt">
  164. <a href="faq.php?page=misc#1" target="_blank">{lang post_discuzcode}</a> {lang is} $bbcodeis<br>
  165. {lang post_imgcode} {lang is} $imgcodeis
  166. </span></td>
  167. <td bgcolor="{ALTBG2}"><textarea rows="4" cols="30" name="signew">$member[signature]</textarea></td>
  168. </tr>
  169. </table>
  170. </td></tr></table><br>
  171. <center><input type="submit" name="editsubmit" value="{lang memcp_profile}"></center>
  172. </form>
  173. {template footer}
  • >> Ayl_X <<
  • Newbie
  • Newbie
  • >> Ayl_X <<
  • Posts: 6

Post 3+ Months Ago

Anyone can teach me how to add a new value, like qualification, which choice in a list box!


& I have problem with
memcp_profile.htm
Code: [ Select ]
<tr>
<td bgcolor="{ALTBG1}" width="21%">{lang location}:</td>
<td bgcolor="{ALTBG2}">
    <select name="locationnew" value="$locationnew">
<option value="保密">&</option>
    <option value="香港島">香港島</option>
    <option value="九龍半島">九龍半島</option>
    <option value="新界區">新界區</option>
    <option value="離島區">離島區</option>
    <option value="澳門">澳門</option>
    <option value="台灣">台灣</option>
    <option value="中國">中國</option>
    <option value="其他">其他</option></select>
</td>
</tr>
  1. <tr>
  2. <td bgcolor="{ALTBG1}" width="21%">{lang location}:</td>
  3. <td bgcolor="{ALTBG2}">
  4.     <select name="locationnew" value="$locationnew">
  5. <option value="保密">&</option>
  6.     <option value="香港島">香港島</option>
  7.     <option value="九龍半島">九龍半島</option>
  8.     <option value="新界區">新界區</option>
  9.     <option value="離島區">離島區</option>
  10.     <option value="澳門">澳門</option>
  11.     <option value="台灣">台灣</option>
  12.     <option value="中國">中國</option>
  13.     <option value="其他">其他</option></select>
  14. </td>
  15. </tr>

When I choose one, it can save.
but when user modified the detail in memcp.php, the page can't read the last time choice!


please help me==v

Post Information

  • Total Posts in this topic: 4 posts
  • Users browsing this forum: No registered users and 81 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
cron
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.