Jump to content

Monk3h

Members
  • Posts

    223
  • Joined

  • Last visited

    Never

Everything posted by Monk3h

  1. I'm not sure.. Could you add what you mean to the script and ill give it a try?
  2. This is a mini chat system im using, its displayed in the top right corner of my site, it works fine apart from when i click Chat to post a message it takes me to chat.php. How would i change this script so that it dosnt take me to chat.php but still does the action. =/ <?php Print"<center> <form method=post action=chat.php?action=minichat> <tr><td colspan=2 align=center> <input type=text name=msg size=15> <input type=submit value=Chat> </form></center>"; } if ($action == minichat) { if ($msg){ if ($stat[rank] == Admin) { $starter = "<span style=color:#0066cc>$stat[user]</span>"; } elseif ($stat[sub] > 0) { $starter = "<span style=color:#FF0000>$stat[user]</span>"; } elseif ($stat[rank] == Staff) { $starter = "<span style=color:#629632>$stat[user]</span>"; } else { $starter = "$stat[user]"; } mysql_query("insert into chat (user, chat) values('$starter', '$msg')"); mysql_query("update players set chatline=chatline+1 where id=$stat[id]"); } } ?> <iframe src=minichat.php width='100%' height=306 id=ifr name=ifr frameborder=0></iframe> </td></tr> </table><br> BTW, Chat .php is the main chat script.
  3. How would i order this: $msel = mysql_query("select * from players where tribe=$mytribe[id]"); while ($mem = mysql_fetch_array($msel)) { } By ID Ascending?
  4. I was looking for && instead of ||. Managed to go thru all the possible ones and founf the right one. Thanks for your help.
  5. Also the Tribe Leader cant View that area now. =/
  6. That didnt work. When a coowner tries to view a section with that at the start it still displays the "You are now a tribe owner message" Even tho they should be able to view it. :S
  7. To keep tribe members from doing actions they shouldnt be able to do i am currently using this. if ($stat[id] != $mytribe[owner]) How would i edit this so that tribe Coowners are alowed to view these areas as well as Owners? Im not sure how to add the if ($stat[id] != $mytribe[owner] or $mytribe[coowner]) Please help..
  8. How would i add that to my script?
  9. When people enter a value into the text box they can buy it for the corect price. But iv noticed that its possible to add + <any number> and you get any number for Free as it adds onto the SQL string (im guessing) Is there any short and fast fay to fix this problem. I tried running the text box value thru a String_replace but it stoped the box from working and no matter what you tried to buy it would just buy 0 every time. =/ if ($mytribe[devcount] >=1) { Print "<form method=post action=dtroops.php?step=buy&troop=1> <table> <tr> <td width='25%'><center>$unit1[name]</center></td> <td width='25%'><center>$unit1[cost] Credits</center></td> <td width='25%'><center><input number=text name=aunit1></b></center></td> <td width='25%'><center><input type=submit value=Buy></form></center></td> </tr> <tr> <td colspan=4><center>$unit1[description]</center></td> </tr> </table></form><br><br>"; if ($troop == 1) { if ($stat[id] != $mytribe[owner]) { Print "You are not the Tribe Owner, you dont have the authority to do that!"; include ("footer.php"); exit; } $amm1 = ($unit1[cost] * $aunit1); if ($mytribe[credits] < $amm1) { Print "<b>Your Tribe Does not have that many Credits.<br><br></b>"; } elseif ($mytribe[land] < $land1) { Print "<b>Your Tribe Does not have enough land to Support.</b>"; } else { Print "<b>You Bought <i>$aunit1 $unit1[name](s) </i>for Your tribe at a cost of $amm1 Credits</b><br><br>"; mysql_query("update tribes set land=land-$land1 where id=$mytribe[id]"); mysql_query("update tribes set credits=credits-$amm1 where id=$mytribe[id]"); mysql_query("update tribes set Wall=Wall+$aunit1 where id=$mytribe[id]"); mysql_query("insert into tlog (owner,log) values($mytribe[id],'<span style=color:#993399>$stat[user] has bought $aunit1 Walls for $amm1 Credits. </span>')"); } } Any help will be greatly aprechiated. Thanks. =]
  10. I am currently using a simple PHP chat room in my game, when people post its put into a Database and the every 20 second the page refreshes automaticly using this code. <META HTTP-EQUIV=Refresh CONTENT="20;url=chatmsgs.php"> My problem is after a hwile the refreshes get faster and kind of catch up with them selfs. Slowing the refresh down only slows chat down and just takes longer for the chat to go crazy and just keep refreshing over n over very quickly. Is there any way around this?
  11. Solved. Deleted the post for security reasons. Had some info on there i shouldnt of. Sorry.
  12. Does anyone know where i can find a Word Filter script for my chat that uses the String_replace Command? I know how to make one i was just wondering if anyone knew where i could find one with allot of the words already entered. There are allot of ways to get past a word filter using upper/lowercase letter and it would take me a very long time to filter them all. =/
  13. The thing is its not jsut in this one place where things are being Doubled up. Its all over my site. When you buy weapons you get 2 if you can offord it, when you take steps in the forrest it uses 2 instead of one. You still get both Steps worth of Stuff.. you just cant see the first step. do you have any idea what could be causing this? =/
  14. Footer.php </td></tr> </table><br> <br> </td><td width=20% valign=top> <table cellpadding=0 cellspacing=0 class=td width=100%> <tr><td style="border-bottom: solid 747d58 1px;" bgcolor=DDCC71 align=center> <b>Storage</b> </td></tr> <tr><td> <?php print "<center><b><u></b></u></center>"; print "<b>Rats Tails:</b> $stat[ratt]<br>"; print "<b>Chicken Feathers:</b> $stat[chickf]<br>"; print "<b>Wolf Hairs:</b> $stat[wolfh]<br>"; print "<b>Hunters Arrows:</b> $stat[hunta]<br>"; print "<b>Witches Brooms:</b> $stat[witchb]<br>"; print "<b>Cobra Fangs:</b> $stat[cobraf]<br>"; print "<b>Dragon Scales:</b> $stat[drags]<br><br>"; if ($stat[mines] > 0) { print "<b>Burelia:</b> $stat[burelia]<br>"; print "<b>Alethite:</b> $stat[alethite]<br><br>"; } if ($stat[dams] > 0) { print "<b>LargeMouth Bass:</b> $stat[bass]<br>"; print "<b>Saratoga:</b> $stat[saratoga]<br>"; } ?> </td></tr> </table><br> <table cellpadding=0 cellspacing=0 class=td width=100%> <tr><td style="border-bottom: solid 747d58 1px;" bgcolor=DDCC71 align=center> <b>Online Players</b> </td></tr> <tr><td> <?php $psel = mysql_query("select * from players order by id asc"); $ctime = time(); while ($pl = mysql_fetch_array($psel)) { $span = ($ctime - $pl[lpv]); if ($span <= 500) { if ($pl[rank] == Admin) { print "<img src=images/admin.gif>"; } if ($pl[rank] == Staff) { print "<img src=Tiny_S.gif>"; } print "$pl[tag]<A href=view.php?view=$pl[id]>$pl[user]</a> ($pl[id])"; if ($pl[sub] > 0) { print "<img src=http://www.renhelp.net/images/tutorials/star.gif>"; } print "<br>"; $numo = ($numo + 1); } } ?> </td></tr> </table><br> <table cellpadding=0 cellspacing=0 class=td width=100%> <tr><td style="border-bottom: solid 747d58 1px;" bgcolor=DDCC71 align=center> <b>Game Stats</b> </td></tr> <tr><td> <?php $nump = @mysql_num_rows(mysql_query("select * from players")); $numw = @mysql_num_rows(mysql_query("select * from equipment where type='W'")); $numa = @mysql_num_rows(mysql_query("select * from equipment where type='A'")); print "<b>$nump</b> total players.<br>"; print "<b>$numo</b> players online.<br>"; print "<b>$numw</b> weapons.<br>"; print "<b>$numa</b> armor.<br>"; ?> </td></tr> </table><br> <table cellpadding=0 cellspacing=0 class=td width=100%> <tr><td style="border-bottom: solid 747d58 1px;" bgcolor=DDCC71 align=center> <b>Vote for Rise of Kingdoms</b></td></tr> <tr><td> <?php print "Please vote using these links to help promote and support this game. For each vote you will receive <b>1 Diamond</b>. The more you vote, the more people see the game, and therefore the more people join and make the game more enjoyable!<br><br>"; if ($stat[vote] == N) { print "<a href=vote.php?vote=1>Top 100 Arena</a><br>"; } if ($stat[vote2] == N) { print "<a href=vote.php?vote=2>Top 50 Onrpg</a><br>"; } if ($stat[vote3] == N) { print "<a href=vote.php?vote=3>Top Game Sites</a><br>"; } if ($stat[vote4] == N) { print "<a href=vote.php?vote=4>GTOP 100</a><br>"; } if ($stat[vote5] == N) { print "<a href=vote.php?vote=5>Game Sites 100</a><br>"; } if ($stat[vote6] == N) { print "<a href=vote.php?vote=6>Ultimate Top 200 Game Sites</a><br>"; } if ($stat[vote7] == N) { print "<a href=vote.php?vote=7>PHP Games Network</a>"; } ?> </td></tr> </td></tr> </table> <center> <!------------(C) 2008 Adam Miller and James Eley GNU Library or Lesser Public License (LGPL)------------> </body> </html>
  15. Another thing, It seems to only happen in Firefox. When in IE this does not happen.
  16. Problem: For some reason when i insert into my log table in my database it double Posts. the first post has all the $mytribe[id] stuff filled in as it should. The second post is exactly the same but all the $stuff is left out. :s Problem Code: mysql_query("insert into tlog (owner, log) values($mytribe[id],'<span style=color:#009900>Your tribe Successfully attacked $enemytribe[name] and gained $landgain land.</span>')"); This is the code just before it: Print "<span style=color:#009900>You Won the battle!<br><br>You gained <b>$landgain</b> Land!</span>"; mysql_query("update tribes set lose=lose+1 where id=$enemytribe[id]"); mysql_query("update tribes set win=win+1 where id=$mytribe[id]"); mysql_query("update tribes set land=land+$landgain where id=$mytribe[id]"); mysql_query("update tribes set land=land-$landgain where id=$enemytribe[id]"); mysql_query("update tribes set energy=energy-10 where id=$mytribe[id]"); This is the Complete Script: <?php $title = "Tribe War Room"; include("header.php"); ?> <?php $mytribe = mysql_fetch_array(mysql_query("select * from tribes where id=$stat[tribe]")); print "Welcome to the war room Commander $stat[user], Who's tribe would you like to attack today?<br><br>"; print "<table><form method=post action=tribebattle.php?action=battle>"; print "<tr><td>Tribe ID:</td><td><input type=text name=tid> "; print "<input type=submit value=Attack></td></tr>"; print "</form></table><br><br>Wins: <b>$mytribe[win]</b><br>Losses: <b>$mytribe[lose]</b><br><br><br>"; if ($action == battle) { $enemytribe = mysql_fetch_array(mysql_query("select * from tribes where id=$tid")); $unit1 = mysql_fetch_array(mysql_query("select * from dtroops where id=1")); $unit2 = mysql_fetch_array(mysql_query("select * from dtroops where id=2")); $unit3 = mysql_fetch_array(mysql_query("select * from dtroops where id=3")); $unit4 = mysql_fetch_array(mysql_query("select * from dtroops where id=4")); $unit5 = mysql_fetch_array(mysql_query("select * from troops where id=1")); $unit6 = mysql_fetch_array(mysql_query("select * from troops where id=2")); $unit7 = mysql_fetch_array(mysql_query("select * from troops where id=3")); $unit8 = mysql_fetch_array(mysql_query("select * from troops where id=4")); $unit9 = mysql_fetch_array(mysql_query("select * from troops where id=5")); $unit10 = mysql_fetch_array(mysql_query("select * from troops where id=6")); $unit1a = ($unit5[dmg] * $mytribe[Peasant]); $unit2a = ($unit6[dmg] * $mytribe[ArmedPeasant]); $unit3a = ($unit7[dmg] * $mytribe[Recruit]); $unit4a = ($unit8[dmg] * $mytribe[TrainedAssasin]); $unit5a = ($unit9[dmg] * $mytribe[Archer]); $unit6a = ($unit10[dmg] * $mytribe[Rifleman]); $unit1d = ($unit1[dmg] * $enemytribe[Wall]); $unit2d = ($unit2[dmg] * $enemytribe[GuardTower]); $unit3d = ($unit3[dmg] * $enemytribe[Catapult]); $unit4d = ($unit4[dmg] * $enemytribe[WoodenTrap]); $attack = ($unit1a + $unit2a + $unit3a + $unit4a + $unit5a + $unit6a); $defence = ($unit1d + $unit2d + $unit3d + $unit4d); $landcap = ($mytribe[land] / 2); $landloss = ($mytribe[land] / 10); $landgain = ($enemytribe[land] / 10); if ($stat[id] != $mytribe[owner]) { Print "You are not the Tribe Owner, you do not have the authority to deploy your tribes troops."; include ("footer.php"); exit; } if ($enemytribe[land] < $landcap){ Print "The enemies tribe is out of range!"; include ("footer.php"); exit; } if ($mytribe[energy] < 10){ Print"Your tribe does not have enough energy to do that!"; include ("footer.php"); exit; } if ($attack < 0){ Print "You dont have any troops, are you Crazy!?"; include ("footer.php"); exit; } if ($defence >= $attack){ Print "<span style=color:#CC0000>You lost the battle!</span>"; mysql_query("update tribes set lose=lose+1 where id=$mytribe[id]"); mysql_query("update tribes set win=win+1 where id=$enemytribe[id]"); mysql_query("update tribes set energy=energy-5 where id=$mytribe[id]"); mysql_query("insert into tlog (owner, log) values($mytribe[id],'<span style=color:#CC0000>Your tribe attacked $enemytribe[name] and Lost.</span>')"); mysql_query("insert into tlog (owner, log) values($enemytribe[id],'<span style=color:#009900>Your tribe Successfully Defended them selfs against an attack from $mytribe[name]</span>')"); include ("footer.php"); exit; }else{ Print "<span style=color:#009900>You Won the battle!<br><br>You gained <b>$landgain</b> Land!</span>"; mysql_query("update tribes set lose=lose+1 where id=$enemytribe[id]"); mysql_query("update tribes set win=win+1 where id=$mytribe[id]"); mysql_query("update tribes set land=land+$landgain where id=$mytribe[id]"); mysql_query("update tribes set land=land-$landgain where id=$enemytribe[id]"); mysql_query("update tribes set energy=energy-10 where id=$mytribe[id]"); mysql_query("insert into tlog (owner, log) values($mytribe[id],'<span style=color:#009900>Your tribe Successfully attacked $enemytribe[name] and gained $landgain land.</span>')"); mysql_query("insert into tlog (owner, log) values($enemytribe[id],'<span style=color:#CC0000>Your tribe unsuccessfully Defended them selfs against an attack from $mytribe[name] and lost $landgain land.</span>')"); }} ?> <?php include("footer.php"); ?> Please help. I have no idea why its doing this. I have used exactly the same string to add to the tlog table in other areas of the game and this dosnt happen. So confused.
  17. Monk3h

    PHP Log

    I have made a small PHP log syetm. The problem is i want it to display the last 15 logs. and it displays the first 15. How would i edit my script to do what i want? $lsel = mysql_query("SELECT * FROM `tlog` WHERE `owner` = '$stat[tribe]' ORDER BY `id` DESC LIMIT 15"); if($lsel){ while($arr = mysql_fetch_assoc($lsel)){ extract($arr); echo "<table width='100%' border='0' cellspacing='0' cellpadding='0'> <tr> <td width='4%'></td> <td width='92%'>$log</td> <td width='4%'></td> </tr> </table>"; } }else{ die("Unable to connect to database. ".mysql_error()); }
  18. It seems to post it once with the $example included. then again without them.. :s
  19. This is the entire Script. Iv posted it all because its prety small. <?php $title = "Tribe War Room"; include("header.php"); ?> <?php $mytribe = mysql_fetch_array(mysql_query("select * from tribes where id=$stat[tribe]")); print "Welcome to the war room Commander $stat[user], Who's tribe would you like to attack today?<br><br>"; print "<table><form method=post action=tribebattle.php?action=battle>"; print "<tr><td>Tribe ID:</td><td><input type=text name=tid> "; print "<input type=submit value=Attack></td></tr>"; print "</form></table><br><br>Wins: <b>$mytribe[win]</b><br>Losses: <b>$mytribe[lose]</b><br><br><br>"; if ($action == battle) { $enemytribe = mysql_fetch_array(mysql_query("select * from tribes where id=$tid")); $unit1 = mysql_fetch_array(mysql_query("select * from dtroops where id=1")); $unit2 = mysql_fetch_array(mysql_query("select * from dtroops where id=2")); $unit3 = mysql_fetch_array(mysql_query("select * from dtroops where id=3")); $unit4 = mysql_fetch_array(mysql_query("select * from dtroops where id=4")); $unit5 = mysql_fetch_array(mysql_query("select * from troops where id=1")); $unit6 = mysql_fetch_array(mysql_query("select * from troops where id=2")); $unit7 = mysql_fetch_array(mysql_query("select * from troops where id=3")); $unit8 = mysql_fetch_array(mysql_query("select * from troops where id=4")); $unit9 = mysql_fetch_array(mysql_query("select * from troops where id=5")); $unit10 = mysql_fetch_array(mysql_query("select * from troops where id=6")); $unit1a = ($unit5[dmg] * $mytribe[Peasant]); $unit2a = ($unit6[dmg] * $mytribe[ArmedPeasant]); $unit3a = ($unit7[dmg] * $mytribe[Recruit]); $unit4a = ($unit8[dmg] * $mytribe[TrainedAssasin]); $unit5a = ($unit9[dmg] * $mytribe[Archer]); $unit6a = ($unit10[dmg] * $mytribe[Rifleman]); $unit1d = ($unit1[dmg] * $enemytribe[Wall]); $unit2d = ($unit2[dmg] * $enemytribe[GuardTower]); $unit3d = ($unit3[dmg] * $enemytribe[Catapult]); $unit4d = ($unit4[dmg] * $enemytribe[WoodenTrap]); $attack = ($unit1a + $unit2a + $unit3a + $unit4a + $unit5a + $unit6a); $defence = ($unit1d + $unit2d + $unit3d + $unit4d); $landcap = ($mytribe[land] / 2); $landloss = ($mytribe[land] / 10); $landgain = ($enemytribe[land] / 10); if ($stat[id] != $mytribe[owner]) { Print "You are not the Tribe Owner, you do not have the authority to deploy your tribes troops."; include ("footer.php"); exit; } if ($enemytribe[land] < $landcap){ Print "The enemies tribe is out of range!"; include ("footer.php"); exit; } if ($mytribe[energy] < 10){ Print"Your tribe does not have enough energy to do that!"; include ("footer.php"); exit; } if ($attack < 0){ Print "You dont have any troops, are you Crazy!?"; include ("footer.php"); exit; } if ($defence >= $attack){ Print "<span style=color:#CC0000>You lost the battle!</span>"; mysql_query("update tribes set lose=lose+1 where id=$mytribe[id]"); mysql_query("update tribes set win=win+1 where id=$enemytribe[id]"); mysql_query("update tribes set energy=energy-5 where id=$mytribe[id]"); mysql_query("insert into tlog (owner, log) values($mytribe[id],'<span style=color:#CC0000>Your tribe attacked $enemytribe[name] and Lost.</span>')"); mysql_query("insert into tlog (owner, log) values($enemytribe[id],'<span style=color:#009900>Your tribe Successfully Defended them selfs against an attack from $mytribe[name]</span>')"); include ("footer.php"); exit; }else{ Print "<span style=color:#009900>You Won the battle!<br><br>You gained <b>$landgain</b> Land!</span>"; mysql_query("update tribes set lose=lose+1 where id=$enemytribe[id]"); mysql_query("update tribes set win=win+1 where id=$mytribe[id]"); mysql_query("update tribes set land=land+$landgain where id=$mytribe[id]"); mysql_query("update tribes set land=land-$landgain where id=$enemytribe[id]"); mysql_query("update tribes set energy=energy-10 where id=$mytribe[id]"); mysql_query("insert into tlog (owner, log) values($mytribe[id],'<span style=color:#009900>Your tribe Successfully attacked $enemytribe[name] and gained $landgain land.</span>')"); mysql_query("insert into tlog (owner, log) values($enemytribe[id],'<span style=color:#CC0000>Your tribe unsuccessfully Defended them selfs against an attack from $mytribe[name] and lost $landgain land.</span>')"); }} ?> <?php include("footer.php"); ?>
  20. Yeah, its in the DB twice. This is some more of the code. mysql_query("insert into tlog (owner, log) values($mytribe[id],'<span style=color:#009900>Your tribe Successfully attacked $enemytribe[name] and gained $landgain land.</span>')"); mysql_query("insert into tlog (owner, log) values($enemytribe[id],'<span style=color:#CC0000>Your tribe unsuccessfully Defended them selfs against an attack from $mytribe[name] and lost $landgain land.</span>')");
  21. My problem is that one of my mysql_query Insert into Strings is double posting and i have no idea why!? :S This is the code that is double posting. mysql_query("insert into tlog (owner, log) values($mytribe[id],'<span style=color:#009900>Your tribe Successfully attacked $enemytribe[name] and gained $landgain land.</span>')"); the output im getting isn't an exact double.. but it still shouldnt apear. Output: Your tribe Successfully attacked TEST TRIE BETA and gained 0 land. Your tribe Successfully attacked and gained 0 land. Any ideas?
  22. All i want is to be able to use a $example[name] but with a gap. EG $example[name name] This is the code im using so far.. $mytribe = mysql_fetch_array(mysql_query("select * from tribes where id=$stat[tribe]")); and $mytribe[example name]
  23. Why does it post it in a vertical line? ID Owner Log Unread Instead of ID Owner Log Unread
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.