Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [PHP][MYSQL]Rejestracja(acces)
gomez
post
Post #1





Grupa: Zarejestrowani
Postów: 11
Pomógł: 1
Dołączył: 8.04.2008

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


Witam
Mam skrypt na rejestracje i działa idealnie! Tylko jeśli rejestruje jakaś osobe to po wysłaniu rekordu, nie moge się i tak zalogować ponieważ nie ma wpisanego w kolumne acces >root<. Chciałbym żebyśćie mi pomogli w naprawieniu tego, o to skrypt:
  1. ><?
  2. if (isset($_POST['submit'])){
  3. require_once('config.php');
  4.  if ( eregi("^[[:alpha:]._]{4,15}$", stripslashes(trim($_POST['login'])))){
  5. $l = usun($_POST['login']);
  6. }else{
  7. $l = FALSE;
  8. $message .= '<font color="red">Proszę podać imie</font><br />';
  9. }
  10.  
  11. if ( eregi ("^[[:alnum:]][a-z0-9_.-]*@[a-z0-9.-]+.[a-z]{2,4}$", stripslashes(trim($_POST['email'])))){
  12. $e = usun($_POST['email']);
  13. }else{
  14. $e = FALSE;
  15. $message .= '<font color="red">Proszę podać email</font><br />';
  16. }
  17. if ( eregi("^[[:alpha:]]{4,20}$", stripslashes(trim($_POST['pass'])))){
  18. if($_POST['pass'] == $_POST['pass2']){
  19. $p = usun($_POST['pass']);
  20. }else{
  21. $message .= '<font color="red">Podane hasła różnią się od siebie</font><br />';
  22. }
  23. }else{
  24. $message .= '<font color="red">Prosze podać hasło</font><br />';
  25. }
  26. if ( $l && $e && $p ){
  27.  
  28. $query = "SELECT user_id FROM user WHERE username='$l'";
  29. $result = @mysql_query($query);
  30.  
  31. // sprawdzanie czy takie konto istnienie
  32. if ( mysql_num_rows($result) == 0){ // jezeli nie istnieje
  33. //dodajemy uzytkownika do bazy
  34. $query2 = "INSERT INTO user (username, email, haslo, data_rejstacji) VALUES ('$l', '$e', PASSWORD('$p'), NOW())";
  35. $result2 = @mysql_query($query2);
  36.  
  37. if ($result2){ //jezeli nie wystapily zadne bledy
  38. echo 'Zostałes zarejstrowany na stronie';
  39. }else{
  40. echo 'Ze względu na wystąpienie błędu systemowego rejestracja nie była możliwa. Przepr
    aszamy za wszelkie niedogodnościi.<br />'
    ;
  41. }
  42. }else{
  43. $message .= '<font color="red">Konto o podanym nicku juz istnieje</font><br />';
  44. }
  45.  
  46. }else{
  47. $message .= '<font color="red">Spróbuj ponownie</font><br />';
  48. }
  49. }
  50. ?>  
  51. <html>
  52. <head>
  53. <title>Rejstracja</title>
  54. <script type="text/javascript">
  55. <!-- //
  56. function regulamin()
  57. {
  58. if(document.getElementById('reg').checked == true )
  59. {
  60. document.getElementById('dalej').disabled=false;
  61. }
  62. else
  63. {
  64. document.getElementById('dalej').disabled=true;
  65. }
  66. }
  67. // ]]> -->
  68. </script>
  69. </head>
  70. <body>
  71. <form method="post" action="<? echo $_SERVER['PHP_SELF']; ?>">
  72. <table align="left" border="0">
  73. <tr>
  74. <td align="right" class="uni_01">login:</td>
  75. <td><input type="text" name="login" size="35" value="<? if (isset($_POST['login'])){ echo $_POST['login']; }?>"><small>*minimalna długość loginu to 4 znaki</small>
  76. </td>
  77. </tr>
  78. <tr>
  79. <td align="right" class="uni_01">email:</td>
  80. <td><input type="text" name="email" size="35" value="<? if (isset($_POST['email'])){ echo $_POST['email']; } ?>">
  81. </td>
  82. </tr>
  83. <tr>
  84. <td align="right" class="uni_01">hasło:</td>
  85. <td><input name="pass" type="password" size="25"><small>*minimalna długosc hasła do 4 znaki</small>
  86. </td>
  87. </tr>
  88. <tr>
  89. <td align="right" class="uni_01">powtórz hasło::</td>
  90. <td><input name="pass2" type="password" size="25">
  91. </td>
  92. </tr>
  93. <tr>
  94. <td align="right" class="uni_01">&nbsp;</td>
  95. <td>
  96. <b>Oświadczam, że zapoznałem się z regulaminem i zgadzam się na warunki tam zami
    eszczone</b>
  97. <input type="checkbox" id="reg" onClick="regulamin()" />
  98. </td>
  99. </tr>
  100. <tr>
  101. <td align="right" class="uni_01">&nbsp;</td>
  102. <td>
  103. <input style="font-weight: bold;" type="submit" name="submit" value="loguj" id="dalej" disabled="disabled">
  104. </td>
  105. </tr>
  106. </table>
  107. </form>

Podsumowanie:
Proszę żeby ktoś pokazał gdzie wstawić coś by do zarejestrowanego nowego użytkownika dopisywało root w kolumnie acces.!
Zgóry dzięki!
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 Aktualny czas: 19.08.2025 - 02:20