jBooker Posted November 1, 2008 Share Posted November 1, 2008 Im not sure how to explain this, I guess I should show the index.php and website first.. Also please understand that my php skills are beginner, if you will. The only way I can learn this stuff is by seeing it and editing it. Only 80% of this 'user CP' was made by me. http://64.135.134.95/InsanityFlyff/userpanel/index.php to see how things work you can login with username jbooker34 and password root. index.php: <?php session_start(); $act = $_GET['a']; if (!isset($_SESSION['user'])) { ?> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <html> <head> <title>Insanity Flyff - <?php echo"$user"; ?>'s user control panel</title> <style type="text/css"> <!-- body { background-image: url(images/bg103.gif); } a:link { color: #000000; text-decoration: none; } a:visited { text-decoration: none; color: #000000; } a:hover { text-decoration: underline; color: #000000; } a:active { text-decoration: none; color: #000000; } --> </style> </head> <body> <center><br><br> <form action="login.php" method="post"> Username: <input type="text" name="accname" size="15" maxlength="15"><br /> Password: <input type="password" name="accpass" size="15" maxlength="15"><br /> <input type="submit" value="Login"> <center> </form> </body> </html> <?php } else { include "config.php"; $user = $_SESSION['user']; $pass = $_SESSION['pass']; if (($act != 'job') && ($act != 'setjob') && ($act != 'resetpos') && ($act != 'buff') && ($act != 'restat') && ($act != 'restatstr') && ($act != 'restatsta') && ($act != 'restatdex') && ($act != 'restatint') && ($act != 'reborn') && ($act != 'transy')) { ?> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <html> <head> <title>Insanity Flyff - <?php echo"$user"; ?>'s user control panel</title> <style type="text/css"> <!-- body { background-image: url(images/bg103.gif); } a:link { color: #000000; text-decoration: underline; } a:visited { text-decoration: underline; color: #000000; } a:hover { text-decoration: none; color: #000000; } a:active { text-decoration: underline; color: #000000; } --> </style> </head> <body> <table width="100%"><tr><td colspan="2"> <?php echo "<center><font size='4'>Logged in as <b>$user</b></font><br>"; echo "<font size='2'><a href='index.php?a=resetpass'>Change Password</a> |"; echo " <a href='logout.php'>Logout</a></center></font><p>"; if ($act == 'resetpass') { if (isset($_SESSION['user'])) { $login = $_POST["login"]; $senhaA = $_POST["senhaAntiga"]; $senhaN = $_POST["senhaNova"]; $senhaN2 = $_POST["senhaNova2"]; if ((!isSet($_POST["login"])) && (!isSet($_POST["senhaAntiga"])) && (!isSet($_POST["senhaNova"])) && (!isSet($_POST["senhaNova2"]))) { echo "<fieldset><legend> <b><i>NEW PASSWORD</i></b> </legend>"; echo '<center><form method="post" action="index.php?a=resetpass">'; echo '<b>Login</b>:<br> <input type="text" name="login" READONLY value="' . $user . '"><p>'; echo '<b>Old Password</b>:<br> <input type="password" name="senhaAntiga"><p>'; echo '<b>New Password</b>:<br> <input type="password" name="senhaNova"><p>'; echo '<b>Confirm New Password</b>:<br> <input type="password" name="senhaNova2"><p>'; echo '<input type="submit" value="OK" name="OK">'; echo '</form></center>'; echo '</fieldset>'; } else { $senhaNova = md5("kikugalanet" . $senhaN); if (md5("kikugalanet" . $senhaN2) != $senhaNova) { echo "<center><h3><font color='#FF0000'>WARNING</font>: The new passwords in known.</h3></center>"; unset($_POST["login"]); unset($_POST["senhaAntiga"]); unset($_POST["senhaNova"]); unset($_POST["senhaNova2"]); } else { $senhaAntiga = md5("kikugalanet" . $senhaA); $res = mysql_query("select * from accounts where username = '$login' AND password = '$senhaAntiga'"); $qtde = mysql_num_rows($res); if ($qtde == 0) { echo "<center><h3><font color='#FF0000'>NOTICE</font>: Please fill up all fields.</h3></center>"; unset($_POST["login"]); unset($_POST["senhaAntiga"]); unset($_POST["senhaNova"]); unset($_POST["senhaNova2"]); } else { $res = mysql_query("update accounts set password = '$senhaNova' where username = '$login' and password = '$senhaAntiga'"); if (mysql_affected_rows() != 0) { echo "<center><h3>Password changed successfully.</h3></center>"; unset($_POST["login"]); unset($_POST["senhaAntiga"]); unset($_POST["senhaNova"]); unset($_POST["senhaNova2"]); } else { echo "<center><h3><font color='#FF0000'>WARNING</font>: Error attempting to change Password.</h3></center>"; unset($_POST["login"]); unset($_POST["senhaAntiga"]); unset($_POST["senhaNova"]); unset($_POST["senhaNova2"]); } } } } } } echo "</td></tr>"; $charrow = mysql_query("SELECT * FROM characters WHERE accountname = '$user' ORDER BY charslot ASC"); $checkchars = mysql_num_rows($charrow); if ($checkchars == 0) echo "You have no cahracters on this account<br>"; else echo "<tr valign='top'><td width='80%'>"; $qtde = $checkchars; while ($fetch = mysql_fetch_assoc($charrow)) { $qtde--; $jobid = $fetch['class']; if ($jobid == 0) $job = 'Vagrant'; if ($jobid == 1) $job = 'Mercenary'; if ($jobid == 2) $job = 'Acrobat'; if ($jobid == 3) $job = 'Assist'; if ($jobid == 4) $job = 'Magician'; if ($jobid == 6) $job = 'Knight'; if ($jobid == 7) $job = 'Blade'; if ($jobid == $job = 'Jester'; if ($jobid == 9) $job = 'Ranger'; if ($jobid == 10) $job = 'Ringmaster'; if ($jobid == 11) $job = 'Billposter'; if ($jobid == 12) $job = 'Psykeeper'; if ($jobid == 13) $job = 'Elementor'; if ($jobid == 16) $job = 'Knight [Master]'; if ($jobid == 17) $job = 'Blade [Master]'; if ($jobid == 18) $job = 'Jester [Master]'; if ($jobid == 19) $job = 'Ranger [Master]'; if ($jobid == 20) $job = 'Ringmaster [Master]'; if ($jobid == 21) $job = 'Billposter [Master]'; if ($jobid == 22) $job = 'Psykeeper [Master]'; if ($jobid == 23) $job = 'Elementor [Master]'; if ($jobid == 24) $job = 'Knight [HERO]'; if ($jobid == 25) $job = 'Blade [HERO]'; if ($jobid == 26) $job = 'Jester [HERO]'; if ($jobid == 27) $job = 'Ranger [HERO]'; if ($jobid == 28) $job = 'Ringmaster [HERO]'; if ($jobid == 29) $job = 'Billposter [HERO]'; if ($jobid == 30) $job = 'Psykeeper [HERO]'; if ($jobid == 31) $job = 'Elementor [HERO]'; $slot = $fetch['charslot']; $name = $fetch['charname']; $lvl = $fetch['level']; $rebirths = $fetch['rebirths']; $id = $fetch['id']; $sex = $fetch['sex']; if ($sex == 0) $truesex = 'Male'; if ($sex == 1) $truesex = 'Female'; echo "<fieldset><legend> <b> Slot $slot </b> </legend>"; echo "<b>Name</b>: <font color='#FF0000'>$name</font><br>"; echo "<b>Sex</b>: <font color='#FF0000'>$truesex</font><br>"; echo "<b>Job</b>: <font color='#FF0000'>$job</font><br>"; echo "<b>Level</b>: <font color='#FF0000'>$lvl</font><br>"; echo "<b>Rebirths</b>: <font color='#FF0000'>$rebirths</font><br>"; echo "<hr size='1'>"; if ($fetch['channelnum'] == -1) { echo "<font size='2'><a href='index.php?a=job&charid=$id'>Change Job</a> | <a href='index.php?a=transy&charid=$id'>Change Sex</a> | <a href='index.php?a=restat&charid=$id'>Restat</a> | <a href='index.php?a=resetpos&charid=$id'>Reset Position</a> | <a href='index.php?a=buff&charid=$id'>Buffs</a> | <a href='index.php?a=reborn&charid=$id'>Rebirth</a></font>"; } else echo "Your character is Online, you must be logged out of the game before you can edit your character."; echo "</fieldset>"; if ($qtde != 0) { echo ""; } } if ($checkchars != 0) { echo "</td>"; } echo "<td width='20%' height='500'><fieldset height='400'><legend> <b> Online Game Moderators </b> </legend>"; $querygm = mysql_query("SELECT * FROM characters AS c INNER JOIN accounts AS a ON a.username = c.accountname WHERE a.accesslevel > 100 AND a.logged_in = 1 AND c.channelnum >= 1"); $listgm = mysql_num_rows($querygm); if ($listgm == 0) echo "<br><br>There are no GMs online.<br>"; else echo "<br><center>"; $qtde = $listgm; while ($fetch = mysql_fetch_assoc($querygm)) { $qtde--; $gmchar = $fetch['charname']; echo "<div style='float: left;' align='left'><b>$gmchar</b></div> <div align='right'><img src='images/on.png'></div><br>"; if ($qtde != 0) { echo ""; } } echo "</center><br><br></fieldset></td></tr>"; echo "<tr><td colspan='2'>"; } if ($act == 'job') { $id = $_GET["charid"]; $matchrows = mysql_query("SELECT * FROM characters AS c INNER JOIN accounts AS a ON a.username = c.accountname WHERE c.id = $id AND a.username = '$user'"); $checkrows = mysql_num_rows($matchrows); if ($checkrows != 0) { $resultado = mysql_query("select * from characters where id = $id"); $reg = mysql_fetch_assoc($resultado); $lvl = $reg['level']; $job = $reg['class']; $mostrou = 'false'; echo "<fieldset><legend> <b><i>CHOOSE YOUR JOB</i></b> </legend>"; if (($lvl == 15) && ($job == 0)) { $mostrou = 'true'; echo "<a href='index.php?a=setjob&charid=$id&job=1'>Mercenary</a><br>"; echo "<a href='index.php?a=setjob&charid=$id&job=2'>Acrobat</a><br>"; echo "<a href='index.php?a=setjob&charid=$id&job=3'>Assist</a><br>"; echo "<a href='index.php?a=setjob&charid=$id&job=4'>Magician</a><br>"; } if (($lvl == 60) && ($job >= 1) && ($job <= 4)) { $mostrou = 'true'; switch($job) { case 1: echo "<a href='index.php?a=setjob&charid=$id&job=6'>Knight</a><br>"; echo "<a href='index.php?a=setjob&charid=$id&job=7'>Blade</a><br>"; break; case 2: echo "<a href='index.php?a=setjob&charid=$id&job=8'>Jester</a><br>"; echo "<a href='index.php?a=setjob&charid=$id&job=9'>Ranger</a><br>"; break; case 3: echo "<a href='index.php?a=setjob&charid=$id&job=10'>Ringmaster</a><br>"; echo "<a href='index.php?a=setjob&charid=$id&job=11'>BillPoster</a><br>"; break; case 4: echo "<a href='index.php?a=setjob&charid=$id&job=12'>Psykeeper</a><br>"; echo "<a href='index.php?a=setjob&charid=$id&job=13'>Elementor</a><br>"; break; } } if (($lvl == 120) && ($job >= 6) && ($job <= 13)) { $mostrou = 'true'; switch($job) { case 6: echo "<a href='index.php?a=setjob&charid=$id&job=16'>Knight [M]</a><br>"; break; case 7: echo "<a href='index.php?a=setjob&charid=$id&job=17'>Blade [M]</a><br>"; break; case 8: echo "<a href='index.php?a=setjob&charid=$id&job=18'>Jester [M]</a><br>"; break; case 9: echo "<a href='index.php?a=setjob&charid=$id&job=19'>Ranger [M]</a><br>"; break; case 10: echo "<a href='index.php?a=setjob&charid=$id&job=20'>Ringmaster [M]</a><br>"; break; case 11: echo "<a href='index.php?a=setjob&charid=$id&job=21'>BillPoster [M]</a><br>"; break; case 12: echo "<a href='index.php?a=setjob&charid=$id&job=22'>Psykeeper [M]</a><br>"; break; case 13: echo "<a href='index.php?a=setjob&charid=$id&job=23'>Elementor [M]</a><br>"; break; } } if (($lvl == 120) && ($job >= 16) && ($job <= 23)) { $mostrou = 'true'; switch($job) { case 16: echo "<a href='index.php?a=setjob&charid=$id&job=24'>Knight [H]</a><br>"; break; case 17: echo "<a href='index.php?a=setjob&charid=$id&job=25'>Blade [H]</a><br>"; break; case 18: echo "<a href='index.php?a=setjob&charid=$id&job=26'>Jester [H]</a><br>"; break; case 19: echo "<a href='index.php?a=setjob&charid=$id&job=27'>Ranger [H]</a><br>"; break; case 20: echo "<a href='index.php?a=setjob&charid=$id&job=28'>Ringmaster [H]</a><br>"; break; case 21: echo "<a href='index.php?a=setjob&charid=$id&job=29'>BillPoster [H]</a><br>"; break; case 22: echo "<a href='index.php?a=setjob&charid=$id&job=30'>Psykeeper [H]</a><br>"; break; case 23: echo "<a href='index.php?a=setjob&charid=$id&job=31'>Elementor [H]</a><br>"; break; } } if ($mostrou == 'false') { echo "<h3><font color='#FF0000'>NOTICE</font>: This characters job can not be changed untill it is level 15, 60, 120, or 120 MASTER.</h3>"; echo "</fieldset>"; } echo "</fieldset>"; } } if ($act == 'setjob') { $id = $_GET["charid"]; $fjob = $_GET["job"]; $matchrows = mysql_query("select * from characters AS c INNER JOIN accounts AS a ON a.username = c.accountname WHERE c.id = $id AND a.username = '$user'"); $checkrows = mysql_num_rows($matchrows); if ($checkrows != 0) { $resultado = mysql_query("select * from characters where id = $id"); $reg = mysql_fetch_assoc($resultado); $lvl = $reg['level']; $job = $reg['class']; $sp = $reg['skillpoints']; $passou = 'false'; $passou = ((($lvl == 15) && ($job == 0) && ($fjob >= 1) && ($fjob <= 4)) || ($passou == 'true')) ? 'true' : 'false'; $passou = ((($lvl == 60) && ($job == 1) && (($fjob == 6) || ($fjob == 7))) || ($passou == 'true')) ? 'true' : 'false'; $passou = ((($lvl == 60) && ($job == 2) && (($fjob == || ($fjob == 9))) || ($passou == 'true')) ? 'true' : 'false'; $passou = ((($lvl == 60) && ($job == 3) && (($fjob == 10) || ($fjob == 11))) || ($passou == 'true')) ? 'true' : 'false'; $passou = ((($lvl == 60) && ($job == 4) && (($fjob == 12) || ($fjob == 13))) || ($passou == 'true')) ? 'true' : 'false'; $passou = ((($lvl == 120) && ($job == 6) && ($fjob == 16)) || ($passou == 'true')) ? 'true' : 'false'; $passou = ((($lvl == 120) && ($job == 7) && ($fjob == 17)) || ($passou == 'true')) ? 'true' : 'false'; $passou = ((($lvl == 120) && ($job == && ($fjob == 18)) || ($passou == 'true')) ? 'true' : 'false'; $passou = ((($lvl == 120) && ($job == 9) && ($fjob == 19)) || ($passou == 'true')) ? 'true' : 'false'; $passou = ((($lvl == 120) && ($job == 10) && ($fjob == 20)) || ($passou == 'true')) ? 'true' : 'false'; $passou = ((($lvl == 120) && ($job == 11) && ($fjob == 21)) || ($passou == 'true')) ? 'true' : 'false'; $passou = ((($lvl == 120) && ($job == 12) && ($fjob == 22)) || ($passou == 'true')) ? 'true' : 'false'; $passou = ((($lvl == 120) && ($job == 13) && ($fjob == 23)) || ($passou == 'true')) ? 'true' : 'false'; $passou = ((($lvl == 120) && ($job == 16) && ($fjob == 24)) || ($passou == 'true')) ? 'true' : 'false'; $passou = ((($lvl == 120) && ($job == 17) && ($fjob == 25)) || ($passou == 'true')) ? 'true' : 'false'; $passou = ((($lvl == 120) && ($job == 18) && ($fjob == 26)) || ($passou == 'true')) ? 'true' : 'false'; $passou = ((($lvl == 120) && ($job == 19) && ($fjob == 27)) || ($passou == 'true')) ? 'true' : 'false'; $passou = ((($lvl == 120) && ($job == 20) && ($fjob == 28)) || ($passou == 'true')) ? 'true' : 'false'; $passou = ((($lvl == 120) && ($job == 21) && ($fjob == 29)) || ($passou == 'true')) ? 'true' : 'false'; $passou = ((($lvl == 120) && ($job == 22) && ($fjob == 30)) || ($passou == 'true')) ? 'true' : 'false'; $passou = ((($lvl == 120) && ($job == 23) && ($fjob == 31)) || ($passou == 'true')) ? 'true' : 'false'; if ($passou == 'true') { switch($fjob) { case 1: $skills = '0,0,0,4,5,6,9,10,7,8,11,12,13,14,108,109,111,112,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0'; break; case 2: $skills = '0,0,0,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0'; break; case 3: $skills = '0,0,0,44,45,46,48,49,50,51,51,52,53,104,105,113,114,115,116,117,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0'; break; case 4: $skills = '0,0,0,64,65,69,70,107,118,119,120,121,30,31,32,33,34,35,36,37,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0'; break; case 6: $skills = '0,0,0,4,5,6,9,10,7,8,11,12,13,14,108,109,111,112,0,0,0,0,0,128,129,130,131,132,133,134,135,0,0,0,0,0,0,0,0,0,0,0,0,0,0'; break; case 7: $skills = '0,0,0,4,5,6,9,10,7,8,11,12,13,14,108,109,111,112,0,0,0,0,0,136,137,138,139,140,141,142,143,0,0,0,0,0,0,0,0,0,0,0,0,0,0'; break; case 8: $skills = '0,0,0,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,0,0,0,0,207,208,209,210,211,212,213,214,0,0,0,0,0,0,0,0,0,0,0,0,0,0'; break; case 9: $skills = '0,0,0,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,0,0,0,0,215,216,217,218,219,220,221,222,0,0,0,0,0,0,0,0,0,0,0,0,0,0'; break; case 10: $skills = '0,0,0,44,45,46,48,49,50,51,51,52,53,104,105,113,114,115,116,117,20,0,0,144,145,146,147,148,149,150,151,230,0,0,0,0,0,0,0,0,0,0,0,0,0'; break; case 11: $skills = '0,0,0,44,45,46,48,49,50,51,51,52,53,104,105,113,114,115,116,117,20,0,0,152,153,154,155,156,157,158,159,0,0,0,0,0,0,0,0,0,0,0,0,0,0'; break; case 12: $skills = '0,0,0,64,65,69,70,107,118,119,120,121,30,31,32,33,34,35,36,37,0,0,0,160,161,162,163,164,165,166,167,0,0,0,0,0,0,0,0,0,0,0,0,0,0'; break; case 13: $skills = '0,0,0,64,65,69,70,107,118,119,120,121,30,31,32,33,34,35,36,37,0,0,0,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,0,0,0'; break; case 16: $skills = '0,0,0,4,5,6,9,10,7,8,11,12,13,14,108,109,111,112,0,0,0,0,0,128,129,130,131,132,133,134,135,0,0,0,0,0,0,0,0,0,0,0,0,310,0'; break; case 17: $skills = '0,0,0,4,5,6,9,10,7,8,11,12,13,14,108,109,111,112,0,0,0,0,0,136,137,138,139,140,141,142,143,0,0,0,0,0,0,0,0,0,0,0,0,309,0'; break; case 18: $skills = '0,0,0,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,0,0,0,0,207,208,209,210,211,212,213,214,0,0,0,0,0,0,0,0,0,0,0,0,311,0'; break; case 19: $skills = '0,0,0,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,0,0,0,0,215,216,217,218,219,220,221,222,0,0,0,0,0,0,0,0,0,0,0,0,312,0'; break; case 20: $skills = '0,0,0,44,45,46,48,49,50,51,51,52,53,104,105,113,114,115,116,117,20,0,0,144,145,146,147,148,149,150,151,230,0,0,0,0,0,0,0,0,0,0,0,316,0'; break; case 21: $skills = '0,0,0,44,45,46,48,49,50,51,51,52,53,104,105,113,114,115,116,117,20,0,0,152,153,154,155,156,157,158,159,0,0,0,0,0,0,0,0,0,0,0,0,315,0'; break; case 22: $skills = '0,0,0,64,65,69,70,107,118,119,120,121,30,31,32,33,34,35,36,37,0,0,0,160,161,162,163,164,165,166,167,0,0,0,0,0,0,0,0,0,0,0,0,314,0'; break; case 23: $skills = '0,0,0,64,65,69,70,107,118,119,120,121,30,31,32,33,34,35,36,37,0,0,0,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,0,313,0'; break; case 24: $skills = '0,0,0,4,5,6,9,10,7,8,11,12,13,14,108,109,111,112,0,0,0,0,0,128,129,130,131,132,133,134,135,0,0,0,0,0,0,0,0,0,0,0,0,310,238'; break; case 25: $skills = '0,0,0,4,5,6,9,10,7,8,11,12,13,14,108,109,111,112,0,0,0,0,0,136,137,138,139,140,141,142,143,0,0,0,0,0,0,0,0,0,0,0,0,309,237'; break; case 26: $skills = '0,0,0,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,0,0,0,0,207,208,209,210,211,212,213,214,0,0,0,0,0,0,0,0,0,0,0,0,311,239'; break; case 27: $skills = '0,0,0,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,0,0,0,0,215,216,217,218,219,220,221,222,0,0,0,0,0,0,0,0,0,0,0,0,312,240'; break; case 28: $skills = '0,0,0,44,45,46,48,49,50,51,51,52,53,104,105,113,114,115,116,117,20,0,0,144,145,146,147,148,149,150,151,230,0,0,0,0,0,0,0,0,0,0,0,316,244'; break; case 29: $skills = '0,0,0,44,45,46,48,49,50,51,51,52,53,104,105,113,114,115,116,117,20,0,0,152,153,154,155,156,157,158,159,0,0,0,0,0,0,0,0,0,0,0,0,315,243'; break; case 30: $skills = '0,0,0,64,65,69,70,107,118,119,120,121,30,31,32,33,34,35,36,37,0,0,0,160,161,162,163,164,165,166,167,0,0,0,0,0,0,0,0,0,0,0,0,314,242'; break; case 31: $skills = '0,0,0,64,65,69,70,107,118,119,120,121,30,31,32,33,34,35,36,37,0,0,0,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,0,313,241'; break; } if (($fjob >= 1) && ($fjob <= 4)) $lvl = ', stat_str = 15, stat_int = 15, stat_sta = 15, stat_dex = 15, statpoints = 28 '; if (($fjob >= 16) && ($fjob <= 23)) $lvl = ', level = 60, exp = 644602 '; else $lvl = ''; $s_query = ''; switch($fjob) { case 1: $sp = $sp + 40; break; case 2: $sp = $sp + 60; break; case 3: $sp = $sp + 60; break; case 4: $sp = $sp + 90; break; case 6: $sp = $sp + 100; break; case 7: $sp = $sp + 60; break; case 8: $sp = $sp + 80; break; case 9: $sp = $sp + 100; break; case 10: $sp = $sp + 100; break; case 11: $sp = $sp + 120; break; case 12: $sp = $sp + 90; break; case 13: $sp = $sp + 300; break; } if (($fjob >= 1) && ($fjob <= 13)) $s_query = ", skillpoints = $sp"; $query = mysql_query("update characters set class = $fjob, skills = '$skills'$lvl$s_query where id = $id"); if (mysql_affected_rows() != 0) { echo "<center><h3>Job changed successful!</h3></center>"; } else { echo "<center><h3><font color='#FF0000'>NOTICE</font>: An error has occured, please try again.</h3></center>"; } } else { echo "<center><h3><font color='#FF0000'>NOTICE</font>: An error has occured, please try again.</h3></center>"; } } } if ($act == 'resetpos') { $id = $_GET["charid"]; $query = mysql_query("select * from characters AS c INNER JOIN accounts AS a ON a.username = c.accountname WHERE c.id = $id AND a.username = '$user'"); $check = mysql_num_rows($query); if ($check != 0) { mysql_query("UPDATE characters SET posX = 6973, posY = 100, posZ = 3328, posWorldID = 1 WHERE id = $id"); if (mysql_affected_rows() != 0) { echo "<center><h3>Position successfuly reset to Flaris.</h3></center>"; } else { echo "<center><h3><font color='#FF0000'>NOTICE</font>: Error attempting to change Position, please try again.</h3></center>"; } } } if ($act == 'buff') { $id = $_GET["charid"]; $query = mysql_query("SELECT * FROM characters WHERE id = $id"); $get = mysql_fetch_array($query); $level = $get['level']; if ($level > $levelcap) { echo "<center><font color=\"#FF0000\">This character has to high a level to get buffed!</font></center>"; } ELSE if ($level < $levelcap) { mysql_query("DELETE FROM buffs WHERE charid = $id"); mysql_query("INSERT INTO buffs VALUES ('$id', '114', '20', '11', '30', '0', '0', '0', '0', '$time')"); #Quick Step(id:114) mysql_query("INSERT INTO buffs VALUES ('$id', '20', '20', '24', '500', '0', '0', '0', '0', '$time');"); #Haste(id:20) mysql_query("INSERT INTO buffs VALUES ('$id', '115', '20', '14', '12', '0', '0', '0', '0', '$time');"); #Cat's Reflexes(id:115) mysql_query("INSERT INTO buffs VALUES ('$id', '50', '20', '2', '20', '0', '0', '0', '0', '$time');"); #Cannon Ball(id:50) mysql_query("INSERT INTO buffs VALUES ('$id', '52', '20', '3', '20', '0', '0', '0', '0', '$time');"); #Mental Sign(id:52) mysql_query("INSERT INTO buffs VALUES ('$id', '49', '20', '4', '40', '0', '0', '0', '0', '$time');"); #Heap Up(id:49) mysql_query("INSERT INTO buffs VALUES ('$id', '53', '20', '1', '20', '0', '0', '0', '0', '$time');"); #Beef Up(id:53) mysql_query("INSERT INTO buffs VALUES ('$id', '116', '20', '47', '20', '0', '0', '0', '0', '$time');"); #Accuracy(id:116) mysql_query("INSERT INTO buffs VALUES ('$id', '150', '10', '63', '150', '24', '500', '0', '0', '$time');"); #GT(id:150) mysql_query("INSERT INTO buffs VALUES ('$id', '148', '10', '63', '140', '0', '0', '0', '0', '$time');"); #SF(id:148) mysql_query("INSERT INTO buffs VALUES ('$id', '146', '10', '26', '50', '0', '0', '0', '0', '$time');"); #Protect(id:146) if (mysql_affected_rows() != 0) { echo "<center><h3>Character buffed, enjoy.</h3></center>"; } else { echo "<center><h3><font color='#FF0000'>NOTICE</font>: An error has occured, please try again.</h3></center>"; } } } if ($act == 'restat') { $id = $_GET["charid"]; $matchrows = mysql_query("SELECT * FROM characters AS c INNER JOIN accounts AS a ON a.username = c.accountname WHERE c.id = $id AND a.username = '$user'"); $checkrows = mysql_num_rows($matchrows); if ($checkrows != 0) { $id = $_GET["charid"]; $ok = $_GET["success"]; $error = $_GET["fail"]; $query = mysql_query("SELECT * FROM characters WHERE id = $id"); $get = mysql_fetch_array($query); $str = $get['stat_str']; $sta = $get['stat_sta']; $dex = $get['stat_dex']; $int = $get['stat_int']; $gp = $get['statpoints']; echo "<fieldset><legend> <b><i>RE-STAT</i></b> </legend>"; echo "<b>Instructions</b>: Simply click on a stat to return all the stat points back to your unused stat points.<br><br>"; echo "<b><a href='index.php?a=restatstr&charid=$id'>Strength</a></b>: $str <br>"; echo "<b><a href='index.php?a=restatsta&charid=$id'>Stamina</a></b>: $sta <br>"; echo "<b><a href='index.php?a=restatdex&charid=$id'>Dexitery</a></b>: $dex <br>"; echo "<b><a href='index.php?a=restatint&charid=$id'>Intellegence</a></b>: $int <br>"; echo "<b>Unused Stat Points</b>: $gp <br>"; echo "</fieldset>"; } } if ($act == 'restatstr') { $id = $_GET["charid"]; $matchrows = mysql_query("SELECT * FROM characters AS c INNER JOIN accounts AS a ON a.username = c.accountname WHERE c.id = $id AND a.username = '$user'"); $checkrows = mysql_num_rows($matchrows); if ($checkrows != 0) { $id = $_GET["charid"]; $query = mysql_query("SELECT * FROM characters WHERE id = $id"); $get = mysql_fetch_array($query); $str = $get['stat_str']; $gp = $get['statpoints']; $truestr = $str - 15; mysql_query("UPDATE characters SET statpoints = $gp + $truestr WHERE id = $id"); mysql_query("UPDATE characters SET stat_str = '15' WHERE id = $id"); if (mysql_affected_rows() != 0) { echo "<center><h3>Strength stat reset successfuly!</h3></center>"; } else { echo "<center><h3>An error has occured, please try again.</h3></center>"; } } } if ($act == 'restatsta') { $id = $_GET["charid"]; $matchrows = mysql_query("SELECT * FROM characters AS c INNER JOIN accounts AS a ON a.username = c.accountname WHERE c.id = $id AND a.username = '$user'"); $checkrows = mysql_num_rows($matchrows); if ($checkrows != 0) { $id = $_GET["charid"]; $query = mysql_query("SELECT * FROM characters WHERE id = $id"); $get = mysql_fetch_array($query); $sta = $get['stat_sta']; $gp = $get['statpoints']; $truesta = $sta - 15; mysql_query("UPDATE characters SET statpoints = $gp + $truesta WHERE id = $id"); mysql_query("UPDATE characters SET stat_sta = '15' WHERE id = $id"); if (mysql_affected_rows() != 0) { echo "<center><h3>Stamina stat reset successfuly!</h3></center>"; } else { echo "<center><h3>An error has occured, please try again.</h3></center>"; } } } if ($act == 'restatdex') { $id = $_GET["charid"]; $matchrows = mysql_query("SELECT * FROM characters AS c INNER JOIN accounts AS a ON a.username = c.accountname WHERE c.id = $id AND a.username = '$user'"); $checkrows = mysql_num_rows($matchrows); if ($checkrows != 0) { $id = $_GET["charid"]; $query = mysql_query("SELECT * FROM characters WHERE id = $id"); $get = mysql_fetch_array($query); $dex = $get['stat_dex']; $gp = $get['statpoints']; $truedex = $dex - 15; mysql_query("UPDATE characters SET statpoints = $gp + $truedex WHERE id = $id"); mysql_query("UPDATE characters SET stat_dex = '15' WHERE id = $id"); if (mysql_affected_rows() != 0) { echo "<center><h3>Dexitery stat reset successfuly!</h3></center>"; } else { echo "<center><h3>An error has occured, please try again.</h3></center>"; } } } if ($act == 'restatint') { $id = $_GET["charid"]; $matchrows = mysql_query("SELECT * FROM characters AS c INNER JOIN accounts AS a ON a.username = c.accountname WHERE c.id = $id AND a.username = '$user'"); $checkrows = mysql_num_rows($matchrows); if ($checkrows != 0) { $id = $_GET["charid"]; $query = mysql_query("SELECT * FROM characters WHERE id = $id"); $get = mysql_fetch_array($query); $int = $get['stat_int']; $gp = $get['statpoints']; $trueint = $int - 15; mysql_query("UPDATE characters SET statpoints = $gp + $trueint WHERE id = $id"); mysql_query("UPDATE characters SET stat_int = '15' WHERE id = $id"); if (mysql_affected_rows() != 0) { echo "<center><h3>Intellegence stat reset successfuly!</h3></center>"; } else { echo "<center><h3>An error has occured, please try again.</h3></center>"; } } } if ($act == 'reborn') { $id = $_GET["charid"]; $matchrows = mysql_query("SELECT * FROM characters AS c INNER JOIN accounts AS a ON a.username = c.accountname WHERE c.id = $id AND a.username = '$user'"); $checkrows = mysql_num_rows($matchrows); if ($checkrows != 0) { $id = $_GET["charid"]; $query = mysql_query("SELECT * FROM characters WHERE id = $id"); $get = mysql_fetch_array($query); $class = $get['class']; $lvl = $get['level']; $rebirths = $get['rebirths']; if (($lvl == 120) && ($class >= 24) && ($class <= 31) && ($rebirths < $maxrebirths)) { if ($class == 24) { mysql_query("UPDATE characters SET class = 6 WHERE id = $id"); } if ($class == 25) { mysql_query("UPDATE characters SET class = 7 WHERE id = $id"); } if ($class == 26) { mysql_query("UPDATE characters SET class = 8 WHERE id = $id"); } if ($class == 27) { mysql_query("UPDATE characters SET class = 9 WHERE id = $id"); } if ($class == 28) { mysql_query("UPDATE characters SET class = 10 WHERE id = $id"); } if ($class == 29) { mysql_query("UPDATE characters SET class = 11 WHERE id = $id"); } if ($class == 30) { mysql_query("UPDATE characters SET class = 12 WHERE id = $id"); } if ($class == 31) { mysql_query("UPDATE characters SET class = 13 WHERE id = $id"); } mysql_query("UPDATE characters SET level = 1 WHERE id = $id"); mysql_query("UPDATE characters SET posWorldID = 1 WHERE id = $id"); mysql_query("UPDATE characters SET posX = 6973 WHERE id = $id"); mysql_query("UPDATE characters SET posY = 10 WHERE id = $id"); mysql_query("UPDATE characters SET posZ = 3328 WHERE id = $id"); mysql_query("UPDATE characters SET rebirths = rebirths + 1 WHERE id = $id"); if (mysql_affected_rows() != 0) { echo "<center><h3>Character has successfully been reborn!</h3></center>"; } else { echo "<center><h3>An error has occured, please try again.</h3></center>"; } } else { echo "<center><h3>Your character can not yet be reborn. You must be level 120 HERO.</h3></center>"; } } } if ($act == 'transy') { $id = $_GET["charid"]; $matchrows = mysql_query("SELECT * FROM characters AS c INNER JOIN accounts AS a ON a.username = c.accountname WHERE c.id = $id AND a.username = '$user'"); $checkrows = mysql_num_rows($matchrows); if ($checkrows != 0) { $id = $_GET["charid"]; $query = mysql_query("SELECT * FROM characters WHERE id = $id"); $get = mysql_fetch_array($query); $sex = $get['sex']; if ($sex == 0) { mysql_query("UPDATE characters SET sex = 1 WHERE id = $id"); header("Location: index.php"); echo "<center><h3>Congratulations! Your character is now a Female.</h3></center>"; exit; } if ($sex == 1) { mysql_query("UPDATE characters SET sex = 0 WHERE id = $id"); header("Location: index.php"); echo "<center><h3>Congratulations! Your character is now a Male.</h3></center>"; exit; } if (mysql_affected_rows() == 0) { echo "<center><h3>An error has occured, please try again.</h3></center>"; } } } ?> </td> </tr> <tr> <td> <center><font size="1">User control panel created by bLah. Job change and reset position scripts created by FlyFor-Soft.</font></center> </td> </tr> </table> </body> </html> <?php } ?> What I want to do is make it so that when something is done, successfully or not, the link in the browser will return to /index.php with a message on the bottom, before the little line of credits, saying "success! blah blah"/"fail blah blah". This is so that when the user refreshes the page they don't do whatever they just did again. At the end of the script you can see I tried using header("index.php");, at first i was getting the "cannot send header' error but i fixed that by adding if(($act != 'job') && ... && ... && ...) around the main part. This worked but it did not display the message with it. Anyway, how else could I do this or what would be the best way to do it? Quote Link to comment Share on other sites More sharing options...
Psycho Posted November 1, 2008 Share Posted November 1, 2008 Use the header() function with a Location reference to a success page. Example: test.php <?php if ($_GET['test']=='true') { //Do some process header('Location: http://localhost/test/success.php'); } else { echo "Click this <a href=\"http://localhost/test/test.php?test=true\">link</a> to reload the page with the paramater on the URL."; } ?> success.php <?php echo "Process succeeded"; ?> Quote Link to comment Share on other sites More sharing options...
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.