Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [PHP] użytkownik istnieje
Wieczny
post
Post #1





Grupa: Zarejestrowani
Postów: 191
Pomógł: 1
Dołączył: 21.03.2007

Ostrzeżenie: (60%)
XXX--


Chce aby użytkownik nie mógł stworzyć konta o loginie który jest w bazie ani żeby nie mógł zostawić pustych pól jednak coś źle poszło i nici z tego ;/
  1. <?php
  2. include('cfg.php');
  3. if($_POST['creat'] == 1 )
  4.  {
  5. $post_login = mysql_real_escape_string($_POST['login']);
  6.  $post_password = mysql_real_escape_string($_POST['password']);
  7.  $post_meail = mysql_real_escape_string($_POST['email']);
  8.  
  9.  
  10.  
  11. if(!empty($_POST["login"]) && !empty($_POST["password"])){ echo "Uzupelnij wszystkie pola";}
  12. else{
  13. if(mysql_num_rows(mysql_query("select * from users where user_login='".htmlspecialchars($_POST["login"]."'"))))
  14.  {
  15.  
  16.  
  17. $query = ('INSERT INTO user (id, login, pw, email) 
  18.  VALUES (''''.$post_login.''''.$post_password.''''.$post_meail.'')') or die(mysql_error());
  19.  
  20. $form = mysql_query($query);
  21.  
  22. echo "DODANE !";  
  23.  
  24. }
  25.  
  26. }
  27.  
  28.  
  29. }
  30.  else {
  31.  
  32. echo "
  33.  <link rel='Stylesheet' type='text/css' href='style.css'>
  34.  
  35.  <form action='register.php' method=POST>
  36.  <input class='input' type='text' name='login' maxlength='12'> - Nazwa użytkownika <br /> <br />
  37.  <input class='input' type='password' name='password' maxlength='8'> - Haslo <br /> <br />
  38.  <input class='input' type='text' name='email'> - Adres email <br /> <br />
  39.  <input class='input' type='submit' value='Rejestruj'>
  40.  <input type='hidden' name='creat' value='1'>
  41.  </form>
  42.  ";
  43.  
  44. }
  45. ?>
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: 17.09.2025 - 22:54