Hello everyone! I'm Amie, and I'm a little new to PHP and MySQL. That being said, I am attempting to create a Login form with a username and password field. I pretty much have it down with the structure I think. I set up the MySQL database with GoDaddy. I started to set up everything in Dreamweaver CS4, I connected to the MySQL on my GoDaddy hosting, and started to make my PHP page. Here is my code so far:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Log In</title>
</head>
<body>
<form action="index.php?login=yes" method="post">
Username: <input type="text" name="user" /><br />
Password: <input type="text" name="pass" /><br />
<input type="submit" value="Log In" /><p>
</form>
<?php
$user=$_POST['user'];
$pass=$_POST['past'];
$login=$_GET['login'];
if($login=='yes'){
$con=mysql_connect('p80mysql90.secureserver.net','AmieAmie88','SexyAmieTits88');
mysql_select_db('amiedata');
$user=mysql_real_escape_string($user);
$pass=mysql_real_escape_string($pass);
$get=mysql_query('SELECT count(id) FROM login WHERE user='$user' and pass='$pass');
$result=mysql=result($get, 0);
mysql_close($con);
if ($result!=1) echo= "Invalid Login!";
else{
echo"Login Success!"
$_SESSION['user']=$user;
};
};
?>
</body>
</html>
Here is my MySQL Database Info:
Connection Name: AmieCutieToes
MySQL Server: p80mysql90.secureserver.net
Username: AmieAmie88
Password: SexyAmieTits88
Database: amiedata
I. Did I properly create a simple login form and put in my MySQL Database Info into the PHP code correctly?
II. How do I go about creating multiple usernames and passwords so that this form can be logged in with more than one username and password. The one I put into the PHP code is the main username and password I created for my database on GoDaddy. I'm thinking you make a table with the multiple usernames and passwords that I want? If so, how do you do that, because I have no clue where to start?
III. Can the PHP login form be customized with some CSS? I want it to eventually look pretty :)
IV. When the user puts in their correct username and password and hits the "Log In" button, I want them to be sent to a page I will create next called "navigation.php". How do I do this instead of having an echo saying "Login Success!" ? On this new page I will have a search feature to search data in tables. I will have to learn and figure out this part next. One question though for now, can I use the same MySQL Database info on the navigation.php and it's search feature?
Thanks a bunch!!