Location: PHPKode > projects > ProNuke. Postnuke To Oracle > postnuke/html/modules/NS-Your_Account/user/modules/changeinfo.php
<?php // $Id: changeinfo.php,v 1.4 2001/12/03 23:03:57 gregorrothfuss Exp $
// ----------------------------------------------------------------------
// POST-NUKE Content Management System
// Copyright (C) 2001 by the Post-Nuke Development Team.
// http://www.postnuke.com/
// ----------------------------------------------------------------------
// Based on:
// PHP-NUKE Web Portal System - http://phpnuke.org/
// Thatware - http://thatware.org/
// ----------------------------------------------------------------------
// LICENSE
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License (GPL)
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// To read the license please visit http://www.gnu.org/copyleft/gpl.html
// ----------------------------------------------------------------------
// Original Author of this file: 
// Purpose of this file: allows users to change account info
// ----------------------------------------------------------------------

global $dbconn;

modules_get_language();

function edituser()
{  global $user, $userinfo, $cookie;
    include("header.php");
    getusrinfo($user);
    $timezone_offset = $userinfo['timezone_offset'];
    OpenTable();
    echo "<center><font class=\"pn-title\">"._PERSONALINFO."</font></center>";
    CloseTable();
       echo "<br>";
    echo "<br>";
    OpenTable();
    echo "<table cellpadding=\"8\" border=\"0\"><tr><td>"
        ."<form name=\"Register\" action=\"user.php\" method=\"post\">"
        ."<font class=\"pn-normal\">"._UREALNAME." "._OPTIONAL."</font><br>"
        ."<input type=\"text\" name=\"name\" value=\"$userinfo[name]\" size=\"30\" maxlength=\"60\"><br><br>"
        ."<font class=\"pn-normal\">"._UREALEMAIL." "._REQUIRED."</font><br>"
        ."<font class=\"pn-normal\">"._EMAILNOTPUBLIC."</font><br>"
        ."<input type=\"text\" name=\"email\" value=\"$userinfo[email]\" size=\"30\" maxlength=\"60\"><br><br>"
        ."<font class=\"pn-normal\">"._UFAKEMAIL." "._OPTIONAL."</font><br>"
        ."<font class=\"pn-normal\">"._EMAILPUBLIC."</font><br>"
        ."<input type=\"text\" name=\"femail\" value=\"$userinfo[femail]\" size=\"30\" maxlength=\"60\"><br><br>"
        ."<font class=\"pn-normal\">"._YOURHOMEPAGE." "._OPTIONAL."</font><br>"
        ."<input type=\"text\" name=\"url\" value=\"$userinfo[url]\" size=\"30\" maxlength=\"100\"><br><br>"
        ."<font class=\"pn-normal\">"._TIMEZONEOFFSET.":</font><br>"
        ."<select name=\"timezoneoffset\">\n"
        ."<option value=\"0\""; if ($timezone_offset==0) { echo "selected"; } echo " >(GMT -12:00 hours) Eniwetok, Kwajalein</option>\n"
        ."<option value=\"1\""; if ($timezone_offset==1) { echo "selected"; } echo " >(GMT -11:00 hours) Midway Island, Samoa</option>\n"
        ."<option value=\"2\""; if ($timezone_offset==2) { echo "selected"; } echo " >(GMT -10:00 hours) Hawaii</option>\n"
        ."<option value=\"3\""; if ($timezone_offset==3) { echo "selected"; } echo " >(GMT -9:00 hours) Alaska</option>\n"
        ."<option value=\"4\""; if ($timezone_offset==4) { echo "selected"; } echo " >(GMT -8:00 hours) Pacific Time (US & Canada)</option>\n"
        ."<option value=\"5\""; if ($timezone_offset==5) { echo "selected"; } echo " >(GMT -7:00 hours) Mountain Time (US & Canada)</option>\n"
        ."<option value=\"6\""; if ($timezone_offset==6) { echo "selected"; } echo " >(GMT -6:00 hours) Central Time (US & Canada), Mexico City</option>\n"
        ."<option value=\"7\""; if ($timezone_offset==7) { echo "selected"; } echo " >(GMT -5:00 hours) Eastern Time (US & Canada), Bogota, Lima, Quito</option>\n"
        ."<option value=\"8\""; if ($timezone_offset==8) { echo "selected"; } echo " >(GMT -4:00 hours) Atlantic Time (Canada), Caracas, La Paz</option>\n"
        ."<option value=\"8.5\""; if ($timezone_offset==8.5) { echo "selected"; } echo " >(GMT -3:30 hours) Newfoundland</option>\n"
        ."<option value=\"9\""; if ($timezone_offset==9) { echo "selected"; } echo " >(GMT -3:00 hours) Brazil, Buenos Aires, Georgetown</option>\n"
        ."<option value=\"10\""; if ($timezone_offset==10) { echo "selected"; } echo " >(GMT -2:00 hours) Mid-Atlantic</option>\n"
        ."<option value=\"11\""; if ($timezone_offset==11) { echo "selected"; } echo " >(GMT -1:00 hours) Azores, Cape Verde Islands</option>\n"
        ."<option value=\"12\""; if ($timezone_offset==12) { echo "selected"; } echo " >(GMT) Western Europe Time, London, Lisbon, Casablanca, Monrovia</option>\n"
        ."<option value=\"13\""; if ($timezone_offset==13) { echo "selected"; } echo " >(GMT +1:00 hours) CET(Central Europe Time), Brussels, Copenhagen, Madrid, Paris</option>\n"
        ."<option value=\"14\""; if ($timezone_offset==14) { echo "selected"; } echo " >(GMT +2:00 hours) EET(Eastern Europe Time), Kaliningrad, South Africa</option>\n"
        ."<option value=\"15\""; if ($timezone_offset==15) { echo "selected"; } echo " >(GMT +3:00 hours) Baghdad, Kuwait, Riyadh, Moscow, St. Petersburg, Volgograd, Nairobi</option>\n"
        ."<option value=\"15.5\""; if ($timezone_offset==15.5) { echo "selected"; } echo " >(GMT +3:30 hours) Tehran</option>\n"
        ."<option value=\"16\""; if ($timezone_offset==16) { echo "selected"; } echo " >(GMT +4:00 hours) Abu Dhabi, Muscat, Baku, Tbilisi</option>\n"
        ."<option value=\"16.5\""; if ($timezone_offset==16.5) { echo "selected"; } echo " >(GMT +4:30 hours) Kabul</option>\n"
        ."<option value=\"17\""; if ($timezone_offset==17) { echo "selected"; } echo " >(GMT +5:00 hours) Ekaterinburg, Islamabad, Karachi, Tashkent</option>\n"
        ."<option value=\"17.5\""; if ($timezone_offset==17.5) { echo "selected"; } echo " >(GMT +5:30 hours) Bombay, Calcutta, Madras, New Delhi</option>\n"
        ."<option value=\"18\""; if ($timezone_offset==18) { echo "selected"; } echo " >(GMT +6:00 hours) Almaty, Dhaka, Colombo</option>\n"
        ."<option value=\"19\""; if ($timezone_offset==19) { echo "selected"; } echo " >(GMT +7:00 hours) Bangkok, Hanoi, Jakarta</option>\n"
        ."<option value=\"20\""; if ($timezone_offset==20) { echo "selected"; } echo " >(GMT +8:00 hours) Beijing, Perth, Singapore, Hong Kong, Chongqing, Urumqi, Taipei</option>\n"
        ."<option value=\"21\""; if ($timezone_offset==21) { echo "selected"; } echo " >(GMT +9:00 hours) Tokyo, Seoul, Osaka, Sapporo, Yakutsk</option>\n"
        ."<option value=\"21.5\""; if ($timezone_offset==21.5) { echo "selected"; } echo " >(GMT +9:30 hours) Adelaide, Darwin</option>\n"
        ."<option value=\"22\""; if ($timezone_offset==22) { echo "selected"; } echo " >(GMT +10:00 hours) EAST, Australia, Guam, Papua New Guinea, Vladivostok</option>\n"
        ."<option value=\"23\""; if ($timezone_offset==23) { echo "selected"; } echo " >(GMT +11:00 hours) Magadan, Solomon Islands, New Caledonia</option>\n"
        ."<option value=\"24\""; if ($timezone_offset==24) { echo "selected"; } echo " >(GMT +12:00 hours) Auckland, Wellington, Fiji, Kamchatka, Marshall Island</option>\n"
        ."</select><br>\n"
        ."<font class=\"pn-normal\">"._YOURAVATAR." "._OPTIONAL."</font><br>[ <a class=\"pn-normal\" href=\"user.php?op=avatarlist&amp;module=NS-NewUser\">"._LIST."</a> ]&nbsp;&nbsp;"
        ."<select name=\"user_avatar\" onChange=\"showimage()\">"
        ."<option value=\"$userinfo[user_avatar]\">$userinfo[user_avatar]</option>";
    $direktori = "images/avatar";
    $handle = opendir($direktori);
    while ($file = readdir($handle)) {
        $filelist[] = $file;
    }
    asort($filelist);
    while (list ($key, $file) = each ($filelist)) {
        ereg(".gif|.jpg",$file);
        if ($file == "." || $file == "..") {
            $a = 1;
        } else {
            echo "<option value=\"$file\">$file</option>";
        }
    }
    echo "</select>&nbsp;&nbsp;<img src=\"images/avatar/$userinfo[user_avatar]\" name=\"avatar\" width=\"32\" height=\"32\" alt=\"\">"
        ."<br><br>"
        ."<font class=\"pn-normal\">"._YICQ." "._OPTIONAL."</font><br>"
        ."<input type=\"text\" name=\"user_icq\" value=\"$userinfo[user_icq]\" size=\"30\" maxlength=\"100\"><br><br>"
        ."<font class=\"pn-normal\">"._YAIM." "._OPTIONAL."</font><br>"
        ."<input type=\"text\" name=\"user_aim\" value=\"$userinfo[user_aim]\" size=\"30\" maxlength=\"100\"><br><br>"
        ."<font class=\"pn-normal\">"._YYIM." "._OPTIONAL."</font><br>"
        ."<input type=\"text\" name=\"user_yim\" value=\"$userinfo[user_yim]\" size=\"30\" maxlength=\"100\"><br><br>"
        ."<font class=\"pn-normal\">"._YMSNM." "._OPTIONAL."</font><br>"
        ."<input type=\"text\" name=\"user_msnm\" value=\"$userinfo[user_msnm]\" size=\"30\" maxlength=\"100\"><br><br>"
        ."<font class=\"pn-normal\">"._YLOCATION." "._OPTIONAL."</font><br>"
        ."<input type=\"text\" name=\"user_from\" value=\"$userinfo[user_from]\" size=\"30\" maxlength=\"100\"><br><br>"
        ."<font class=\"pn-normal\">"._YOCCUPATION." "._OPTIONAL."</font><br>"
        ."<input type=\"text\" name=\"user_occ\" value=\"$userinfo[user_occ]\" size=\"30\" maxlength=\"100\"><br><br>"
        ."<font class=\"pn-normal\">"._YINTERESTS." "._OPTIONAL."</font><br>"
        ."<input type=\"text\" name=\"user_intrest\" value=\"$userinfo[user_intrest]\" size=\"30\" maxlength=\"100\"><br><br>"
        ."<font class=\"pn-normal\">"._SIGNATURE." "._OPTIONAL."</font><br>"
        ."<font class=\"pn-normal\">"._255CHARMAX."</font><br>"
        ."<textarea wrap=\"virtual\" cols=\"50\" rows=\"5\" name=\"user_sig\">$userinfo[user_sig]</textarea><br>"
        ."<br><br>"
        ."<font class=\"pn-normal\">"._EXTRAINFO." "._OPTIONAL."</font><br>"
        ."<font class=\"pn-normal\">"._CANKNOWABOUT."</font><br>"
        ."<textarea wrap=\"virtual\" cols=\"50\" rows=\"5\" name=\"bio\">$userinfo[bio]</textarea>"
        ."<br><br>"
        ."<font class=\"pn-normal\">"._PASSWORD." "._TYPENEWPASSWORD."</font><br>"
        ."<input type=\"password\" name=\"pass\" size=\"10\" maxlength=\"20\">&nbsp;&nbsp;<input type=\"password\" name=\"vpass\" size=\"10\" maxlength=\"20\">"
        ."<br><br>"
        ."<input type=\"hidden\" name=\"uname\" value=\"$userinfo[uname]\">"
        ."<input type=\"hidden\" name=\"uid\" value=\"$userinfo[uid]\">"
        ."<input type=\"hidden\" name=\"op\" value=\"saveuser\">"
        ."<input type=\"submit\" value=\""._SAVECHANGES."\">"
        ."</form></td></tr></table>";
    CloseTable();
    include("footer.php");
}

