Pomoc - Szukaj - Użytkownicy - Kalendarz
Pełna wersja: Problem z Skryptem
Forum PHP.pl > Forum > PHP
rodzio2
Witam. Mam gotowy skrypt .
O to on
  1. <?php
  2. include("config.php");
  3. $connect = odbc_connect("Driver={SQL Server};Server={$host}; Database={$dbname}", $user, $pass) or die("Can't connect the MSSQL server.");
  4.  
  5. ?>
  6. <html>
  7. <head>
  8. <title>LifeSro Registration</title>
  9. <link rel="stylesheet" href="css/style2.css" type="text/css" media="screen" />
  10. <link rel="stylesheet" href="css/stylesheet.css" type="text/css" media="screen" />
  11. </head>
  12. <body>
  13. <div align="center" style="position:absolute; top:10px; z-index:0;">
  14.  
  15. </div>
  16. <div class="reg" style="position:relative; top:222px; left:300px;">
  17. <div style="position:relative; top:-28px; left:11px;">
  18. <center><table width='350'>
  19. <form action='epin.php?act=regis' method='POST'>
  20. <tr>
  21. <td><b><font size="5" color="white">LifeSro Registration</font></b></td><br><br>
  22. </tr>
  23. <tr>
  24. </tr>
  25. <tr>
  26. <td width='50px'><input value='ID' type='text' name='username'></td>
  27. </tr>
  28. <tr>
  29. <td width='50px'><input value='E-PIN' type='text' name='password'></td>
  30. </tr>
  31. <tr>
  32. <td width='50px'><input type='submit' value='Dodaj'></td>
  33. </tr>
  34. </table>
  35. </center>
  36. <div style="position:relative; top:-30px; left:135px;">
  37. </div>
  38. </div>
  39. </div>
  40. <center>
  41. <?php
  42. $ip = ($_SERVER['REMOTE_ADDR']);
  43.  
  44. if (isset($_GET['act']) AND $_GET['act'] == "regis")
  45. {
  46. $regdate = date("Y-m-d H:i:s");
  47.  
  48. function anti_injection($sql) {
  49. $sql = preg_replace(sql_regcase("/(from|select|insert|delete|where|'|\"|drop table|show tables|#|\*|--|\\\\)/"),"",$sql);
  50. $sql = trim($sql);
  51. $sql = strip_tags($sql);
  52. $sql = addslashes($sql);
  53. return $sql;
  54. }
  55. $username=anti_injection($_POST['username']);
  56. $password=anti_injection($_POST['password']);
  57.  
  58. if (!$_POST['username'] )
  59. {
  60. echo "<script>alert('Username is empty');location.href='epin.php';</script>";
  61. die();
  62. }
  63. else
  64. if (!$_POST['password'] )
  65. {
  66. echo "<script>alert('E-Pin is empty');location.href='epin.php';</script>";
  67. die();
  68. }
  69.  
  70. $query = odbc_exec($connect, "SELECT LifePIN FROM epin WHERE LifePIN = '$password'");
  71.  
  72. $existing_users = odbc_num_rows($query);
  73. if($existing_users != 1) {
  74.  
  75. echo "<script>alert('Zły lub wykorzystany LifePin');location.href='epin.php';</script>";
  76. die();
  77. } else
  78.  
  79. odbc_exec($connect, "INSERT INTO SK_Silk (JID, silk_own, silk_gift, silk_point) VALUES ('99999', '99999', '0', '0')");
  80.  
  81. echo "<script>alert('Account Registration Successful! \\nUsername: $username \\nPassword: $password2');location.href='$index';</script>";
  82. }
  83.  
  84. ?>
  85. <br/>
  86. </center>
  87. </body>
  88. <tr>
  89. <td>
  90. </td>
  91. </tr>
  92. </table>
  93. </html>

jest to taki skrypt zmieniany na szybko . Ale mam jeden problem. Ponieważ chciałbym aby zrobiło mi coś takiego . SELECT JID FROM TB_User WHERE StrUserID = '$username'" i te wyciagniete JID wpisalo mi do tej tabeli SK_Silk czyli tutaj INSERT INTO SK_Silk (JID, silk_own, silk_gift, silk_point) VALUES ('TUTAJ ZAMIAST TEGO', '99999', '0', '0')")
wookieb
Temat: Jak poprawnie zatytulowac watek
To jest wersja lo-fi głównej zawartości. Aby zobaczyć pełną wersję z większą zawartością, obrazkami i formatowaniem proszę kliknij tutaj.
Invision Power Board © 2001-2025 Invision Power Services, Inc.