Jump to content

Registration Script Pronlem


dawid232345

Recommended Posts

Hi all, I'm starting with php and I've made a Registration Script here's the code

<?php

include("skrypty PHP/baza.php"); 
include("skrypty PHP/funkcjewalidacji.php"); 


if(isset($_POST['Rejestruj']))
{
        $username = $_POST['username'];
        $email = $_POST['email'];
        $password = $_POST['password'];
        $password_confirm = $_POST['password_confirm'];
      $firstname = $_POST['firstname'];
      $lastname = $_POST['lastname'];
        $data = $_POST['data'];
        $telefon = $_POST['telefon'];
        $ulica = $_POST['ulica'];
      $miasto = $_POST['miasto'];
      $wojewodztwo = $_POST['wojewodztwo'];
      $Nr_domu = $_POST['Nr_domu'];
      $Nr_mieszkania = $_POST['Nr_mieszkania'];
      $Kod_pocztowy = $_POST['Kod_pocztowy'];
      $regulamin1 = $_POST['regulamin1'];
      $regulamin2 = $_POST['regulamin2'];   
      

        if ((compare($password,$password_confirm)) &&
         (!(walidacja_email($email))) &&
         (!(czywypelnione($firstname))) && 
         (!(czywypelnione($lastname))) && 
         (!(czywypelnione($telefon))) && 
         (!(czywypelnione($ulica))) && 
         (!(czywypelnione($miasto))) && 
         (!(czywypelnione($wojewodztwo))) && 
         (!(czywypelnione($Nr_domu))) && 
         (!(czywypelnione($Kod_pocztowy))) && 
         (sprawdzCheckbox($regulamin1)) &&
         (sprawdzCheckbox($regulamin2)) &&
         wal($username))
      {
             ///// filtrujemy dane
                $username = trim(strip_tags( mysql_real_escape_string(HTMLSpecialChars($username))));
                $email = trim(strip_tags( mysql_real_escape_string(HTMLSpecialChars($email))));
                $password = trim(strip_tags( mysql_real_escape_string(HTMLSpecialChars($password))));
                $password_confirm = trim(strip_tags( mysql_real_escape_string(HTMLSpecialChars($password_confirm))));
            $firstname = trim(strip_tags( mysql_real_escape_string(HTMLSpecialChars($firstname))));
                $lastname = trim(strip_tags( mysql_real_escape_string(HTMLSpecialChars($lastname))));
                $data = trim(strip_tags( mysql_real_escape_string(HTMLSpecialChars($data))));
                $telefon = trim(strip_tags( mysql_real_escape_string(HTMLSpecialChars($telefon))));
            $ulica = trim(strip_tags( mysql_real_escape_string(HTMLSpecialChars($ulica))));
                $miasto = trim(strip_tags( mysql_real_escape_string(HTMLSpecialChars($miasto))));
                $wojewodztwo = trim(strip_tags( mysql_real_escape_string(HTMLSpecialChars($wojewodztwo))));
                $Nr_domu = trim(strip_tags( mysql_real_escape_string(HTMLSpecialChars($Nr_domu))));
            $Nr_mieszkania = trim(strip_tags( mysql_real_escape_string(HTMLSpecialChars($Nr_mieszkania))));
                $Kod_pocztowy = trim(strip_tags( mysql_real_escape_string(HTMLSpecialChars($Kod_pocztowy))));
         
                $password = md5($pass);
            
                        $query = "INSERT INTO `rejestr` (`username`, `email`, `password`, `firstname`, `lastname`, `data`, `telefon`, `ulica`, `miasto`, `wojewodztwo`, `Nr_domu`, `Nr_mieszkania`, `Kod_pocztowy`)
                                                 VALUES ('$username', '$email', '$password', '$firstname', '$lastname', '$data', '$telefon', `$ulica`, '$miasto', '$wojewodztwo', '$Nr_domu', '$Nr_mieszkania', '$Kod_pocztowy')"; 
            
                        if(mysql_query($query))
                  {
                      $mesage = 'Rejestraca Zakoñczona Powodzeniem'; 
                  }   

      }         
} else {
    mysql_error();
} 
    
    
    

