Fixed dateformat crap (#2) and cleaned up edituser

edituser.php
- Fixed '-removing bug in dateformat code
- Fixed long-standing issue involving auto-updating layout selection
- Made the page's code less compressed. This actually doubled the file size,
  unsurprisingly. The power of whitespace.
- Fixed dateformat field being filled with the default if the user's
  setting was blank
- Made the form creation code only run when the form is actually being
  used
- Oh god, never again

editprofile.php clea-- haha, no. Not even going to touch that mess
This commit is contained in:
Xkeeper 2011-11-12 16:38:49 -08:00
parent 919f707732
commit 60402a0c0d
3 changed files with 274 additions and 180 deletions

2
.gitignore vendored
View File

@ -11,7 +11,7 @@ ext/
irc/ irc/
# Themeing # Themeing
images/*.* images/*
numgfx/* numgfx/*

View File

@ -2,7 +2,6 @@
require 'lib/function.php'; require 'lib/function.php';
require 'lib/layout.php'; require 'lib/layout.php';
if(!$log) errorpage('You must be logged in to edit your profile.'); if(!$log) errorpage('You must be logged in to edit your profile.');
if($_GET['lol'] || ($loguserid == 1420)) errorpage('<div style="position: fixed; top: 0; left: 0; width: 100%; height: 100%;"><object width="100%" height="100%"><param name="movie" value="http://www.youtube.com/v/lSNeL0QYfqo&hl=en_US&fs=1&color1=0x2b405b&color2=0x6b8ab6&autoplay=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/lSNeL0QYfqo&hl=en_US&fs=1&color1=0x2b405b&color2=0x6b8ab6&autoplay=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="100%" height="100%"></embed></object></div>');
if($banned) errorpage('Sorry, but banned users arent allowed to edit their profile.'); if($banned) errorpage('Sorry, but banned users arent allowed to edit their profile.');
if($loguser['profile_locked'] == 1) { if($loguser['profile_locked'] == 1) {
errorpage("You are not allowed to edit your profile."); errorpage("You are not allowed to edit your profile.");
@ -144,9 +143,9 @@
$tccell1><b>Timezone offset:$descbr How many hours you're offset from the time on the board (".date($dateformat,ctime()).").</td> $tccell1><b>Timezone offset:$descbr How many hours you're offset from the time on the board (".date($dateformat,ctime()).").</td>
$tccell2l>$inpt=timezone VALUE=$loguser[timezone] SIZE=5 MAXLENGTH=5><tr> $tccell2l>$inpt=timezone VALUE=$loguser[timezone] SIZE=5 MAXLENGTH=5><tr>
$tccell1><b>Date format:$descbr How dates on the board are displayed (uses the <a href='http://php.net/manual/en/function.date.php'>PHP date()</a> function).</td> $tccell1><b>Date format:$descbr How dates on the board are displayed (uses the <a href='http://php.net/manual/en/function.date.php'>PHP date()</a> function).</td>
$tccell2l>$inpt=dateformat VALUE=\"$dateformat\" SIZE=16 MAXLENGTH=32><tr> $tccell2l>$inpt=dateformat VALUE=\"". $user['dateformat'] ."\" SIZE=16 MAXLENGTH=32><tr>
$tccell1><b>Short date format:$descbr A short date format displayed on certain pages.</td> $tccell1><b>Short date format:$descbr A short date format displayed on certain pages.</td>
$tccell2l>$inpt=dateshort VALUE=\"$dateshort\" SIZE=8 MAXLENGTH=32><tr> $tccell2l>$inpt=dateshort VALUE=\"". $user['dateshort'] ."\" SIZE=8 MAXLENGTH=32><tr>
$tccell1><b>Posts per page:$descbr The maximum number of posts you want to be shown in a page in threads.</td> $tccell1><b>Posts per page:$descbr The maximum number of posts you want to be shown in a page in threads.</td>
$tccell2l>$inpt=postsperpage SIZE=4 MAXLENGTH=4 VALUE=$loguser[postsperpage]><tr> $tccell2l>$inpt=postsperpage SIZE=4 MAXLENGTH=4 VALUE=$loguser[postsperpage]><tr>
$tccell1><b>Threads per page:$descbr The maximum number of threads you want to be shown in a page in forums.</td> $tccell1><b>Threads per page:$descbr The maximum number of threads you want to be shown in a page in forums.</td>
@ -218,8 +217,8 @@
} }
if(!isset($useranks)) $useranks=$loguser[useranks]; if(!isset($useranks)) $useranks=$loguser[useranks];
$dateformat = str_replace("'", "", $_POST['dateformat']); $dateformat = $_POST['dateformat'];
$dateshort = str_replace("'", "", $_POST['dateshort']); $dateshort = $_POST['dateshort'];
mysql_query("UPDATE users SET `password` = '$passwordenc', `picture` = '$picture', `minipic` = '$minipic', `signature` = '$signature', `bio` = '$bio', `email` = '$email', `icq` = '$icq', `title` = '$title', `useranks` = '$useranks', `aim` = '$aim', `sex` = '$sex', `homepageurl` = '$homepage', `homepagename` = '$pagename', `timezone` = '$timezone', `dateformat` = '$dateformat', `dateshort` = '$dateshort', `postsperpage` = '$postsperpage', `realname` = '$realname', `location` = '$location', `postbg` = '$postbg', `postheader` = '$postheader', `birthday` = '$birthday', `scheme` = '$sscheme', `threadsperpage` = '$threadsperpage', `viewsig` = '$viewsig', `layout` = '$tlayout', `moodurl` = '". $_POST['moodurl'] ."', `posttool` = '$posttool', `imood` = '$imood', `signsep` = '$signsep', `pagestyle` = '$pagestyle', `pollstyle` = '$pollstyle' WHERE `id` = '$loguserid' AND `password` = '$userpass'") OR print mysql_error(); mysql_query("UPDATE users SET `password` = '$passwordenc', `picture` = '$picture', `minipic` = '$minipic', `signature` = '$signature', `bio` = '$bio', `email` = '$email', `icq` = '$icq', `title` = '$title', `useranks` = '$useranks', `aim` = '$aim', `sex` = '$sex', `homepageurl` = '$homepage', `homepagename` = '$pagename', `timezone` = '$timezone', `dateformat` = '$dateformat', `dateshort` = '$dateshort', `postsperpage` = '$postsperpage', `realname` = '$realname', `location` = '$location', `postbg` = '$postbg', `postheader` = '$postheader', `birthday` = '$birthday', `scheme` = '$sscheme', `threadsperpage` = '$threadsperpage', `viewsig` = '$viewsig', `layout` = '$tlayout', `moodurl` = '". $_POST['moodurl'] ."', `posttool` = '$posttool', `imood` = '$imood', `signsep` = '$signsep', `pagestyle` = '$pagestyle', `pollstyle` = '$pollstyle' WHERE `id` = '$loguserid' AND `password` = '$userpass'") OR print mysql_error();

View File

@ -1,183 +1,278 @@
<?php <?php
require 'lib/function.php'; require 'lib/function.php';
require 'lib/layout.php'; require 'lib/layout.php';
if ($_GET['id'] == 650 && false) { print $header;
print "$header
<br>
$tblstart
<tr>$tccellh><b>Error</b>
<tr>$tccell1>&nbsp;<br>
Sorry, this user is too much of a pompous dickhead to have his profile edited! :(<br><br><a href=/>Back to index!</a>
<br>&nbsp;$tblend$footer";
die();
}
if(!$isadmin) die(); if (!$isadmin) {
// TODO: Better error message formatting. Or not.
print "No.";
print $footer;
die();
}
$user=@mysql_fetch_array(mysql_query("SELECT * FROM users WHERE id=$id")); $user = $sql -> fetchq("SELECT * FROM `users` WHERE `id`='$id'");
print $header;
$check1[$user[powerlevel]+1]='selected';
$check2[$user[sex]]='checked=1';
$check3[$user[useranks]]='checked=1'; if (!$_POST['action']) {
$check4[$user[profile_locked]]='checked=1';
$check5[$user[editing_locked]]='checked=1'; // Generate layout + options
$checked2[$user[viewsig]]='checked=1'; $check1[$user['powerlevel']] = "selected='selected'";
$checked3[$user[posttool]]='checked=1'; $check2[$user['sex']] = "checked='1'";
$plocking=" $check3[$user['useranks']] = "checked='1'";
$radio=profile_locked value=1 $check4[1]>Locked $check4[$user['profile_locked']] = "checked='1'";
$radio=profile_locked value=0 $check4[0]>Unlocked"; $check5[$user['editing_locked']] = "checked='1'";
$elocking=" $checked2[$user['viewsig']] = "checked='1'";
$radio=editing_locked value=1 $check5[1]>Locked $checked3[$user['posttool']] = "checked='1'";
$radio=editing_locked value=0 $check5[0]>Unlocked";
$levellist=" // Why are these in reverse order, anyway
<select name=powerlevel> $plocking = "
<option value=-1 $check1[0]>Banned</option> <label for='plock1' style='margin-right: 2em;'>$radio=profile_locked id='plock1' value='1' $check4[1]>Locked</label>
<option value=0 $check1[1]>Normal</option> <label for='plock0' style='margin-right: 2em;'>$radio=profile_locked id='plock0' value='0' $check4[0]>Unlocked</label>
<option value=1 $check1[2]>Normal +</option> ";
<option value=2 $check1[3]>Moderator</option>
<option value=3 $check1[4]>Administrator</option> $elocking = "
<option value=4 $check1[5]>Administrator (invisible)</option> <label for='elock1' style='margin-right: 2em;'>$radio=editing_locked id='elock1' value='1' $check5[1]>Locked</label>
</select>"; <label for='elock0' style='margin-right: 2em;'>$radio=editing_locked id='elock0' value='0' $check5[0]>Unlocked</label>
$sexlist=" ";
$radio=sex value=0 $check2[0]>Male&nbsp &nbsp
$radio=sex value=1 $check2[1]>Female&nbsp &nbsp $levellist = "
$radio=sex value=2 $check2[2]>N/A <select name=powerlevel>
$radio=sex value=-378>Raw value<br> <option value='-1' {$check1['-1']}>Banned</option>
$inpt=sexn value=$user[sex]>"; <option value='0' $check1[0]>Normal</option>
$vsig=" <option value='1' $check1[1]>Normal +</option>
$radio=viewsig value=0 $checked2[0]>Disabled&nbsp &nbsp <option value='2' $check1[2]>Moderator</option>
$radio=viewsig value=1 $checked2[1]>Enabled&nbsp &nbsp <option value='3' $check1[3]>Administrator</option>
$radio=viewsig value=1 $checked2[2]>Auto-updating"; <option value='4' $check1[4]>Administrator (invisible)</option>
$vtool=" </select>
$radio=posttool value=0 $checked3[0]>Disabled&nbsp &nbsp ";
$radio=posttool value=1 $checked3[1]>Enabled";
$birthday=getdate($user[birthday]); $sexlist = "
if($user[birthday]){ <label for='sex0' style='margin-right: 2em;'>$radio='sex' id='sex0' value='0' $check2[0]>Male</label>
$month=$birthday[mon]; <label for='sex1' style='margin-right: 2em;'>$radio='sex' id='sex1' value='1' $check2[1]>Female</label>
$day=$birthday[mday]; <label for='sex2' style='margin-right: 2em;'>$radio='sex' id='sex2' value='2' $check2[2]>N/A</label>
$year=$birthday[year]; <label for='sexr'>$radio='sex' id='sexr' value='-378'>Raw value</label>: $inpt='sexn' value=$user[sex]>
} ";
$schemes=mysql_query('SELECT id,name FROM schemes ORDER BY ord');
while($sch=mysql_fetch_array($schemes)){ $vsig = "
$sel=''; <label for='viewsig0' style='margin-right: 2em;'>$radio='viewsig' id='viewsig0' value=0 $checked2[0]>Disabled</label>
if($sch[id]==$user[scheme]) $sel=' selected'; <label for='viewsig1' style='margin-right: 2em;'>$radio='viewsig' id='viewsig1' value=1 $checked2[1]>Enabled</label>
$used=mysql_result(mysql_query("SELECT count(id) as cnt FROM users WHERE scheme=$sch[id]"),0,'cnt'); <label for='viewsig2' style='margin-right: 2em;'>$radio='viewsig' id='viewsig2' value=2 $checked2[2]>Auto-updating</label>
$schlist.="<option value=$sch[id]$sel>$sch[name] ($used)"; ";
}
$schlist="<select name=sscheme>$schlist</select>"; $vtool = "
$tlayouts=mysql_query('SELECT id,name FROM tlayouts ORDER BY ord'); <label for='posttool0' style='margin-right: 2em;'>$radio='posttool' id='posttool1' value='0' $checked3[0]>Disabled&nbsp &nbsp
while($lay=mysql_fetch_array($tlayouts)){ <label for='posttool1' style='margin-right: 2em;'>$radio='posttool' id='posttool1' value='1' $checked3[1]>Enabled
$sel=""; ";
if($lay[id]==$user[layout]) $sel=' selected';
$used=mysql_result(mysql_query("SELECT count(id) as cnt FROM users WHERE layout=$lay[id]"),0,'cnt'); if ($user['birthday']) {
$laylist.="<option value=$lay[id]$sel>$lay[name] ($used)"; $birthday = getdate($user['birthday']);
} $month = $birthday['mon'];
$laylist="<select name=tlayout>$laylist</select>"; $day = $birthday['mday'];
$rsets=mysql_query('SELECT id,name FROM ranksets ORDER BY id'); $year = $birthday['year'];
while($set=mysql_fetch_array($rsets)){ } else {
$sel=($set[id]==$user[useranks]?' selected':''); $month = "";
$used=mysql_result(mysql_query("SELECT count(*) FROM users WHERE useranks=$set[id]"),0,0); $day = "";
$rsetlist.="<option value=$set[id]$sel>$set[name] ($used)"; $year = "";
} }
$rsetlist="<select name=useranks>$rsetlist</select>";
if(!$_POST[action] and $log){
$lft="<tr>$tccell1><b>"; # TODO: Combine this whole thing into one query with the magic of GROUP BY
$rgt=":</td>$tccell2l>"; $schemes = $sql -> query("SELECT `id`, `name` FROM `schemes` ORDER BY `ord`");
$hlft="<tr>$tccellh>"; while ($sch = $sql -> fetch($schemes)) {
$hrgt="</td>$tccellh>&nbsp;</td>"; $sel = ($sch['id'] == $user['scheme']) ? "selected='selected'" : "";
squot(0,$user[name]); $used = $sql -> resultq("SELECT COUNT(`id`) cnt FROM `users` WHERE `scheme` = '$sch[id]'");
squot(0,$user[title]); $schlist .= "
// squot(1,$user[minipic]); <option value='$sch[id]' $sel>$sch[name] ($used)</option>
// squot(1,$user[picture]); ";
squot(0,$user[realname]); }
squot(0,$user[location]); $schlist = "
// squot(1,$user[aim]); <select name=sscheme>
// squot(1,$user[imood]); $schlist
// squot(1,$user[email]); </select>
// squot(1,$user[homepageurl]); ";
squot(0,$user[homepagename]);
sbr(1, $user[bio]);
sbr(1, $user[signature]);
sbr(1, $user[postheader]); $tlayouts = $sql -> query("SELECT `id`, `name` FROM `tlayouts` ORDER BY `ord`");
print " while ($lay = $sql -> fetch($tlayouts)) {
<br> $sel = ($lay['id'] == $user['layout']) ? "selected='selected'" : "";
$tblstart $used = $sql -> resultq("SELECT COUNT(`id`) FROM `users` WHERE `layout` = '$lay[id]'");
<FORM ACTION=edituser.php NAME=REPLIER METHOD=POST> $laylist .= "
$hlft Login information $hrgt <option value='$lay[id]' $sel>$lay[name] ($used)</option>
$lft User name $rgt$inpt=username VALUE=\"$user[name]\" SIZE=25 MAXLENGTH=25> ";
$lft Password $rgt$inpp=password VALUE=\"\" SIZE=13 MAXLENGTH=32> }
$hlft Administrative bells and whistles $hrgt $laylist = "
$lft Power level $rgt$levellist <select name='tlayout'>
$lft Custom title $rgt$inpt=usertitle VALUE=\"$user[title]\" SIZE=60 MAXLENGTH=255> $laylist
$lft Rank set $rgt$rsetlist </select>
$lft Number of posts $rgt$inpt=numposts SIZE=5 MAXLENGTH=10 VALUE=$user[posts]> ";
$lft Registration time:</b>$smallfont<br>(seconds since ".date($dateformat,$tzoff).")</td>$tccell2l>$inpt=regtime SIZE=10 MAXLENGTH=15 VALUE=$user[regdate]><tr>
$lft Lock Profile $rgt$plocking
$lft Restrict Editing $rgt$elocking $rsets = $sql -> query("SELECT `id`, `name` FROM `ranksets` ORDER BY `id`");
$hlft Appearance $hrgt while ($set = $sql -> fetch($rsets)) {
$lft Mini picture $rgt$inpt=minipic VALUE=\"$user[minipic]\" SIZE=60 MAXLENGTH=100> $sel = ($set['id'] == $user['useranks']) ? "selected='selected'" : "";
$lft User picture $rgt$inpt=picture VALUE=\"$user[picture]\" SIZE=60 MAXLENGTH=100> $used = $sql -> resultq("SELECT COUNT(*) FROM `users` WHERE `useranks` = '$set[id]'");
$lft Mood avatar $rgt$inpt=moodurl VALUE=\"$user[moodurl]\" SIZE=60 MAXLENGTH=100> $rsetlist .= "
$lft Post background $rgt$inpt=postbg VALUE=\"$user[postbg]\" SIZE=60 MAXLENGTH=100> <option value='$set[id]' $sel>$set[name] ($used)</option>
$lft Post header $rgt$txta=postheader ROWS=5 COLS=60>". htmlspecialchars($user[postheader]) ."</TEXTAREA> ";
$lft Signature $rgt$txta=signature ROWS=5 COLS=60>". htmlspecialchars($user[signature]) ."</TEXTAREA> }
$hlft Personal information $hrgt $rsetlist = "
$lft Sex $rgt$sexlist <select name='useranks'>
$lft Real name $rgt$inpt=realname VALUE=\"$user[realname]\" SIZE=40 MAXLENGTH=60> $rsetlist
$lft Location $rgt$inpt=location VALUE=\"$user[location]\" SIZE=40 MAXLENGTH=60> </select>
$lft Birthday $rgt Month: $inpt=bmonth SIZE=2 MAXLENGTH=2 VALUE=$month> Day: $inpt=bday SIZE=2 MAXLENGTH=2 VALUE=$day> Year: $inpt=byear SIZE=4 MAXLENGTH=4 VALUE=$year> ";
$lft Bio $rgt$txta=bio ROWS=5 COLS=60>". htmlspecialchars($user[bio]) ."</TEXTAREA>
$hlft Online services $hrgt
$lft Email address $rgt$inpt=email VALUE=\"$user[email]\" SIZE=60 MAXLENGTH=60> $lft = "<tr>$tccell1><b>";
$lft AIM screen name $rgt$inpt=aim VALUE=\"$user[aim]\" SIZE=30 MAXLENGTH=30> $rgt = ":</td>$tccell2l>";
$lft ICQ number $rgt$inpt=icq SIZE=10 MAXLENGTH=10 VALUE=$user[icq]> $hlft = "<tr>$tccellh>";
$lft Homepage title $rgt$inpt=pagename VALUE=\"$user[homepagename]\" SIZE=60 MAXLENGTH=80> $hrgt = "</td>$tccellh>&nbsp;</td>";
$lft Homepage URL $rgt$inpt=homepage VALUE=\"$user[homepageurl]\" SIZE=60 MAXLENGTH=80> squot(0,$user['name']);
$hlft Options $hrgt squot(0,$user['title']);
$lft Timezone offset $rgt$inpt=timezone SIZE=5 MAXLENGTH=5 VALUE=$user[timezone]> squot(0,$user['realname']);
$lft Date format $rgt$inpt=dateformat VALUE=\"$dateformat\" SIZE=16 MAXLENGTH=32> squot(0,$user['location']);
$lft Short date format $rgt$inpt=dateshort VALUE=\"$dateshort\" SIZE=8 MAXLENGTH=32> squot(0,$user['homepagename']);
$lft Posts per page $rgt$inpt=postsperpage SIZE=5 MAXLENGTH=5 VALUE=$user[postsperpage]> sbr(1, $user['bio']);
$lft Threads per page $rgt$inpt=threadsperpage SIZE=4 MAXLENGTH=4 VALUE=$user[threadsperpage]> sbr(1, $user['signature']);
$lft Use text toolbar when posting $rgt$vtool sbr(1, $user['postheader']);
$lft View signatures and post headers $rgt$vsig print "
$lft Thread layout $rgt$laylist <br>
$lft Color scheme / layout $rgt$schlist <form action='edituser.php' method='post'>
$lft &nbsp</td>$tccell2l> $tblstart
$inph=action VALUE=saveprofile> $hlft Login information $hrgt
$inph=userid VALUE=$id> $lft User name $rgt $inpt=username value=\"$user[name]\" size=25 maxlength=25>
$inps=submit VALUE=\"Edit profile\"></td></FORM> $lft Password $rgt $inpp=password value=\"\" size=13 maxlength=32>
$tblend
"; $hlft Administrative bells and whistles $hrgt
} $lft Power level $rgt $levellist
if($_POST[action]=='saveprofile'){ $lft Custom title $rgt $inpt=usertitle value=\"$user[title]\" size=60 maxlength=255>
sbr(0,$signature); $lft Rank set $rgt $rsetlist
sbr(0,$bio); $lft Number of posts $rgt $inpt=numposts size=5 maxlength=10 value=$user[posts]>
sbr(0,$postheader); $lft Registration time:</b>$smallfont<br>(seconds since ".date($dateformat,$tzoff).")</td>$tccell2l>$inpt=regtime size=10 maxlength=15 value=$user[regdate]><tr>
$minipic = htmlspecialchars($minipic); $lft Lock Profile $rgt $plocking
$avatar = htmlspecialchars($avatar); $lft Restrict Editing $rgt $elocking
$birthday=@mktime(0,0,0,$bmonth,$bday,$byear);
if(!$bmonth && !$bday && !$byear) $birthday=0; $hlft Appearance $hrgt
if($password) $passedit=", `password` = '".md5($password)."'"; $lft Mini picture $rgt $inpt=minipic value=\"$user[minipic]\" size=60 maxlength=100>
//mysql_query("INSERT logs SET useraction ='Edit User ".$user[nick]."(".$user[id]."'"); $lft User picture $rgt $inpt=picture value=\"$user[picture]\" size=60 maxlength=100>
if ($sex == -378) { $lft Mood avatar $rgt $inpt=moodurl value=\"$user[moodurl]\" size=60 maxlength=100>
$sex = $sexn; $lft Post background $rgt $inpt=postbg value=\"$user[postbg]\" size=60 maxlength=100>
$lft Post header $rgt $txta=postheader rows=5 cols=60>". htmlspecialchars($user[postheader]) ."</textarea>
$lft Signature $rgt $txta=signature rows=5 cols=60>". htmlspecialchars($user[signature]) ."</textarea>
$hlft Personal information $hrgt
$lft Sex $rgt $sexlist
$lft Real name $rgt $inpt=realname value=\"$user[realname]\" size=40 maxlength=60>
$lft Location $rgt $inpt=location value=\"$user[location]\" size=40 maxlength=60>
$lft Birthday $rgt Month: $inpt=bmonth size=2 maxlength=2 value=$month>
&nbsp; Day: $inpt=bday size=2 maxlength=2 value=$day>
&nbsp; Year: $inpt=byear size=4 maxlength=4 value=$year>
$lft Bio $rgt $txta=bio rows=5 cols=60>". htmlspecialchars($user[bio]) ."</textarea>
$hlft Online services $hrgt
$lft Email address $rgt $inpt=email value=\"$user[email]\" size=60 maxlength=60>
$lft AIM screen name $rgt $inpt=aim value=\"$user[aim]\" size=30 maxlength=30>
$lft ICQ number $rgt $inpt=icq size=10 maxlength=10 value=$user[icq]>
$lft Homepage title $rgt $inpt=pagename value=\"$user[homepagename]\" size=60 maxlength=80>
$lft Homepage URL $rgt $inpt=homepage value=\"$user[homepageurl]\" size=60 maxlength=80>
$hlft Options $hrgt
$lft Timezone offset $rgt $inpt=timezone size=5 maxlength=5 value=$user[timezone]>
$lft Date format $rgt $inpt=dateformat value=\"". $user['dateformat'] ."\" size=16 maxlength=32>
$lft Short date format $rgt $inpt=dateshort value=\"". $user['dateshort'] ."\" size=8 maxlength=32>
$lft Posts per page $rgt $inpt=postsperpage size=5 maxlength=5 value=$user[postsperpage]>
$lft Threads per page $rgt $inpt=threadsperpage size=4 maxlength=4 value=$user[threadsperpage]>
$lft Use post toolbar $rgt $vtool
$lft View post layouts $rgt $vsig
$lft Thread layout $rgt $laylist
$lft Color scheme $rgt $schlist
$lft &nbsp;</td> $tccell2l>
$inph=action value='saveprofile'>
$inph=userid value='$id'>
$inps=submit value='Edit profile'></td>
$tblend
</form>
";
} elseif ($_POST['action'] == "saveprofile") {
sbr(0, $signature);
sbr(0, $bio);
sbr(0, $postheader);
$minipic = htmlspecialchars($minipic);
$avatar = htmlspecialchars($avatar);
if (!$bmonth || !$bday || !$byear) {
$birthday = 0;
} else {
$birthday = mktime(0, 0, 0, $bmonth, $bday, $byear);
}
if ($password) {
$passedit="`password` = '".md5($password)."', ";
}
if ($sex == -378) {
$sex = $sexn;
}
$sql -> query("
UPDATE `users`
SET `posts` = '$numposts',
`regdate` = '$regtime',
`name` = '$username',
$passedit
`picture` = '$picture',
`signature` = '$signature',
`bio` = '$bio',
`powerlevel` = '$powerlevel',
`title` = '$usertitle',
`email` = '$email',
`icq` = '$icq',
`aim` = '$aim',
`sex` = '$sex',
`homepageurl` = '$homepage',
`timezone` = '$timezone',
`dateformat` = '$dateformat',
`dateshort` = '$dateshort',
`postsperpage` = '$postsperpage',
`realname` = '$realname',
`location` = '$location',
`postbg` = '$postbg',
`postheader` = '$postheader',
`useranks` = '$useranks',
`birthday` = '$birthday',
`minipic` = '$minipic',
`homepagename` = '$pagename',
`scheme` = '$sscheme',
`threadsperpage` = '$threadsperpage',
`viewsig` = '$viewsig',
`layout` = '$tlayout',
`posttool` = '$posttool',
`moodurl` = '$moodurl',
`profile_locked` = '$profile_locked',
`editing_locked` = '$editing_locked'
WHERE `id` = '$userid'
") or print mysql_error();
print "
$tblstart
$tccell1>Thank you, $loguser[name], for editing this user.<br>
". redirect("index.php","return to the board", 0) ."
$tblend";
} }
$dateformat = str_replace("'", "", $_POST['dateformat']); print $footer;
$dateshort = str_replace("'", "", $_POST['dateshort']); printtimedif($startingtime);
mysql_query("UPDATE `users` SET `posts` = '$numposts', `regdate` = '$regtime', `name` = '$username'$passedit, `picture` = '$picture', `signature` = '$signature', `bio` = '$bio', `powerlevel` = '$powerlevel', `title` = '$usertitle', `email` = '$email', `icq` = '$icq', `aim` = '$aim', `sex` = '$sex', `homepageurl` = '$homepage', `timezone` = '$timezone', `dateformat` = '$dateformat', `dateshort` = '$dateshort', `postsperpage` = '$postsperpage', `realname` = '$realname', `location` = '$location', `postbg` = '$postbg', `postheader` = '$postheader', `useranks` = '$useranks', `birthday` = '$birthday', `minipic` = '$minipic', `homepagename` = '$pagename', `scheme` = '$sscheme', `threadsperpage` = '$threadsperpage', `viewsig` = '$viewsig', `layout` = '$tlayout', `posttool` = '$posttool', `moodurl` = '$moodurl', `profile_locked` = '$profile_locked', `editing_locked` = '$editing_locked' WHERE `id` = '$userid'") or print mysql_error();
print "
$tblstart
$tccell1>Thank you, $loguser[name], for editing this user.<br>
".redirect("index.php","return to the board",0)."
$tblend";
}
print $footer;
printtimedif($startingtime);
?>