Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> Automatyczne submit
matmaxalez
post
Post #1





Grupa: Zarejestrowani
Postów: 8
Pomógł: 0
Dołączył: 12.10.2010

Ostrzeżenie: (0%)
-----


Witajcie,

Jestem raczej poczatkujacy w PHP... wiec nie jedzcie po mnie.

Mam taki problem:

Na stronie xxx.pl/skrypt.php jest formularz ktory dodaje np. 1 Pkt dla danego usera.
Formularz wyglada tak:
ID:
Punktow:

Wartosci juz sa wpsiane w value. I teraz chce aby osoba ktora wszedla na xxx.pl/skrypt.php nie musiala klikac na DODAJ, tylko zeby samo wejscie dodalo pkt i przenioslo odrazu na np. xxx.pl/index.php.

Mam nadzieje ze mnie zrozumieliscie, pomimo tak chaotycznego wytlumaczena.

Dzieki i pozdro.
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
matmaxalez
post
Post #2





Grupa: Zarejestrowani
Postów: 8
Pomógł: 0
Dołączył: 12.10.2010

Ostrzeżenie: (0%)
-----


Punkty dalem jako przyklad, skrypt daje surowce (silnik xnova)
  1. <form action="add_money.php" method="post">
  2. <input type="hidden" name="mode" value="addit">
  3. <table width="305">
  4. <tbody>
  5. <th width="130">ID</th>
  6. <th width="155"><input name="id" type="text" value="1" size="3" /></th>
  7. </tr><tr>
  8. <th>Metal</th>
  9. <th><input name="metal" type="text" value="1000" /></th>
  10. </tr><tr>
  11. <th>Krysztal</td>
  12. <th><input name="cristal" type="text" value="1000" /></th>
  13. </tr><tr>
  14. <th>deuter</td>
  15. <th><input name="deut" type="text" value="1000" /></th>
  16. </tr><tr>
  17. <th colspan="2"><input type="Submit" value="Dodaj" /></th>
  18. </tbody>
  19. </tr>
  20. </table>
  21. </form>
  22. <?php
  23.  
  24. /**
  25.  * add_money.php
  26.  *
  27.  * @version 1.1
  28.  * @copyright 2008 By Chlorel for XNova
  29.  * portion to e-Zobar<form action="add_money.php" method="post">
  30. <input type="hidden" name="mode" value="addit">
  31. <table width="305">
  32. <tbody>
  33. <th width="130">ID</th>
  34. <th width="155"><input name="id" type="text" value="1" size="3" /></th>
  35. </tr><tr>
  36. <th>Metal</th>
  37. <th><input name="metal" type="text" value="1000" /></th>
  38. </tr><tr>
  39. <th>Krysztal</td>
  40. <th><input name="cristal" type="text" value="1000" /></th>
  41. </tr><tr>
  42. <th>deuter</td>
  43. <th><input name="deut" type="text" value="1000" /></th>
  44. </tr><tr>
  45. <th colspan="2"><input type="Submit" value="Dodaj" /></th>
  46. </tbody>
  47. </tr>
  48. </table>
  49. </form>
  50.  <?php
  51.  
  52. /**
  53.  * add_money.php
  54.  *
  55.  * @version 1.1
  56.  * @copyright 2008 By Chlorel for XNova
  57.  * portion to e-Zobar
  58.  */
  59.  
  60. define('INSIDE' , true);
  61. define('INSTALL' , false);
  62. define('IN_ADMIN', true);
  63.  
  64. $xnova_root_path = './../';
  65. include($xnova_root_path . 'extension.inc');
  66. include($xnova_root_path . 'common.' . $phpEx);
  67.  
  68. if ($user['authlevel'] >= 0) {
  69. includeLang('admin');
  70.  
  71. $mode = $_POST['mode'];
  72.  
  73. $PageTpl = gettemplate("admin/ad_mone");
  74. $parse = $lang;
  75.  
  76. if ($mode == 'addit') {
  77. $id = $_POST['id'];
  78. $metal = $_POST['metal'];
  79. $cristal = $_POST['cristal'];
  80. $deut = $_POST['deut'];
  81.  
  82. $QryUpdatePlanet = "UPDATE {{table}} SET ";
  83. $QryUpdatePlanet .= "`metal` = `metal` + '". $metal ."', ";
  84. $QryUpdatePlanet .= "`crystal` = `crystal` + '". $cristal ."', ";
  85. $QryUpdatePlanet .= "`deuterium` = `deuterium` + '". $deut ."' ";
  86. $QryUpdatePlanet .= "WHERE ";
  87. $QryUpdatePlanet .= "`id` = '". $id ."' ";
  88. doquery( $QryUpdatePlanet, "planets");
  89.  
  90. AdminMessage ( $lang['adm_am_done'], $lang['adm_am_ttle'] );
  91. }
  92. $Page = parsetemplate($PageTpl, $parse);
  93.  
  94. display ($Page, $lang['adm_am_ttle'], false, '', true);
  95. } else {
  96. AdminMessage ( $lang['sys_noalloaw'], $lang['sys_noaccess'] );
  97. }
  98.  
  99. ?>
  100. */
  101.  
  102. define('INSIDE' , true);
  103. define('INSTALL' , false);
  104. define('IN_ADMIN', true);
  105.  
  106. $xnova_root_path = './../';
  107. include($xnova_root_path . 'extension.inc');
  108. include($xnova_root_path . 'common.' . $phpEx);
  109.  
  110. if ($user['authlevel'] >= 0) {
  111. includeLang('admin');
  112.  
  113. $mode = $_POST['mode'];
  114.  
  115. $PageTpl = gettemplate("admin/ad_mone");
  116. $parse = $lang;
  117.  
  118. if ($mode == 'addit') {
  119. $id = $_POST['id'];
  120. $metal = $_POST['metal'];
  121. $cristal = $_POST['cristal'];
  122. $deut = $_POST['deut'];
  123.  
  124. $QryUpdatePlanet = "UPDATE {{table}} SET ";
  125. $QryUpdatePlanet .= "`metal` = `metal` + '". $metal ."', ";
  126. $QryUpdatePlanet .= "`crystal` = `crystal` + '". $cristal ."', ";
  127. $QryUpdatePlanet .= "`deuterium` = `deuterium` + '". $deut ."' ";
  128. $QryUpdatePlanet .= "WHERE ";
  129. $QryUpdatePlanet .= "`id` = '". $id ."' ";
  130. doquery( $QryUpdatePlanet, "planets");
  131.  
  132. AdminMessage ( $lang['adm_am_done'], $lang['adm_am_ttle'] );
  133. }
  134. $Page = parsetemplate($PageTpl, $parse);
  135.  
  136. display ($Page, $lang['adm_am_ttle'], false, '', true);
  137. } else {
  138. AdminMessage ( $lang['sys_noalloaw'], $lang['sys_noaccess'] );
  139. }
  140.  
  141. ?>
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 7.10.2025 - 03:09