Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> php/mysql Formularz zamówienia
matx132
post 3.03.2008, 17:03:12
Post #1





Grupa: Zarejestrowani
Postów: 243
Pomógł: 19
Dołączył: 12.09.2005

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


witam,
otóż mam taki formularz zamówienia,

  1. <form method="post" action="zamow.php">
  2.  
  3. <table width="400" border="0" align="center">
  4. <tr>
  5. <td width="150" align="left"><p><label>PayPal E-mail</label></p></td>
  6. <td width="250" align="left"><input type="text" name="pemail" size="25" maxlength="100" autocomplete="off" class="field" value="" tabindex="1" /></td>
  7. </tr>
  8. <tr>
  9. <td width="150" align="left"><p><label>Opis</label></p></td>
  10. <td width="250" align="left"><input type="text" name="description" size="25" maxlength="100" autocomplete="off" class="field" value="" tabindex="2" /></td>
  11. </tr>
  12. <tr>
  13. <td width="150" align="left"><p><label>Link</label></p></td>
  14. <td width="250" align="left"><input type="text" name="url" size="25" maxlength="150" autocomplete="off" class="field" value="http://" tabindex="3" /></td>
  15. </tr>
  16. <tr>
  17. <td width="150" align="left"><p><label>Wybierz plan:</label></p></td>
  18. <td width="250" align="left"><select name="plan" class="combo" tabindex="4" />
  19.  
  20. <option value="<?
  21. require ('config.php');
  22. $sql = "SELECT * FROM tb_config WHERE item='hits' and howmany='500'";
  23. $result = mysql_query($sql);
  24. $row = mysql_fetch_array($result);
  25.  
  26. echo $row["howmany"];
  27.  
  28. ?>"><?= $row["howmany"] ?> Wizyt $<?= $row["price"] ?></option>


plik w którym jest to odbierane wygląda tak


  1. <?
  2. if (isset($_POST["pemail"])) {
  3. require('config.php');
  4.  if( strtolower($_POST['code'])!= strtolower($_SESSION['texto'])){
  5. echo "Zły kod... <br>";
  6.  include('footer.php');
  7. exit();
  8. }
  9.  
  10. function limpiarez($mensaje)
  11. {
  12. $mensaje = htmlentities(stripslashes(trim($mensaje)));
  13. $mensaje = str_replace("'"," ",$mensaje);
  14. $mensaje = str_replace(";"," ",$mensaje);
  15. $mensaje = str_replace("$"," ",$mensaje);
  16. return $mensaje;
  17. }
  18. function getRealIPe()
  19. {
  20.  
  21.  if( $_SERVER['HTTP_X_FORWARDED_FOR'] != '' )
  22.  {
  23. $client_ip =
  24.  ( !empty($_SERVER['REMOTE_ADDR']) ) ?
  25. $_SERVER['REMOTE_ADDR']
  26. :
  27. ( ( !empty($_ENV['REMOTE_ADDR']) ) ?
  28.  $_ENV['REMOTE_ADDR']
  29.  :
  30.  "unknown" );
  31. $entries = split('[, ]', $_SERVER['HTTP_X_FORWARDED_FOR']);
  32. reset($entries);
  33. while (list(, $entry) = each($entries))
  34. {
  35.  $entry = trim($entry);
  36.  if ( preg_match("/^([0-9]+.[0-9]+.[0-9]+.[0-9]+)/", $entry, $ip_list) )
  37.  {
  38. // <a href=\"http://www.faqs.org/rfcs/rfc1918.html\" target=\"_blank\">http://www.faqs.org/rfcs/rfc1918.html</a>
  39. $private_ip = array(
  40. '/^0./',
  41. '/^127.0.0.1/',
  42. '/^192.168..*/',
  43. '/^172.((1[6-9])|(2[0-9])|(3[0-1]))..*/',
  44. '/^10..*/');
  45.  
  46. $found_ip = preg_replace($private_ip, $client_ip, $ip_list[1]);
  47.  
  48. if ($client_ip != $found_ip)
  49. {
  50.  $client_ip = $found_ip;
  51.  break;
  52. }
  53.  }
  54. }
  55.  }
  56.  else
  57.  {
  58. $client_ip =
  59.  ( !empty($_SERVER['REMOTE_ADDR']) ) ?
  60. $_SERVER['REMOTE_ADDR']
  61. :
  62. ( ( !empty($_ENV['REMOTE_ADDR']) ) ?
  63.  $_ENV['REMOTE_ADDR']
  64.  :
  65.  "unknown" );
  66.  }
  67.  
  68.  return $client_ip;
  69.  
  70. }
  71.  
  72. $pemail=limpiarez($_POST["pemail"]);
  73. $plan=limpiarez($_POST["plan"]);
  74. $url2=limpiarez($_POST["url"]);
  75. $description=limpiarez($_POST["description"]);
  76. $bold=limpiarez($_POST["bold"]);
  77. $highlight=limpiarez($_POST["highlight"]);
  78.  
  79. if ($pemail==""){echo "Error"; exit();}
  80. if ($plan==""){echo "Error"; exit();}
  81. if ($url2==""){echo "Error"; exit();}
  82. if ($description==""){echo "Error"; exit();}
  83.  
  84. $laip = getRealIPe();
  85.  
  86. require ('config.php');
  87. $query = "INSERT INTO tb_advertisers (pemail, plan, url, description, category, ip, bold, highlight) VALUES('$pemail','$plan','$url2','$description','$category','$laip','$bold','$highlight')";
  88. mysql_query($query) or die(mysql_error());
  89.  
  90. $sql = "SELECT * FROM tb_config WHERE item='hits' and howmany='1000'";
  91. $result = mysql_query($sql);
  92. $row = mysql_fetch_array($result);
  93.  
  94. $wop=$row["howmany"];
  95. $wop1=$row["bold"];
  96. $wop2=$row["highlight"];
  97.  
  98. if ($plan==$wop){
  99. ?>
  100.  
  101. <?
  102. $precio=$row["price"];
  103.  if ($bold==1){
  104. $precio=$row["price"]+2.00;
  105.  }
  106.  if ($highlight==1){
  107. $precio=$row["price"]+3.00;
  108.  }
  109.  if ($bold==&& $highlight==1){
  110. $precio=$row["price"]+2.00+3.00;
  111.  }
  112. ?>


i teraz mam problem bo ostatnio dostałem e miala iż w tym kodzie jest błąd lecz ja nie znalazłem nic w nim:(
sprawdziłem kilka razy i nic nie potrafię znaleźć
czy mógłby mi ktoś pomóc
Go to the top of the page
+Quote Post

Posty w temacie


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

 



RSS Wersja Lo-Fi Aktualny czas: 19.07.2025 - 18:46