I wrote this script today, and it works with check the password and everything, but how do i get it to go to another webpage when the password is right?
Code:<form name="form1" method="post" action="<?php $_SERVER['PHP_SELF']; ?>?action=login"> Username:<input type="text" name="u"><br> Password:<input type="text" name="p"><br> <input type="submit" name="Submit" value="Submit"> </form> <?php $server = "localhost"; $username = "root"; $password = ""; $datebase = "login"; $a = 0; $db = mysql_connect($server, $username, $password); mysql_select_db($datebase, $db); $result = mysql_query("SELECT * FROM users WHERE username='$u'",$db) or die(mysql_error()); while ( $r = mysql_fetch_array( $result ) ) { $uu = $r['username']; $pp = $r['password']; } if (isset($action) && $action == 'login') { if ($uu == $u && $pp == $p){ echo "Right!"; $a ++; }else echo "Wrong!"; $a == 0; } print $a; ?>
thanks for any help![]()




Reply With Quote