dawid232345 Posted August 27, 2011 Share Posted August 27, 2011 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 ? MOD EDIT: manual tags changed to code tags . . . Link to comment https://forums.phpfreaks.com/topic/245831-registration-script-pronlem/ Share on other sites More sharing options...
Pikachu2000 Posted August 27, 2011 Share Posted August 27, 2011 Scroll down through your code, and pay attention to where the syntax highlighting colors abruptly change in that mess of elseif() clauses. Link to comment https://forums.phpfreaks.com/topic/245831-registration-script-pronlem/#findComment-1262652 Share on other sites More sharing options...
dawid232345 Posted August 27, 2011 Author Share Posted August 27, 2011 Can anybody fix this code. When I said That nothing's happening, I mean That it's moved me to a empty page. In the address bar, you can see .. / .. / Register.php that's the file of the code that I added Link to comment https://forums.phpfreaks.com/topic/245831-registration-script-pronlem/#findComment-1262655 Share on other sites More sharing options...
cunoodle2 Posted August 27, 2011 Share Posted August 27, 2011 Pikachu2000 already gave you the answer. I'll go even further and just paste the line where the error is.. elseif (czywypelnione($ulica) && (isset($_POST['Rejestruj']))) { $mesage='Wype³nij Wszystkie dane Link to comment https://forums.phpfreaks.com/topic/245831-registration-script-pronlem/#findComment-1262658 Share on other sites More sharing options...
dawid232345 Posted August 28, 2011 Author Share Posted August 28, 2011 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 https://forums.phpfreaks.com/topic/245831-registration-script-pronlem/#findComment-1262821 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.