Jump to content
MakeWebGames

Query error


Colonel

Recommended Posts

Re: Query error

Here is most of the preferences.php file without the flags part listed. Is there something i am missing??

 

<?php
class bbcode {
var $engine="";
function bbcode()
{
require "bbcode_engine.php";
$this->engine= new bbcode_engine;
$this->engine->cust_tag("/</","<");
$this->engine->cust_tag("/>/",">");
//Since \n and 
screw up preg, convert them out.
$this->engine->cust_tag("/\n/","&nbrlb;");
$this->engine->simple_bbcode_tag("b");
$this->engine->simple_bbcode_tag("i");  
$this->engine->simple_bbcode_tag("u");  
$this->engine->simple_bbcode_tag("s");
$this->engine->simple_bbcode_tag("sub");  
$this->engine->simple_bbcode_tag("sup");
$this->engine->simple_bbcode_tag("big");
$this->engine->simple_bbcode_tag("small"); 
$this->engine->adv_bbcode_tag("list","ul");
$this->engine->adv_bbcode_tag("olist","ol");
$this->engine->adv_bbcode_tag("item","li");
$this->engine->adv_option_tag("font","font","family");
$this->engine->adv_option_tag("size","font","size"); 
$this->engine->adv_option_tag("url","a","href");
$this->engine->adv_option_tag("color","font","color");
$this->engine->adv_option_tag("style","span","style");
$this->engine->simp_option_notext("img","src");
$this->engine->simp_bbcode_att("img","src");
$this->engine->cust_tag("/\(c\)/","©");
$this->engine->cust_tag("/\(tm\)/","?");
$this->engine->cust_tag("/\(r\)/","®");
$this->engine->adv_option_tag_em("email","a","href");
$this->engine->adv_bbcode_att_em("email","a","href");

$this->engine->cust_tag("/\[left\](.+?)\[\/left\]/","<div align='left'>\\1</div>");
$this->engine->cust_tag("/\[center\](.+?)\[\/center\]/","<div align='center'>\\1</div>");
$this->engine->cust_tag("/\[right\](.+?)\[\/right\]/","<div align='right'>\\1</div>");
$this->engine->cust_tag("/\[quote="(.+?)\"](.+?)\[\/quote\]/","<div class='quotetop'>QUOTE(\\1)</div><div class='quotemain'>\\2</div>");
$this->engine->cust_tag("/\[quote\](.+?)\[\/quote\]/","<div class='quotetop'>QUOTE</div><div class='quotemain'>\\1</div>");
$this->engine->cust_tag("/\[code\](.+?)\[\/code\]/","<div class='codetop'>CODE</div><div class='codemain'><code>\\1</code></div>");
$this->engine->cust_tag("/\[codebox\](.+?)\[\/codebox\]/","<div class='codetop'>CODE</div><div class='codemain' style='height:200px;white-space:pre;overflow:auto'>\\1</div>");
$this->engine->cust_tag("/&nbrlb;/","
\n"); 
}
function bbcode_parse($html)
{
return $this->engine->parse_bbcode($html);
}

}
function strip_html_tags($text)
{
return preg_replace("/<(.+?)>/is","", $text);
}
require "globals.php";
$bbc = new bbcode;

switch($_GET['action'])
{
case 'changeflag':
flag_change();
break;

case 'submitflag':
flag_submit();
break;

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 'infochange2':
do_info_change();
break;

case 'infochange':
info_change();
break;

case 'picchange2':
do_pic_change();
break;

case 'picchange':
pic_change();
break;

case 'forumchange2':
do_forum_change();
break;

case 'forumchange':
forum_change();
break;

case 'sigchange':
sig_change();
break;

case 'sigchange2':
do_sig_change();
break;

default:
prefs_home();
break;
}


function prefs_home()
{
global $db,$ir,$c,$userid,$h;
print "


<h2>Preferences</h2>


<table width='100%' style='border: 1px solid #666;' cellspacing='0' class='ce_hover'>
<tr>
<th colspan='3' style='border-bottom: 1px dashed #666; padding-left: 15px;'><span style='font-weight: bold; font-size: 15pt;'>Character/Profile Preferences</span></th>
</tr>
<tr>
<td width='33%' style='height: 30px; text-align: center; border-right: 1px dashed #666666; border-bottom: 1px dashed #666666;' valign='top' onMouseOver = 'this.style.backgroundColor = '#333333'' onMouseOut = 'this.style.backgroundColor = '#000000''>
[url='preferences.php?action=sexchange']Sex Change[/url]

Toggles between Male and Female.</td>
<td width='33%' style='height: 30px; text-align: center; border-right: 1px dashed #666; border-bottom: 1px dashed #666;' valign='top' onMouseOver = 'this.style.backgroundColor = '#333'' onMouseOut = 'this.style.backgroundColor = '#000''>[url='preferences.php?action=passchange']Password Change[/url]

Changes your password.</td>
<td width='33%' style='height: 30px; text-align: center; border-right: 1px dashed #666; border-bottom: 1px dashed #666;' valign='top' onMouseOver = 'this.style.backgroundColor = '#333'' onMouseOut = 'this.style.backgroundColor = '#000''>[url='preferences.php?action=namechange']Name Change[/url]

Changes your [i]displayed[/i] name.</td>
</tr>
<tr>
<td style='height: 30px; text-align: center; border-right: 1px dashed #666; border-bottom: 1px dashed #666;' valign='top' onMouseOver = 'this.style.backgroundColor = '#333'' onMouseOut = 'this.style.backgroundColor = '#000''>[url='preferences.php?action=picchange']Display Pic Change[/url]

Changes your display picture on your profile.</td>
<td style='height: 30px; text-align: center; border-right: 1px dashed #666; border-bottom: 1px dashed #666;' valign='top' onMouseOver = 'this.style.backgroundColor = '#333'' onMouseOut = 'this.style.backgroundColor = '#000''>[url='preferences.php?action=changeflag']Change your counry[/url]

Changes your country flag on your profle.</td>
<td style='height: 30px; text-align: center; border-right: 1px dashed #666; border-bottom: 1px dashed #666;' valign='top' onMouseOver = 'this.style.backgroundColor = '#333'' onMouseOut = 'this.style.backgroundColor = '#000''>[url='preferences.php?action=sigchange']Profie Signature[/url]

Changes Your profile signature.</td>
</tr>
<tr>
<td style='height: 30px; text-align: center; border-right: 1px dashed #666; border-bottom: 1px dashed #666;' valign='top' onMouseOver = 'this.style.backgroundColor = '#333'' onMouseOut = 'this.style.backgroundColor = '#000''>[url='preferences.php?action=infochange']Personal Informaton[/url]

Change your personal information on your profile.</td>
<td style='height: 30px; text-align: center; border-right: 1px dashed #666; border-bottom: 1px dashed #666;' valign='top' onMouseOver = 'this.style.backgroundColor = '#333'' onMouseOut = 'this.style.backgroundColor = '#000''>[url='preferences.php?action=blogs.php']Blog[/url]

Edit your blog.</td>
<td style='height: 30px; text-align: center; border-right: 1px dashed #666; border-bottom: 1px dashed #666;' valign='top' onMouseOver = 'this.style.backgroundColor = '#333'' onMouseOut = 'this.style.backgroundColor = '#000''>[url='viewuser.php?u={$ir[']Go To Your Profile![/url]

Takes you to your personal profile.</td>
</tr>
</table></center></center></div>
</div>
</div>
</div>
</div>";
}
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;
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']);
$db->query("UPDATE users SET username='{$_POST['newname']}' WHERE userid=$userid");
print "Username changed! [url='preferences.php']>Back[/url]";
}
}
function info_change()
{
global $ir,$c,$userid,$h;
print "<h3>Personal Information Change</h3>You will need to fill in all boxes or it will delete what was there
<form action=preferences.php?action=infochange2 method=post>Real Name:
<input type='text' name='pro_name'>


Country:
<input type=text name=pro_country>


Age:
<input type=text name=pro_age>


E-Mail:
<input type=text name=pro_email>

You an choose if you want your info to be shown or not

Show -<input type='radio' name='infoshow' value='0'>
<input type='radio' name='infoshow' value='1'>- Hide


<input type=submit value=Submit></form>

";
}
function do_info_change()
{
global $db,$ir,$c,$userid,$h;
$_POST['pro_name']=str_replace(array("<", ">", "\\\'"), array("<", ">", "'"), $_POST['pro_name']);
$db->query("UPDATE users SET pro_name='{$_POST['pro_name']}' WHERE userid=$userid");
$db->query("UPDATE users SET pro_country='{$_POST['pro_country']}' WHERE userid=$userid");
$db->query("UPDATE users SET pro_age='{$_POST['pro_age']}' WHERE userid=$userid");
$db->query("UPDATE users SET pro_email='{$_POST['pro_email']}' WHERE userid=$userid");
$db->query("UPDATE users SET infoshow='{$_POST['infoshow']}' WHERE userid=$userid");
print "Details changed!
[url='preferences.php']>Back[/url]";

}
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']>Back[/url]";
}
else
{
$_POST['newpic']=str_replace('\\\'',''', $_POST['newpic']);
$db->query("UPDATE users SET display_pic='{$_POST['newpic']}' WHERE userid=$userid");
print "Pic changed! [url='preferences.php']>Back[/url]";
}
}
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']);
$db->query("UPDATE users SET forums_avatar='{$_POST['forums_avatar']}', forums_signature='{$_POST['forums_signature']}' WHERE userid=$userid");
print "Forum Info changed! [url='preferences.php']>Back[/url]";
}
function sig_change()
{
global $ir,$c,$userid,$h;
print "<h3>Profile Signature Change</h3>
Profile sig goes here. *note* big signatures look poo.
'less is more' No BBcode yet. sorry :(<form action='preferences.php?action=sigchange2' method='post'><textarea rows=10 cols=80 name='pro_sig'>
".htmlspecialchars($ir['pro_sig'])."</textarea>

<input type='submit' value='Change Info' /></form>";
}
function do_sig_change()
{
global $db,$ir,$c,$userid,$h;
$_POST['pro_sig']=str_replace(array("<", ">"), array("<", ">"), $_POST['pro_sig']);
$db->query("UPDATE users SET pro_sig='{$_POST['pro_sig']}', pro_sig='{$_POST['pro_sig']}' WHERE userid=$userid");
print "Profile signature changed! 
[url='preferences.php']>Back[/url]";
}
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...