Re: [mccode] Profile Signatures
For the sig mod to work u need to end the prefences.php file with
}
}
?>
here's what i have got.
<?php
session_start();
require "global_func.php";
if($_SESSION['loggedin']==0) { header("Location: login.php");exit; }
$userid=$_SESSION['userid'];
require "header.php";
$h = new headers;
$h->startheaders();
include "mysql.php";
global $c;
$is=mysql_query("SELECT u.*,us.* FROM users u LEFT JOIN userstats us ON u.userid=us.userid WHERE u.userid=$userid",$c) or die(mysql_error());
$ir=mysql_fetch_array($is);
check_level();
$fm=money_formatter($ir['money']);
$cm=money_formatter($ir['crystals'],'');
$lv=date('F j, Y, g:i a',$ir['laston']);
$h->userdata($ir,$lv,$fm,$cm);
$h->menuarea();
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 'signature2': do_signature_change(); break;
case 'signature': signature_change(); break;
case 'status': stat_us(); break;
case 'statussub': stat_us_sub(); break;
default: prefs_home(); break;
}
function prefs_home()
{
global $ir,$c,$userid,$h;
print "<h3>Preferences</h3>
[url='preferences.php?action=namechange']Name Change[/url]
[url='preferences.php?action=signaturechange']Profile Signature[/url]
[url='preferences.php?action=status']Change Status[/url]
[url='preferences.php?action=sexchange']Sex Change[/url]
[url='preferences.php?action=passchange']Password Change[/url]
[url='preferences.php?action=picchange']Display Pic Change[/url]
";
}
function stat_us()
{
global $ir,$c,$userid,$h;
print "<h3>Set Current Status</h3>
<form action='preferences.php?action=statussub' method='post'>
<select name='status' type='dropdown'>
<option value='Active'>Active
<option value='Bored'>Bored
<option value='Coding'>Coding
<option value='Making you gits happy!'>Making you gits happy!
<option value='Busy'>Busy
<option value='Away'>Away
<option value='Be Right Back'>Be Right Back
<option value='In Bed'>In Bed
<option value='On Holiday'>On Holiday
<option value='On Phone'>On Phone
<option value='Having A Wank'>Having A Wank
<option value='Helping Magic Having A Wank'>Helping Magic
<option value='Having Sex'>Having Sex
<option value='Offline'>Going Offline
<option value='Smoking'>Smoking
<option value='Sitting In The Corner Staring At Everyone'>Sitting In The Corner Staring At Everyone O_O
<option value='Getting Married'>Getting Married
<option value='Quit'>Quit</select>
<input type='submit' value='Change Status' /></form>";
}
function stat_us_sub()
{
global $db,$ir,$c,$userid,$h;
$_POST['status']=str_replace(array("<", ">", "\\\'"), array("<", ">", "'"), $_POST['status']);
mysql_query("UPDATE users SET status='{$_POST['status']}' WHERE userid=$userid");
print "Status changed and saved!";
}
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 $ir,$c,$userid,$h;
if($ir['gender'] == "Male") { $g="Female"; } else { $g="Male"; }
mysql_query("UPDATE users SET gender='$g' WHERE userid=$userid",$c);
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 $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
{
mysql_query("UPDATE users SET userpass=md5('{$_POST['newpw']}') WHERE userid=$userid",$c);
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 $ir,$c,$userid,$h;
if($_POST['newname'] == "")
{
print "You did not enter a new name.
[url='preferences.php?action=namechange']> Back[/url]";
}
else
{
$_POST['newname']=str_replace(array("<", ">", "\\\'"), array("<", ">", "'"), $_POST['newname']);
mysql_query("UPDATE users SET username='{$_POST['newname']}' WHERE userid=$userid",$c);
print "Username changed!";
}
}
function signature_change()
{
global $ir,$c,$userid,$h;
print "<h3>Profile Signature Change</h3>
<form action='preferences.php?action=signature2' method='post'>
New Profile Signature:
<textarea rows=7 cols=40 name='newsignature'>{$ir['signature']}</textarea>
<input type='submit' value='Change Profile Signature' /></form>
[b]Current Profile Signature :[/b]{$r['signature']}";
}
function do_signature_change()
{
global $ir,$c,$userid,$h;
if($_POST['newsignature'] == "")
{
print "You did not enter a new signature.
> [url='preferences.php?action=signature']Back[/url]";
}
else
{
mysql_query("UPDATE users SET signature='{$_POST['newsignature']}' WHERE userid=$userid",$c);
print "Profile Signature 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 $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']);
mysql_query("UPDATE users SET display_pic='{$_POST['newpic']}' WHERE userid=$userid",$c);
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'>
Avatar: <input type='text' name='forums_avatar' value='{$ir['forums_avatar']}' />
Signature (you may use BBcode): <textarea rows=10 cols=50 name='forums_signature'>{$ir['forums_signature']}</textarea>
<input type='submit' value='Change Info' /></form>";
}
function do_forum_change()
{
global $db,$ir,$c,$userid,$h;
$_POST['forums_avatar']=str_replace(array("<", ">"), array("<", ">"), $_POST['forums_avatar']);
mysql_query("UPDATE users SET forums_avatar='{$_POST['forums_avatar']}', forums_signature='{$_POST['forums_signature']}' WHERE userid=$userid");
print "Forum Info changed!";
}
$h->endpage();
}
}
?>
Please note this is for V1 this pref
Also while ur here try, www.silver-assassins.com :P
(Added code tags)