Jump to content

grant09

Members
  • Posts

    22
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

grant09's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. hello php freaks am not sure y this is not working i want the textarea not to so my messages i want them hiding so that users can edit lines but when i reply the messages wont show here is the message i want to hide in the textarea but its not getting the old message that the user has sent and not showing the message i have just typed its just blank with lines ------------- like so any help would be great thanks <td width='13%'>Message:</td><td width='87%' align="center"><textarea name='msgtext' cols='70' rows='7' id='message' class="areatest"></textarea> <input type="hidden" name='msgtext' value='<? echo ($_GET['reply'] != "") ? " \n -------- \n ".$worked2['msgtext'] : ""; ?>'> </td> here the php file am using the now <? include 'header.php'; if ($_GET['delete'] != ""){ $deletemsg = $_GET['delete']; $result = mysql_query("DELETE FROM `pms` WHERE `id`='".$deletemsg."'"); echo Message("Message Deleted!"); } if ($_GET['deleteall'] == "true"){ $result = mysql_query("DELETE FROM `pms` WHERE `to`='".$user_class->username."'"); echo Message("Message Deleted!"); } if ($_POST['newmessage'] != ""){ $to = $_POST['to']; $from = $user_class->id; $timesent = time(); $subject = strip_tags($_POST['subject']); $msgtext = strip_tags($_POST['msgtext']); $checkuser = mysql_query("SELECT `username` FROM `grpgusers` WHERE `username`='".$to."'"); $username_exist = mysql_num_rows($checkuser); if($username_exist > 0){ $result= mysql_query("INSERT INTO `pms` (`to`, `from`, `timesent`, `subject`, `msgtext`)". "VALUES ('$to', '$from', '$timesent', '$subject', '$msgtext')"); echo Message("Message successfully sent to $to <meta HTTP-EQUIV='REFRESH' content='1; url=pms.php'>"); } else { echo Message('I am sorry but the Username you specified does not exist...'); } } function smilie($string) { global $dir; $smilie = array(") " => '<img src="smileys/21.gif">', ":-? " => '<img src="smileys/39.gif">', " " => '<img src="smileys/10.gif">', ":-> " => '<img src="smileys/15.gif">', " " => '<img src="smileys/4.gif">', ":f: " => '<img src="smileys/23.gif">', "=)) " => '<img src="smileys/24.gif">', ":| " => '<img src="smileys/22.gif">', ":-J " => '<img src="smileys/78.gif">', ":-O " => '<img src="smileys/13.gif">', ":-$ " => '<img src="smileys/32.gif">', "6543 " => '<img src="smileys/65.gif">', ":-: " => '<img src="smileys/46.gif">', ":__: " => '<img src="smileys/6.gif">', ":" => '<img src="smileys/112.gif">', ":12" => '<img src="smileys/77.gif">', ":65" => '<img src="smileys/68.gif">', "(" => '<img src="smileys/20.gif">', ":ang" => '<img src="smileys/14.gif">', ":ang" => '<img src="smileys/14.gif">', ":657" => '<img src="smileys/19.gif">', "xD" => '<img src="smileys/">' ); return strtr($string, $smilie); } function bbCode($string) { $bb = array("[b]" => "<b>", "[/b]" => "</b>", "[u]" => "<u>", "[/u]" => "</u>", "[s]" => "<s>", "[img]" => "[img]", "[/img]" => "[/img]", "[/s]" => "<s>", "[sup]" => "<sup>", "[/sup]" => "</sup>", "[sub]" => "<sub>", "[/sub]" => "</sub>", "[time]" => date('G:i (A)') ); return strtr($string, $bb); } ?> <? if ($_GET['reply'] != ""){ $result2 = mysql_query("SELECT * from `pms` WHERE `id`='".$_GET['reply']."'"); $worked2 = mysql_fetch_array($result2); $from_user_class = new User($worked2['from']); } ?> <link href="style.css" rel="stylesheet" type="text/css" /> <table width="100%" border="0" class="contenthead"> <tr> <td align="center">Reply</td> </tr> </table> <table width="100%" border="0" class="contentcontent"> <tr> <td height="16"> </td> </tr> <tr><td class="contentcontentnob"><table width='100%' class="contentcontent"> <form method='post'> <tr> <td width='13%'>Sending To:</td><td width='87%'><?php echo $_GET['to'] . $from_user_class->username; ?><input type='hidden' name='to' value='<?php echo $_GET['to'] . $from_user_class->username; ?>' size='20' maxlength='20'> </tr> <tr> <td width='13%'>Subject:</td><td width='87%' align="center"><input class="areatest" type='text' name='subject' style="width: 500px" maxlength='75' value="<? echo ($_GET['reply'] != "") ? "Re: ".$worked2['subject'] : ""; ?>"></td> </tr> <tr> <td width='13%'>Message:</td><td width='87%' align="center"><textarea name='msgtext' cols='70' rows='7' id='message' class="areatest"></textarea> <input type="hidden" name='msgtext' value='<? echo ($_GET['reply'] != "") ? " \n -------- \n ".$worked2['msgtext'] : ""; ?>'> </td> </tr> <tr><td width='13%'> </td><td width='87%' align="center"><img src="smileys/21.gif" alt="" onclick="insertSmiley(')')" /> <img src="smileys/39.gif" alt="" onclick="insertSmiley(':-?')" /> <img src="smileys/10.gif" alt="" onclick="insertSmiley('')" /> <img src="smileys/15.gif" alt="" onclick="insertSmiley(':->')" /> <img src="smileys/4.gif" alt="" onclick="insertSmiley('')" /> <img src="smileys/23.gif" alt="" onclick="insertSmiley(':f:')" /> <img src="smileys/24.gif" alt="" onclick="insertSmiley('=))')" /> <img src="smileys/22.gif" alt="" onclick="insertSmiley(':|')" /> <img src="smileys/78.gif" alt="" onclick="insertSmiley(':-J')" /> <img src="smileys/13.gif" alt="" onclick="insertSmiley(':-O')" /> <img src="smileys/32.gif" alt="" onclick="insertSmiley(':-$')" /> <img src="smileys/65.gif" alt="" onclick="insertSmiley('6543')" /> <img src="smileys/46.gif" alt="" onclick="insertSmiley(':-:')" /> <img src="smileys/6.gif" alt="" onclick="insertSmiley(':__:')" /> <img src="smileys/112.gif" alt="" onclick="insertSmiley(':')" /> <img src="smileys/20.gif" alt="" onclick="insertSmiley('(')" /> <img src="smileys/14.gif" alt="" onclick="insertSmiley(':ang')" /> <img src="smileys/19.gif" alt="" onclick="insertSmiley(':657')" /></td> </tr> <tr> <td width='13%'></td><td width='87%' align='left'><input name='newmessage' type='submit' class="buttong" value='Send'></td> </tr> </form> </table></td></tr> <tr><td class="contentcontent"><table width='100%' style='table-layout:fixed;WORD-BREAK:BREAK-ALL;'> <td width='100%' align="center"><br><br> <i>previous message</i> <pre><? echo ($_GET['reply'] != "") ? " ".$worked2['msgtext'] : ""; ?></pre></td> </tr> </table></td></tr> <? include 'footer.php'; ?>
  2. hello all users of phpfreaks am making a game a mafia game and need someone with exp to check for bugs if there is any bugs would you please mail me them so i can get them seen to thanks http://www.mafia-warriors.net/warrior.txt website : http://www.mafia-warriors.net
  3. grant09

    $_POST

    yes but i want the money to be like 29.000.000 am trying to fink if this may be it prettynum($_POST['amount']) that make the number like so 000.000.000 with out the prettynum() its 000000000
  4. grant09

    $_POST

    ok am workin on this script its a points market for a text based game but my money is not taking the amount of the players i points on the market ... just say i post 10 points for $29.000.000 ... and when the player buys the points it takes the money from that user and give the user points but .... when the user buy the points it dont give the user the money it give $290 ?? not sure is its my SQL av post that to <?php include 'header.php'; $_POST['buypoints'] = abs(intval($_POST['buypoints']));{ $result = mysql_query("SELECT * FROM `pointsmarket` WHERE `id`='".$_POST['points_id']."'"); $worked = mysql_fetch_array($result); $price = $worked['price']; $amount = $worked['amount']; $totalcost = $price * prettynum($_POST['amount']); $newpointsinmarket = $amount - prettynum($_POST['amount']); $user_points = new User($worked['owner']); if ($worked['owner'] == $user_class->id) { echo Message("You have taken ".$_POST['amount']." points off the market."); $newpoints = $user_class->points + $_POST['amount'];; $result = mysql_query("UPDATE `grpgusers` SET `points` = '".$newpoints."' WHERE `id`='".$user_class->id."'"); $user_class = new User($_SESSION['id']); if ($newpointsinmarket == 0){ $result = mysql_query("DELETE FROM `pointsmarket` WHERE `id`='".$worked['id']."'"); } else { $result = mysql_query("UPDATE `pointsmarket` SET `amount` = '".$newpointsinmarket."' WHERE `id`='".$worked['id']."'"); } include 'footer.php'; die(); } $_POST['amount'] = abs(intval($_POST['amount'])); $_POST['points_id'] = abs(intval($_POST['points_id']));{ } $_POST['amount'] = abs(intval($_POST['amount'])); $_POST['points_id'] = abs(intval($_POST['points_id']));{ } if ($totalcost > prettynum($user_class->money)){ echo Message("You don't have enough money."); } if($_POST['amount'] >= 1 && $_POST['amount'] <= $amount && $totalcost <= $user_class->money){ echo Message("You have bought ".$_POST['amount']." points for $".$totalcost); $newpoints = $user_class->points + $_POST['amount']; $newmoney = $user_class->money - $totalcost; $result = mysql_query("UPDATE `grpgusers` SET `money` = '".$newmoney."', `points` = '".$newpoints."' WHERE `id`='".$user_class->id."'"); $newmoney = $user_points->money + $totalcost; $result = mysql_query("UPDATE `grpgusers` SET `money` = '".$newmoney."' WHERE `id`='".$user_points->id."'"); $user_class = new User($_SESSION['id']); if ($newpointsinmarket == 0){ $result = mysql_query("DELETE FROM `pointsmarket` WHERE `id`='".$worked['id']."'"); } else { $result = mysql_query("UPDATE `pointsmarket` SET `amount` = '".$newpointsinmarket."' WHERE `id`='".$worked['id']."'"); } } } $_POST['addpoints'] = abs(intval($_POST['addpoints'])); $_POST['id'] = abs(intval($_POST['id']));{ } if($_POST['amount'] < 1){ } if($_POST['price'] < 1){ } if ($_POST['amount'] >= 1 && prettynum($_POST['amount']) <= $user_class->points && $_POST['price'] >= 1){ echo Message("You have added ".$_POST['amount']." points to the market a price of $".$_POST['price']." per point."); $result= mysql_query("INSERT INTO `pointsmarket` (owner, amount, price)"."VALUES ('$user_class->id', '$_POST[amount]', '$_POST[price]')"); $newpoints = $user_class->points - $_POST['amount']; $result = mysql_query("UPDATE `grpgusers` SET `points` = '".$newpoints."' WHERE `id`='".$user_class->id."'"); $user_class = new User($_SESSION['id']); } ?> <link href="style.css" rel="stylesheet" type="text/css" /> <tr><td class="contenthead">Point Market</td></tr> <tr><td align="center" class="contentcontent"> <p> </p> <p><strong>You need to be a Respected Warrior to add points to the market</strong><br> Use this form to add points to the points market.</p> <p><strong>Bank Account[<? echo prettynum($user_class->bank) ?>]</strong><strong></strong><br /> <strong><a href="pointmarket.php">[Refresh</a>]</strong></p> <form method='post'> <table align="center"> <tr> <td>Amount of points</td><td> <input name='amount' type='text' class="areatest" value='0' size='10' maxlength='20'></td> </tr> <tr> <td>Price per point</td><td>$<input name='price' type='text' class="areatest" value="0" size='10' maxlength='20'></td> <tr><td align="center" colspan="2"><input name='addpoints' type='submit' class="buttong" value='Add Points'></form></td> </tr></table> </td></tr> <tr><td class="contentcontent"> <?php $result = mysql_query("SELECT * FROM `pointsmarket` ORDER BY `price` DESC"); while($line = mysql_fetch_array($result, MYSQL_ASSOC)) { $user_points = new User($line['owner']); if ($user_points->id == $user_class->id){ $submittext = "Remove"; } else { $submittext = "Buy"; } echo "<form method='post'>"; echo $user_points->formattedname." - ".$line['amount']." points for ".prettynum($line['price'],1)." per point <input type='text' name='amount' size='3' maxlength='20' value='".prettynum($line['amount'])."'><input type='hidden' name='points_id' value='".$line['id']."'><input type='submit' name='buypoints' value='".$submittext."'></form><br>"; } ?> </td></tr> <?php include 'footer.php'; ?> SQL CREATE TABLE IF NOT EXISTS `pointsmarket` ( `owner` int(10) NOT NULL default '0', `amount` text NOT NULL, `price` text NOT NULL, `id` int(10) NOT NULL auto_increment, PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC AUTO_INCREMENT=81 ;
  5. select count(*) as rank from grpgusers where strength >= (select strength from grpgusers where id = $user_class->id); that the way i have tryed it
  6. yes but its giving me the same rank on all users
  7. thanks so much and i have removed that
  8. well if the player attacks the other users its all based on how much strength - defense the player has and if the other player has more strength defense the highest strength - defense wins the fight
  9. am not to sure what the $wait variable is for and am trying to get it so players health go down by 20% if get hit and if he wins the attackers health 0 av been at this code for 2 days now lol just cant get the sum of attack to take the users health down
  10. Ok i have this attack.php but when i attack its giving me odd sums when i attack someone it says am hitting with 20 damage You are in a war Match with Deadly Viper . You hit Deadly Viper for 20 damage using your Mini Gun. i am trying to sum it out so bob user 1 john user 2 bob attacks john both of there health are 100% , bob looses and i want his health to go to 0% and johns health to go down by 20% but if he wins i want johns health to go to 0% and bobs health to go down by 20 % here is my code hope you can help <? include 'header.php'; include '1min.php'; $error = ($user_class->energypercent < 25) ? "You need to have at least 25% of your energy if you want to attack someone." : $error; $error = ($user_class->jail > 0) ? "You can't attack someone if you are in jail." : $error; $error = ($user_class->hospital > 0) ? "You can't attack someone if you are in the hospital." : $error; $error = ($_GET['attack'] == "") ? "You didn't choose someone to attack." : $error; $error = ($_GET['attack'] == $user_class->id) ? "You can't attack yourself." : $error; $attack_person = new User($_GET['attack']); $error = ($attack_person->city != $user_class->city) ? "You must be in the same city as the person you are attacking. Duh." : $error; $error = ($attack_person->username == "") ? "That person doesn't exist." : $error; $error = ($attack_person->hospital > 0) ? "You can't attack someone that is in the hospital." : $error; $error = ($attack_person->banned == 1) ? "You can't attack someone that is banned." : $error; $error = ($attack_person->jail > 0) ? "You can't attack someone that is in jail." : $error; $error = ($user_class->level > 101 && $attack_person->level < 1) ? "You can't attack someone that is level 100 or below because you are higher than level 100." : $error; if (isset($error)){ echo Message($error); include 'footer.php'; die(); } $yourhp = $user_class->hp; $theirhp = $attack_person->hp; ?> <tr><td class="contenthead"></td></tr> <tr><td class="contentcontent">You are in a war Match with <? echo $attack_person->formattedname ?>.</td></tr> <tr><td class="contentcontent"> <? $wait = ($user_class->strength > $attack_person->strength) ? 1 : 0; while($yourhp > 0 && $theirhp > 0){ $damage = $hp = floor($attack_person->hp /10); $damage = ($damage < 1) ? 1 : $damage; if($wait == 0){ $yourhp = $yourhp - $damage; echo $attack_person->formattedname . " hit you for " . $damage . " damage using their ".$attack_person->weaponname.". <br>"; } else { $wait = 0; } if($yourhp > 0) { $damage = $hp = floor($attack_person->hp /10); $damage = ($damage < 1) ? 1 : $damage; $hp = $hp - $damage; echo "You hit " . $attack_person->formattedname . " for " . $damage . " damage using your ".$user_class->weaponname.". <br>"; } if($theirhp <= 0){ // attacker won $winner = $user_class->id; $theirhp = 0; $moneywon = floor($attack_person->money /10); $hp = floor($attack_person->hp /10); $battlewon = 1 + $user_class->battlewon; $battlemoney = $moneywon + $user_class->battlemoney; $expwon = 150 - (25 * ($user_class-> level - $attack_person->level)); $expwon = ($expwon < 200) ? 5 : $expwon; $newexp = $expwon + $user_class->exp; $newmoney = $user_class->money + $moneywon; $result = mysql_query("UPDATE `grpgusers` SET `hp` = '".$hp."',`exp` = '".$newexp."', money = '".$newmoney."', `battlewon` = '".$battlewon."', `battlemoney` = '".$battlemoney."' WHERE `id`='".$_SESSION['id']."'"); $newmoney = $attack_person->money - $moneywon; $battlelost = $user_class->battlelost + 1; $battlemoney = $user_class->battlemoney - $moneywon; $result = mysql_query("UPDATE `grpgusers` SET `money` = '".$newmoney."',`hp` = '".$hp."', `hwho` = '".$user_class->username."', `hhow` = 'wasattacked', `hwhen` = '".date(g.":".i.":".sa,time())."', `hospital` = '1200', `battlelost` = '".$battlelost."', `battlemoney` = '".$battlemoney."' WHERE `id`='".$attack_person->id."'"); Send_Event($attack_person->id, "You were hospitalized by ".$user_class->username." for 20 minutes."); echo Message("You hospitalized " . $attack_person->formattedname . ". You gain $expwon exp and stole $".$moneywon." from " . $attack_person->formattedname . "."); //give gang exp if ($user_class->gang != 0) { $gang = New Gang($user_class->gang); $newgangexp = $gang->exp + $expwon; $result = mysql_query("UPDATE `gangs` SET `exp` = '".$newgangexp."' WHERE `id`='".$gang->id."'"); } } if($yourhp <= 0){ // defender won $winner = $attack_person->id; $yourhp = 0; $battlewon = 1 + $attack_person->battlewon; $moneywon = floor($user_class->money /10); $battlemoney = $moneywon + $attack_person->battlemoney; $expwon = 100 - (25 * ($attack_person-> level - $user_class->level)); $expwon = ($expwon < 200) ? 5 : $expwon; $newexp = $expwon + $attack_person->exp; $newmoney = $attack_person->money + $moneywon; $result = mysql_query("UPDATE `grpgusers` SET `exp` = '".$newexp."', money = '".$newmoney."', `battlewon` = '".$battlewon."', `battlemoney` = '".$battlemoney."' WHERE `id`='".$attack_person->id."'"); $newmoney = $user_class->money - $moneywon; $battlelost = $user_class->battlelost + 1; $battlemoney = $user_class->battlemoney - $moneywon; $result = mysql_query("UPDATE `grpgusers` SET `money` = '".$newmoney."', `hwho` = '".$attack_person->username."', `hhow` = 'attacked', `hwhen` = '".date(g.":".i.":".sa,time())."', `hospital` = '1200', `battlelost` = '".$battlelost."', `battlemoney` = '".$battlemoney."' WHERE `id`='".$user_class->id."'"); echo Message($attack_person->formattedname . " Hospitalized you and stole $".$moneywon." from you."); //give gang exp if ($attack_user->gang != 0) { $gang = New Gang($attack_user->gang); $newgangexp = $gang->exp + $expwon; $result = mysql_query("UPDATE `gangs` SET `exp` = '".$newgangexp."' WHERE `id`='".$gang->id."'"); } } } //put defense log into gang if ($attack_person->gang != 0) { $time = time(); $result= mysql_query("INSERT INTO `ganglog` (`timestamp`, gangid, attacker, defender, winner)"."VALUES ('".$time."', '".$attack_person->gang."', '".$user_class->id."', '".$attack_person->id."', '".$winner."')"); } //update users $newenergy = $user_class->energy - floor($user_class->energy * .10); $newhp = $attack_person->hp - floor($attack_person->hp * .5); $newhp = $user_class->hp - floor($user_class->hp * .40); $result = mysql_query("UPDATE `grpgusers` SET `hp` = '".$newhp."' WHERE `id`='".$attack_person->id."'"); $result = mysql_query("UPDATE `grpgusers` SET `hp` = '".$newhp."', `energy` = '".$newenergy."' WHERE `id`='".$user_class->id."'"); echo "</td></tr>"; include 'footer.php'; ?>
  11. ok sorry about the wait am just back from holiday ok i will try explain how i want to to show 1 200100675456 <<<-- jeffy i Want on his profile to say .....you are ranked [1] with out the row of other numbers so its just an individual number like[1] 2 484918 3 210000 4 101000 5 25500 6 2651 7 1000 8 335 9 295 10 255 11 130 12 79 13 10 <<<- jimmy i Want on his profile to say he is ranked [13] in all of my game but the code that am trying to do this is not giving me that sum its giving me am ranked 2 and so are all the users
  12. sorry am still new to php and confussed about wot would the output be to show the ranks
  13. no how would i single all those user out to get there rank
×
×
  • 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.