login  Naam:   Wachtwoord: 
Registreer je!
 Forum

Forms werken niet; pagina reload alleen maar

Offline Sjaakmans - 13/05/2005 17:53
Avatar van SjaakmansNieuw lid Ik heb een script gemaakt voor mijn mafia site.
Maar nu zit ik met een probleem:
Als je op de submit knop drukt reload de pagina alleen maar.

Zou iemand mij kunnen helpen?

dit is de code:
  1. <?php
  2. include("mafia.php");
  3. $username = $_SESSION['username'];
  4. $sql = mysql_query("SELECT * FROM users WHERE username = '$username'");
  5. $dbres = mysql_query("SELECT * FROM crews");
  6. $resultcrew = mysql_num_rows($dbres);
  7.  
  8. while($user = mysql_fetch_Array($sql)){
  9. $money = $user['money'];
  10. $location = $user['country'];
  11. $rankp = $user['ervaring'];
  12. $rank = $user['rank'];
  13. $crewuser = $user['crew'];
  14. $crewlvl = $user['crewlvl'];
  15. }
  16. $dbres2 = mysql_query("SELECT * FROM crews WHERE crewname = '$crewuser'");
  17. $crew = mysql_fetch_Array($dbres2);
  18. if(isset($_POST['invite_submit'])){
  19. $sel = mysql_query("SELECT * FROM users WHERE username = '$to_user'");
  20. $userexcists = mysql_num_rows($sel);
  21. if($to_user == ""){
  22. echo ("You need to fill in an username");
  23. }
  24. elseif(!$userexcists){
  25. echo ("This user doesn't excist");
  26. }
  27. elseif($to_user == $username){
  28. echo ("You cannot invite yourself");
  29. }
  30. else{
  31. $sqldb = mysql_query("SELECT * FROM messages ORDER BY id DESC LIMIT 1");
  32. $mes = mysql_fetch_array($sqldb);
  33. $pm = $mes['id']+1;
  34. $message = "<form action=\"inbox.php\"><input type=hidden name=id value=$pm> $crew[crewname] has invited you to join there crew.<br><br><input type=\"hidden\" name=\"crew\" value=\"$crew[crewname]\"> You can <input type=\"radio\" name=\"accept\" value=\"yes\">Accept or <input type=\"radio\" name=\"accept\" value=\"no\">Decline the offer.<br><input type=\"submit\" value=\"Submit\" name=\"submit\"></form>";
  35. $ip = $_SERVER['REMOTE_ADDR'];
  36. $date = date("H:i:s d-m-Y");
  37. mysql_query("INSERT INTO messages (van,naar,datum,bericht,gelezen) VALUES ('Notification','$invite_user','$date','$message','0')") or die(mysql_error());
  38. echo "Invite is sent to <b>$to_user</b>.";
  39. }
  40. }
  41. elseif(isset($_POST['perform'])){
  42. if($action == 'donate'){
  43. if($value < 1){
  44. echo ("You need to donate at least $1.");
  45. }
  46. elseif($value > $money){
  47. echo ("You don't have enough money to donate");
  48. }
  49. else{
  50. $nmoney = $money - $value;
  51. $cmoney = $crew['crewbank'] + $value;
  52. mysql_query("UPDATE users SET money = '$nmoney' WHERE username ='$username'");
  53. mysql_query("UPDATE crews SET crewbank = '$cmoney' WHERE crewname = '$crewuser");
  54. echo ("You donated <b>$".number_format($value)."</b> in your crews bank.");
  55. }
  56. }
  57. elseif($action == 'withdraw'){
  58. if($value < 1){
  59. echo ("You need to withdraw at least $1");
  60. }
  61. elseif($value > $crew['crewbank']){
  62. echo ("You cannot withdraw more than there is on the crewbank");
  63. }
  64. else{
  65. $nmoney = $money + $value;
  66. $cmoney = $crew['crewbank'] - $value;
  67. mysql_query("UPDATE users SET money = '$nmoney' WHERE username = '$username'");
  68. mysql_query("UPDATE crews SET crewbank = '$cmoney' WHERE crewname = '$crewuser'");
  69. echo ("You withdrew <b>$".number_format($value)."</b> from your crewbank.");
  70. }
  71. }
  72. }
  73. elseif(isset($_POST['change_quote'])){
  74. mysql_query("UPDATE crews SET quote = '$quote' WHERE crewname = '$crewuser'");
  75. echo ("Crews quote has been changed");
  76. }
  77. elseif(isset($_GET['kick'])){
  78. mysql_query("UPDATE users SET crew = 'none' WHERE id = '{$_GET['kick']}'");
  79. echo ("That member has been kicked");
  80. }
  81. elseif(isset($_POST['change_underboss'])){
  82. $select = mysql_query("SELECT * FROM users WHERE username = '$new_underboss'");
  83. $underboss_excists = mysql_num_rows($select);
  84. if(!$underboss_excists){
  85. echo ("This user doesn't excist");
  86. }
  87. elseif($new_underboss == ""){
  88. echo ("You need to fill in an username");
  89. }
  90. else{
  91. mysql_query("UPDATE users SET crewlvl = '3' WHERE username = '$new_underboss'");
  92. mysql_query("UPDATE crews SET underboss = '$new_underboss' WHERE crename = '$crewuser'");
  93. echo ("The underboss has been changed");
  94. }
  95. }
  96. if($crewuser == "" OR $crewuser == "none"){
  97. if(isset($_POST['submit'])){
  98. if(($crewname == "") || (strlen($crewname) > 100)){
  99. echo "You need to fill in a crewname";
  100. }
  101. elseif($crewuser != "none"){
  102. echo ("You are already in a crew. Please contact an admin if you see this page");
  103. }
  104. elseif($resultcrew >= 20){
  105. echo ("There can only be 20 crews. You need to kill an other crew if you want to create one.");
  106. }
  107. elseif($money < 10000000){
  108. echo ("You don't have enough money. You need $10,000,000 to create a crew");
  109. }
  110. else{
  111. $nmoney = $money - 10000000;
  112. mysql_query("UPDATE users SET crew = '$crewname' WHERE username = '$username'");
  113. mysql_query("UPDATE users SET money = '$nmoney' WHERE username = '$username'");
  114. mysql_query("INSERT INTO `crews` (`crewname`,`leader`,`underboss`,`crewbank`) VALUES ('$crewname','$username','None','1000')") or die(mysql_error());
  115. mysql_query("UPDATE users SET crewlvl = '3' WHERE username = '$username'");
  116. echo ("Congratulations. Your crew <b>".$crewname."</b> has been created.");
  117. }
  118. }
  119. else{
  120. ?>
  121. <center>
  122. <form action="<?=$_SERVER['PHP_SELF']; ?>">
  123. <table border=1 bordercolor=#000000 cellpadding=0 cellspacing=0>
  124. <th class=header colspan=2>Create a crew</th>
  125. <tr>
  126. <td>Crewname:</td>
  127. <td><input type="text" name="crewname"></td>
  128. </tr>
  129. <tr>
  130. <td>&nbsp;</td>
  131. <td><input type="submit" value="Create" name="create"></td>
  132. </tr>
  133. </table>
  134. </form>
  135. <?
  136. }
  137. }
  138. elseif($username != $crew['leader'] AND $username != $crew['underboss']){
  139. if(isseT($_POST['leave'])){
  140. $nmoney = $money - 500000;
  141. mysql_query("UPDATE users SET money = '$nmoney' WHERE username = '$username'");
  142. mysql_query("UPDATE users SET crew = 'none' WHERE username = '$username'");
  143. echo ("You left your crew!");
  144. }
  145. else{
  146. if(isset($_POST['donate_submit'])){
  147. if($donate < 1){
  148. echo ("You need to donate at least $1");
  149. }
  150. elseif($donate > $money){
  151. echo ("You don't have that much money");
  152. }
  153. else{
  154. $nmoney = $money - $donate;
  155. $cmoney = $crew['crewbank'] + $donate;
  156. mysql_query("UPDATE users SET money = '$nmoney' WHERE username ='$username'");
  157. mysql_query("UPDATE crews SET crewbank = '$cmoney' WHERE crewname = '$crewuser'");
  158. echo ("You donated <b>$".number_format($donate)."</b> in your crews bank.");
  159. }
  160. }
  161. ?>
  162. <table border=0 width="100%" class="page">
  163. <tr><td width="50%" align="center" rowspan="2">
  164.  
  165. <form action="<?=$_SERVER['PHP_SELF']; ?>">
  166. <table border=1 bordercolor=#000000 cellpadding=0 cellspacing=0>
  167. <th class="header">Welcome to the crew section</th>
  168. <tr><td>
  169. Welcome to the crew's hq <?=$username; ?>.
  170. In here you can find everything about your crew and more.<br>
  171. You are currently in <a href="viewcrew.php?crew=<?=$crewuser; ?>"><?=$crewuser; ?></a>.<br>
  172. Your leader is <a href="view.php?user=<?=$crew['leader']; ?>"><?=$crew['leader']; ?></a>.<br>
  173. And the underboss is <a href="view.php?user=<?=$crew['underboss']; ?>"><?=$crew['underboss']; ?></a>.<br>
  174. <br>
  175. If you don't want to be in this crew anymore you could also choose to leave.<br>
  176. This will cost you $500,000 and you might loose some of your health.<br>
  177. If you want to leave click the button below:<br>
  178. <center><input type="submit" value="Leave" name="leave">
  179. </td></tr>
  180. </table>
  181. </td><td width="50%" align="center" valign="top">
  182.  
  183. <form action="<?=$_SERVER['PHP_SELF']; ?>">
  184. <table border=1 bordercolor=#000000 cellpadding=0 cellspacing=0>
  185. <th class=header colspan="2">Crewbank</th>
  186. <tr>
  187. <td>Money on crewbank:</td>
  188. <td>$<?=number_format($crew['crewbank']); ?></td>
  189. </tr>
  190. <tr>
  191. <td>Donate:</td>
  192. <td><input type="text" name="donate"></td>
  193. </tr>
  194. <tr>
  195. <Td>&nbsp;</td>
  196. <td><input type="submit" value="Donate!" name="donate_submit"></td>
  197. </tr>
  198. </table>
  199. </form>
  200. </td></tr>
  201. <tr><td align="center" valign="top">
  202. <?
  203. $m = mysql_query("SELECT * FROM users WHERE crew = '$crewuser'");
  204. $members = mysql_num_rows($m);
  205. $mm = mysql_query("SELECT SUM(`money`) FROM users WHERE crew = '$crewuser'");
  206. $membersmoney = mysql_result($mm,0);
  207. $lr = mysql_query("SELECT * FROM users WHERE crew = '$crewuser' ORDER BY rank ASC");
  208. $lowestrank = mysql_fetch_array($lr);
  209. ?>
  210. <table border=1 bordercolor=#000000 cellpadding=0 cellspacing=0>
  211. <th class="header" colspan="2">Crew stats</th>
  212. <tr>
  213. <td>Total members:</td>
  214. <td><?=number_format($members); ?></td>
  215. </tr>
  216. <tr>
  217. <td>Total member money:</td>
  218. <td>$<?=number_format($membersmoney); ?></td>
  219. </tr>
  220. <tr>
  221. <td>Lowest rank in the crew:</td>
  222. <td><?=$lowestrank['rank']; ?></td>
  223. </tr>
  224. </table>
  225. </td></tr>
  226. <tr><td colspan="2" align="center" valign="top">
  227. <?
  228. if($crewlvl == 1){
  229. if(isset($_POST['invite_submit'])){
  230. $sel = mysql_query("SELECT * FROM users WHERE username = '$to_user'");
  231. $userexcists = mysql_num_rows($sel);
  232. if($to_user == ""){
  233. echo ("You need to fill in an username");
  234. }
  235. elseif(!$userexcists){
  236. echo ("This user doesn't excist");
  237. }
  238. elseif($to_user == $username){
  239. echo ("You cannot invite yourself");
  240. }
  241. else{
  242. $sqldb = mysql_query("SELECT * FROM messages ORDER BY id DESC LIMIT 1");
  243. $mes = mysql_fetch_array($sqldb);
  244. $pm = $mes['id']+1;
  245. $message = "<form action=\"inbox.php\"><input type=hidden name=id value=$pm> $crew[crewname] has invited you to join there crew.<br><br><input type=\"hidden\" name=\"crew\" value=\"$crew[crewname]\"> You can <input type=\"radio\" name=\"accept\" value=\"yes\">Accept or <input type=\"radio\" name=\"accept\" value=\"no\">Decline the offer.<br><input type=\"submit\" value=\"Submit\" name=\"submit\"></form>";
  246. $ip = $_SERVER['REMOTE_ADDR'];
  247. $date = date("H:i:s d-m-Y");
  248. mysql_query("INSERT INTO messages (van,naar,datum,bericht,gelezen) VALUES ('Notification','$invite_user','$date','$message','0')") or die(mysql_error());
  249. echo "Invite is sent to <b>$to_user</b>.";
  250. }
  251. }
  252. ?>
  253. <form action="<?=$_SERVER['PHP_SELF']; ?>">
  254. <table border=1 bordercolor=#000000 cellpadding=0 cellspacing=0>
  255. <th class="header" colspan="2">Invite user</th>
  256. <tr>
  257. <td>Username:</td>
  258. <td><input type="text" name="to_user"></td>
  259. </tr>
  260. <tr>
  261. <td>&nbsp;</td>
  262. <td><input type="submit" value="Send invite" name="invite_submit"></td>
  263. </tr>
  264. </table>
  265. </form>
  266. <?
  267. }
  268. }
  269. ?>
  270. </td></tr>
  271. </table>
  272. <?
  273. }
  274. elseif($username == $crew['underboss']){
  275. if(isset($_POST['invite_submit'])){
  276. $sel = mysql_query("SELECT * FROM users WHERE username = '$to_user'");
  277. $userexcists = mysql_num_rows($sel);
  278. if($to_user == ""){
  279. echo ("You need to fill in an username");
  280. }
  281. elseif(!$userexcists){
  282. echo ("This user doesn't excist");
  283. }
  284. elseif($to_user == $username){
  285. echo ("You cannot invite yourself");
  286. }
  287. else{
  288. $sqldb = mysql_query("SELECT * FROM messages ORDER BY id DESC LIMIT 1");
  289. $mes = mysql_fetch_array($sqldb);
  290. $pm = $mes['id']+1;
  291. $message = "<form action=\"inbox.php\"><input type=hidden name=id value=$pm> $crew[crewname] has invited you to join there crew.<br><br><input type=\"hidden\" name=\"crew\" value=\"$crew[crewname]\"> You can <input type=\"radio\" name=\"accept\" value=\"yes\">Accept or <input type=\"radio\" name=\"accept\" value=\"no\">Decline the offer.<br><input type=\"submit\" value=\"Submit\" name=\"submit\"></form>";
  292. $ip = $_SERVER['REMOTE_ADDR'];
  293. $date = date("H:i:s d-m-Y");
  294. mysql_query("INSERT INTO messages (van,naar,datum,bericht,gelezen) VALUES ('Notification','$invite_user','$date','$message','0')") or die(mysql_error());
  295. echo "Invite is sent to <b>$to_user</b>.";
  296. }
  297. }
  298. elseif(isset($_POST['perform'])){
  299. if($action == 'donate'){
  300. if($value < 1){
  301. echo ("You need to donate at least $1.");
  302. }
  303. elseif($value > $money){
  304. echo ("You don't have enough money to donate");
  305. }
  306. else{
  307. $nmoney = $money - $value;
  308. $cmoney = $crew['crewbank'] + $value;
  309. mysql_query("UPDATE users SET money = '$nmoney' WHERE username ='$username'");
  310. mysql_query("UPDATE crews SET crewbank = '$cmoney' WHERE crewname = '$crewuser");
  311. echo ("You donated <b>$".number_format($value)."</b> in your crews bank.");
  312. }
  313. }
  314. elseif($action == 'withdraw'){
  315. if($value < 1){
  316. echo ("You need to withdraw at least $1");
  317. }
  318. elseif($value > $crew['crewbank']){
  319. echo ("You cannot withdraw more than there is on the crewbank");
  320. }
  321. else{
  322. $nmoney = $money + $value;
  323. $cmoney = $crew['crewbank'] - $value;
  324. mysql_query("UPDATE users SET money = '$nmoney' WHERE username = '$username'");
  325. mysql_query("UPDATE crews SET crewbank = '$cmoney' WHERE crewname = '$crewuser'");
  326. echo ("You withdrew <b>$".number_format($value)."</b> from your crewbank.");
  327. }
  328. }
  329. }
  330. elseif(isset($_POST['change_quote'])){
  331. mysql_query("UPDATE crews SET quote = '$quote' WHERE crewname = '$crewuser'");
  332. echo ("Crews quote has been changed");
  333. }
  334. elseif(isset($_GET['kick'])){
  335. mysql_query("UPDATE users SET crew = 'none' WHERE id = '{$_GET['kick']}'");
  336. echo ("That member has been kicked");
  337. }
  338. ?>
  339. <table border=0 class="page" width="100%">
  340. <tr><td width="50%" align="center" valign="top">
  341.  
  342. <form action="<?=$_SERVER['PHP_SELF']; ?>">
  343. <table border=1 bordercolor=#000000 cellpadding=0 cellspacing=0>
  344. <th class="header" colspan="2">Invite user:</th>
  345. <tr>
  346. <td>Username:</td>
  347. <td><input type='text' name="to_user"></td>
  348. </tr>
  349. <tr>
  350. <td>&nbsp;</td>
  351. <td><input type="submit" value="Send invite!" name="invite_submit"></td>
  352. </tr>
  353. </table>
  354. </form>
  355.  
  356. </td><td align="center" valign="top" width="50%">
  357.  
  358. <form action="<?=$_SERVER['PHP_SELF']; ?>">
  359. <table border=1 bordercolor=#000000 cellpadding=0 cellspacing=0>
  360. <th class="header" colspan="2">Crewbank</th>
  361. <tr>
  362. <td>Money on crewbank:</td>
  363. <td>$<?=number_format($crew['crewbank']); ?></td>
  364. </tr>
  365. <tr>
  366. <td><input type="radio" name="action" value="donate"> Donate<br />
  367. <input type="radio" name="action" value="withdraw"> Withdraw</td>
  368. <td><input type="text" name="value"></td>
  369. </tr>
  370. <tr>
  371. <td>&nbsp;</td>
  372. <td><input type="submit" value="Perform action" name="perform"></td>
  373. </tr>
  374. </table>
  375. </form>
  376.  
  377. </td></tr>
  378. <tr><td align="center" valign="top" width="50%">
  379.  
  380. <form action="<?=$_SERVER['PHP_SELF']; ?>">
  381. <table border=1 bordercolor=#000000 cellpadding=0 cellspacing=0>
  382. <th class="header" colspan="2">Change Quote:</th>
  383. <tr><td>Quote:</td><td><textarea name="quote" cols="28" rows="8"><?=$crew['quote']; ?></textarea></td></tr>
  384. <tr><td>&nbsp;</td><td><input type="submit" value="Change" name="change_quote"></td></tr>
  385. </table>
  386. </form>
  387.  
  388. </td><td align="center" valign="top" width="50%">
  389.  
  390. <form action=<?=$_SERVER['PHP_SELF']; ?>>
  391. <table border=1 bordercolor=#000000 cellpadding=0 cellspacing=0>
  392. <th class="header" colspan="2">Change Image</th>
  393. <tr>
  394. <td>Image:</td>
  395. <td><? if($crew['imgurl'] == ''){ echo "None"; }else{ echo "<img src=".$crew['imgurl'].">"; } ?></td>
  396. </tr>
  397. <tr>
  398. <td>New image:</td>
  399. <td><input type="text" name="new_imgurl" <? if($crew['imgurl'] == ''){ echo "value=http://"; } ?>></td>
  400. </tr>
  401. </table>
  402. </form>
  403.  
  404. </td></tr>
  405. <tr><td valign="top" align="center" width="50%">
  406.  
  407. <table border=1 bordercolor=#000000 cellpadding=0 cellspacing=0>
  408. <th class="header" colspan="6">Members</th>
  409. <tr>
  410. <td>Username</td>
  411. <td>Rank</td>
  412. <td>Status</td>
  413. <td>Kick</td>
  414. </tr>
  415. <?
  416. $allm = mysql_query("SELECT * FROM users WHERE crew = '$crewuser'");
  417. $totalcrewmembers = mysql_num_rows($allm);
  418. while($member = mysql_fetch_Array($allm)){
  419. $id = $member['id'];
  420. $membername = $member['username'];
  421. $ervaring = $member['ervaring'];
  422. if($ervaring <= 150){
  423. $rank = "Scum";
  424. }
  425. elseif($ervaring > 150 AND $ervaring <= 350){
  426. $rank = "Thief";
  427. }
  428. elseif($ervaring > 350 AND $ervaring <= 750){
  429. $rank = "Mobster";
  430. }
  431. elseif($ervaring > 750 AND $ervaring <= 1500){
  432. $rank = "Thug";
  433. }
  434. elseif($ervaring > 1500 AND $ervaring <= 3500){
  435. $rank = "Scout";
  436. }
  437. elseif($ervaring > 3500 AND $ervaring <= 7500){
  438. $rank = "Soldier";
  439. }
  440. elseif($ervaring > 7500 AND $ervaring <= 15000){
  441. $rank = "Local Boss";
  442. }
  443. elseif($ervaring > 15000 AND $ervaring <= 50000){
  444. $rank = "Boss";
  445. }
  446. elseif($ervaring > 50000 AND $ervaring <= 150000){
  447. $rank = "Commander";
  448. }
  449. elseif($ervaring > 150000 AND $ervaring <= 200000){
  450. $rank = "Godfather";
  451. }
  452. elseif($ervaring > 200000 AND $ervaring <= 400000){
  453. $rank = "Legendary Godfather";
  454. }
  455. elseif($ervaring > 400000 AND $ervaring <= 600000){
  456. $rank = "General";
  457. }
  458. elseif($ervaring > 600000 AND $ervaring <= 800000){
  459. $rank = "Don";
  460. }
  461. elseif($ervaring > 800000 AND $ervaring <= 1000000){
  462. $rank = "Respectable Don";
  463. }
  464. elseif($ervaring > 1000000 AND $ervaring <= 1000000000){
  465. $rank = "Legendary Don";
  466. }
  467. elseif($ervaring > 1000000000 AND $ervaring <= 5000000000){
  468. $rank = "Moderator";
  469. }
  470. else{
  471. $rank = "Administrator";
  472. }
  473. if($member['life'] > 0){
  474. $status = "Alive";
  475. }
  476. else{
  477. $status = "Dead";
  478. }
  479. }
  480. $i = 0;
  481. while($i <= $totalcrewmembers){
  482. ?>
  483. <tr>
  484. <td><a href="view.php?user=<?=$membername; ?>"><?=$membername; ?></a></td>
  485. <Td><?=$rank; ?></td>
  486. <td><?=$status; ?></td>
  487. <td><a href="?kick=<?=$id; ?>">Kick</a></td>
  488. </tr>
  489. <?
  490. $i++;
  491. }
  492. ?>
  493. </table>
  494.  
  495. </td></tr>
  496. </table>
  497. <?
  498. }
  499. elseif($username == $crew['leader']){
  500. if(isset($_POST['invite_submit'])){
  501. $sel = mysql_query("SELECT * FROM users WHERE username = '$to_user'");
  502. $userexcists = mysql_num_rows($sel);
  503. if($to_user == ""){
  504. echo ("You need to fill in an username");
  505. }
  506. elseif(!$userexcists){
  507. echo ("This user doesn't excist");
  508. }
  509. elseif($to_user == $username){
  510. echo ("You cannot invite yourself");
  511. }
  512. else{
  513. $sqldb = mysql_query("SELECT * FROM messages ORDER BY id DESC LIMIT 1");
  514. $mes = mysql_fetch_array($sqldb);
  515. $pm = $mes['id']+1;
  516. $message = "<form action=\"inbox.php\"><input type=hidden name=id value=$pm> $crew[crewname] has invited you to join there crew.<br><br><input type=\"hidden\" name=\"crew\" value=\"$crew[crewname]\"> You can <input type=\"radio\" name=\"accept\" value=\"yes\">Accept or <input type=\"radio\" name=\"accept\" value=\"no\">Decline the offer.<br><input type=\"submit\" value=\"Submit\" name=\"submit\"></form>";
  517. $ip = $_SERVER['REMOTE_ADDR'];
  518. $date = date("H:i:s d-m-Y");
  519. mysql_query("INSERT INTO messages (van,naar,datum,bericht,gelezen) VALUES ('Notification','$invite_user','$date','$message','0')") or die(mysql_error());
  520. echo "Invite is sent to <b>$to_user</b>.";
  521. }
  522. }
  523. elseif(isset($_POST['perform'])){
  524. if($action == 'donate'){
  525. if($value < 1){
  526. echo ("You need to donate at least $1.");
  527. }
  528. elseif($value > $money){
  529. echo ("You don't have enough money to donate");
  530. }
  531. else{
  532. $nmoney = $money - $value;
  533. $cmoney = $crew['crewbank'] + $value;
  534. mysql_query("UPDATE users SET money = '$nmoney' WHERE username ='$username'");
  535. mysql_query("UPDATE crews SET crewbank = '$cmoney' WHERE crewname = '$crewuser");
  536. echo ("You donated <b>$".number_format($value)."</b> in your crews bank.");
  537. }
  538. }
  539. elseif($action == 'withdraw'){
  540. if($value < 1){
  541. echo ("You need to withdraw at least $1");
  542. }
  543. elseif($value > $crew['crewbank']){
  544. echo ("You cannot withdraw more than there is on the crewbank");
  545. }
  546. else{
  547. $nmoney = $money + $value;
  548. $cmoney = $crew['crewbank'] - $value;
  549. mysql_query("UPDATE users SET money = '$nmoney' WHERE username = '$username'");
  550. mysql_query("UPDATE crews SET crewbank = '$cmoney' WHERE crewname = '$crewuser'");
  551. echo ("You withdrew <b>$".number_format($value)."</b> from your crewbank.");
  552. }
  553. }
  554. }
  555. elseif(isset($_POST['change_quote'])){
  556. mysql_query("UPDATE crews SET quote = '$quote' WHERE crewname = '$crewuser'");
  557. echo ("Crews quote has been changed");
  558. }
  559. elseif(isset($_GET['kick'])){
  560. mysql_query("UPDATE users SET crew = 'none' WHERE id = '{$_GET['kick']}'");
  561. echo ("That member has been kicked");
  562. }
  563. elseif(isset($_POST['change_underboss'])){
  564. $select = mysql_query("SELECT * FROM users WHERE username = '$new_underboss'");
  565. $underboss_excists = mysql_num_rows($select);
  566. if(!$underboss_excists){
  567. echo ("This user doesn't excist");
  568. }
  569. elseif($new_underboss == ""){
  570. echo ("You need to fill in an username");
  571. }
  572. else{
  573. mysql_query("UPDATE users SET crewlvl = '3' WHERE username = '$new_underboss'");
  574. mysql_query("UPDATE crews SET underboss = '$new_underboss' WHERE crename = '$crewuser'");
  575. echo ("The underboss has been changed");
  576. }
  577. }
  578. ?>
  579. <table border=0 class="page" width="100%">
  580. <tr><td width="50%" align="center" valign="top">
  581.  
  582. <form action="<?=$_SERVER['PHP_SELF']; ?>">
  583. <table border=1 bordercolor=#000000 cellpadding=0 cellspacing=0>
  584. <th class="header" colspan="2">Invite user:</th>
  585. <tr>
  586. <td>Username:</td>
  587. <td><input type='text' name="to_user"></td>
  588. </tr>
  589. <tr>
  590. <td>&nbsp;</td>
  591. <td><input type="submit" value="Send invite!" name="invite_submit"></td>
  592. </tr>
  593. </table>
  594. </form>
  595.  
  596. </td><td align="center" valign="top" width="50%">
  597.  
  598. <form action="<?=$_SERVER['PHP_SELF']; ?>">
  599. <table border=1 bordercolor=#000000 cellpadding=0 cellspacing=0>
  600. <th class="header" colspan="2">Crewbank</th>
  601. <tr>
  602. <td>Money on crewbank:</td>
  603. <td>$<?=number_format($crew['crewbank']); ?></td>
  604. </tr>
  605. <tr>
  606. <td><input type="radio" name="action" value="donate"> Donate<br />
  607. <input type="radio" name="action" value="withdraw"> Withdraw</td>
  608. <td><input type="text" name="value"></td>
  609. </tr>
  610. <tr>
  611. <td>&nbsp;</td>
  612. <td><input type="submit" value="Perform action" name="perform"></td>
  613. </tr>
  614. </table>
  615. </form>
  616.  
  617. </td></tr>
  618. <tr><td align="center" valign="top" width="50%">
  619.  
  620. <form action="<?=$_SERVER['PHP_SELF']; ?>">
  621. <table border=1 bordercolor=#000000 cellpadding=0 cellspacing=0>
  622. <th class="header" colspan="2">Change Quote:</th>
  623. <tr><td>Quote:</td><td><textarea name="quote" cols="28" rows="8"><?=$crew['quote']; ?></textarea></td></tr>
  624. <tr><td>&nbsp;</td><td><input type="submit" value="Change" name="change_quote"></td></tr>
  625. </table>
  626. </form>
  627.  
  628. </td><td align="center" valign="top" width="50%">
  629.  
  630. <form action=<?=$_SERVER['PHP_SELF']; ?>>
  631. <table border=1 bordercolor=#000000 cellpadding=0 cellspacing=0>
  632. <th class="header" colspan="2">Change Image</th>
  633. <tr>
  634. <td>Image:</td>
  635. <td><? if($crew['imgurl'] == ''){ echo "None"; }else{ echo "<img src=".$crew['imgurl'].">"; } ?></td>
  636. </tr>
  637. <tr>
  638. <td>New image:</td>
  639. <td><input type="text" name="new_imgurl" <? if($crew['imgurl'] == ''){ echo "value=http://"; } ?>></td>
  640. </tr>
  641. </table>
  642. </form>
  643.  
  644. </td></tr>
  645. <tr><td valign="top" align="center" width="50%">
  646.  
  647. <table border=1 bordercolor=#000000 cellpadding=0 cellspacing=0>
  648. <th class="header" colspan="6">Members</th>
  649. <tr>
  650. <td>Username</td>
  651. <td>Rank</td>
  652. <td>Status</td>
  653. <td>Kick</td>
  654. </tr>
  655. <?
  656. $allm = mysql_query("SELECT * FROM users WHERE crew = '$crewuser'");
  657. $totalcrewmembers = mysql_num_rows($allm);
  658. while($member = mysql_fetch_Array($allm)){
  659. $id = $member['id'];
  660. $membername = $member['username'];
  661. $ervaring = $member['ervaring'];
  662. if($ervaring <= 150){
  663. $rank = "Scum";
  664. }
  665. elseif($ervaring > 150 AND $ervaring <= 350){
  666. $rank = "Thief";
  667. }
  668. elseif($ervaring > 350 AND $ervaring <= 750){
  669. $rank = "Mobster";
  670. }
  671. elseif($ervaring > 750 AND $ervaring <= 1500){
  672. $rank = "Thug";
  673. }
  674. elseif($ervaring > 1500 AND $ervaring <= 3500){
  675. $rank = "Scout";
  676. }
  677. elseif($ervaring > 3500 AND $ervaring <= 7500){
  678. $rank = "Soldier";
  679. }
  680. elseif($ervaring > 7500 AND $ervaring <= 15000){
  681. $rank = "Local Boss";
  682. }
  683. elseif($ervaring > 15000 AND $ervaring <= 50000){
  684. $rank = "Boss";
  685. }
  686. elseif($ervaring > 50000 AND $ervaring <= 150000){
  687. $rank = "Commander";
  688. }
  689. elseif($ervaring > 150000 AND $ervaring <= 200000){
  690. $rank = "Godfather";
  691. }
  692. elseif($ervaring > 200000 AND $ervaring <= 400000){
  693. $rank = "Legendary Godfather";
  694. }
  695. elseif($ervaring > 400000 AND $ervaring <= 600000){
  696. $rank = "General";
  697. }
  698. elseif($ervaring > 600000 AND $ervaring <= 800000){
  699. $rank = "Don";
  700. }
  701. elseif($ervaring > 800000 AND $ervaring <= 1000000){
  702. $rank = "Respectable Don";
  703. }
  704. elseif($ervaring > 1000000 AND $ervaring <= 1000000000){
  705. $rank = "Legendary Don";
  706. }
  707. elseif($ervaring > 1000000000 AND $ervaring <= 5000000000){
  708. $rank = "Moderator";
  709. }
  710. else{
  711. $rank = "Administrator";
  712. }
  713. if($member['life'] > 0){
  714. $status = "Alive";
  715. }
  716. else{
  717. $status = "Dead";
  718. }
  719. ?>
  720. <tr>
  721. <td><a href="view.php?user=<?=$membername; ?>"><?=$membername; ?></a></td>
  722. <Td><?=$rank; ?></td>
  723. <td><?=$status; ?></td>
  724. <td><a href="?kick=<?=$id; ?>">Kick</a></td>
  725. </tr>
  726. <?
  727. }
  728. ?>
  729.  
  730. </table>
  731.  
  732. </td><td width="50%" valign="top" align="center">
  733.  
  734. <form action="<?=$_SERVER['PHP_SELF']; ?>?p=members">
  735. <table border=1 bordercolor=#000000 cellpadding=0 cellspacing=0>
  736. <th class="header" colspan="2">Change Underboss</th>
  737. <tr>
  738. <td>Old underboss:</td>
  739. <td><?=$crew['underboss']; ?></td>
  740. </tr>
  741. <tr>
  742. <td>New underboss:</td>
  743. <td><input type="text" name="new_underboss"></td>
  744. </tr>
  745. <tr>
  746. <td>&nbsp;</td>
  747. <td><input type="submit" value="Change" name="change_underboss"></td>
  748. </tr>
  749. </table>
  750. </form>
  751.  
  752. </td></tr>
  753. </table>
  754. <?
  755. }
  756. include("footer.php");
  757. ?>