if (!compare($password,$password_confirm) && (!($_POST['$password'] == $_POST['$password_confirm'])) && (isset($_POST['Rejestruj'])) ){ $mesage='Wprowadzone has³a nie s± identyczne'; }
    elseif (!sprawdzCheckbox($regulamin1) && (isset($_POST['$regulamin1'])) )  { $mesage='Wymagana akceptacja regulaminu';}
   elseif (!sprawdzCheckbox($regulamin2) && (isset($_POST['$regulamin2'])) )  { $mesage='Wymagana akceptacja na przetwarzanie';}
   elseif  (czywypelnione($username) && (isset($_POST['Rejestruj'])))  { $mesage='Wype³nij Wszystkie dane';}
   elseif  (czywypelnione($email) && (isset($_POST['Rejestruj'])))  { $mesage='Wype³nij Wszystkie dane';}
   elseif  (czywypelnione($firstname) && (isset($_POST['Rejestruj'])))  { $mesage='Wype³nij Wszystkie dane';}
   elseif  (czywypelnione($lastname) && (isset($_POST['Rejestruj'])))  { $mesage='Wype³nij Wszystkie dane';}
   elseif  (czywypelnione($data) && (isset($_POST['Rejestruj'])))  { $mesage='Wype³nij Wszystkie dane';}
   elseif  (czywypelnione($telefon) && (isset($_POST['Rejestruj'])))  { $mesage='Wype³nij Wszystkie dane';}
   elseif  (czywypelnione($ulica) && (isset($_POST['Rejestruj'])))  { $mesage='Wype³nij Wszystkie dane
   elseif  (czywypelnione($miasto) && (isset($_POST['Rejestruj'])))  { $mesage='Wype³nij Wszystkie dane';}
   elseif  (czywypelnione($wojewodztwo) && (isset($_POST['Rejestruj'])))  { $mesage='Wype³nij Wszystkie dane';}
   elseif  (czywypelnione($Nr_domu) && (isset($_POST['Rejestruj'])))  { $mesage='Wype³nij Wszystkie dane';}
   elseif  (czywypelnione($Kod_pocztowy) && (isset($_POST['Rejestruj'])))  { $mesage='Wype³nij Wszystkie dane';}
   elseif (!wal() &&  (isset($_POST['Rejestruj'])) ) { $mesage = 'Podany login jest ju¿ zajêty';}
   // mysql_close();

?>

I'm sorry but it's in polish because I'm from Poland  ;) , but i hope you'll understand it.  When i complete the form there's nothing happens. What's the problem ? :confused: 

 

MOD EDIT: manual tags changed to code tags . . .

Link to comment
Share on other sites

i see that something goes wrong when i past the code :) and there's no ';} the code that i have has that at the end

<?php

include("skrypty PHP/baza.php"); 
include("skrypty PHP/funkcjewalidacji.php"); 

