Jump to content
MakeWebGames

Miks

Members
  • Posts

    90
  • Joined

  • Last visited

Everything posted by Miks

  1. I have created a table in the database to store the winner of the lottery. The table has 3 columns: id, lotuid(userid), lotuname(username), the table successfully collects the users id but doesnt collect the username This is what I have done //Add to winner log $test=$db->query("SELECT `username` FROM `users` WHERE `userid`='$userid'"); $ug=$db->fetch_row($test); $db->query("INSERT INTO `lotterylog` (`id`, `lotuid`, `lotuname`) VALUES ('', '{$userid}', '{$test}')");   Any advice?
  2. Yea that would be awesome!
  3. Apparently I need the white statement The feature adds an award to an award Table, it checks to see if the user has the award, if they dont it goes onto the else statement and adds it. The problem I am having is everytime you refresh the page it keeps adding the award. I must point out that this is for Award number 2,3,4+ etc Award 1 doesnt repeat itself. So the select and fetch section is only looking at one row i.e Award 1 even though award 2 is in the table as well. So I need help getting the result to query the whole table and not just 1 row.....if that makes sense
  4. Thanks but when I changed it to your suggestion it then added the award and every time I loaded the page it would duplicate on the screen and the database So first visit it added one award and displayed 1 award, the second time it would display two awards and add the award twice, then 4 times and then 8 times etc
  5. I dont seem to understand, I cant get it to work right $i=$db->query("SELECT `awardno` FROM `uawards` WHERE userid={$userid}"); $a = $db->fetch_row($i); if ($ir['level'] <= 9 && $a['awardno'] == 2) { while($a = $db->fetch_row($i)) { echo "You have the award already"; } } else if ($ir['level'] >= 10) { $db->query("INSERT INTO `uawards` (`id`, `userid`, `awardno`) VALUES ('',{$userid}, '2')"); echo " <div class='desc2'> <div class='citstat'> <table class='mytable'><tr><td><center><BR> <font color='green'>Congratulations!</font> you have earned an award!<BR><img src='https://cdn4.iconfinder.com/data/icons/pc_de_hamburg_icon_pack/32x32/bestseller.png'><BR>You have reached level 10<BR><BR></center></td></tr></table></div></div> "; }   Its failing and going straight to the else if statement and adding the award again.....Need a smoke break!
  6. Update: Award 1 gets added to the database and doesnt repeat itself when you visit the page with this code, so appears to work fine   <?php require_once("globals.php"); $i=$db->query("SELECT * FROM `uawards` WHERE userid={$userid}"); $a=$db->fetch_row($i); if ($a['awardno'] == 1 && $ir['level'] >= 5) { echo "You have the award"; } else if ($ir['level'] >= 5) { $db->query("INSERT INTO `uawards` (`id`, `userid`, `awardno`) VALUES ('',{$userid}, '1')"); echo " <div class='desc2'> <div class='citstat'> <table class='mytable'><tr><td><center><BR> <font color='green'>Congratulations!</font> you have earned an award!<BR><img src='https://cdn4.iconfinder.com/data/icons/pc_de_hamburg_icon_pack/32x32/bestseller.png'><BR>You have reached level 10<BR><BR></center></td></tr></table></div></div> "; } $h->endpage(); ?>   Award 2 with pretty much the same code works but every time you refresh the page it adds itsel over and over agin. The same applies to award 3.......But when you visit award 1 it wont repeat itself. Heres the code for award 2, its the same as award 1 but with the check values changed   <?php require_once("globals.php"); $i=$db->query("SELECT * FROM `uawards` WHERE userid={$userid}"); $a=$db->fetch_row($i); if ($a['awardno'] == 2 && $ir['level'] >= 10) { echo "You have the award"; } else if ($ir['level'] >= 10) { $db->query("INSERT INTO `uawards` (`id`, `userid`, `awardno`) VALUES ('',{$userid}, '2')"); echo " <div class='desc2'> <div class='citstat'> <table class='mytable'><tr><td><center><BR> <font color='green'>Congratulations!</font> you have earned an award!<BR><img src='https://cdn4.iconfinder.com/data/icons/pc_de_hamburg_icon_pack/32x32/bestseller.png'><BR>You have reached level 10<BR><BR></center></td></tr></table></div></div> "; }   Here is a screenshot of the table structure [ATTACH]1852[/ATTACH] I've spent hours trying to figure it out, maybe it was my table structure? so i spent time reading up on Primary, Index, Unique values etc Then I started reading up on fetch_row and read somewhere that it only looks at one row? Then I started reading up on fetch array, assoc, object etc I also thought it might be to do with my statements and my checks.... Anyway, a few hours later and I'v learned a bit more but cant work out why its not working and repeating the other awards but not award 1
  7. [MENTION=68711]KyleMassacre[/MENTION] You were right, thank you, and I took your advise about having the AI id column aswell ☺
  8. I have another problem, using the same code it wont add a second award, is this because my userid is already in the table? If I remove the first award from the database then it will add the second award but if there is already an award in the database it wont add the next one. QUERY ERROR: Query was INSERT INTO `uawards` (`id`, `reason`, `awardno`) VALUES ('1', 'You got this award for reaching level 10', '2')   <?php require_once("globals.php"); $i=$db->query("SELECT * FROM uawards"); $a=$db->fetch_row($i); if ($a['awardno'] == 2 && $ir['level'] >= 10) { echo "You are level 5 and you have this award"; } else if ($ir['level'] >= 10) { $db->query("INSERT INTO `uawards` (`id`, `reason`, `awardno`) VALUES ('$userid', 'You got this award for reaching level 10', '2')"); echo "Award Added"; } $h->endpage(); ?>   I've tried $db->query("INSERT INTO uawards (id, reason, awardno) VALUES ($userid, 'You got this award for reaching level 10', 2)"); and $db->query("INSERT INTO `uawards` (`id`, `reason`, `awardno`) VALUES ('$userid', 'You got this award for reaching level 10', '2')");
  9. [MENTION=65530]Coly010[/MENTION] Thank you that was very helpful and informative as always, I greatly appreciate you taking the time out and to go into detail. I will take a read of your references this evening!
  10. The page loads but doesnt display the success message and doesnt input the data with the below string, no query error though? $db->query("INSERT INTO uawards (id, reason, awardno) VALUES ($userid, You got this award for reaching level 5, 1)");   <?php require_once("globals.php"); $i=$db->query("SELECT * FROM uawards WHERE id={$userid}"); $a=$db->fetch_row($i); if ($a['awardno'] == 1 && $ir['level'] == 5) { echo "You are level 5 and you have this award"; } else if ($ir['level'] == 5) { $db->query("INSERT INTO uawards (id, reason, awardno) VALUES ($userid, You got this award for reaching level 5, 1)"); echo "Award Added"; } $h->endpage(); ?>
  11. That didnt work, the brackets caused an unexpected T string error so I removed them and then it came up with a query error similar to this QUERY ERROR: Query was INSERT INTO 'uawards' VALUES '1', 'You got this award for reaching level 5', '1' $db->query("INSERT INTO 'uawards' VALUES '$userid', 'You got this award for reaching level 5', '1'");
  12. One last question on the same topic if you dont mind I'm having trouble coming up with the right query to then assign them there award. I have tried the following $db->query("INSERT INTO uawards WHERE reason=You got this award for reaching level 5 , awardno=1 , id=$userid"); $db->query("INSERT INTO uawards SET reason=You got this award for reaching level 5 , awardno=1 , id=$userid"); $db->query("UPDATE uawards SET reason='You got this award for reaching level 5' , awardno='1' , id='$userid'"); $db->query("UPDATE uawards SET reason='You got this award for reaching level 5' , awardno='1' , id='$userid' WHERE id='$userid'"); $db->query("UPDATE uawards INSERT reason='You got this award for reaching level 5' , awardno='1' , id='$userid' WHERE id='$userid'"); $db->query("INSERT reason=You got this award for reaching level 5 , awardno=1 , id=$userid WHERE id=$userid"); So I'm guessing I dont need to use UPDATE as its not updating a value but adding a new value to a table? This is the first time I have created another table and assigned the user ID as well as the value to that table etc. Well to be honest I'm doing a lot of firsts this week! Heres the full code for the page I have taken a look at some examples from other pages within the game to try and help but :(   <?php require_once("globals.php"); $i=$db->query("SELECT * FROM uawards WHERE id={$userid}"); $a=$db->fetch_row($i); if ($a['awardno'] == 1 && $ir['level'] == 5) { echo "You are level 5 and you have this award"; } else if ($ir['level'] == 5) { $db->query("INSERT reason=You got this award for reaching level 5 , awardno=1 , id=$userid WHERE id=$userid"); echo "Award Added"; } $h->endpage(); ?>
  13. Thanks [MENTION=65073]lucky3809[/MENTION] it works now :)
  14. Ok for some reason its not seeing if ($i['awardno'] == 1) Spelling is correct, well I hope so as I've triple checked! I'm not sure what would be stopping it? When I put the ticks in ' it gives me this error QUERY ERROR: Query was SELECT 'awardno' FROM 'uawards' WHERE 'id'=1
  15. I wanted to create an award system, I have most of it setup but now I need to add a request to some pages to check if the user has the award already, if they deserve it, and then issue it. So for example I am checking to see if a user is Level 5 and if they have been given the award already I know theres probably something out there similar but I am doing this to learn, plus it would be nice to make my own version. Anyway, heres the code Whats happening is even though I am level 5 and have the award it is still going to the statement that says "Award Added" awardno = Each award has its own number which is how I'm going to check if they have it already, I have issued myself this award so I have award no 1 and I am level 5   <?php require_once("globals.php"); $i=$db->query("SELECT * FROM uawards WHERE id={$userid}"); if ($ir['level'] == 5 && $i['awardno'] == 1 ) { echo "You are level 5 and you have the award"; } else if ($ir['level'] == 5) { echo "Award Added"; } $h->endpage(); ?>   I'm guessing its to do with this line? Somethings wrong but what? if ($ir['level'] == 5 && $i['awardno'] == 1 ) Anyways, as always thanks for taking the time to look!!
  16. [MENTION=70574]TheMasterGeneral[/MENTION] I gotta say this is an awesome feature   From a users point of view there is no statement for if the user ID you entered doesnt exist but thats a minor. Tested it several times with other players and it seems to work fine Oh and its probably the forum doing this but on the DB queries where the user gets put in hospital theres a big gap on the "reason" variable which breaks it, again its a minor Also I checked the logs table in the database and it appears (if Im right, and theres a high chance I'm not) that the log is putting the same user ID for rr_p1 and rr_p2
  17. Ok I think I may see now where I have gone wrong.... I was originally basing this on the search the streets feature but wanted to hide the event from the url. So I started using this way as it was one of a few suggestions. The search the street feature does it this way else if($_GET['search'] == 3) { if($rand == 1) {   I now see what you mean :(
  18. This is the part I'm talking about   $chance=mt_rand(3,3); $hchance=mt_rand(1,1);   else if ($chance == 3) { if ($hchance == 1) { echo " <table class='mytable'><tr><td><center><h2>In The Hatch</h2> <img src='img/stairs.jpg' width='500px' height='300px'> You end up in a large room with 2 tunnels leading off and a stairs leading deeper down into the underground hatch Take the stairs <a href=''>Down</a> Take the tunnel on the <a href=''>Left</a> Take the next tunnel on the <a href=''>Right</a> Look for an exit <a href=''>Leave</a> </center></td></tr></table>"; } else { $Time = mt_rand(2,5); echo " As you walk down the dark and scary looking tunnel you here something creep up behind youBefore you can turn around you feel a blade pushed into your back <a href='hospital.php'>Hospital</a>"; $db->query(sprintf("UPDATE users SET hospital = $time , hospreason = 'While searching you got stabbed' WHERE `userid` = $userid")); } } The second statement i.e "else" the one that puts the user in hospital isnt appearing i.e the text and the db query isnt happening, this is the one that I want to happen when I load the page. All its doing is displaying the top statement which it shouldnt be doing. I'm new to this but to me it reads If chance == 3 and hchance == 1 put the user in hospital But what it is doing is If chance == 3 and hchance == something other than 1 then display the top statement Its the first time I'm doing something like this but if I have got it wrong then show me because I really dont understand at the moment
  19. Sorry for the confusion I thought by making $hchance=mt_rand(1,1) and $chance=mt_rand(3,3) it would force it to select those appropriate results so I can test and tell when its working as it will trigger the second result i.e $hchance to put the user in hospital I am not getting any error message, all its doing is displaying the "else if" statement which is just taking into consideration only the $chance variable and not then looking at the "if" statement i.e $hchance and triggering that result The if statement is the one that is not triggering
  20. [MENTION=65530]Coly010[/MENTION] Thanks but that didnt work unfortunately :( same issue as before
  21. Nearly there So I have adopted what [MENTION=70574]TheMasterGeneral[/MENTION] has suggested and its now doing what I wanted but I have one more problem that I cant work out :( I have two random variables i.e $chance=mt_rand(1,3); $hchance=mt_rand(1,5);   $chance represents which random event to trigger $hchance will be used to trigger another event once $chance has been triggered Anyway everything that runs under an IF statement works fine but if you look at my code and see where event 3 is I have added an else statement but cant get that to trigger. Does anyone know why?   $chance=mt_rand(2,3); $hchance=mt_rand(1,1); require('globals.php'); //Your user tests if($ir['brave'] <= 0) { echo $noturns; $h->endpage(); exit; } if($ir['jail']) { print "<div class='desc2'> <div class='citstat'> <table class='mytable'><tr><td><center><BR> How can you enter the hatch when you're in jail <BR><a href='jail.php'>Go back to jail</a> <BR><BR></center></td></tr></table>"; $h->endpage(); exit; } if($ir['hospital']) { print "<div class='desc2'> <div class='citstat'> <table class='mytable'><tr><td><center><BR> How can you enter the hatch when you're in hospital recovering<<BR>a href='hospital.php'>Go back to Hospital</a> <BR><BR></center></td></tr></table>"; $h->endpage(); exit; } // The events $db->query("UPDATE `users` SET `brave`=`brave`-1 WHERE `userid`=$userid"); If ($chance == 1) { echo " <table class='mytable'><tr><td><center><h2>In The Hatch</h2> <img src='http://yupi.md/wp-content/uploads/2014/12/1692009144053.jpg' width='500px' height='300px'><BR><BR> Its dark, you cant see anything but you hear a sound down one of the tunnels<BR><BR> Take the tunnel straight <a href=''>Ahead</a><BR> Take the tunnel on the <a href=''>Left</a><BR> Take the next tunnel on the <a href=''>Right</a><BR> Time to leave <a href=''>Leave</a><BR> <BR></center></td></tr></table>"; } if ($chance == 2) { echo " <table class='mytable'><tr><td><center><h2>In The Hatch</h2> <img src='img/stairs.jpg' width='500px' height='300px'><BR><BR> You end up in a large room with 2 tunnels leading off and a stairs leading deeper down into the underground hatch<BR><BR> Take the stairs <a href=''>Down</a><BR> Take the tunnel on the <a href=''>Left</a><BR> Take the next tunnel on the <a href=''>Right</a><BR> Look for an exit <a href=''>Leave</a><BR> <BR></center></td></tr></table>"; } else if ($chance == 3) { if ($hchance == 1) { echo " <table class='mytable'><tr><td><center><h2>In The Hatch</h2> <img src='img/stairs.jpg' width='500px' height='300px'><BR><BR> You end up in a large room with 2 tunnels leading off and a stairs leading deeper down into the underground hatch<BR><BR> Take the stairs <a href=''>Down</a><BR> Take the tunnel on the <a href=''>Left</a><BR> Take the next tunnel on the <a href=''>Right</a><BR> Look for an exit <a href=''>Leave</a><BR> <BR></center></td></tr></table>"; } else { $Time = mt_rand(2,5); echo " As you walk down the dark and scary looking tunnel you here something creep up behind you<BR>Before you can turn around you feel a blade pushed into your back <br /><a href='hospital.php'>Hospital</a>"; $db->query(sprintf("UPDATE users SET hospital = $time , hospreason = 'While searching you got stabbed' WHERE `userid` = $userid")); } }
  22. [MENTION=70574]TheMasterGeneral[/MENTION] Thank you I will use your method :)
  23. I have tried numerous ways to implement what you have told me but I cant get it to work The below code is what I'm working with, how would I implement $_post and how would I add mt_rand to the function I changed all the GETs to POSTs but that didnt work, I'm guessing theres more to just changing GET to POST Anyway I'm stuck and would appreciate a helping hand   <?php $noturns = "<div class='desc2'> <div class='citstat'>It requires a player to have a certain amount of Skill to enter the hatch which you dont have<BR> <a href='mountains.php'>Home</a>"; include(DIRNAME(__FILE__) . '/globals.php'); if($ir['brave'] <= 0) { echo $noturns; $h->endpage(); exit; } if($ir['jail'] or $ir['hospital']) { print "<div class='desc2'> <div class='citstat'>How can you enter the hatch when you're in jail or recovering in hospital<BR><a href='mountains.php'>Leave</a>"; $h->endpage(); exit; } $_GET['hatch'] = isset($_GET['hatch']) && is_string($_GET['hatch']) ? trim($_GET['hatch']) : ""; switch($_GET['hatch']) { case 'search': search_hatch(); break; default: index(); break; } function index() { global $db, $ir, $userid, $h, $db; $Type = mt_rand(1, 10); echo " <style type='text/css'> .style1 { text-align: center; } </style> <div class='desc2'> <div class='citstat'> <table class='mytable'> <h2>Inside The Hatch</h2>"; echo " <tr><td><center><BR> You climb down some old wooden ladders which take you to a large, dark, poorly light underground<br> room with 3 tunnels leading off in different directions. Which way do you want to go?<BR><br> Take the path that leads straight ahead <a href='?hatch=search&search=$Type'>Ahead</a><BR> Take the path that leads left <a href='?hatch=search&search=$Type'>Left</a><BR> Take the path that leads right <a href='?hatch=search&search=$Type'>Right</a><BR> Climb back up the ladders <a href='mountains.php'>Leave</a><BR><br></center></td></tr></table> "; } function search_hatch() { global $db, $ir, $userid, $h; /*----------------------------------------------------- # Start Config # -----------------------------------------------------*/ $nonrecorded = "What you doing here?<br /><a href='index.php'>Go back</a>"; $rand = mt_rand(0,2); $randhard = mt_rand(0,3); $randharder = mt_rand(0,6); $randmoney = mt_rand(1,100); $randcrystals = mt_rand(1,8); $itemidsearch2 = 155; //Item id for search 2 $quantitysearch2 = 1; //Item quantity for search 2 $itemidsearch4 = 159; //Item id for search 4 $quantitysearch4 = 1; //Item quantity for search 4 $itemidsearch5 = 131; //Item id for search 5 $quantitysearch5 = 1; //Item quantity for search 5 $itemidsearch7 = 160; //Item id for search 7 $quantitysearch7 = 1; //Item quantity for search 7 $itemidsearch8 = 150; //Item id for search 8 $quantitysearch8 = 1; //Item quantity for search 8 $itemidsearch9 = 150; //Item id for search 9 $quantitysearch9 = 1; //Item quantity for search 9 /*----------------------------------------------------- # End Config # -----------------------------------------------------*/ $_GET['search'] = abs(@intval($_GET['search'])); if(!$_GET['search']) { echo $nonrecorded; $h->endpage(); exit; } $db->query("UPDATE `users` SET `brave`=`brave`-1 WHERE `userid`=$userid"); if($_GET['search'] == 1) { echo " <div class='desc2'> <div class='citstat'> <span style='color:red;font-weight:700;'>Unlucky!</span><br />You didnt find anything down this path<br /> Take the path that leads straight ahead <a href='?hatch=search&search=".$Type."'>Ahead</a><BR> Take the path that leads left <a href='?hatch=search&search=".$Type."'>Left</a><BR> Turn back <a href='?hatch=search&search=".$Type."'>Back</a><BR>"; } else if($_GET['search'] == 2) { if($rand == 1) { $db->query("INSERT INTO `inventory` VALUES('',$itemidsearch2,$userid,$quantitysearch2)"); echo "<div class='desc2'> <div class='citstat'><span style='color:green;font-weight:700;'>Success</span><br />While searching ".$cityname." you found a mysterious item. Go to your inventory to find out what<br /><a href='inventory.php'>Inventory</a><br /><a href='mountainhatch.php'>Streets</a>"; } else { $Time = mt_rand(2,10); echo "<div class='desc2'> <div class='citstat'><span style='color:red;font-weight:700;'>Unlucky!</span><br />As you walk down the dark scary looking path you here something creep up behind you<BR>Before you can turn around you feel a blade pushed into your back <br /><a href='hospital.php'>Hospital</a>"; $db->query(sprintf("UPDATE `users` SET `hospital` = %u, `hospreason` = 'While searching %s you got stabbed' WHERE `userid` = %u", $Time, $cityname, $userid)); } } else if($_GET['search'] == 3) { if($rand == 1) { $db->query("UPDATE `users` SET `money`=`money`+".$randmoney." WHERE `userid`=$userid"); echo "<div class='desc2'> <div class='citstat'><font color = 'green'><b>Sucess</b></font><br />You earned ".money_formatter($randmoney)." for robbing an old man of his pension"; } else { $Time = mt_rand(2,10); echo "<div class='desc2'> <div class='citstat'><span style='color:red;font-weight:700;'>Unlucky!</span><br />While searching ".$cityname." you got shot.<br /><a href='hospital.php'>Click Here</a>"; $db->query(sprintf("UPDATE `users` SET `hospital` = %u, `hospreason` = 'While searching %s they got shot' WHERE `userid` = %u", $Time, $cityname, $userid)); } } else if($_GET['search'] == 4) { if($randhard == 1) { $db->query("INSERT INTO inventory VALUES('',$itemidsearch4,$userid,$quantitysearch4)"); echo "<div class='desc2'> <div class='citstat'><span style='color:green;font-weight:700;'>Success</span><br />While searching ".$cityname." you found an mysterious item. Go to your inventory to find out what<br /><a href='inventory.php'>Inventory</a><br /><a href='streets.php'>Streets</a>"; } else { echo "<div class='desc2'> <div class='citstat'><span style='color:red;font-weight:700;'>Unlucky!</span><br />While searching ".$cityname." you found NOTHING!<br /><a href='streets.php'>Click Here</a>"; } } else if($_GET['search'] == 5) { $db->query("INSERT INTO inventory VALUES('',$itemidsearch5,$userid,$quantitysearch5)"); echo "<div class='desc2'> <div class='citstat'><span style='color:green;font-weight:700;'>Success</span><br />While searching underground you found an mysterious item. Go to your inventory to find out what<br /><a href='inventory.php'>Inventory</a><br /><a href='streets.php'>Streets</a>"; } else if($_GET['search'] == 6) { if($rand == 1) { $db->query("UPDATE users SET `crystals`=`crystals`+".$randcrystals." WHERE userid=$userid"); echo "<div class='desc2'> <div class='citstat'><span style='color:green;font-weight:700;'>Success</span><br />While searching ".$cityname." You fell down a hole and found a crystal mine , You took ".number_format($randcrystals)."<br /><a href='streets.php'>Click Here</a>"; } else { $Time = mt_rand(2,10); echo "<div class='desc2'> <div class='citstat'><span style='color:red;font-weight:700;'>Unlucky!</span><br />While searching ".$cityname." a police officer arrested you.<br /><a href='jail.php'>Jail</a>"; $db->query(sprintf("UPDATE `users` SET `jail` = %u, `jail_reason` = 'Arrested for hanging around %s' WHERE `userid` = %u", $Time, $cityname, $userid)); } } else if($_GET['search'] == 7) { if($rand == 1) { $db->query("INSERT INTO inventory VALUES('',$itemidsearch7,$userid,$quantitysearch7)"); echo "<div class='desc2'> <div class='citstat'><span style='color:green;font-weight:700;'>Success</span><br />While searching ".$cityname." You found an mysterious item. Go to your inventory to find out what<br /><a href='inventory.php'>Inventory</a><br /><a href='streets.php'>Streets</a>"; } else { $Time = mt_rand(2,10); echo "<div class='desc2'> <div class='citstat'> <table class='mytable'> <tr><td><center><BR> <span style='color:red;font-weight:700;'>Unlucky!</span><br />While searching ".$cityname." a police officer arrested you.<br /><a href='jail.php'>Click Here</a><br><BR></center></td></tr></table>"; $db->query(sprintf("UPDATE `users` SET `jail` = %u, `jail_reason` = 'Arrested for hanging around %s' WHERE `userid` = %u", $Time, $cityname, $userid)); } } else if($_GET['search'] == 8) { if($randhard == 1) { $db->query("INSERT INTO inventory VALUES('',$itemidsearch8,$userid,$quantitysearch8)"); echo "<div class='desc2'> <div class='citstat'> <table class='mytable'> <tr><td><center><BR> <span style='color:green;font-weight:700;'>Success</span><br />While searching you found an mysterious item. Go to your inventory to find out what<br /><a href='inventory.php'>Inventory</a><br /><a href='streets.php'>Streets</a><br><BR></center></td></tr></table>"; } else { $Time = mt_rand(2,8); echo "<div class='desc2'> <div class='citstat'> <table class='mytable'> <tr><td><center><BR> <span style='color:red;font-weight:700;'>The tunnel collapsed!</span><br />The tunnel collapsed! and you fell into an old tomb<br> <a href='hospital.php'>Click Here</a><br><BR></center></td></tr></table>"; $db->query(sprintf("UPDATE `users` SET `hospital` = %u, `hospreason` = 'Hospitalized for falling into an old tomb %s' WHERE `userid` = %u", $Time, $cityname, $userid)); } } else if($_GET['search'] == 9) { if($randhard == 1) { $db->query("INSERT INTO inventory VALUES('',$itemidsearch8,$userid,$quantitysearch8)"); echo "<div class='desc2'> <div class='citstat'> <table class='mytable'> <tr><td><center><BR> <span style='color:green;font-weight:700;'>Success</span><br />While searching you found an mysterious item. Go to your inventory to find out what<br /><a href='inventory.php'>Inventory</a><br /><a href='streets.php'>Streets</a><br><BR></center></td></tr></table>"; } else { $Time = mt_rand(2,8); echo "<div class='desc2'> <div class='citstat'> <table class='mytable'> <tr><td><center><BR> <span style='color:red;font-weight:700;'>The path collapsed!</span><br />The path collapsed and you fell into an old tomb<br /><a href='hospital.php'>Click Here</a><BR><br></center></td></tr></table>"; $db->query(sprintf("UPDATE `users` SET `hospital` = %u, `hospreason` = 'Hospitalized for falling into an old tomb %s' WHERE `userid` = %u", $Time, $cityname, $userid)); } } else if($_GET['search'] == 10) { if($rand == 1) { echo " <div class='desc2'> <div class='citstat'> <table class='mytable'> <tr><td><center><BR> You didnt find anything down this path<br><br> Take the path to the right <a href='?hatch=search&search=".$Type."'>Ahead</a><BR> Take the path that leads left <a href='?hatch=search&search=".$Type."'>Left</a><BR> Turn back <a href='?hatch=search&search=".$Type."'>Back</a><BR><BR> </center></td></tr></table> "; } else { echo " <div class='desc2'> <div class='citstat'> <table class='mytable'> <tr><td><center><BR> You didnt find anything down this path<br><br> You see a hole in the ground with ladders going down <a href='?hatch=search&search=".$Type."'>Down</a><BR> Follow the path straight ahead <a href='?hatch=search&search=".$Type."'>Ahead</a><BR> Take the path that leads left <a href='?hatch=search&search=".$Type."'>Left</a><BR> Take the path that leads right <a href='?hatch=search&search=".$Type."'>Right</a><BR> Turn back <a href='?hatch=search&search=".$Type."'>Back</a><BR> <BR></center></td></tr></table> "; } } } $h->endpage(); ?>
  24. I have created a feature which works a lot like Searching The Streets. The problem that I am having is you can see the random event number in the url like so: google.com/mountainhatch.php?hatch=search&search=8 So if a user realizes that event 8 can potentially give you money then they can sit there hitting refresh and continuously earn money. The search the streets feature has the same issue. I could create multiple IF and Else statements for event 8 so its not easy for them to get the result there after but I would like to add special items which can only be found with certain events. Anyway is there a way to hide the event number from the url? Heres the code $Type = mt_rand(1, 10); Take the path that leads left <a href='?hatch=search&search=".$Type."'>Left</a><BR>
×
×
  • Create New...