daGrevis Posted April 25, 2009 Report Share Posted April 25, 2009 Tātad problēma ir pavisam vienkārša, nesaprotu kādēļ tiek izmests paziņojums "Error!", pat ja visi lauciņi ir aizpildīti... if(isset($_GET['action']) and $_GET['action'] == "signup") { $username = $_POST['username']; $email = $_POST['email']; $password = md5($_POST['password']); $error = array(); if(empty($username)) { $error['username'] = true; } if(empty($email)) { $error['email'] = true; } if(empty($password)) { $error['password'] = true; } if(count($error) <= 1) { echo "Error!"; } else { mysql_query("INSERT INTO users (username, email, password) VALUES ('$username', '$email', '$password')") or die(mysql_error()); } message("announcment", "You have successfully signup!"); //header("Refresh: 3; url=login.php"); } Quote Link to comment Share on other sites More sharing options...
rausis Posted April 25, 2009 Report Share Posted April 25, 2009 if(count($error) <= 1) { samaini uz if(count($error) > 0) { Quote Link to comment Share on other sites More sharing options...
daGrevis Posted April 26, 2009 Author Report Share Posted April 26, 2009 (edited) Paldies, bet nestrādā. Mēģinu piereģistrēt lietotāju bez epasta, un arī piereģistrēju... :( Citas idejas? Labojums. Nē, strādā gan, tikai ir tāda nopietna problēma ar md5 hashoto paroli... Neieraktot neko paroles lauciņā, lietotājs tiek piereģistrēts tāpat, un db tiek ierakstīts "d41d8cd98f00b204e9800998ecf8427e", kas atbilst tukšumam. Idejas? Edited April 26, 2009 by daGrevis Quote Link to comment Share on other sites More sharing options...
rausis Posted April 26, 2009 Report Share Posted April 26, 2009 (edited) pārbaudē liec post bez md5, pēc pārbaudes hasho viņu uz md5 Edited April 26, 2009 by rausis Quote Link to comment Share on other sites More sharing options...
daGrevis Posted April 26, 2009 Author Report Share Posted April 26, 2009 (edited) Šadi? <?php if(isset($_GET['action']) and $_GET['action'] == "signup") { $username = $_POST['username']; $email = $_POST['email']; $password = $_POST['password']; $error = array(); if(empty($username)) { $error['username'] = true; } if(empty($email)) { $error['email'] = true; } if(empty($password)) { $error['password'] = true; } else { $password = $encryptedPassword; $encryptedPassword = md5($_POST['encryptedPassword']); } if(count($error) > 0) { message("error", "Missing from data!"); } else { mysql_query("INSERT INTO users (username, email, password) VALUES ('$username', '$email', '$encryptedPassword')") or die(mysql_error()); message("announcment", "You have successfully signup!"); //header("Refresh: 3; url=login.php"); } } ?> Tik problēma tā pati - saglabājas viss tukšā hashā... :( Edited April 26, 2009 by daGrevis Quote Link to comment Share on other sites More sharing options...
rausis Posted April 26, 2009 Report Share Posted April 26, 2009 http://paste.php.lv/cf5adb218dbb51f0dbff5edf2d0103ef/nonum kaut kā tā... Quote Link to comment Share on other sites More sharing options...
daGrevis Posted April 26, 2009 Author Report Share Posted April 26, 2009 Liels paldies, rausis. Strādā. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.