Hi if you are willing to learn how to hand-code a login script and believe me its not that difficult only a few months ago was i like you and was dependant on Dreamweaver for all login scripts but now i know how to code by hand the login script and believe me it makes much more sense 🙂 so i have posted this script in which i hope it helps you
ok first off in dreamweaver create your forms which i presume you know how to do as you got login stage ok 😃
<?php
///////////////////////////////////CONNECTION SCRIPT!//////////////////////////////////
$connect = mysql_connect('the server name here','username here','password here');
if (!$connect){echo "Could Not Connect!";};
$select_db = mysql_select_db('your database name here',$connect);
if(!$select_db){echo "Could Not Find DB!";}
///////////////////////////////////END CONNECTION SCRIPT!//////////////////////////////////
?>
Now what this script above is doing is making a connection to your server which i presume is localhost but i made the necessary adjustments so you can place your details in and save this file as connect.php
Once done try this
************* NOTE NAME YOUR INPUT FIELDS username and password and your submit button must be named login for this to work.
<?php
include_once('connect.php');
if(isset($_POST['login'])){
$username = ucfirst(trim(mysql_real_escape_string($_POST['username'])));
$password = md5(trim(mysql_real_escape_string($_POST['password']))));
//turn all posts into session variables
foreach($_POST as $key => $val)
{
$_SESSION[$key] = $val;
}
/*query the db The select username
and password bit in the sql indicates the username and password field in your table within your database*/
$sql = "select username,password from (yourtablenamehere) where
username = '".$username."' and
password = '".$password."'";
//execute the sql below
$query = mysql_query($sql);
//check number of rows
$num_rows = mysql_num_rows($query) or die(mysql_error($sql));
//if number of rows is zero then tell the user incorrect login
if ($num_rows == 0){
echo "<li> Your error message here such as incorrect login or something";
//else send the user to loggedinpage.
}else {
header('Location : loggedin.php');
}
}
?>
I hope this helps you and as you can see php- hand code looks a biut tidier than DW generated 🙂
Regards Pinky
P.S This code is untested and may not work but it is not far off it 😃 but hopefully it will work for you 🙂