Jump to content
MakeWebGames

gangsta life

Members
  • Posts

    41
  • Joined

  • Last visited

Everything posted by gangsta life

  1. QUERY ERROR: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1 Query was SELECT * FROM users WHERE userid= i get this eroor?
  2. gangsta life

    sql help!

    i have a mod called hitman agency but dont have the sql and am bad at them stuff so can some one help me witht the sql <?php session_start(); require "globals.php"; if($ir['hospital']) { die("<font color=red><h3>This page has been blocked.</br /></h3><h4>You are currently in hospital for another {$ir['hospital']} minutes!</h4></font> "); } if($ir['jail']) { die("<font color=red><h3>This page has been blocked.</br /></h3><h4>You are currently in jail for another {$ir['jail']} minutes!</h4></font>"); } //-- We print the hitman agency print "<center><h3>Hitman Agency</h3> <a href='hitmanagency.php?action=add'>Add Contract</a> | <a href='hitmanagency.php?action=about'>About</a> | <a href='hitmanagency.php?action=completedlist'>Hitman Missions Completed</a> | <a href='hitmanagency.php'>Available Missions</a> | <a href='hitmanagency.php?action=signup'>Become a Hitman</a><br /><br />"; switch($_GET['action']) { case "completedlist": hitman_completedlist(); break; case "about": hitman_about(); break; case "signup": hitman_signup(); break; case "add": hitman_add(); break; default: hitman_index(); break; } function hitman_index() { global $db,$ir,$c,$userid,$h; $q=$db->query("SELECT * FROM hitman_agency WHERE h_done=0 ORDER BY h_added ASC",$c); if($db->num_rows($q) == 0) { print "There is no available hitman missions available"; } else { print "<table width=80% border=0><tr><th>Payer</th><th>Target</th><th>Days Remaining</th><th>Payment</th><th>Fails</th><th>Take Job</th></tr>"; while($r=$db->num_rows($q)) { $user1=$db->fetch_row($db->query("SELECT * FROM users WHERE userid={$r['h_from']}",$c)); $user2=$db->fetch_row($db->query("SELECT * FROM users WHERE userid={$r['h_to']}",$c)); if($r['h_daysleft'] == 0) { $d_text="Today"; } elseif($r['h_daysleft'] == 1) { $d_text="Tommorrow"; } elseif($r['h_daysleft'] == 7) { $d_text="One Week"; } elseif($r['h_daysleft'] == 31) { $d_text="One Month"; } else { $d_text=$r['h_daysleft']." days left"; } print "<tr><td>{$user1['username']} [{$user1['userid']}]</td><td>{$user2['username']} [{$user2['userid']}]</td><td>$d_text</td><td><font color=green>\$".number_format($r['h_price'])."</font><br />"; if($r['h_crystals'] > 0) { print "<font color=maroon>and ".$r['h_crystals']." crystals</font>"; } print "</td><td>".$r['h_fails']."</td><td>"; if($ir['hitman_user'] == 0) { print "<b>You need to be a hitman</b>"; } else { print "<a href='attack.php?ID={$r['h_to']}'>Take Job</a>"; } print "</td></tr>"; } print "</table>"; } } function hitman_completedlist() { global $db,$ir,$c,$userid,$h; print "Completed List.<br />"; $q=$db->query("SELECT h.*,u.* FROM hitman_agency h LEFT JOIN users u ON h.h_to=u.userid WHERE h.h_done=$userid",$c); if($db->num_rows($q) == 0) { print "<B>You haven't completed any missions so far</b>"; } else { $tc = 0; $tcc = 0; $targets = "These are your targets you have hit<br /> <table width=50% border=1><tr><th><b>Payer</b></th><th><b>Target</b></th></tr>"; while($r=$db->num_rows($q)) { $tc+=$r['h_price']; $tcc+=$r['h_crystals']; $tr=mysql_fetch_array($db->query("SELECT * FROM users WHERE userid={$r['h_from']}",$c)); $targets .= "<tr><td><a href='viewuser.php?u={$tr['userid']}'>{$tr['username']}</a> [{$tr['userid']}]</td><td><a href='viewuser.php?u={$r['userid']}'>{$r['username']}</a> [{$r['userid']}]</td></tr>"; } $targets .= "</table>"; print "<b>Missions Completed</b>: ".$db->num_rows($q)."<br /> <b>Total Payment (Game Money)</b>: \$$tc<br /> <b>Total Payment (Crystals)</b>: $tcc crystals<br /> <br /> ".$targets; } } function hitman_about() { global $db,$ir,$c,$userid,$h; print "About/How to use Hitman Agency.<br /> <li>If you cannot defeat someone or you want to make a hidden attack, You can open a hitman contract against a user for a following price in which a hitman who has signed up will be available to take that contract and upon winning, they will get paid the amount chosen and your enemy/contracted user will be attacked.</li> <li>Hitman Missions are completely dependant, We dont guarantee attacks in a certain amount of time. You can only put a hitman mission up for upto 7 days, After 7 days it will be removed.</li> <li>To become a hitman, a \$50,000 a day will occur. And signing up as a hitman allows you to take these missions and earn a bundle of cash and vouchers.</li> <li>If you fail a mission, it will occur on the system as 1 fail. If the hitman has recieved over 10 fails, The contract will be removed.</li> <li>Hitman Missions cannot be hit against owners or NPCs.</li>"; } function hitman_signup() { global $db,$ir,$c,$userid,$h; if($ir['level'] <= 3) { print "<b>You must be over level 3 to become a hitman.</b>"; } elseif($ir['money'] < 50000) { print "<b>You dont have enough money to renew/become your hitman status</b>"; } elseif($ir['daysold'] <= 10) { print "<b>You need to be at least over 10 days to have a hitman status</b>"; } else { if($_POST['days']) { $req=(int) $_POST['days']*50000; if($ir['money'] < $req) { print "You dont have enough funds to purchase this amount of days."; $h->endpage(); exit(); } if($ir['hitman_user'] > 0) { print "You have successfully renewed your hitman status!<br />"; } else { print "You have successfully become a hitman!<br />"; } $ir['hitman_user']+=(int) $_POST['days']; print "<b>Upon this date, you now have {$ir['hitman_user']} days as a hitman</b><br /> <a href='hitmanagency.php'>Back</a><br />"; $db->query("UPDATE users SET hitman_user={$ir['hitman_user']},money=money-$req WHERE userid=$userid",$c); } else { print "Sign up as a hitman.<br /> Each day as a hitman costs <b>\$50,000</b> a day<br />"; if($ir['hitman_user'] > 0) { print "You currently have <b>{$ir['hitman_user']}</b> days left as a hitman<br />"; } print "<form action='hitmanagency.php?action=signup' method='post'> Days: <input type='text' name='days' value=''><br /> <input type='submit' value='Submit'></form>"; } } } function hitman_add() { global $db,$ir,$c,$userid,$h; if($ir['level'] <= 5) { print "<b>You must be over level 5 to start a hitman contract.</b>"; } elseif($ir['daysold'] <= 10) { print "<b>You need to be at least over 10 days old to set a hitman contract.</b>"; } else { if($_POST['user'] and $_POST['amount'] and $_POST['days']) { $q=$db->query("SELECT * FROM users WHERE userid={$_POST['user']}",$c); $r=$db->num_rows($q); if($db->num_rows($q) == 0) { print "<b>You can only put a hitman mission on a user that actually exists!</b>"; } elseif($_POST['user'] == $userid) { print "<b>Haha, Trying to make hitman contracts on yourself?</b>"; } elseif($r['lastip'] == $ir['lastip']) { print "<b>Haha, Trying to make hitman contracts on your own IP mate?</b>"; } elseif($_POST['amount'] > $ir['money'] || $_POST['crystals'] > $ir['crystals']) { print "<b>You dont have the right funds to do these vast amounts.</b>"; } elseif($_POST['amount'] <= 0 || $_POST['crystals'] < 0) { print "<b>You either have posted no money or your trying to cheat.</b>"; } elseif($_POST['days'] < 0 or ($ir['donatordays'] == 0 and $_POST['days'] > 3)) { print "<b>Your not a donator so put your days to 1-3 days.</b>"; } elseif($ir['donatordays'] > 0 and $_POST['days'] > 7) { print "<b>You are a donator but you cant list a hitman contract for over 7 days.</b>"; } else { $time=time(); $db->query("INSERT INTO hitman_agency (h_id,h_from,h_to,h_daysleft,h_price,h_crystals,h_done,h_fails,h_added) VALUES ('NULL', '{$userid}', '{$_POST['user']}', '{$_POST['days']}', '{$_POST['amount']}', '{$_POST['crystals']}', '0', '0', '{$time}');",$c) or die($db->error()); $db->query("UPDATE users SET money=money-{$_POST['amount']} WHERE userid=$userid",$c); if($_POST['crystals'] > 0) { $db->query("UPDATE users SET crystals=crystals-{$_POST['crystals']} WHERE userid=$userid",$c); } print "<B>Hitman Mission Added</B><br /> You will have a remaining <b>$_POST[days]</b> days for it to be took<br /> If the mission has been failed more than 9 times, it will be removed<br /> <a href='hitmanagency.php'>Back</a><br />"; } } else { print "Adding a hitman contract.<br /> <script language='JavaScript'> function checkError() { var id=document.getElementById('cash').value; var money=document.getElementById('mycash').value; var days=document.getElementById('days').value; var donator=document.getElementById('donator').value; if(!id || !money || !days) { alert('Please go back and fill in all fields.'); return false; exit; } if(id < 0) { alert('Trying to cheat, eh?'); return false; exit; } elseif(id > money) { alert('You dont that much money.'); return false; exit; } elseif(days < 0 || days>7) { alert('Your days cannot be over 7 or under 0.'); return false; exit; } elseif(donator == 0 && days>3) { alert('Your days cannot be over 3 because your not a donator.'); return false; exit; } } </script> <b>If your not a donator, you can only put your maximum days as 3.</b><br /> <form action='hitmanagency.php?action=add' method='post'> User ID: <input type='text' name='user' value=''><br /> <input type='hidden' id='mycash' value='{$ir['money']}'><br /> Cash: <input type='text' name='amount' value='' id='cash'><br /> Crystals: <input type='text' name='crystals' value=''><br /> <input type='hidden' id='donator' value='{$ir['donatordays']}'> Days to show up: <input type='text' name='days' value='' maxlength='1' id='days'><br /> <input type='submit' value='Submit' onclick='checkError()'></form>"; } } } print '</center>'; $h->endpage(); ?>
  3. well i do want it like that but a little adjust can you help me basically i want some when you click on news paper it shows table with title, and message section then once added and paid for you ad should display on the same page below the tabel. i have fixed the table section but when i add a ad it say congrats then i still have my money and doesnt display nothing?
  4. okay 2 problems its doesnt take my money away and say congratulation and then after added does not vie below?
  5. okay i fixed the table part now the only problems is it dont display the ads?>
  6. http://www.deadland.net login as test and test and see there news paper that what i want..
  7. okay i have tried it it did work but i dont want it like that i want it on all on one page so all funtions on one page newspaper.php so basically i dont want action saying then for it to display the table i want it to display then once added the funtion i want it action=added but i removed if($_GET['action'] == 'add') { it doesnt work shows error?
  8. i want something where soon as you click the newspaper page the form to come up title , message etc. then once submitted for it to do the script function and work..?
  9. i dont know how to do it can you make me one so i can see or are you talking about the newspaper at the bottom shell ichange that link?
  10. the table still does not appear?
  11. thanks lucky much love for that it worked but one problem it dont let me add announcement link with the code next to it? ({$ir['new_announcements']})
  12. tried it but didnt work maybe i did it worng can you re edit and post the script for me how you said?
  13. i have added everything i think its a script error have you checked
  14. okay i got mainmenu design which i want to use but i dont know how to put it in with the scripting i tried many ways and get so many errors can anyone fix it please? am new and trying to leasrn off my mistakes so please show some support <?php global $db,$c,$ir, $set; $hc=$set['hospital_count']; $jc=$set['jail_count']; $ec=$ir['new_events']; $mc=$ir['new_mail']; if($ir['hospital']) { print " <ul id="menu"> <li><a href="index.php">Home</a></li> <li><a href="explore.php">Z-1. The Trails</a></li> <li><a href="bank.php">Bank</a></li> <li><a href="gym.php">Gym</a></li> <li><a href="criminal.php">Crimes</a></li> <li><a href="mail.php">Messages(<span id="msg_count">3</span>)</a></li> <li><a href="events.php">Events(0)</a></li> <li><a href="inventory.php">Inventory</a></li> <li><a href="hospital.php">Hospital[<span id='hospital'>0</span>]</a></li> <li><a href="jail.php">Jail [<span id='jail'>0</span>]</a></li> <li><a href="gangs.php">Your Gang</a></li> <li><a href="forums.php">Forums</a></li> <li><a href="newspaper.php">Newspaper</a></li> <li><a href="search.php">Search</a></li> </ul> <ul id="menu"> <li><a href="new_chat.php">Chat</a></li> <li><a href="yourfriends.php">Your Friends</a></li> <li><a href="itempedia.php">Item Guide</a></li> <li><a href="donator.php">Upgrade Account</a></li> <li><a href="preferences.php">Edit Account</a></li> <li><a href="logout.php">Logout</a></li> </ul></div> <div id="menu_foot"> <img src="images/header_24.jpg" alt="" /><br /> </div> </div> </td> <td> <div id="middle_divide"></div> </td> "; ?>   i dont really want the menu divied like for example in the coding once you in hospital the menu will give you a link to hospital i dont want that i just want only 1 menu out the whole game not for it to change..
  15. i wanted a newspaer with ads on it so user can click the newspaper link and be able to add a title and message and post it for $5000 game cash and underneath it should view there post but i seem to have a problem it dont show the box or anything it shows a blank page can anyone correct this please. am new coder and dont know 100% coding and this code is messy i know so can someone help me so i can learn from my mistake pls appreciate my efforts   <?php include "globals.php"; if($_GET['action'] == "add") { print " <h3>Add Advertisement ($5,000)</h3> <table width='80%' border='0' cellspacing='1' class='table'><tr colspan='2'> <th><b>Newspaper:</b></th> </tr> <td> <form action='newspaper.php?action=added' method='post'> <table width='100%'> <tr><td valign=top >Title: </td> <td valign=top > <input type='text' name='npTITLE' class='textbox'> </td></tr> <tr><td valign=top >Message: </td> <td valign=top> <textarea rows=8 cols=40 name='npBODY' class='textbox'></textarea> </td></tr> <tr> <td valign=top> </td> <td valign=top > <input class='textbox' type='submit' value='Place Ad ($5000)' /> </td> </table> </form> "; } if($_GET['action'] == "added") { if($ir['money']>5000) { print "Congratulations, you bought a an ad for \$5,000! "; $q=$db->query("SELECT * FROM newscontent LIMIT 1",$c); $ncontent=mysql_result($q,0,0); $q=$db->query("SELECT * FROM papercontent LIMIT 1",$c); $content=mysql_result($q,0,0); $q=$db->query("SELECT * FROM npaper LIMIT 10"); while($na=mysql_fetch_array($q)) $db->query("UPDATE users SET money=money-5000 WHERE userid=$userid"); $title=str_replace(array("\n"),array(" "),strip_tags($_POST['npTITLE'])); $body=str_replace(array("\n"),array(" "),strip_tags($_POST['npBODY'])); $q=$db->query("INSERT INTO `npaper` VALUES (NULL, '$userid', '$title', '$body', unix_timestamp())"); print "Ad Added! <a href='http://newspaper.php' target='_blank'>>Back</a>"; } else { print "You do not have enough money to add an ad. "; } } ?>
×
×
  • Create New...