Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [MySQL][PHP] link referujacy
Lethys
post 13.04.2011, 16:04:38
Post #1





Grupa: Zarejestrowani
Postów: 642
Pomógł: 2
Dołączył: 9.03.2006

Ostrzeżenie: (30%)
XX---


Witam,

Chcę zrobić system polecania gry.

Problem polega na tym, że mimo iż mimo że zmianna $ref pobiera z linku polecajacego to nie jest on dodawany do bazy :/

Na tym linku można zobaczyć że gracz jest sczytywany http://www.westernlife.pl/poleca/lethys/

Obecnie wygląda to tak:


  1.  
  2. <?php
  3. $ref = mysql_fetch_array(mysql_query("select * from players where user='$ref'"));
  4. ?>
  5.  
  6.  
  7. <form method=post action=rejestracja.php?action=register>
  8.  
  9. <table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" width="500" align="center" height="200">
  10. <tr>
  11. <td width="100%" align="center">
  12. <table border="0">
  13. <tr><td>Użytkownik:</td><td><input type="text" name="user" maxlength="10"></td></tr>
  14. <tr><td>Email:</td><td><input type="text" name="email" maxlength="40"></td></tr>
  15. <tr><td>Powtórz mail:</td><td><input type="text" name="vemail" maxlength="40"></td></tr>
  16. <tr><td>Hasło:</td><td><input type="password" name="pass" maxlength="15"></td></tr>
  17. <tr><td>Polecający:</td><td><?php echo("<input type=\"text\" name=\"referujacy\" value=\"$ref[user]\" disabled=\"disabled\" />"); ?></td></tr>
  18. <tr><td></td><td><br><br><input type="submit" value="Rejestracja" name="submit"></td></tr>
  19. </table>
  20. </form>
  21. <br>Rejestrując się akceptujesz <a href=regulamin.php>regulamin</a>
  22. </td>
  23. </tr>
  24. </table>
  25.  
  26.  
  27.  
  28. <?php
  29. if (isset ($_POST['submit'])){//isset wyslij
  30.  
  31. include("config.php");
  32.  
  33.  
  34. if (!$user || !$email || !$vemail|| !$pass) {
  35. $problem = TRUE;
  36. echo("<p id='uwaga'><h2>Musisz wypełnić wszystkie pola.</h2></p>");
  37. }
  38. if (10 < strlen($_POST['user'])) {
  39. echo("<p id='uwaga'><h2>Zbyt długa nazwa loginu. Maksymalnie <b>10</b> znaków.</h2></p>");
  40. $problem = TRUE;
  41. }
  42. if (strlen($_POST['email']) != strlen($_POST['vemail'])) {
  43. echo("<p id='uwaga'><h2>Podane przez Ciebie emaile się nie zgadzają. Potwierdzony email musi być taki sam.</h2></p>");
  44. $problem = TRUE;
  45. }
  46. $test1 = mysql_num_rows(mysql_query("select * from players where user='".$_POST['user']."'"));
  47. if ($test1 > 0) {
  48. echo("<p id='uwaga'><h2>Ktoś już użył takiej nazwy użytkownika, musisz wybrać inną.</h2></p>");
  49. $problem = TRUE;
  50. }
  51. $test2 = mysql_num_rows(mysql_query("select * from players where email='".$_POST['email']."'"));
  52. if ($test2 > 0) {
  53. echo("<p id='uwaga'><h2>Ktoś już użył takiego adresu email. Musisz użyć innego adresu.</h2></p>");
  54. $problem = TRUE;
  55. }
  56. $test3 = mysql_num_rows(mysql_query("select * from gracze where user='".$_POST['user']."'"));
  57. if ($test3 > 0) {
  58. echo("<p id='uwaga'><h2>Ktoś już użył takiej nazwy użytkownika, musisz wybrać inną.</h2></p>");
  59. $problem = TRUE;
  60. }
  61. $test4 = mysql_num_rows(mysql_query("select * from gracze where email='".$_POST['email']."'"));
  62. if ($test4 > 0) {
  63. echo("<p id='uwaga'><h2>Ktoś już użył takiego adresu email. Musisz użyć innego adresu.</h2></p>");
  64. $problem = TRUE;
  65. }
  66. if (15 < strlen($_POST['pass'])) {
  67. echo("<p id='uwaga'><h2>Twoje hasło jest za długie. Maksymalnie możesz użyć <b>15</b> znaków.</h2></p>");
  68. $problem = TRUE;
  69. }
  70. if(!preg_match('/^([a-ż0-9_]+)$/i', $_POST['user'])){
  71. $problem = TRUE;
  72. echo("<p id='uwaga'><h2>Użyto niedozwolonych znaków w nazwie użytkownika.</h2></p>");
  73. }
  74. if(!preg_match('/^([a-ż0-9_]+)$/i', $_POST['pass'])){
  75. $problem = TRUE;
  76. echo("<p id='uwaga'><h2>Użyto niedozwolonych znaków w haśle.</h2></p>");
  77. }
  78.  
  79.  
  80. if (!$problem){
  81.  
  82.  
  83.  
  84. $data = date("d.m.y");
  85. $haslo = md5($pass);
  86. $kod = rand(100000000,999999999);
  87. global $referujacy;
  88.  
  89. mysql_query("insert into gracze (user, email, pass, data, kod, ref) values ('$user','$email','$haslo','$data','$kod','$referujacy')") or die("Nie można zarejestować.");
  90.  
  91.  
  92. /// blabal dalej kod


Ten post edytował Lethys 13.04.2011, 16:05:08


--------------------
filmy podobne do - wyszukiwarka podobnych filmów
motywacja do działania - Bądź Lepszy
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: 24.07.2025 - 16:09