function saveuser($uid, $name, $uname, $email, $femail, $url, $pass, $vpass, $bio, $user_avatar, $user_icq, $user_occ, $user_from, $user_intrest, $user_sig, $user_aim, $user_yim, $user_msnm, $attach, $timezoneoffset)
{
    global $user, $cookie, $userinfo, $EditedMessage, $system, $pntable, $dbconn;

    csrfcheck();

    cookiedecode($user);
    $check = $cookie[1];
    $check2 = $cookie[2];
    $column = &$pntable['users_column'];
    $result = $dbconn->Execute("SELECT $column[uid], $column[pass] FROM $pntable[users] WHERE $column[uname]='$check'");
    list($vuid, $ccpass) = $result->fields;
    if (($uid == $vuid) AND ($check2 == $ccpass)) {
        if ((isset($pass)) && ("$pass" != "$vpass")) {
            echo "<center><font class=\"pn-title\">"._PASSDIFFERENT."</center></font>";
        } elseif (($pass != "") && (strlen($pass) < $minpass)) {
            echo "<center><font class=\"pn-title\">"._YOURPASSMUSTBE." $minpass "._CHARLONG."</center></font>";
        } else {
            if ($bio) {
                filter_text($bio); $bio = $EditedMessage; $bio = FixQuotes($bio);
            }
            if ($pass != "") {
                cookiedecode($user);
                $dbconn->Execute("LOCK TABLES $pntable[users] WRITE");
                     $pass = md5($pass);
                if (!eregi("^http://[\-\.0-9a-z]+",$url)) {
                    $url = "http://".$url;
                }
                $column = &$pntable['users_column'];
                $dbconn->Execute("UPDATE $pntable[users] SET $column[name]='$name', $column[email]='$email', $column[femail]='$femail', $column[url]='$url', $column[pass]='$pass', $column[bio]='$bio' , $column[user_avatar]='$user_avatar', $column[user_icq]='$user_icq', $column[user_occ]='$user_occ', $column[user_from]='$user_from', $column[user_intrest]='$user_intrest', $column[user_sig]='$user_sig', $column[user_aim]='$user_aim', $column[user_yim]='$user_yim', $column[user_msnm]='$user_msnm', $column[timezone_offset]=$timezoneoffset WHERE $column[uid]='$uid'");
                $myquery = buildSimpleQuery ('users', array ('uid', 'uname', 'pass', 'storynum', 'umode', 'uorder', 'thold', 'noscore', 'ublockon', 'theme', 'timezone_offset'), "$column[uname]='$uname' AND $column[pass]='$pass'");
                $result = $dbconn->Execute($myquery);
                if ($result->PO_RecordCount()==1) {
                    $userinfo = $result->GetRowAssoc(false);
                    $result->MoveNext();
                    docookie($userinfo[uid],$userinfo[uname],$userinfo[pass],$userinfo[storynum],$userinfo[umode],$userinfo[uorder],$userinfo[thold],$userinfo[noscore],$userinfo[ublockon],$userinfo[theme],$userinfo[commentmax],$userinfo[timezone_offset]);
                } else {
                    echo "<center><font class=\"pn-title\">"._SOMETHINGWRONG."</center></font><br>";
                }
                $dbconn->Execute("UNLOCK TABLES");
            } else {
                $column = &$pntable['users_column'];
                $dbconn->Execute("UPDATE $pntable[users] SET $column[name]='$name', $column[email]='$email', $column[femail]='$femail', $column[url]='$url', $column[bio]='$bio', $column[user_avatar]='$user_avatar', $column[user_icq]='$user_icq', $column[user_occ]='$user_occ', $column[user_from]='$user_from', $column[user_intrest]='$user_intrest', $column[user_sig]='$user_sig', $column[user_aim]='$user_aim', $column[user_yim]='$user_yim', $column[user_msnm]='$user_msnm', $column[timezone_offset]=$timezoneoffset WHERE $column[uid]='$uid'");
                if ($attach) {
                    $a = 1;
                } else {
                    $a = 0;
                }
            }
            redirect_user();   // we need to rip this out to mainfile and pass it a $page param
        }
    }
}

switch ($op) {
        case "edituser":
                edituser();
                break;
        case "saveuser":
                saveuser($uid, $name, $uname, $email, $femail, $url, $pass, $vpass, $bio, $user_avatar, $user_icq, $user_occ,$user_from, $user_intrest, $user_sig, $user_aim, $user_yim, $user_msnm, $attach, $timezoneoffset);
                break;

}

?>
Return current item: ProNuke. Postnuke To Oracle