// je¿li zostanie naci_ni_ty przycisk "Rejestruj"
if(isset($_POST['Rejestruj']))
{
        $username = $_POST['username'];
        $email = $_POST['email'];
        $password = $_POST['password'];
        $password_confirm = $_POST['password_confirm'];
	$firstname = $_POST['firstname'];
	$lastname = $_POST['lastname'];
        $data = $_POST['data'];
        $telefon = $_POST['telefon'];
        $ulica = $_POST['ulica'];
	$miasto = $_POST['miasto'];
	$wojewodztwo = $_POST['wojewodztwo'];
	$Nr_domu = $_POST['Nr_domu'];
	$Nr_mieszkania = $_POST['Nr_mieszkania'];
	$Kod_pocztowy = $_POST['Kod_pocztowy'];
	$regulamin1 = $_POST['regulamin1'];
	$regulamin2 = $_POST['regulamin2'];	

// Walidacja wszystkich pól
        if ((compare($password,$password_confirm)) &&
		(!(walidacja_email($email))) &&
		(!(czywypelnione($firstname))) && 
		(!(czywypelnione($lastname))) && 
		(!(czywypelnione($telefon))) && 
		(!(czywypelnione($ulica))) && 
		(!(czywypelnione($miasto))) && 
		(!(czywypelnione($wojewodztwo))) && 
		(!(czywypelnione($Nr_domu))) && 
		(!(czywypelnione($Kod_pocztowy))) && 
		(sprawdzCheckbox($regulamin1)) &&
		(sprawdzCheckbox($regulamin2)) &&
		wal($username))
	{
			 ///// filtrujemy dane
                $username = trim(strip_tags( mysql_real_escape_string(HTMLSpecialChars($username))));
                $email = trim(strip_tags( mysql_real_escape_string(HTMLSpecialChars($email))));
                $password = trim(strip_tags( mysql_real_escape_string(HTMLSpecialChars($password))));
                $password_confirm = trim(strip_tags( mysql_real_escape_string(HTMLSpecialChars($password_confirm))));
			$firstname = trim(strip_tags( mysql_real_escape_string(HTMLSpecialChars($firstname))));
                $lastname = trim(strip_tags( mysql_real_escape_string(HTMLSpecialChars($lastname))));
                $data = trim(strip_tags( mysql_real_escape_string(HTMLSpecialChars($data))));
                $telefon = trim(strip_tags( mysql_real_escape_string(HTMLSpecialChars($telefon))));
			$ulica = trim(strip_tags( mysql_real_escape_string(HTMLSpecialChars($ulica))));
                $miasto = trim(strip_tags( mysql_real_escape_string(HTMLSpecialChars($miasto))));
                $wojewodztwo = trim(strip_tags( mysql_real_escape_string(HTMLSpecialChars($wojewodztwo))));
                $Nr_domu = trim(strip_tags( mysql_real_escape_string(HTMLSpecialChars($Nr_domu))));
			$Nr_mieszkania = trim(strip_tags( mysql_real_escape_string(HTMLSpecialChars($Nr_mieszkania))));
                $Kod_pocztowy = trim(strip_tags( mysql_real_escape_string(HTMLSpecialChars($Kod_pocztowy))));
			///// koduemy has³o
                $password = md5($pass);
			//// tworzymy zapytanie
                        $query = "INSERT INTO `rejestr` (`username`, `email`, `password`, `firstname`, `lastname`, `data`, `telefon`, `ulica`, `miasto`, `wojewodztwo`, `Nr_domu`, `Nr_mieszkania`, `Kod_pocztowy`)
                                                 VALUES ('$username', '$email', '$password', '$firstname', '$lastname', '$data', '$telefon', `$ulica`, '$miasto', '$wojewodztwo', '$Nr_domu', '$Nr_mieszkania', '$Kod_pocztowy')" or die (mysql_error()); 
			 // je¿eli zapytanie wykona siê poprawnie to zostanie wy¶wietlony stosowny komunikat
                        if(mysql_query($query))
					{
					    $mesage = 'Rejestraca Zakoñczona Powodzeniem'; 
					}	

	}			
} else {
    mysql_error();
} 
    
    
    

if (!compare($password,$password_confirm) && (!($_POST['$password'] == $_POST['$password_confirm'])) && (isset($_POST['Rejestruj'])) ){ $mesage='Wprowadzone has³a nie s± identyczne'; }
    elseif (!sprawdzCheckbox($regulamin1) && (isset($_POST['$regulamin1'])) )  { $mesage='Wymagana akceptacja regulaminu';}
elseif (!sprawdzCheckbox($regulamin2) && (isset($_POST['$regulamin2'])) )  { $mesage='Wymagana akceptacja na przetwarzanie';}
elseif  (czywypelnione($username) && (isset($_POST['Rejestruj'])))  { $mesage='Wype³nij Wszystkie dane';}
elseif  (czywypelnione($email) && (isset($_POST['Rejestruj'])))  { $mesage='Wype³nij Wszystkie dane';}
elseif  (czywypelnione($firstname) && (isset($_POST['Rejestruj'])))  { $mesage='Wype³nij Wszystkie dane';}
elseif  (czywypelnione($lastname) && (isset($_POST['Rejestruj'])))  { $mesage='Wype³nij Wszystkie dane';}
elseif  (czywypelnione($data) && (isset($_POST['Rejestruj'])))  { $mesage='Wype³nij Wszystkie dane';}
elseif  (czywypelnione($telefon) && (isset($_POST['Rejestruj'])))  { $mesage='Wype³nij Wszystkie dane';}
elseif  (czywypelnione($ulica) && (isset($_POST['Rejestruj'])))  { $mesage='Wype³nij Wszystkie dane';}
elseif  (czywypelnione($miasto) && (isset($_POST['Rejestruj'])))  { $mesage='Wype³nij Wszystkie dane';}
elseif  (czywypelnione($wojewodztwo) && (isset($_POST['Rejestruj'])))  { $mesage='Wype³nij Wszystkie dane';}
elseif  (czywypelnione($Nr_domu) && (isset($_POST['Rejestruj'])))  { $mesage='Wype³nij Wszystkie dane';}
elseif  (czywypelnione($Kod_pocztowy) && (isset($_POST['Rejestruj'])))  { $mesage='Wype³nij Wszystkie dane';}
elseif (!wal() &&  (isset($_POST['Rejestruj'])) ) { $mesage = 'Podany login jest ju¿ zajêty';}
// mysql_close();

?>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.