Jump to content

need help with login


bran407

Recommended Posts

<?php session_start(); ?>

<html>

<head>

<title> Login Test With Mysql</title>

<Form action='index.php'?==login==yes' method=POST>

Username <input type=text name='user'><br />

Password <input type=password name='pass'><br />

<input type=submit value='Login'>

</form>

 

<?php

$user=$_POST['user'];

$Pass=$_POST['pass'];

$login=$_Get['login'];

 

if ($login=='yes')

{

$con = mysql_connect("localhost","root","yournewpassword");

}

 

else

{

echo "Connected to database please login";

}

mysql_select_db('login');

$sql = "SELECT * FROM `users` WHERE `username`='$username' AND `password`='$password'";

$result = mysql_query($sql) or die(mysql_error());

mysql_close($con);

if ($result=1)

{echo "login failure!";

}

else

{

echo "login success!";

}

?>

 

 

 

</body>

</html>

 

 

 

and i think thats wrong but also i dunno how to test it mysql i tried 

 

CREATE TABLE `users` (

`user_id` int(4) NOT NULL auto_increment,

`username` varchar(65) NOT NULL default '',

`password` varchar(65) NOT NULL default '',

PRIMARY KEY (`user_id`)

) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

 

but i oculdnt figure out how to fill out a username/pass feild thanks so much for the help if u can guys!!!!

Link to comment
https://forums.phpfreaks.com/topic/78604-need-help-with-login/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.