goonygugle Posted January 19, 2008 Share Posted January 19, 2008 Hello all, I have been using a simple php script for the past 3 years to calculate points for a gaming guild i am in,it has worked perfectly for 3 years then 3 weeks ago it just quit working properly, then script had been untouched for 2 years and then only the database was purged of old information. here is a link to the script packaged in a rar lnrguild.com/points/points.rar and a link to the working site lnrguild.com/points any help would be much appreciated Quote Link to comment https://forums.phpfreaks.com/topic/86773-help-me-please/ Share on other sites More sharing options...
AndyB Posted January 19, 2008 Share Posted January 19, 2008 best guess: the script relied on register_globals being ON and your web host finally upgraded their php version and set register_globals to OFF Quote Link to comment https://forums.phpfreaks.com/topic/86773-help-me-please/#findComment-443488 Share on other sites More sharing options...
goonygugle Posted January 19, 2008 Author Share Posted January 19, 2008 is that something i could fix? Quote Link to comment https://forums.phpfreaks.com/topic/86773-help-me-please/#findComment-443493 Share on other sites More sharing options...
revraz Posted January 19, 2008 Share Posted January 19, 2008 You can either: Best and recommend method, fix the code or Change the php.ini to enable register globals. Ask your Host what was changed. Quote Link to comment https://forums.phpfreaks.com/topic/86773-help-me-please/#findComment-443494 Share on other sites More sharing options...
goonygugle Posted January 19, 2008 Author Share Posted January 19, 2008 how could i tell if the script is relying on the register_global to be on , and if it is the case could you point me in the right direction towards changing it to not rely on it? Quote Link to comment https://forums.phpfreaks.com/topic/86773-help-me-please/#findComment-443499 Share on other sites More sharing options...
revraz Posted January 19, 2008 Share Posted January 19, 2008 You can look at your php.ini file to see if it's off and turn it on and see if it works. An example would be something like, you have a URL that has www.mysite.com/index.php?page=news Then you look at your code for index.php and notice <?php echo $page; ?> Notice how we didn't define $page and we didn't use $_GET['page'] to set the variable. Quote Link to comment https://forums.phpfreaks.com/topic/86773-help-me-please/#findComment-443500 Share on other sites More sharing options...
goonygugle Posted January 19, 2008 Author Share Posted January 19, 2008 that doesn't appear to be the case,im going to include the code for the main page, <? ob_start(); session_start(); require ('includes/mysql_connect.php'); if($_GET['action'] == "Members"){ echo '<font size=4>Guild Member Points Listings</font><BR>'; echo '<font color="red">***Lifetime Points are not for Auctions, they are a total of all points ever earned.</font>'; echo '<table width="490" border="1" bordercolor="000652" cellpadding="0" cellspacing="0" class="tablebg">' . "\n"; echo '<tr align="center" valign="middle" bgcolor="#090090"><td width="200" height="20"><b>Name</b></td>' . "\n"; echo '<td width="100">Rank</td><td width="100">Activity</td><td width="70">Currently</td><td width="60">Lifetime</td></tr>' . "\n"; $mani = mysql_query("SELECT * FROM `guild_members` where Rank != 'Ex-Member' ORDER BY `Name` asc LIMIT 0, 1000") or die("Could not connect to database"); while ($members = mysql_fetch_array($mani, MYSQL_BOTH)) { $total = $members[pts] + $members[usedpts]; echo '<tr align="center" valign="middle"><td width="200" class="names"><b>'.$members[Name].'</b></td>' . "\n"; echo '<td width="100">'.$members[Rank].'</td><td width="100">'.$members[Activity].'</td>' . "\n"; echo '<td width="70" bgcolor="#002253">'.$members[pts].'</td><td width="60">'.$total.'</td></tr>' . "\n"; } echo '</table><BR><BR><br>' . "\n"; $query = "SELECT * FROM `guild_members` where Rank = 'Ex-Member' ORDER BY `pts` DESC LIMIT 0, 100"; $result = mysql_query ($query); if (mysql_num_rows($result) != 0) { echo '<table width="490" border="1" bordercolor="000652" cellpadding="0" cellspacing="0" class="tablebg">' . "\n"; echo '<tr align="center" valign="middle" bgcolor="#090090"><td width="200" height="20"><b>Name</b></td>' . "\n"; echo '<td width="100">Rank</td><td width="100">Activity</td><td width="70">Currently</td><td width="60">Lifetime</td></tr>' . "\n"; $mani = mysql_query("SELECT * FROM `guild_members` where Rank = 'Ex-Member' ORDER BY `pts` DESC LIMIT 0, 100") or die("Could not connect to database"); while ($members = mysql_fetch_array($mani, MYSQL_BOTH)) { $total = $members[pts] + $members[usedpts]; echo '<tr align="center" valign="middle"><td width="200" class="names"><b>'.$members[Name].'</b></td>' . "\n"; echo '<td width="100">'.$members[Rank].'</td><td width="100">'.$members[Activity].'</td>' . "\n"; echo '<td width="70" bgcolor="#002253">'.$members[pts].'</td><td width="60">'.$total.'</td></tr>' . "\n"; } echo '</table><BR><BR><br>' . "\n"; } } if($_GET['action'] == "Pts"){ if (!isset($_SESSION['Fname']) AND (substr($_SERVER['PHP_SELF'], -10) != 'logout.php')) { header ("Location: http://" . LINK . "adminlogin.php"); } echo '<font size="4">Spawn Posting</font><BR>Please choose your spawn and check who was there.<BR>'; ?> <form method="post" action="<? $_SERVER['PHP_SELF']; ?>?action=Ptssub"> <? echo 'Spawn:<SELECT name="spawnname" value="">'; echo '<option value="">Choose Boss</option>'; echo '<option value="Barracoon">Barracoon</option>'; echo '<option value="Neira">Neira</option>'; echo '<option value="Rikktor">Rikktor</option>'; echo '<option value="Semidar">Semidar</option>'; echo '<option value="Mephisto">Mephisto</option>'; echo '<option value="Lord Oaks">Lord Oaks</option>'; echo '<option value="Harrower">Harrower</option></select>'; echo '<SELECT name="spawnlocation" value="">'; echo '<option value="">Choose Location</option>'; echo '<option value="Despise">Despise</option>'; echo '<option value="Destard">Destard</option>'; echo '<option value="Deceit">Deceit</option>'; echo '<option value="Shame">Shame</option>'; echo '<option value="Tera Keep">Tera Keep</option>'; echo '<option value="Oaks">Oaks</option>'; echo '<option value="COD">City of the Dead</option>'; echo '<option value="Damwin">Damwin</option>'; echo '<option value="Marble">Marble</option>'; echo '<option value="Tortise">Tortise</option>'; echo '<option value="Ice West">Ice West</option>'; echo '<option value="Ice East">Ice East</option>'; echo '<option value="Island">Sanc Island</option>'; echo '<option value="Hoppers Bog">Hoppers Bog</option>'; echo '<option value="Kaldun">Kaldun</option>'; echo '<option value="Desert">Desert</option>'; echo '<option value="Oasis">Oasis</option></select>'; echo '<input type="text" name="spawndesc" value="" size="30"> <font color="gray">'.$Rdate.'</font>' . "\n"; echo '<table width="400" border="1" bordercolor="000652" cellpadding="0" cellspacing="0" class="tablebg">' . "\n"; echo '<tr align="center" valign="middle"><td colspan="5" width="400" height="20"><b>Points Given</b><BR></td></tr>' . "\n"; echo '<tr><td width="80"><input type="checkbox" name="spawnvalue" value="1">1 Pt</td> <td width="80"><input type="checkbox" name="spawnvalue" value="2">2 Pt</td> <td width="80"><input type="checkbox" name="spawnvalue" value="3">3 Pt</td>' . "\n"; echo '<td width="80"><input type="checkbox" name="spawnvalue" value="4">4 Pt</td>' . "\n"; echo '<td width="80"><input type="checkbox" name="spawnvalue" value="5">5 Pt</td>' . "\n"; echo '<td width="80"><input type="checkbox" name="spawnvalue" value="6">6 Pt</td>' . "\n"; echo '<td width="80"><input type="checkbox" name="spawnvalue" value="7">7 Pt</td>' . "\n"; echo '<td width="80"><input type="checkbox" name="spawnvalue" value="8">8 Pt</td>' . "\n"; echo '<td width="80"><input type="checkbox" name="spawnvalue" value="9">9 Pt</td>' . "\n"; echo '<td width="80"><input type="checkbox" name="spawnvalue" value="10">10 Pt</td>' . "\n"; echo '</table><BR><BR>' . "\n"; echo 'Scout:<SELECT name="Scout" value="" class="forms">'; echo '<option value="None">None</option>'; $mani = mysql_query("SELECT * FROM `guild_members` ORDER BY `Name` ASC LIMIT 0, 1000") or die("Could not connect to database"); while ($guildlist = mysql_fetch_array($mani, MYSQL_BOTH)) { echo '<option value="'.$guildlist[iD].'">'.$guildlist[Name].'</option>'; } echo '<table width="440" border="1" bordercolor="000652" cellpadding="0" cellspacing="0" class="tablebg">' . "\n"; echo '<tr align="center" valign="middle" bgcolor="#090090"><td width="200" height="20"><b>Name</b></td>' . "\n"; echo '<td width="100">Rank</td><td width="60">Activity</td><td width="40">Pts.</td><td width="40">Check</td></tr>' . "\n"; $mani = mysql_query("SELECT * FROM `guild_members` ORDER BY `Name` ASC LIMIT 0, 1000") or die("Could not connect to database"); for ($i=1;$members = mysql_fetch_array($mani, MYSQL_BOTH);++$i) { echo '<tr align="center" valign="middle"><td width="200" class="names"><b>'.$members['Name'].'</b></td>' . "\n"; echo '<td width="100">'.$members['Rank'].'</td><td width="60">'.$members['Activity'].'</td><td width="40">'.$members['pts'].'</td>'; print '<td width="40"><input type="checkbox" name="checkbox[]" value="'.$members['ID'].'"><input type="hidden" name="checkedmembers[]" value"'.$members['Name'].'"> <input type="hidden" name="ID" value"'.$members['ID'].'"></td></tr>' . "\n"; }mysql_close(); echo '</table><BR><BR>' . "\n"; echo '<input type="submit" value="Update" name="submits"><br /></form><br />'; } if($_GET['action'] == "Ptssub"){ if (!isset($_SESSION['Fname']) AND (substr($_SERVER['PHP_SELF'], -10) != 'logout.php')) { header ("Location: http://" . LINK . "adminlogin.php"); } if(empty($spawnvalue) || empty($spawndesc) || empty($spawnlocation)) die("Field left Blank"); if (isset($_POST['submits'])) { if (isset($_POST['checkbox'])) { $names = NULL; foreach($_POST['checkbox'] as $key=>$val) { $mani = mysql_query("SELECT * FROM `guild_members` where ID = $val"); $result = mysql_query ($mani); while($test = mysql_fetch_array($mani, MYSQL_BOTH)) { $names .= "{$test['Name']}, "; $blah = $test['pts'] + $_POST['spawnvalue']; $query = "UPDATE guild_members SET pts=$blah where ID = $val"; $result = mysql_query ($query); if ($result) { echo ''.$test['Name'].': +'.$_POST['spawnvalue'].'<Br>'; } } } $names = substr($names, 0, -2); $checkbox = TRUE; } else { $checkbox = NULL; echo 'No checkboxes!<BR>'; exit (); } $query = "SELECT * FROM `guild_members` where ID = '$Scout'"; $result = mysql_query ($query); if (mysql_num_rows($result) != 0) { $mani = mysql_query("SELECT * FROM `guild_members` where ID = '$Scout'"); $result = mysql_query ($mani); while($test = mysql_fetch_array($mani, MYSQL_BOTH)) { $numb = 3; $point = $test['pts'] + $numb; $query = "UPDATE guild_members SET pts=$point where ID = '$Scout'"; $result = mysql_query ($query); if ($result) { echo "Scout: ".$test["Name"].""; } $cmdstr = "insert into spawns(spawnname, spawnlocation, spawndesc, spawnvalue, Rdate, message, posted, Scout) values ('{$_POST['spawnname']}', '{$_POST['spawnlocation']}', '{$_POST['spawndesc']}', '{$_POST['spawnvalue']}', '$Rdate', '$names', '$_SESSION[Fname]', '{$test['Name']}')"; $result = mysql_query($cmdstr); } } else { $cmdstr = "insert into spawns(spawnname, spawnlocation, spawndesc, spawnvalue, Rdate, message, posted, Scout) values ('{$_POST['spawnname']}', '{$_POST['spawnlocation']}', '{$_POST['spawndesc']}', '{$_POST['spawnvalue']}', '$Rdate', '$names', '$_SESSION[Fname]', '{$_POST['Scout']}')"; $result = mysql_query($cmdstr); if ($result) { echo "No Scout Was Rewarded!<BR><BR>"; } } } mysql_close(); } ?> Quote Link to comment https://forums.phpfreaks.com/topic/86773-help-me-please/#findComment-443509 Share on other sites More sharing options...
revraz Posted January 19, 2008 Share Posted January 19, 2008 You don't really say how it doesn't work. Try changing short tags <? to <?php Quote Link to comment https://forums.phpfreaks.com/topic/86773-help-me-please/#findComment-443511 Share on other sites More sharing options...
revraz Posted January 19, 2008 Share Posted January 19, 2008 I also don't see any quotes around your array indexes, are they constants? $members[Name] Quote Link to comment https://forums.phpfreaks.com/topic/86773-help-me-please/#findComment-443515 Share on other sites More sharing options...
goonygugle Posted January 19, 2008 Author Share Posted January 19, 2008 i realy dont know much about writing php scripts, just enough to install them and edit them a lil bit, the problem with the script is that there is a admin page that allows me to add points to multiple members by checking there name on a list, now when i sumbit it, the screen goes blank and doesnt update, i can also add members, manualy edit there info and this all still works fine Quote Link to comment https://forums.phpfreaks.com/topic/86773-help-me-please/#findComment-443527 Share on other sites More sharing options...
goonygugle Posted January 19, 2008 Author Share Posted January 19, 2008 sorry for lack of info and thank you very much for the help your giving me Quote Link to comment https://forums.phpfreaks.com/topic/86773-help-me-please/#findComment-443529 Share on other sites More sharing options...
revraz Posted January 19, 2008 Share Posted January 19, 2008 Check with your Host to see what changed on the day you noticed it stop working. Quote Link to comment https://forums.phpfreaks.com/topic/86773-help-me-please/#findComment-443534 Share on other sites More sharing options...
goonygugle Posted January 20, 2008 Author Share Posted January 20, 2008 i was informed php was upgraded on the server when my script stop working, what would that affect? Quote Link to comment https://forums.phpfreaks.com/topic/86773-help-me-please/#findComment-443994 Share on other sites More sharing options...
trq Posted January 20, 2008 Share Posted January 20, 2008 Have you changed your code from <? to <?php tags? Quote Link to comment https://forums.phpfreaks.com/topic/86773-help-me-please/#findComment-443996 Share on other sites More sharing options...
goonygugle Posted January 20, 2008 Author Share Posted January 20, 2008 yes i did Quote Link to comment https://forums.phpfreaks.com/topic/86773-help-me-please/#findComment-443997 Share on other sites More sharing options...
Fyorl Posted January 20, 2008 Share Posted January 20, 2008 Yeah, most likely register globals then. If you're looking for a quick and dirty fix you might try: <?php ini_set('register_globals', 'on'); ?> At the top of your file. Quote Link to comment https://forums.phpfreaks.com/topic/86773-help-me-please/#findComment-443998 Share on other sites More sharing options...
trq Posted January 20, 2008 Share Posted January 20, 2008 So what exactly is happening, what is the problem? Quote Link to comment https://forums.phpfreaks.com/topic/86773-help-me-please/#findComment-443999 Share on other sites More sharing options...
goonygugle Posted January 20, 2008 Author Share Posted January 20, 2008 So what exactly is happening, what is the problem? that didnt work, what exactly happens is when i fill in the info to post the pionts the next page will either be blank or say field blank and none of the info is transfered to the database Quote Link to comment https://forums.phpfreaks.com/topic/86773-help-me-please/#findComment-444015 Share on other sites More sharing options...
trq Posted January 20, 2008 Share Posted January 20, 2008 Yeah, most likely register globals then. If you're looking for a quick and dirty fix you might try: <?php ini_set('register_globals', 'on'); ?> At the top of your file. register_globals cannot be switched on via ini_set. We need to see the relevent code. Quote Link to comment https://forums.phpfreaks.com/topic/86773-help-me-please/#findComment-444018 Share on other sites More sharing options...
goonygugle Posted January 20, 2008 Author Share Posted January 20, 2008 here is a link to the entire script in a rar http://www.lnrguild.com/points/points.rar Quote Link to comment https://forums.phpfreaks.com/topic/86773-help-me-please/#findComment-444031 Share on other sites More sharing options...
goonygugle Posted January 20, 2008 Author Share Posted January 20, 2008 this should be the section that sumbits the post <? ob_start(); session_start(); require ('includes/mysql_connect.php'); if($_GET['action'] == "Members"){ echo '<font size=4>Guild Member Points Listings</font><BR>'; echo '<font color="red">***Lifetime Points are not for Auctions, they are a total of all points ever earned.</font>'; echo '<table width="490" border="1" bordercolor="000652" cellpadding="0" cellspacing="0" class="tablebg">' . "\n"; echo '<tr align="center" valign="middle" bgcolor="#090090"><td width="200" height="20"><b>Name</b></td>' . "\n"; echo '<td width="100">Rank</td><td width="100">Activity</td><td width="70">Currently</td><td width="60">Lifetime</td></tr>' . "\n"; $mani = mysql_query("SELECT * FROM `guild_members` where Rank != 'Ex-Member' ORDER BY `Name` asc LIMIT 0, 1000") or die("Could not connect to database"); while ($members = mysql_fetch_array($mani, MYSQL_BOTH)) { $total = $members[pts] + $members[usedpts]; echo '<tr align="center" valign="middle"><td width="200" class="names"><b>'.$members[Name].'</b></td>' . "\n"; echo '<td width="100">'.$members[Rank].'</td><td width="100">'.$members[Activity].'</td>' . "\n"; echo '<td width="70" bgcolor="#002253">'.$members[pts].'</td><td width="60">'.$total.'</td></tr>' . "\n"; } echo '</table><BR><BR><br>' . "\n"; $query = "SELECT * FROM `guild_members` where Rank = 'Ex-Member' ORDER BY `pts` DESC LIMIT 0, 100"; $result = mysql_query ($query); if (mysql_num_rows($result) != 0) { echo '<table width="490" border="1" bordercolor="000652" cellpadding="0" cellspacing="0" class="tablebg">' . "\n"; echo '<tr align="center" valign="middle" bgcolor="#090090"><td width="200" height="20"><b>Name</b></td>' . "\n"; echo '<td width="100">Rank</td><td width="100">Activity</td><td width="70">Currently</td><td width="60">Lifetime</td></tr>' . "\n"; $mani = mysql_query("SELECT * FROM `guild_members` where Rank = 'Ex-Member' ORDER BY `pts` DESC LIMIT 0, 100") or die("Could not connect to database"); while ($members = mysql_fetch_array($mani, MYSQL_BOTH)) { $total = $members[pts] + $members[usedpts]; echo '<tr align="center" valign="middle"><td width="200" class="names"><b>'.$members[Name].'</b></td>' . "\n"; echo '<td width="100">'.$members[Rank].'</td><td width="100">'.$members[Activity].'</td>' . "\n"; echo '<td width="70" bgcolor="#002253">'.$members[pts].'</td><td width="60">'.$total.'</td></tr>' . "\n"; } echo '</table><BR><BR><br>' . "\n"; } } if($_GET['action'] == "Pts"){ if (!isset($_SESSION['Fname']) AND (substr($_SERVER['PHP_SELF'], -10) != 'logout.php')) { header ("Location: http://" . LINK . "adminlogin.php"); } echo '<font size="4">Spawn Posting</font><BR>Please choose your spawn and check who was there.<BR>'; ?> <form method="post" action="<? $_SERVER['PHP_SELF']; ?>?action=Ptssub"> <? echo 'Spawn:<SELECT name="spawnname" value="">'; echo '<option value="">Choose Boss</option>'; echo '<option value="Barracoon">Barracoon</option>'; echo '<option value="Neira">Neira</option>'; echo '<option value="Rikktor">Rikktor</option>'; echo '<option value="Semidar">Semidar</option>'; echo '<option value="Mephisto">Mephisto</option>'; echo '<option value="Lord Oaks">Lord Oaks</option>'; echo '<option value="Harrower">Harrower</option></select>'; echo '<SELECT name="spawnlocation" value="">'; echo '<option value="">Choose Location</option>'; echo '<option value="Despise">Despise</option>'; echo '<option value="Destard">Destard</option>'; echo '<option value="Deceit">Deceit</option>'; echo '<option value="Shame">Shame</option>'; echo '<option value="Tera Keep">Tera Keep</option>'; echo '<option value="Oaks">Oaks</option>'; echo '<option value="COD">City of the Dead</option>'; echo '<option value="Damwin">Damwin</option>'; echo '<option value="Marble">Marble</option>'; echo '<option value="Tortise">Tortise</option>'; echo '<option value="Ice West">Ice West</option>'; echo '<option value="Ice East">Ice East</option>'; echo '<option value="Island">Sanc Island</option>'; echo '<option value="Hoppers Bog">Hoppers Bog</option>'; echo '<option value="Kaldun">Kaldun</option>'; echo '<option value="Desert">Desert</option>'; echo '<option value="Oasis">Oasis</option></select>'; echo '<input type="text" name="spawndesc" value="" size="30"> <font color="gray">'.$Rdate.'</font>' . "\n"; echo '<table width="400" border="1" bordercolor="000652" cellpadding="0" cellspacing="0" class="tablebg">' . "\n"; echo '<tr align="center" valign="middle"><td colspan="5" width="400" height="20"><b>Points Given</b><BR></td></tr>' . "\n"; echo '<tr><td width="80"><input type="checkbox" name="spawnvalue" value="1">1 Pt</td> <td width="80"><input type="checkbox" name="spawnvalue" value="2">2 Pt</td> <td width="80"><input type="checkbox" name="spawnvalue" value="3">3 Pt</td>' . "\n"; echo '<td width="80"><input type="checkbox" name="spawnvalue" value="4">4 Pt</td>' . "\n"; echo '<td width="80"><input type="checkbox" name="spawnvalue" value="5">5 Pt</td>' . "\n"; echo '<td width="80"><input type="checkbox" name="spawnvalue" value="6">6 Pt</td>' . "\n"; echo '<td width="80"><input type="checkbox" name="spawnvalue" value="7">7 Pt</td>' . "\n"; echo '<td width="80"><input type="checkbox" name="spawnvalue" value="8">8 Pt</td>' . "\n"; echo '<td width="80"><input type="checkbox" name="spawnvalue" value="9">9 Pt</td>' . "\n"; echo '<td width="80"><input type="checkbox" name="spawnvalue" value="10">10 Pt</td>' . "\n"; echo '</table><BR><BR>' . "\n"; echo 'Scout:<SELECT name="Scout" value="" class="forms">'; echo '<option value="None">None</option>'; $mani = mysql_query("SELECT * FROM `guild_members` ORDER BY `Name` ASC LIMIT 0, 1000") or die("Could not connect to database"); while ($guildlist = mysql_fetch_array($mani, MYSQL_BOTH)) { echo '<option value="'.$guildlist[iD].'">'.$guildlist[Name].'</option>'; } echo '<table width="440" border="1" bordercolor="000652" cellpadding="0" cellspacing="0" class="tablebg">' . "\n"; echo '<tr align="center" valign="middle" bgcolor="#090090"><td width="200" height="20"><b>Name</b></td>' . "\n"; echo '<td width="100">Rank</td><td width="60">Activity</td><td width="40">Pts.</td><td width="40">Check</td></tr>' . "\n"; $mani = mysql_query("SELECT * FROM `guild_members` ORDER BY `Name` ASC LIMIT 0, 1000") or die("Could not connect to database"); for ($i=1;$members = mysql_fetch_array($mani, MYSQL_BOTH);++$i) { echo '<tr align="center" valign="middle"><td width="200" class="names"><b>'.$members['Name'].'</b></td>' . "\n"; echo '<td width="100">'.$members['Rank'].'</td><td width="60">'.$members['Activity'].'</td><td width="40">'.$members['pts'].'</td>'; print '<td width="40"><input type="checkbox" name="checkbox[]" value="'.$members['ID'].'"><input type="hidden" name="checkedmembers[]" value"'.$members['Name'].'"> <input type="hidden" name="ID" value"'.$members['ID'].'"></td></tr>' . "\n"; }mysql_close(); echo '</table><BR><BR>' . "\n"; echo '<input type="submit" value="Update" name="submits"><br /></form><br />'; } if($_GET['action'] == "Ptssub"){ if (!isset($_SESSION['Fname']) AND (substr($_SERVER['PHP_SELF'], -10) != 'logout.php')) { header ("Location: http://" . LINK . "adminlogin.php"); } if(empty($spawnvalue) || empty($spawndesc) || empty($spawnlocation)) die("Field left Blank"); if (isset($_POST['submits'])) { if (isset($_POST['checkbox'])) { $names = NULL; foreach($_POST['checkbox'] as $key=>$val) { $mani = mysql_query("SELECT * FROM `guild_members` where ID = $val"); $result = mysql_query ($mani); while($test = mysql_fetch_array($mani, MYSQL_BOTH)) { $names .= "{$test['Name']}, "; $blah = $test['pts'] + $_POST['spawnvalue']; $query = "UPDATE guild_members SET pts=$blah where ID = $val"; $result = mysql_query ($query); if ($result) { echo ''.$test['Name'].': +'.$_POST['spawnvalue'].'<Br>'; } } } $names = substr($names, 0, -2); $checkbox = TRUE; } else { $checkbox = NULL; echo 'No checkboxes!<BR>'; exit (); } $query = "SELECT * FROM `guild_members` where ID = '$Scout'"; $result = mysql_query ($query); if (mysql_num_rows($result) != 0) { $mani = mysql_query("SELECT * FROM `guild_members` where ID = '$Scout'"); $result = mysql_query ($mani); while($test = mysql_fetch_array($mani, MYSQL_BOTH)) { $numb = 3; $point = $test['pts'] + $numb; $query = "UPDATE guild_members SET pts=$point where ID = '$Scout'"; $result = mysql_query ($query); if ($result) { echo "Scout: ".$test["Name"].""; } $cmdstr = "insert into spawns(spawnname, spawnlocation, spawndesc, spawnvalue, Rdate, message, posted, Scout) values ('{$_POST['spawnname']}', '{$_POST['spawnlocation']}', '{$_POST['spawndesc']}', '{$_POST['spawnvalue']}', '$Rdate', '$names', '$_SESSION[Fname]', '{$test['Name']}')"; $result = mysql_query($cmdstr); } } else { $cmdstr = "insert into spawns(spawnname, spawnlocation, spawndesc, spawnvalue, Rdate, message, posted, Scout) values ('{$_POST['spawnname']}', '{$_POST['spawnlocation']}', '{$_POST['spawndesc']}', '{$_POST['spawnvalue']}', '$Rdate', '$names', '$_SESSION[Fname]', '{$_POST['Scout']}')"; $result = mysql_query($cmdstr); if ($result) { echo "No Scout Was Rewarded!<BR><BR>"; } } } mysql_close(); } ?> Quote Link to comment https://forums.phpfreaks.com/topic/86773-help-me-please/#findComment-444033 Share on other sites More sharing options...
goonygugle Posted January 20, 2008 Author Share Posted January 20, 2008 actually i think this is it <? ob_start(); session_start(); require ('includes/mysql_connect.php'); if($action == "Viewspawns") { echo '<font size=4>Recent Spawn Listings</font>'; if ( $page == NULL || $page < 1 ) $page = 1; echo '<table border="1" bordercolor="000652" cellpadding="0" cellspacing="0" class="tablebg">' . "\n"; echo '<tr align="left" valign="top"><td>'; $mani = mysql_query("SELECT * FROM `spawns` ORDER BY `ID` DESC LIMIT ".(($page-1)*30).", 30") or die("Could not connect to database"); while ($erm = mysql_fetch_array($mani, MYSQL_BOTH)) { #Admin edit check if($_SESSION[Level] > 1) { echo '<a href="?action=Editspawn&id='.$erm['ID'].'"><font color="red">Edit</font></a> - '; } echo '<a href="spawns.php?action=Displayspawn&id='.$erm['ID'].'">' . "\n"; echo ''.$erm['spawnname'].' | '.$erm['spawnlocation'].': '.$erm['spawndesc'].'</a> - '.$erm['Rdate'].' '.$erm['Rtime'].'<BR>' . "\n"; } $query = "SELECT * FROM `spawns`" or die("Could not connect to database"); $result = mysql_query ($query); $totalfields = mysql_num_rows($result); $totalpages = $totalfields / 30; if ( $totalfields % 30 > 0 ) $totalpages++; echo '<BR><BR>Page: '; for( $i = 1; $i <= $totalpages; $i++) { if ( $page != $i ) echo '<a href="?action=Viewspawns&page='.$i.'">'.$i.'</a>'; else echo $i; if ( $i < $totalpages ) echo ' | '; } exit(); } echo '</td></tr></table>'; if($action == "Displayspawn"){ if ( $id == NULL || !is_numeric($id) || $id < 1 ) $id = 1; echo '<font size=4>Spawn Listings</font>'; $mani = mysql_query("SELECT * FROM `spawns` where `ID` = $id") or die("Could not connect to database"); $result = mysql_query($mani); while ($erm = mysql_fetch_array($mani, MYSQL_BOTH)) { echo '<table width="500" border="1" bordercolor="000652" cellpadding="0" cellspacing="0" class="tablebg">' . "\n"; echo '<tr align="left" valign="middle"><td width="500" height="20" colspan="2"><b>Spawn:</b>'.$erm['spawnname'].' | '.$erm['spawnlocation'].': '.$erm['spawndesc'].'<BR></td>' . "\n"; echo '</tr><tr><td width="500" align="right" colspan="2">'.$erm['Rdate'].' '.$erm['Rtime'].'</td></tr>' . "\n"; echo '<tr><td width="250" align="left" valign="top">Scout: '.$erm['Scout'].' +1</td>' . "\n"; echo '<td width="250" align="right" valign="top">+'.$erm['spawnvalue'].' Spawn Pts</td></tr>' . "\n"; echo '<tr><td width="500" height="100" align="left" valign="top" colspan="2"><b>Attended:</b> '.$erm['message'].'</td></tr>'; echo '<tr><td width="500" align="right" valign="top" colspan="2"><b>Posted by:</b> '.$erm['posted'].'</td></tr>'; echo '</table><BR><BR>' . "\n"; } exit(); } if($action == "Editspawn"){ if (!isset($_SESSION['Fname']) AND (substr($_SERVER['PHP_SELF'], -10) != 'logout.php')) { header ("Location: http://" . LINK . "adminlogin.php"); } if ( $id == NULL || !is_numeric($id) || $id < 1 ) $id = 1; if (isset($_POST['submit'])) { $mani = mysql_query("SELECT * FROM `spawns` where `ID` = $id") or die("Could not connect to database"); $result = mysql_query($mani); while ($erm = mysql_fetch_array($mani, MYSQL_BOTH)) { $query = "UPDATE spawns SET spawnname='{$_POST['editname']}', spawndesc='{$_POST['editdesc']}', spawnvalue='{$_POST['editvalue']}', message='{$_POST['editmembers']}', Scout='{$_POST['editscout']}', posted='{$_POST['editposted']}' where ID = '$id'"; $result = mysql_query ($query); } echo '<BR><BR>-= Spawn edited and saved =-<BR>'; $mani = mysql_query("SELECT * FROM `spawns` where `ID` = $id") or die("Could not connect to database"); $result = mysql_query($mani); while ($erm = mysql_fetch_array($mani, MYSQL_BOTH)) { echo '<table width="400" border="1" bordercolor="000652" cellpadding="0" cellspacing="0" class="tablebg">' . "\n"; echo '<tr align="left" valign="middle"><td width="400" height="20" colspan="2"><b>Spawn:</b>'.$erm['spawnname'].' - '.$erm['spawndesc'].'<BR></td>' . "\n"; echo '</tr><tr><td width="400" align="right" colspan="2">'.$erm['Rdate'].' '.$erm['Rtime'].'</td></tr>' . "\n"; echo '<tr><td width="200" align="left" valign="top">Scout: '.$erm['Scout'].' +1</td>' . "\n"; echo '<td width="200" align="right" valign="top">+'.$erm['spawnvalue'].' Spawn Pts</td></tr>' . "\n"; echo '<tr><td width="400" height="100" align="left" valign="top" colspan="2"><b>Attended:</b> '.$erm['message'].'</td></tr>'; echo '<tr><td width="400" align="right" valign="top" colspan="2"><b>Posted by:</b> '.$erm['posted'].'</td></tr>'; echo '</table><BR><BR>' . "\n"; } exit(); } $mani = mysql_query("SELECT * FROM `spawns` where `ID` = $id") or die("Could not connect to database"); $result = mysql_query($mani); while ($erm = mysql_fetch_array($mani, MYSQL_BOTH)) { echo '<font size=4>Spawn Listings</font>'; echo '<form action="spawns.php?action=Editspawn&id='.$id.'" method="post">'; echo '<table width="450" border="0" bordercolor="000652" cellpadding="0" cellspacing="0" class="tablebg">' . "\n"; echo '<tr align="right" valign="middle"><td width="450">'; echo 'Name:<input type="text" name="editname" value="'.$erm['spawnname'].'" size="20"><BR>' . "\n"; echo 'Description:<input type="text" name="editdesc" value="'.$erm['spawndesc'].'" size="20"><BR>' . "\n"; echo 'Points:<input type="text" name="editvalue" value="'.$erm['spawnvalue'].'" size="2"> ' . "\n"; echo 'Scout:<input type="text" name="editscout" value="'.$erm['Scout'].'" size="20"><BR>' . "\n"; echo 'Attended:<textarea name="editmembers" value="" cols="40" rows="6">'.$erm['message'].'</textarea><BR>' . "\n"; echo 'Posted by:<input type="text" name="editposted" value="'.$erm['posted'].'" size="20"><BR>' . "\n"; echo '<input type="submit" value="Edit" name="submit"><BR>'; echo '</td></tr></table>' . "\n"; } exit(); } exit(); ?> Quote Link to comment https://forums.phpfreaks.com/topic/86773-help-me-please/#findComment-444035 Share on other sites More sharing options...
revraz Posted January 20, 2008 Share Posted January 20, 2008 Still shows the <? tag instead of <?php Quote Link to comment https://forums.phpfreaks.com/topic/86773-help-me-please/#findComment-444038 Share on other sites More sharing options...
goonygugle Posted January 20, 2008 Author Share Posted January 20, 2008 they are changed on the one actualy running on the server Quote Link to comment https://forums.phpfreaks.com/topic/86773-help-me-please/#findComment-444269 Share on other sites More sharing options...
goonygugle Posted January 20, 2008 Author Share Posted January 20, 2008 i created a database on a different server and the script runs fine with it,i would just keep at that but not too sure how much i like running it from a free mysql server Quote Link to comment https://forums.phpfreaks.com/topic/86773-help-me-please/#findComment-444275 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.