Strats Posted August 7, 2009 Posted August 7, 2009 Can someone please help me out and see if they can spot the problem. Or fix it and let me know. Problems, 1) I added an extra picture for profiles which is called "profile_pic" When I click on change profile pic it comes up with everything like normal, but in the box where you put the the link to the profile picture it has a "1" When you put the link to your picture it says pic changed. But it does not show up on the profile and when you go back to preferences it does not keep the pic link it goes back to "1" 2) When I click forum change I get this message : Fatal error: Call to undefined function forum_change() in /home/wrestlin/public_html/preferences.php on line 58 This happened randomly as it was working the other day. 3) When I click change personal details I get this message : Fatal error: Call to undefined function pdetail_change() in /home/wrestlin/public_html/preferences.php on line 66 Here is my preferences : <?php include "globals.php"; switch($_GET['action']) { case 'sexchange2': do_sex_change(); break; case 'sexchange': conf_sex_change(); break; case 'passchange2': do_pass_change(); break; case 'passchange': pass_change(); break; case 'namechange2': do_name_change(); break; case 'namechange': name_change(); break; case 'picchange2': do_pic_change(); break; case 'picchange': pic_change(); break; case 'newpropic': new_propic(); break; case 'newpropic2': do_new_propic(); break ; case 'smchange2': do_sm_change(); break; case 'smchange': sm_change(); break; case 'forumchange2': do_forum_change(); break; case 'forumchange': forum_change(); break; case 'pdetailchange2': do_pdetail_change(); break; case 'pdetailchange': pdetail_change(); break; default: prefs_home(); break; } function prefs_home() { global $db,$ir,$c,$userid,$h; print "<h3>Preferences</h3> [url='preferences.php?action=sexchange']Sex Change[/url] [url='preferences.php?action=passchange']Password Change[/url] [url='preferences.php?action=namechange']Name Change[/url] [url='preferences.php?action=picchange']Display Pic Change[/url] [url='preferences.php?action=smchange']Status Message Change[/url] [url='preferences.php?action=newpropic']Profile Pic Change[/url] [url='preferences.php?action=forumchange']Forum Info Change[/url] [url='preferences.php?action=pdetailchange']Personal Detail Change[/url] "; } function conf_sex_change() { global $ir,$c,$userid,$h; if($ir['gender'] == "Male") { $g="Female"; } else { $g="Male"; } print "Are you sure you want to become a $g? [url='preferences.php?action=sexchange2']Yes[/url] | [url='preferences.php']No[/url]"; } function do_sex_change() { global $db,$ir,$c,$userid,$h; if($ir['gender'] == "Male") { $g="Female"; } else { $g="Male"; } $db->query("UPDATE users SET gender='$g' WHERE userid=$userid"); print "Success, you are now $g! [url='preferences.php']Back[/url]"; } function pass_change() { global $ir,$c,$userid,$h; print "<h3>Password Change</h3><form action='preferences.php?action=passchange2' method='post'>Current Password: <input type='password' name='oldpw' /> New Password: <input type='password' name='newpw' /> Confirm: <input type='password' name='newpw2' /> <input type='submit' value='Change PW' /></form>"; } function do_pass_change() { global $db,$ir,$c,$userid,$h; if(md5($_POST['oldpw']) != $ir['userpass']) { print "The current password you entered was wrong. [url='preferences.php?action=passchange']> Back[/url]"; } else if($_POST['newpw'] !== $_POST['newpw2']) { print "The new passwords you entered did not match! [url='preferences.php?action=passchange']> Back[/url]"; } else { $db->query("UPDATE users SET userpass=md5('{$_POST['newpw']}') WHERE userid=$userid"); print "Password changed!"; } } function name_change() { global $ir,$c,$userid,$h; print "<h3>Name Change</h3> Please note that you still use the same name to login, this procedure simply changes the name that is displayed. <form action='preferences.php?action=namechange2' method='post'> New Name: <input type='text' name='newname' /> <input type='submit' value='Change Name' /></form>"; } function do_name_change() { global $db,$ir,$c,$userid,$h; // Edited by zero-affect if($_POST['newname'] == "" || $_POST['newname'] == " " || $_POST['newname'] == " " || $_POST['newname'] == " " || $_POST['newname'] == " " || $_POST['newname'] == " " || $_POST['newname'] == " " || $_POST['newname'] == " " || $_POST['newname'] == " " || $_POST['newname'] == " " || $_POST['newname'] == " " || $_POST['newname'] == " " || $_POST['newname'] == " " || $_POST['newname'] == " " || $_POST['newname'] == " " && $_POST['newname'] == " ") { $_POST['newname'] = trim($_POST['newname']); $i = mysql_query("SELECT * FROM users WHERE username='{$_POST['username']}'") or die(mysql_error()); if(mysql_num_rows($i)) {echo 'Username already in use!';$h->endpage(); exit; } print "You did not enter a new name. [url='preferences.php?action=name_change']> Back[/url]"; } else { $_POST['newname'] = trim($_POST['newname']); $_POST['newname']=str_replace(array("<", ">", "\\\'"), array("<", ">", "'"), $_POST['newname']); $_POST['newname']=str_replace(array("{", "}", "\\\'"), array("<", ">", "'"), $_POST['newname']); $_POST['newname']=str_replace(array("eval", "alert", "\\\'"), array(".", ".", "."), $_POST['newname']); $checkun=$db->num_rows($db->query("SELECT * FROM users WHERE username='{$_POST['newname']}' AND userid!=$userid")); if($checkun) { echo "Username is already in use."; $h->endpage(); exit; } $checkln=$db->num_rows($db->query("SELECT * FROM users WHERE login_name='{$_POST['newname']}' AND userid!=$userid")); if($checkln) { echo "Username is already in use."; $h->endpage(); exit; } $db->query("UPDATE users SET username='{$_POST['newname']}' WHERE userid=$userid"); print "Username changed!"; } } function pic_change() { global $ir,$c,$userid,$h; print "<h3>Pic Change</h3> Please note that this must be externally hosted, [url='http://imageshack.us']ImageShack[/url] is our recommendation. Any images that are not 150x150 will be automatically resized <form action='preferences.php?action=picchange2' method='post'> New Pic: <input type='text' name='newpic' value='{$ir['display_pic']}' /> <input type='submit' value='Change Name' /></form>"; } function do_pic_change() { global $db,$ir,$c,$userid,$h; if($_POST['newpic'] == "") { print "You did not enter a new pic. [url='preferences.php?action=picchange']> Back[/url]"; } else { $_POST['newpic']=str_replace('\\\'',''', $_POST['newpic']); $db->query("UPDATE users SET display_pic='{$_POST['newpic']}' WHERE userid=$userid"); print "Pic changed!"; } } function new_propic() { global $ir,$c,$userid,$h; print "<h3>Pic Change</h3> Please note that this must be externally hosted, [url='http://imageshack.us']ImageShack[/url] is our recommendation. Any images that are not 150x150 will be automatically resized <form action='preferences.php?action=newpropic2' method='post'> New Pic: <input type='text' name='newpic1' value='{$ir['profile_pic']}' /> <input type='submit' value='Change profile pic' /></form>"; } function do_new_propic() { global $db,$ir,$c,$userid,$h; if($_POST['newpic1'] == "") { print "You did not enter a new pic. [url='preferences.php?action=newpropic']> Back[/url]"; } else { $_POST['newpic1']=str_replace('\\\'',''', $_POST['newpic']); $db->query("UPDATE users SET profile_pic='{$_POST['newpic1']}' WHERE userid=$userid"); print "Pic changed!"; } function forum_change() { global $ir,$c,$userid,$h; print "<h3>Forum Info Change</h3> Please note that the avatar must be externally hosted, [url='http://imageshack.us']ImageShack[/url] is our recommendation. Any avatars that are not 100x100 will be automatically resized <form action='preferences.php?action=forumchange2' method='post'> <table style='border-style:solid;border-width:1px;border-color:#303030;' cellpadding='5'> <tr> <td bgcolor='#606060'>Avatar:</td> <td bgcolor='#404040'><input type='text' name='forums_avatar' value='{$ir['forums_avatar']}' /></td> </tr> <tr> <td bgcolor='#606060'>Signature (you may use BBcode):</td> <td bgcolor='#404040'><textarea rows=10 cols=50 name='forums_signature'>{$ir['forums_signature']}</textarea></td> </tr> <tr colspan='2' bgcolor='#404040'> <td colspan='2'> <input type='submit' value='Change Info' /></td> </tr> </table></form>"; } function do_forum_change() { global $db,$ir,$c,$userid,$h; $url=$_POST['forums_avatar']; if(substr($url, -1)!="g" && substr($url, -1)!="G" && substr($url, -1)!="F" && substr($url, -1)!="f") { print"You need to supply a real image. [url='preferences.php?action=forumchange']> Back[/url]"; include"int2.php"; die(""); } if (preg_match("/.jpg/", $url) || preg_match("/.php/", $url)) { } else if(preg_match("/.jpeg/", $url) || preg_match("/.php/", $url)) { } else if(preg_match("/.gif/", $url) || preg_match("/.php/", $url)) { } else if(preg_match("/.JPG/", $url) || preg_match("/.php/", $url)) { } else if(preg_match("/.JPEG/", $url) || preg_match("/.php/", $url)) { } else if(preg_match("/.GIF/", $url) || preg_match("/.php/", $url)) { } else if(preg_match("/.PNG/", $url) || preg_match("/.php/", $url)) { } else if(preg_match("/.png/", $url) || preg_match("/.php/", $url)) { } else { print"You need to supply a real image. [url='preferences.php?action=forumchange']> Back[/url]"; include"int2.php"; die(""); } $_POST['forums_avatar']=mysql_real_escape_string($_POST['forums_avatar']); $_POST['forums_signature']=mysql_real_escape_string($_POST['forums_signature']); mysql_query("UPDATE users SET forums_avatar='{$_POST['forums_avatar']}', forums_signature='{$_POST['forums_signature']}' WHERE userid=$userid"); print "Forum Info changed!"; } } function sm_change() { global $ir,$c,$userid,$h; print "<h3>Status Message Change Change</h3> Here, you can change your status message that will be shown on your profile. <form action='preferences.php?action=smchange2' method='post'> Status Message: <input type='text' name='sm' /> <input type='submit' value='Change Status Message' /></form>"; } function do_sm_change() { global $db,$ir,$c,$userid,$h; if($_POST['sm'] == "") { print "You did not enter a new status message. [url='preferences.php?action=smchange']> Back[/url]"; } else { $_POST['sm']=str_replace(array("<", ">", "\\\'"), array("<", ">", "'"), $_POST['sm']); $db->query("UPDATE users SET sm='{$_POST['sm']}' WHERE userid=$userid"); print "Status Message Changed!"; } function pdetail_change() { global $db,$userid; echo "<h3>Personal Details Change</h3>"; $pd=$db->query("SELECT * FROM pdetails WHERE userid=$userid"); $p=$db->fetch_row($pd); echo "<form action='preferences.php?action=pdetailchange2' method='post'> First Name: <input type='text' name='fistname' value='{$p['first']}' /> Last Name: <input type='text' name='lastname' value='{$p['last']}' /> Age: <input type='text' name='age' value='{$p['age']}' /> Aim Of The Game: <input type='text' name='aog' value='{$p['aog']}' /> Msn: <input type='text' name='msn' value='{$p['msn']}' /> Aim: <input type='text' name='aim' value='{$p['aim']}' /> Aol: <input type='text' name='aol' value='{$p['aol']}' /> Yahoo: <input type='text' name='yahoo' value='{$p['yahoo']}' /> Personal Details: <select name='pdetails' type='dropdown'> <option value='ON'>On <option value='OFF'>Off</select> <input type='submit' value='Update' /></form>"; } function do_pdetail_change() { global $db,$userid; $pd=$db->query("SELECT * FROM pdetails WHERE userid=$userid"); $p=$db->fetch_row($pd); $db->query("UPDATE pdetails SET first='{$_POST['fistname']}', last='{$_POST['lastname']}', age='{$_POST['age']}', aog='{$_POST['aog']}', msn='{$_POST['msn']}', aim='{$_POST['aim']}', aol='{$_POST['aol']}', yahoo='{$_POST['yahoo']}', personal='{$_POST['pdetails']}' WHERE userid=$userid"); echo "Personal Details Changed!"; } } $h->endpage(); ?> Quote
Lithium Posted August 7, 2009 Posted August 7, 2009 Re: preference problem <?php include "globals.php"; switch($_GET['action']) { case 'sexchange2': do_sex_change(); break; case 'sexchange': conf_sex_change(); break; case 'passchange2': do_pass_change(); break; case 'passchange': pass_change(); break; case 'namechange2': do_name_change(); break; case 'namechange': name_change(); break; case 'picchange2': do_pic_change(); break; case 'picchange': pic_change(); break; case 'newpropic': new_propic(); break; case 'newpropic2': do_new_propic(); break ; case 'smchange2': do_sm_change(); break; case 'smchange': sm_change(); break; case 'forumchange2': do_forum_change(); break; case 'forumchange': forum_change(); break; case 'pdetailchange2': do_pdetail_change(); break; case 'pdetailchange': pdetail_change(); break; default: prefs_home(); break; } function prefs_home() { global $db,$ir,$c,$userid,$h; print "<h3>Preferences</h3> [url='preferences.php?action=sexchange']Sex Change[/url] [url='preferences.php?action=passchange']Password Change[/url] [url='preferences.php?action=namechange']Name Change[/url] [url='preferences.php?action=picchange']Display Pic Change[/url] [url='preferences.php?action=smchange']Status Message Change[/url] [url='preferences.php?action=newpropic']Profile Pic Change[/url] [url='preferences.php?action=forumchange']Forum Info Change[/url] [url='preferences.php?action=pdetailchange']Personal Detail Change[/url] "; } function conf_sex_change() { global $ir,$c,$userid,$h; if($ir['gender'] == "Male") { $g="Female"; } else { $g="Male"; } print "Are you sure you want to become a $g? [url='preferences.php?action=sexchange2']Yes[/url] | [url='preferences.php']No[/url]"; } function do_sex_change() { global $db,$ir,$c,$userid,$h; if($ir['gender'] == "Male") { $g="Female"; } else { $g="Male"; } $db->query("UPDATE users SET gender='$g' WHERE userid=$userid"); print "Success, you are now $g! [url='preferences.php']Back[/url]"; } function pass_change() { global $ir,$c,$userid,$h; print "<h3>Password Change</h3><form action='preferences.php?action=passchange2' method='post'>Current Password: <input type='password' name='oldpw' /> New Password: <input type='password' name='newpw' /> Confirm: <input type='password' name='newpw2' /> <input type='submit' value='Change PW' /></form>"; } function do_pass_change() { global $db,$ir,$c,$userid,$h; if(md5($_POST['oldpw']) != $ir['userpass']) { print "The current password you entered was wrong. [url='preferences.php?action=passchange']> Back[/url]"; } else if($_POST['newpw'] !== $_POST['newpw2']) { print "The new passwords you entered did not match! [url='preferences.php?action=passchange']> Back[/url]"; } else { $db->query("UPDATE users SET userpass=md5('{$_POST['newpw']}') WHERE userid=$userid"); print "Password changed!"; } } function name_change() { global $ir,$c,$userid,$h; print "<h3>Name Change</h3> Please note that you still use the same name to login, this procedure simply changes the name that is displayed. <form action='preferences.php?action=namechange2' method='post'> New Name: <input type='text' name='newname' /> <input type='submit' value='Change Name' /></form>"; } function do_name_change() { global $db,$ir,$c,$userid,$h; // Edited by zero-affect if($_POST['newname'] == "" || $_POST['newname'] == " " || $_POST['newname'] == " " || $_POST['newname'] == " " || $_POST['newname'] == " " || $_POST['newname'] == " " || $_POST['newname'] == " " || $_POST['newname'] == " " || $_POST['newname'] == " " || $_POST['newname'] == " " || $_POST['newname'] == " " || $_POST['newname'] == " " || $_POST['newname'] == " " || $_POST['newname'] == " " || $_POST['newname'] == " " && $_POST['newname'] == " ") { $_POST['newname'] = trim($_POST['newname']); $i = mysql_query("SELECT * FROM users WHERE username='{$_POST['username']}'") or die(mysql_error()); if(mysql_num_rows($i)) { echo 'Username already in use!';$h->endpage(); exit; } print "You did not enter a new name. [url='preferences.php?action=name_change']> Back[/url]"; } else { $_POST['newname'] = trim($_POST['newname']); $_POST['newname']=str_replace(array("<", ">", "\\\'"), array("<", ">", "'"), $_POST['newname']); $_POST['newname']=str_replace(array("{", "}", "\\\'"), array("<", ">", "'"), $_POST['newname']); $_POST['newname']=str_replace(array("eval", "alert", "\\\'"), array(".", ".", "."), $_POST['newname']); $checkun=$db->num_rows($db->query("SELECT * FROM users WHERE username='{$_POST['newname']}' AND userid!=$userid")); if($checkun) { echo "Username is already in use."; $h->endpage(); exit; } $checkln=$db->num_rows($db->query("SELECT * FROM users WHERE login_name='{$_POST['newname']}' AND userid!=$userid")); if($checkln) { echo "Username is already in use."; $h->endpage(); exit; } $db->query("UPDATE users SET username='{$_POST['newname']}' WHERE userid=$userid"); print "Username changed!"; } } function pic_change() { global $ir,$c,$userid,$h; print "<h3>Pic Change</h3> Please note that this must be externally hosted, [url='http://imageshack.us']ImageShack[/url] is our recommendation. Any images that are not 150x150 will be automatically resized <form action='preferences.php?action=picchange2' method='post'> New Pic: <input type='text' name='newpic' value='{$ir['display_pic']}' /> <input type='submit' value='Change Name' /></form>"; } function do_pic_change() { global $db,$ir,$c,$userid,$h; if($_POST['newpic'] == "") { print "You did not enter a new pic. [url='preferences.php?action=picchange']> Back[/url]"; } else { $_POST['newpic']=str_replace('\\\'',''', $_POST['newpic']); $db->query("UPDATE users SET display_pic='{$_POST['newpic']}' WHERE userid=$userid"); print "Pic changed!"; } } function new_propic() { global $ir,$c,$userid,$h; print "<h3>Pic Change</h3> Please note that this must be externally hosted, [url='http://imageshack.us']ImageShack[/url] is our recommendation. Any images that are not 150x150 will be automatically resized <form action='preferences.php?action=newpropic2' method='post'> New Pic: <input type='text' name='newpic1' value='{$ir['profile_pic']}' /> <input type='submit' value='Change profile pic' /></form>"; } function do_new_propic() { global $db,$ir,$c,$userid,$h; if($_POST['newpic1'] == "") { print "You did not enter a new pic. [url='preferences.php?action=newpropic']> Back[/url]"; } else { $_POST['newpic1']=str_replace('\\\'',''', $_POST['newpic']); $db->query("UPDATE users SET profile_pic='{$_POST['newpic1']}' WHERE userid=$userid"); print "Pic changed!"; } } function forum_change() { global $ir,$c,$userid,$h; print "<h3>Forum Info Change</h3> Please note that the avatar must be externally hosted, [url='http://imageshack.us']ImageShack[/url] is our recommendation. Any avatars that are not 100x100 will be automatically resized <form action='preferences.php?action=forumchange2' method='post'> <table style='border-style:solid;border-width:1px;border-color:#303030;' cellpadding='5'> <tr> <td bgcolor='#606060'>Avatar:</td> <td bgcolor='#404040'><input type='text' name='forums_avatar' value='{$ir['forums_avatar']}' /></td> </tr> <tr> <td bgcolor='#606060'>Signature (you may use BBcode):</td> <td bgcolor='#404040'><textarea rows=10 cols=50 name='forums_signature'>{$ir['forums_signature']}</textarea></td> </tr> <tr colspan='2' bgcolor='#404040'> <td colspan='2'> <input type='submit' value='Change Info' /></td> </tr> </table></form>"; } function do_forum_change() { global $db,$ir,$c,$userid,$h; $url=$_POST['forums_avatar']; if(substr($url, -1)!="g" && substr($url, -1)!="G" && substr($url, -1)!="F" && substr($url, -1)!="f") { print"You need to supply a real image. [url='preferences.php?action=forumchange']> Back[/url]"; include"int2.php"; die(""); } if (preg_match("/.jpg/", $url) || preg_match("/.php/", $url)) { } else if(preg_match("/.jpeg/", $url) || preg_match("/.php/", $url)) { } else if(preg_match("/.gif/", $url) || preg_match("/.php/", $url)) { } else if(preg_match("/.JPG/", $url) || preg_match("/.php/", $url)) { } else if(preg_match("/.JPEG/", $url) || preg_match("/.php/", $url)) { } else if(preg_match("/.GIF/", $url) || preg_match("/.php/", $url)) { } else if(preg_match("/.PNG/", $url) || preg_match("/.php/", $url)) { } else if(preg_match("/.png/", $url) || preg_match("/.php/", $url)) { } else { print"You need to supply a real image. [url='preferences.php?action=forumchange']> Back[/url]"; include"int2.php"; die(""); } $_POST['forums_avatar']=mysql_real_escape_string($_POST['forums_avatar']); $_POST['forums_signature']=mysql_real_escape_string($_POST['forums_signature']); mysql_query("UPDATE users SET forums_avatar='{$_POST['forums_avatar']}', forums_signature='{$_POST['forums_signature']}' WHERE userid=$userid"); print "Forum Info changed!"; } function sm_change() { global $ir,$c,$userid,$h; print "<h3>Status Message Change Change</h3> Here, you can change your status message that will be shown on your profile. <form action='preferences.php?action=smchange2' method='post'> Status Message: <input type='text' name='sm' /> <input type='submit' value='Change Status Message' /></form>"; } function do_sm_change() { global $db,$ir,$c,$userid,$h; if($_POST['sm'] == "") { print "You did not enter a new status message. [url='preferences.php?action=smchange']> Back[/url]"; } else { $_POST['sm']=str_replace(array("<", ">", "\\\'"), array("<", ">", "'"), $_POST['sm']); $db->query("UPDATE users SET sm='{$_POST['sm']}' WHERE userid=$userid"); print "Status Message Changed!"; } } function pdetail_change() { global $db,$userid; echo "<h3>Personal Details Change</h3>"; $pd=$db->query("SELECT * FROM pdetails WHERE userid=$userid"); $p=$db->fetch_row($pd); echo "<form action='preferences.php?action=pdetailchange2' method='post'> First Name: <input type='text' name='fistname' value='{$p['first']}' /> Last Name: <input type='text' name='lastname' value='{$p['last']}' /> Age: <input type='text' name='age' value='{$p['age']}' /> Aim Of The Game: <input type='text' name='aog' value='{$p['aog']}' /> Msn: <input type='text' name='msn' value='{$p['msn']}' /> Aim: <input type='text' name='aim' value='{$p['aim']}' /> Aol: <input type='text' name='aol' value='{$p['aol']}' /> Yahoo: <input type='text' name='yahoo' value='{$p['yahoo']}' /> Personal Details: <select name='pdetails' type='dropdown'> <option value='ON'>On <option value='OFF'>Off</select> <input type='submit' value='Update' /></form>"; } function do_pdetail_change() { global $db,$userid; $pd=$db->query("SELECT * FROM pdetails WHERE userid=$userid"); $p=$db->fetch_row($pd); $db->query("UPDATE pdetails SET first='{$_POST['fistname']}', last='{$_POST['lastname']}', age='{$_POST['age']}', aog='{$_POST['aog']}', msn='{$_POST['msn']}', aim='{$_POST['aim']}', aol='{$_POST['aol']}', yahoo='{$_POST['yahoo']}', personal='{$_POST['pdetails']}' WHERE userid=$userid"); echo "Personal Details Changed!"; } $h->endpage(); ?> Quote
Strats Posted August 7, 2009 Author Posted August 7, 2009 Re: preference problem Ok that fixed it thanks. I still have a problem with the pic tho not sure if it's something to do with the profile now. I think it is this : function display($user) { $useric = ($user['profile_pic']) ? sprintf("[img=%s]", $user['profile_pic']) : "[img=Dpic.jpg]"; echo sprintf("<center>%s</center>", $useric); } Quote
Lithium Posted August 7, 2009 Posted August 7, 2009 Re: preference problem as for the code shown... there is no problem... what is the problem with it? Quote
Strats Posted August 7, 2009 Author Posted August 7, 2009 Re: preference problem The picture never shows on the profile. Here is the file maybe there's a problem somewhere else in it. <?php /******************************************************* -- Created By Magictallguy -- Copyright to Magictallguy -- For Free -- -- TERMS AND CONDITIONS -- The name "Magictallguy" must stay on the copyright notice. -- Removal of this copyright notice is not allowed. -- Alterations of this script are allowed, and encouraged, as long as the name "Magictallguy" stays on the copyright notice. -- If you do not agree with the terms and conditions, and you still use the file anyway, legal action will be taken - Ignorance is not an excuse! -- -- By using this script, you agree to the terms and conditions stated above. -- ------------------------------------------------------------------------ -- If you don't understand it, leave it alone. -- If you need help with this script and/or all/any parts connected with this script (profile.php), contact Magictallguy [email][email protected][/email] -- -- Copyright (c) 2009, Magictallguy -- Based on a v2 source -- If you don't understand it, leave it alone *******************************************************/ include(DIRNAME(__FILE__) . '/bbcode_parser.php'); include(DIRNAME(__FILE__) . '/globals.php'); global $db, $ir; $_GET['user'] = abs(@intval($_GET['user'])); $_GET['user'] = ($_GET['user']) ? $_GET['user'] : $userid; $sql = sprintf( "SELECT u.*, us.*, c.*, h.*, g.*, f.* " . "FROM users u " . "LEFT JOIN userstats us ON (u.userid = us.userid) " . "LEFT JOIN cities c ON (u.location = c.cityid) " . "LEFT JOIN houses h ON (u.maxwill = h.hWILL) " . "LEFT JOIN gangs g ON (g.gangID = u.gang) " . "LEFT JOIN fedjail f ON (f.fed_userid = u.userid) " . "WHERE (u.userid = %u)", $_GET['user']); $q = $db->query($sql); $user = $db->fetch_row($q); if(!$db->num_rows($q)) { echo "Sorry this ID does not exist."; $h->endpage(); exit; } $ts = ($user['strength'] + $user['agility'] + $user['guard'] + $user['labour'] + $user['IQ']); name($user); $now = time(); echo sprintf("<h2>Profile for %s</h2>", format($user['username'])); if($ir['user_level'] > 1) { echo sprintf("<h3>Login Name: %s</h3>", $user['login_name']); } echo "<table class='table' width='100%' cellspacing='2' border='1'>"; echo "<tr>"; echo "<th width='60%'>User Info</th>"; echo "<th width='40%'>Profile Picture</th>"; echo "</tr>"; echo "<tr>"; echo "<td>"; echo "<table class='table' width='100%'>"; echo "<tr>"; echo "<td style='text-align:center;'>Username</td>"; echo sprintf("<td style='text-align:right;'>%s</td>", name($user)); echo "</tr>"; echo "<tr>"; echo "<td style='text-align:center;'>User Level</td>"; echo sprintf("<td style='text-align:right;'>%s</td>", user_level($user)); echo "</tr>"; echo "<tr>"; echo "<td style='text-align:center;'>Duties</td>"; echo sprintf("<td style='text-align:right;'>%s</td>", show($user['duties'])); echo "</tr>"; echo "<tr>"; echo "<td style='text-align:center;'>Gender</td>"; echo sprintf("<td style='text-align:right;'>%s</td>", $user['gender']); echo "</tr>"; echo "<tr>"; echo "<td style='text-align:center;'>Date Signed Up</td>"; echo sprintf("<td style='text-align:right;'>%s</td>", date("D jS M, Y g:i:s a ", $user['signedup'])); echo "</tr>"; echo "<tr>"; echo "<td style='text-align:center;'>Last Login</td>"; echo sprintf("<td style='text-align:right;'>%s</td>", $user['last_login'] ? sprintf("%s ago", time_format($now - $user['last_login'])) : "Never"); echo "</tr>"; echo "<tr>"; echo "<td style='text-align:center;'>Last Action</td>"; echo sprintf("<td style='text-align:right;'>%s</td>", $user['laston'] ? sprintf("%s ago", time_format($now - $user['laston'])) : "Never"); echo "</tr>"; echo "<tr>"; echo "<td style='text-align:center;'>Online</td>"; echo sprintf("<td style='text-align:right;'>%s</td>", online($user)); echo "</tr>"; echo "<tr>"; echo "<td style='text-align:center;'>Age</td>"; echo sprintf("<td style='text-align:right;'>%s</td>", time_format($now - $user['signedup'])); echo "</tr>"; echo "<tr>"; echo "<td style='text-align:center;'>Status Message</td>"; echo sprintf("<td style='text-align:right;'>%s</td>", $user['sm']); echo "</tr>"; echo "<tr>"; echo "<td style='text-align:center;'>Rating</td>"; echo sprintf("<td style='text-align:right;'>[url='ratings.php?rate=plus&user=%u']<font color=lime>[img=imageicons/accept.png][/url]</font> %s [url='ratings.php?rate=minus&user=%u']<font color=red>[img=imageicons/decline.png]</font>[/url]</td>", $user['userid'], $user['rating'], $user['userid']); echo "</tr>"; /* echo "<tr>"; echo "<td style='text-align:center;'>Marital Status</td>"; echo sprintf("<td style='text-align:right;'>%s</td>", marriage($user)); echo "</tr>"; */ echo "<tr>"; echo "<td style='text-align:center;'>Level</td>"; echo sprintf("<td style='text-align:right;'>%s</td>", format($user['level'])); echo "</tr>"; echo "<tr>"; echo "<td style='text-align:center;'>Property</td>"; echo sprintf("<td style='text-align:right;'>%s</td>", format($user['hNAME'])); echo "</tr>"; echo "<tr>"; echo "<td style='text-align:center;'>Referrals</td>"; echo sprintf("<td style='text-align:right;'>%s</td>", referrals($user)); echo "</tr>"; echo "<tr>"; echo "<td style='text-align:center;'>Friends</td>"; echo sprintf("<td style='text-align:right;'>%s</td>", format($user['friend_count'])); echo "</tr>"; echo "<tr>"; echo "<td style='text-align:center;'>Enemies</td>"; echo sprintf("<td style='text-align:right;'>%s</td>", format($user['enemy_count'])); echo "</tr>"; echo "<tr>"; echo "<td style='text-align:center;'>Money Hacked</td>"; echo sprintf("<td style='text-align:right;'>%s</td>", format($user['money_hacked'])); echo "</tr>"; echo "</table>"; echo "</td>"; echo "<td colspan='50%' class='tdcenter'>"; echo "<table class='table' width='50%'>"; echo "<tr>"; echo sprintf("<td style='text-align:center;'>%s</td>", display($user)); echo "</tr>"; echo "</table>"; echo "</td>"; echo "</tr>"; echo "</table>"; echo "<table class='table' width='100%' border='1'>"; echo "<tr>"; echo sprintf("<td>%s</td>", physical_info($user)); // echo sprintf("<td>%s</td>", personal_info($user)); echo "</tr>"; echo "</table>"; user_links($user); echo "<table class='table' width='100%' border='1'>"; echo "<tr>"; echo "<td>"; status_messages($user); echo "</td>"; echo "</tr>"; echo "</table>"; if($ir['user_level'] > 1) { echo "<table class='table' width='100%' border='1'>"; echo "<tr>"; echo "<td>"; echo "</td>"; echo "</tr>"; echo "</table>"; } echo " "; echo " "; echo " "; // echo "<table class='table' width='100%' border='1' >"; // echo "<tr>"; // echo sprintf("<td>%s</td>", user_signature($user)); // echo "</tr>"; // echo "<tr>"; // echo sprintf("<td>%s</td>", user_comments($user)); // echo "</tr>"; // echo "</table>"; function physical_info($user) { global $ir; $gang = ($user['gang']) ? sprintf("[url='gangs.php?action=view&ID=%u']%s[/url]", $user['gang'], $user['gangNAME']) : "No Gang"; $travel = ($ir['location'] != $user['location']) ? sprintf("[[url='monorail.php?to=%u']Travel[/url]]", $user['cityid']) : ''; echo "<table class='table' width='100%' valign='top'>"; echo "<tr>"; echo "<th colspan='100%'>Physical Info</th>"; echo "</tr>"; echo "<tr>"; echo "<td style='text-align:center;'>Health</td>"; echo sprintf("<td style='text-align:right;'>%s/%s</td>", format($user['hp']), format($user['maxhp'])); echo "</tr>"; echo "<tr>"; echo "<td style='text-align:center;'>Gang</td>"; echo sprintf("<td style='text-align:right;'>%s</td>", format($gang)); echo "</tr>"; echo "<tr>"; echo "<td style='text-align:center;'>Location</td>"; echo sprintf("<td style='text-align:right;'>%s %s</td>", format($user['cityname']), $travel); echo "</tr>"; echo "</table>"; } function personal_info($user) { echo "<table class='table' width='100%' valign='top'>"; echo "<tr>"; echo "<th colspan='100%'>Personal Information</th>"; echo "</tr>"; if($user['personal'] == 'ON') { echo "<tr>"; echo "<td style='text-align:center;'>First Name</td>"; echo sprintf("<td style='text-align:right;'>%s</td>", format($user['first'])); echo "</tr>"; echo "<tr>"; echo "<td style='text-align:center;'>Last Name</td>"; echo sprintf("<td style='text-align:right;'>%s</td>", format($user['last'])); echo "</tr>"; echo "<tr>"; echo "<td style='text-align:center;'>Age</td>"; echo sprintf("<td style='text-align:right;'oi>%s</td>", format($user['age'])); echo "</tr>"; echo "<tr>"; echo "<td style='text-align:center;'>Aim Of The Game</td>"; echo sprintf("<td style='text-align:right;'>%s</td>", format($user['aog'])); echo "</tr>"; echo "<tr>"; echo "<td style='text-align:center;'>MSN</td>"; echo sprintf("<td style='text-align:right;'>%s</td>", format($user['msn'])); echo "</tr>"; echo "<tr>"; echo "<td style='text-align:center;'>AIM</td>"; echo sprintf("<td style='text-align:right;'>%s</td>", format($user['aim'])); echo "</tr>"; echo "<tr>"; echo "<td style='text-align:center;'>AOL</td>"; echo sprintf("<td style='text-align:right;'>%s</td>", format($user['aol'])); echo "</tr>"; echo "<tr>"; echo "<td style='text-align:center;'>Yahoo</td>"; echo sprintf("<td style='text-align:right;'>%s</td>", format($user['yahoo'])); echo "</tr>"; } else { echo "<tr>"; echo "<td colspan='100%'>This person does not wish to share there personal details.</td>"; echo "</tr>"; } echo "</table>"; } function status_messages($user) { $fed_s = ($user['fed_days'] == 1) ? "" : "s"; $hos_s = ($user['hospital'] == 1) ? "" : "s"; $jai_s = ($user['jail'] == 1) ? "" : "s"; echo "<table class='table' width='100%'>"; echo "<tr>"; echo "<th colspan='100%'>Status Messages</th>"; echo "</tr>"; echo "<tr>"; echo "<td style='text-align:center;'>Federal Jail Status</td>"; echo "<td style='text-align:right;'>"; echo ($user['fedjail']) ? sprintf("<span style='color:red;'>In federal jail for %s day%s. %s</span>", format($user['fed_days']), $fed_s, format($user['fed_reason'])) : "<span style='color:green;'>Not in federal jail</span>"; echo "</td>"; echo "</tr>"; echo "<tr>"; echo "<td style='text-align:center;'>Hospital Status</td>"; echo "<td style='text-align:right;'>"; echo ($user['hospital']) ? sprintf("<span style='color:red'>In hospital for %s minute%s. %s</span>", format($user['hospital']), $hos_s, format($user['hospreason'])) : "<span style='color:green;'>Not in hospital</span>"; echo "</td>"; echo "</tr>"; echo "<tr>"; echo "<td style='text-align:center;'>Jail Status</td>"; echo "<td style='text-align:right;'>"; echo ($user['jail']) ? sprintf("<span style='color:red;'>In jail for %s minute%s. %s</span>", format($user['jail']), $jai_s, format($user['jail_reason'])) : "<span style='color:green;'>Not in jail</span>"; echo "</td>"; echo "</tr>"; echo "</table>"; } function user_links($user) { global $ir, $set, $userid; echo "<table class='table' width='100%' border='1'>"; echo "<tr>"; echo "<th colspan='100%'>Links</th>"; echo "</tr>"; echo "</td>"; echo "</tr>"; echo "<tr style='text-align:center;'>"; echo "<th>View</th>"; echo "<td>"; echo sprintf("[url='userlistings.php?user=%u']Market Listings[/url], ", $user['userid']); echo sprintf("[url='blogs.php?action=userblog&ID=%u']Blog[/url], ", $user['userid']); { echo sprintf("[url='gallery.php?function=viewgallery&ID=%u']Gallery[/url]", $user['userid']); } // else { echo "<span style='color:#555;'>Gallery</span>"; } echo "</td>"; echo "</tr>"; echo "<tr style='text-align:center;'>"; echo "<th>Add To</th>"; echo "<td>"; if($user['userid'] != $userid) { echo sprintf("[url='contactlist.php?action=add&ID=%u']Contacts[/url]", $user['userid']); } else { echo "<span style='color:#555;'>Contacts</span>"; } if($ir['donatordays'] && $user['userid'] != $userid) { echo sprintf(", [url='friendslist.php?action=add&ID=%u']Friends[/url]", $user['userid']); echo sprintf(", [url='blacklist.php?action=add&ID=%u']Enemies[/url]", $user['userid']); } else { echo ", <span style='color:#555;'>Friends</span>"; echo ", <span style='color:#555;'>Enemies</span>"; } echo "</td>"; echo "</tr>"; echo "<tr style='text-align:center;'>"; echo "<th>Actions</th>"; echo "<td>"; if($user['userid'] != $userid && !$user['hospital'] && !$user['jail']) { echo sprintf("[url='attack.php?ID=%u']Attack[/url]", $user['userid']); } else { echo "<span style='color:#555;'>Attack</span>"; } /* if($user['userid'] != $userid) { echo sprintf(", [url='nudge.php?ID=%u']Nudge[/url]", $user['userid']); echo sprintf(", [url='trade.php?ID=%u']Trade[/url]", $user['userid']); echo sprintf(", [url='driveby.php?ID=%u']Drive By[/url]", $user['userid']); echo sprintf(", [url='hitandrun.php?ID=%u']Hit and Run[/url]", $user['userid']); echo sprintf(", [url='assassin.php?ID=%u']Assassinate[/url]", $user['userid']); } else { echo ", <span style='color:#555;'>Nudge</span>"; echo ", <span style='color:#555;'>Trade</span>"; echo ", <span style='color:#555;'>Drive By</span>"; echo ", <span style='color:#555;'>Hit and Run</span>"; echo ", <span style='color:#555;'>Assassinate</span>"; } */ echo "</td>"; echo "</tr>"; if($ir['user_level'] > 1) { echo "<tr style='text-align:center;'>"; echo "<th>Staff Actions</th>"; echo "<td>"; echo sprintf("[url='bans.php?from=federal&userid=%u']Fed Jail[/url]", $user['userid']); echo sprintf(", [url='bans.php?from=mail&userid=%u']Mail Ban[/url]", $user['userid']); echo sprintf(", [url='bans.php?from=forum&userid=%u']Forum Ban[/url]", $user['userid']); echo sprintf(", [url='bans.php?from=beg&userid=%u']Beg Ban[/url]", $user['userid']); echo "</td>"; echo "</tr>"; } echo "</table>"; } function user_signature($user) { global $db, $bbc; echo "<table class='table' width='100%'>"; echo "<tr>"; echo "<th>Profile Signature</th>"; echo "<tr>"; echo "<td style='text-align:left;'>"; $sig = stripslashes($bbc->bbcode_parse($user['signature'])); $signature = ($user['signature']) ? sprintf("%s", $sig) : sprintf("%s doesn't have a profile signature", $user['username']); echo sprintf("%s", $signature); echo "</td>"; echo "</tr>"; echo "</table>"; } function user_comments($user) { global $db, $bbc; echo "<table class='table' width='100%'>"; echo "<tr>"; echo sprintf("<th>User Comments - [url='comments.php?userid=%u']Add a comment[/url]</th>", $user['userid']); echo "</tr> <tr> <td colspan='100%'> <table width='100%' class='table' border='1'> <tr> <th>Time</th> <th>By</th> <th>Comment</th> </tr>"; $sql = sprintf("SELECT * FROM ucomments WHERE (userto = %u) ORDER BY time DESC", $user['userid']); $q = $db->query($sql); if(!$db->num_rows($q)) { echo "<tr> <td colspan='100%' class='tdcenter'>No comments for this user</td> </tr>"; } $i = 1; while($y = $db->fetch_row($q)) { $sql = sprintf("SELECT userid, username FROM users WHERE (userid = %u)", $y['userfrom']); $g = $db->query($sql); $s = $db->fetch_row($g); echo sprintf("<tr class='row%u'>", $i & 1); $i++; echo sprintf("<td width='30%%'>%s</td>", date("j/M/y, Y g:i:s a ",$y['time'])); echo sprintf("<td width='20%%'>[url='profile.php?user=%u']%s[/url] [%s]</td>", $s['userid'], $s['username'], format($s['userid'])); echo sprintf("<td>%s</td>", stripslashes($bbc->bbcode_parse($y['message']))); echo "</tr>"; } echo "</td>"; echo "</tr>"; echo "</table>"; echo "</td>"; echo "</tr>"; echo "</table>"; } function display($user) { $useric = ($user['profile_pic']) ? sprintf("[img=%s]", $user['profile_pic']) : "[img=Dpic.jpg]"; echo sprintf("<center>%s</center>", $useric); } function marriage($user) { global $db; if(!$user['married']) { $marital = "<span style='color:#555;'>Single</span>"; } else { $s = $db->fetch_single($db->query(sprintf("SELECT username FROM users WHERE (userid = %u)", $user['married']))); $marital = sprintf("[url='profile.php?user=%u']%s[/url]", $user['married'], $s); } return $marital; } function online($user) { $now = time(); $online = ($user['laston'] > $now - 900) ? "<span style='color:green;'>Online</span>" : "<span style='color:red;'>Offline</span>"; return $online; } function user_level($user) { switch($user['user_level']) { case 0: return "NPC"; case 1: return "Member"; case 2: return "Administrator"; case 3: return "Secretary"; case 4: return "IRC Op"; case 5: return "Assistant"; } return "Unknown"; } function name($user) { $name = format($user['username']); if ($user['user_level'] == 2) { $name = sprintf("<span style='color:#1B3F8B;'>%s</span>", $name); }//Administrator else if ($user['user_level'] == 3) { $name = sprintf("<span style='color:#6600FF;'>%s</span>", $name); } //Secretary else if ($user['user_level'] == 4) { $name = sprintf("<span style='color:#615E3F;'>%s</span>", $name); }//IRC Op else if ($user['user_level'] == 5) { $name = sprintf("<span style='color:#385E0F;'>%s</span>", $name); }//Assistant else if ($user['donatordays']) { $name = sprintf("<span style='color:#FF0000;'>%s</span>", $name); } //Obviously donator! if($user['donatordays']) { $name .= sprintf(" [img=donator.gif]", format($user['donatordays']), format($user['donatordays'])); } return $name; } function staff_notepad($user) { echo "<form action='staffnotes.php' method='post'>"; echo sprintf("<input type='hidden' name='ID' value='%u' />", $user['userid']); echo sprintf("<textarea rows='7' style='width:99%%;border:solid 1px #555;' name='staffnotes' class='spell_check'>%s</textarea>", strip_tags(format($user['staffnotes']))); echo " "; echo "<input type='submit' value='Update' style='margin-top:0.3em;' />"; echo "</form>"; } function referrals($user) { global $db; $userefsql = sprintf("SELECT COUNT(refREFER) FROM referals WHERE (refREFER = %u)", $user['userid']); $userr = $db->query($userefsql); $userefs = $db->fetch_single($userr); $userefs = format($userefs); return $userefs; } $h->endpage(); ?> Quote
Strats Posted August 7, 2009 Author Posted August 7, 2009 Re: preference problem Fixed it :) And I spotted the mistake myself this time lol Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.