3 antwoorden

Gesponsorde links
Offline Sjaakmans - 13/05/2005 17:56
Avatar van Sjaakmans Nieuw lid Op twee regels staat:
  1. $message = "<form action=\"inbox.php\"><input type=hidden name=id value=$pm> $crew[crewname] has invited you to join there crew.<br><br><input type=\"hidden\" name=\"crew\" value=\"$crew[crewname]\"> You can <input type=\"radio\" name=\"accept\" value=\"yes\">Accept or <input type=\"radio\" name=\"accept\" value=\"no\">Decline the offer.<br><input type=\"submit\" value=\"Submit\" name=\"submit\"></form>";


Deze forms werken wel
Offline Rens - 13/05/2005 18:02
Avatar van Rens Gouden medaille

Crew algemeen
En wij mogen in deze 761 regels gaan zoeken?
;-) 
Offline Shifty - 13/05/2005 18:04
Avatar van Shifty Onbekend Een <form>-tag vereist altijd een declarering van de actie (action) en de methode van posten (method).
  1. <form method="post" action="<?=$_SERVER['PHP_SELF']?>">

Zoiets dus.
Gesponsorde links
Dit onderwerp is gesloten.
Actieve forumberichten
© 2002-2025 Sitemasters.be - Regels - Laadtijd: 0.265s