bluegman991
Members-
Posts
394 -
Joined
-
Last visited
-
Days Won
2
Content Type
Profiles
Forums
Events
Everything posted by bluegman991
-
now if you want bbcode to be enabled and html to be disabled do the following in viewuser.php find <?php and after it add session_start(); 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 name='(.+?)\'](.+?)\[\/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); } then find include "globals.php"; and below add $bbc = new bbcode; next find if($r['profsignature']) { and after it add {$r['profsignature']=$bbc->bbcode_parse($r['profsignature']); }
-
Now about the signature mod I take no credit for it it is on_fire's mod in this thread after u have installed the account.php page all u have to do is run sql query [mysql]ALTER TABLE users ADD `profsignature` text NOT NULL;[/mysql] then add this into your profile werever u want it in viewuser.php (preferably close to the end of the page where its noticable) (NOTE: you may have to add a { and/or a } depending on where you put the code at) print " <table width=100%><tr><th><hr /></th> <tr><td rowspan='1'>"; if($r['profsignature']) { print "{$r['profsignature']}"; } else { print "<font size='5'><center>[b]Profile Signature Shows Here![/b]<center></font>"; } print "</td></tr></table>"; Refer to next post about enabling bbcode and disabling html
-
Turns out I did have a copy of this mod! Copy and paste this into a file named account.php <?php include "globals.php"; echo "<h3>Edit Account</h3>"; if(!empty($_POST['username']) && !empty($_POST['loginname']) && !empty($_POST['email'])) { foreach($_POST as $k => $v) { $v=trim($v); } $username=$db->escape($_POST['username']); $loginname=$db->escape($_POST['loginname']); $email=$db->escape($_POST['email']); $gender=!empty($_POST['gender']) ? $db->escape($_POST['gender']) : ''; $displaypic=!empty($_POST['newpic']) && exif_imagetype($_POST['newpic']) ? $_POST['newpic'] : ""; $forumpic=!empty($_POST['forums_avatar']) && exif_imagetype($_POST['forums_avatar']) ? $_POST['forums_avatar'] : ""; $forum_sig=!empty($_POST['forums_sig']) ? $db->escape($_POST['forums_sig']) : ''; $prof_sig=!empty($_POST['prof_sig']) ? $db->escape($_POST['prof_sig']) : ''; $unqr=$db->query("SELECT `userid` FROM `users` WHERE `username`='{$username}'"); $lnqr=$db->query("SELECT `userid` FROM `users` WHERE `login_name`='{$loginname}'"); $emqr=$db->query("SELECT `userid` FROM `users` WHERE `email`='{$email}'"); $error=false; if($db->num_rows($unqr) && $db->escape($ir['username']) !=$_POST['username']) { $error=true; echo "Username in use.<br />"; } if($db->num_rows($lnqr) && $db->escape($ir['login_name']) !=$_POST['loginname']) { $error=true; echo "Login name in use.<br />"; } if($db->num_rows($emqr) && $db->escape($ir['email']) !=$_POST['email']) { $error=true; echo "Email in use.<br />"; } if($error==false) { $db->query("UPDATE `users` SET `username`='{$username}',`login_name`='{$loginname}',`email`='{$email}',`gender`='{$gender}',`display_pic`='{$displaypic}',`forums_avatar`='{$forumpic}',`forums_signature`='{$forum_sig}',`profsignature`='{$prof_sig}' WHERE `userid`='{$ir['userid']}'"); } if((!empty($_POST['newpw']) || !empty($_POST['newpw2'])) && $_POST['newpw'] !=$_POST['newpw2']) { echo "New passwords do not match."; } elseif(!empty($_POST['newpw']) && !empty($_POST['newpw2']) && $_POST['newpw']==$_POST['newpw2']) { $pass=md5($_POST['newpw']); $db->query("UPDATE `users` SET `userpass`='{$pass}' WHERE `userid`='{$ir['userid']}'"); } } else { echo '<form method="post"><table width="95%"> <tr><td>Username:</td><td><input type="text" name="username" value="'.htmlspecialchars($ir['username']).'" /></td></tr> <tr><td>Login Name:</td><td><input type="text" name="loginname" value="'.htmlspecialchars($ir['login_name']).'" /></td></tr> <tr><td>Email:</td><td><input type="text" name="email" value="'.htmlspecialchars($ir['email']).'" /></td></tr> <tr><td>Password:</td><td><input type="password" name="newpw1" /></td></tr> <tr><td>Confirm Password:</td><td><input type="password" name="newpw2" /></td></tr> <tr><td>Gender:</td><td><select name="gender">'; $gens=array('Male','Female'); foreach($gens as $k => $v) { if($ir['gender']==$v) { echo '<option selected="selected">'.$v.'</option>'; } else { echo '<option>'.$v.'</option>'; } } echo '</select></td></tr> <tr><td>Display Pic:</td><td><input type="text" name="newpic" value="'.htmlspecialchars($ir['display_pic']).'" /></td></tr> <tr><td>Forum Avatar:</td><td><input type="text" name="forums_avatar" value="'.htmlspecialchars($ir['forums_avatar']).'" /></td></tr> <tr><th colspan="2">Forum Signature</th></tr> <tr><td colspan="2"><textarea rows="10" cols="50" name="forums_sig">'.htmlspecialchars($ir['forums_signature']).'</textarea></td></tr> <tr><th colspan="2">Profile Signature</th></tr> <tr><td colspan="2"><textarea rows="20" cols="100" name="prof_sig">'.htmlspecialchars($ir['profsignature']).'</textarea></td></tr> <tr><td></td><td><input type="submit" value="Save" /></td></tr> </table></form>'; } $h->endpage(); exit(); ?>
-
ty lazyt :) i tried it and it said that the name was already in use but still changed it so i added this $h->endpage(); exit; worked great ty again :D wish i knew how to +1 :|
-
lazy i tried yours but it didn't work and i also tried something similar to it before i posted this thread here is the if statement i tried before posting this thread i simply got it from the register page i tried editing it a whole bunch of different ways but its to many to post :P $q=$db->query("SELECT * FROM users WHERE username='{$username}' OR login_name='{$username}'"); if($db->num_rows($q)) { print "Username already in use. Choose another. >[url='register']Back[/url]"; } and Danny i only need the if statement but what happened with ur if statement is i put it in how it was and then it wouldn't change the username at all it got a query error but i believe the correct thing to refer to is login_name not loginname becuase thats what actually works in the action to change the login name so i put an underscore between login and name but then it continued to change the username whether it was in use or not. heres the query error i got QUERY ERROR: Unknown column 'loginname' in 'field list' Query was SELECT username, loginname FROM users here are my functions that i am currently using name change 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?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;$r = $db->fetch_row($db->query("SELECT username FROM users")); if($_POST['newname'] == '$r->username') { die("This username is in use."); $h->endpage(); exit; } if($_POST['newname'] == "") { print "You did not enter a new name. [url='preferences?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!"; } } login name change function login_change() { global $ir,$c,$userid,$h; print "<h3>Login Name Change</h3><form action='preferences?action=loginchange2' method='post'>New Login Name: <input type='login_name' name='newloginname' value='{$ir['login_name']}' /> <input type='submit' value='Change Login Name' /></form>"; } function do_login_change() { global $db,$ir,$c,$userid,$h; if($_POST['newloginname'] == "") { print "You did not enter a new login name. [url='preferences?action=loginchange']> Back[/url]"; } else { $db->query("UPDATE users SET login_name='{$_POST['newloginname']}' WHERE userid=$userid"); print "Login Name changed!"; } } email change function email_change() { global $ir,$c,$userid,$h; print "<h3>Email Change</h3><form action='preferences?action=emailchange2' method='post'>New Email: <input type='email' name='newemail' value='{$ir['email']}' /> <input type='submit' value='Change Email' /></form>"; } function do_email_change() { global $db,$ir,$c,$userid,$h; if($_POST['newemail'] == "") { print "You did not enter a new email. [url='preferences?action=emailchange']> Back[/url]"; } else { $db->query("UPDATE users SET email='{$_POST['newemail']}' WHERE userid=$userid"); print "Email Address changed!"; } }
-
i have made a couple actions on my preferences page to change email and change login name and i need help also with the change username what i need help with is creating an if statement for each 1 so if a username, login name, or email is already in use you cannot use that username, login, or email. i know some of you pro coders either already have this or know how to do it but if anybody doest know how or need to see the code to get an idea of what the if statement should be tell me and I'll post it
-
yessir it did
-
thx guys i wanted to make it id 1 was the only one that could edit admin positions but other admin could edit other staff positions but this is good enuf thx again ;)
-
thanks mario and thanks seanbobby i think i'll try them both :P but seanbobby i already know what the if statement would be im just not sure where to put it that would be my first choice tho and mario i have an idea of where to put ur's in but i am not for shure so i will try the way i think it might be and i would add them under the user level function correct? if so ill post the function if u dont already have it for u guys to get a better idea
-
Hi i am new to php and mccodes coding and the only way i really learn is from experience or trial/error so some bugs i can fix and some adjustments i can make but whats got me stuck is i am trying to make it so only user id 1 can take away or give admin so the other admin of my game cannot give other people admin or take away from the ones who already have it and if anyone besides id 1 tries to do it they get a 403 error can someone help me on how to do this please :rolleyes: