mysql - After filling in the form I dont receive anything back. [PHP register/login] -
you dont need anymore:
*after filling in form dont receive site. tried fill in random letters doesnt answer passwords doesnt mach or so. made mysql table this: img url: http://i.imgur.com/gyc6flf.png me? skip
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
edit:
i found new script login script seems working fine. register doesn't work here. doesn't tell if dont fill in field. nothing if fill fields in.
skip
(new) register.php
<? session_start(); ?> <font face=verdana size=1> <? if($_session['login'] == "true"){ print " have allready account.";//because logged in stupid } include('connect mysql database link'); if(!isset($_request['submit'])){ ?> <form method=post acion=""<? $_server['php_self'] ?>""> <table> <tr> <td> <font face=verdana size=1>username: </td> <td> <input type="text" name="name" maxlength="15"> </td> </tr> <tr> <td> <font face=verdana size=1>password: </td> <td> <input type="password" name="pass1"> </td> </tr> <tr> <td> <font face=verdana size=1>confirm: </td> <td> <input type="password" name="pass2"> </td> </tr> <tr> <td> <input type="submit" value=submit name="submit"> </td> <td> <input type="reset"> </td> </tr> </table> </form> <?php }else{ //request $dead = "false";//we make 'dead' if fields not filled in don't check pass , name in db. $message = "<font face=verdana size=1>pleas fill in fields correctly:<br>"; $username = $_post['name']; $pass1 = $_post['pass1']; $pass2 = $_post['pass2']; $ip = $_server['remote_addr']; $status = "1";//1 member, 2,co-admin 3, admin //begin search errors if(strlen($username) <= 3 or strlen($username) >=15){ $dead = "true"; $message .= "username (4-14)<br>"; } if(strlen($pass1) < 6 or strlen($pass1) > 20 or $pass1 !== $pass2) { $dead = "true"; $message .= "password (6-20) or passwords not match"; } if($dead = "false"){ $username = strtolower(trim(strip_tags($username))); $pass1 = trim($pass1); $pass1 = md5($pass1); $query = mysql_query("select * members username ='$username'"); $aantalrijen = mysql_num_rows($query); if($aantalrijen == 1){ print "<font face=verdana size=1>sorry, username exists allready."; } else{ $query1 = "insert members(username, password, ip, status) values ('$username','$pass1', '$ip','$status')"; if(mysql_query($query1)){ print "<font face=verdana size=1>well donne member of rtd group.<br><a href=login.php>login</a>"; } } } elseif($dead == "true"){ print $message; } } ?>
for readability, try changing;
switch($act){ default; index(); break; case "login"; login(); break; }
to
$act = $_get['act']; if("login" == $act){ login(); }else{ index(); }
once working, should converting mysqli, or pdo. mysql_query (or be) deprecated. recommend juddsters database class - http://development.andrewjudd.ca/ (link on right 'database.php').
======== edit
a simple debugging method adding example;
$act = $_get['act']; print "1"; if("login" == $act){ print "2"; login(); print "3"; }else{ print "4"; index(); print "5"; } print "6";
if functions calling correctly should see either 12 @ start , 36 @ end, or 14 @ start , 56 @ end.
Comments
Post a Comment