coolglen
21 May 2011, 07:11 AM
i am getting very annoyed with php everything i wright i get a error of some kind and its ever easy to fix, anyway this time i got my login script working i could log into my dummy account no problem so i set that aside and started making my register script i have got that all finished and n i have created a account with that and tried to login to it using my login script but it doesn't find my account in the data base i get the else statement from "if ($numrows !=0)"
<?php
session_start();
$username = $_POST['username'];
$password = $_POST['password'];
include ("connect.php");
if ($username && $password)
{
$queryget = mysql_query ("SELECT * FROM users WHERE username='$username' AND password='password'");
$numrows = mysql_num_rows($queryget);
if ($numrows != 0)
{
$_SESSION['username'] = $username;
echo "You have been logged in. <a href='members.php'> Go to members area.</a>";
}
else
{
echo "Your username was not found.<a href='index.php'>Register here.</a>";
}
}
else
{
echo "You did not provide the proper info needed for login.";
include ("loginpage.php");
}
?>
p.s. i also have md5 encryption on the register script and id also like to know how to add it to the loin script so it finds the right password, that's not why i am having these troubles though because i made a dummy account without an encryption to test it.
and as for the adding the date to the database.
i am trying to make a registration script for my website iv got it mostly done but i am wondering how to get the date of birth into the database with my format.
i am using a drop down menu for the date of birth
like this..
<select name='birthdate1' id='birthdate1'><option value='0'>--Day--</option>
<select name=;birthdate2' id='birthdate2'><option value='0'>--Month--</option>
<select name='birthdate3' id='birthdate3'><option value='0'>--Year--</option>
and in my php code i have
$fullname = $_POST['name'];
$username = $_POST['username'];
$password = $_POST['password'];
$cpass= $_POST['cpass'];
$email = $_POST['email'];
$cemail = $_POST['cemail'];
$dob1 = $_POST['birthdate1'];
$dob2 = $_POST['birthdate2'];
$dob3 = $_POST['birthdate3'];
and to insert it into my data base i use
$register = mysql_query ("INSERT INTO users VALUES('','$username',$password')
since the date of birth has 3 "attributes"($dob1, $dob2, $dob3) i hope that's what there called :S correct me if i am wrong, anyway back to the point
how can i get the date of birth into the database properly?
<?php
session_start();
$username = $_POST['username'];
$password = $_POST['password'];
include ("connect.php");
if ($username && $password)
{
$queryget = mysql_query ("SELECT * FROM users WHERE username='$username' AND password='password'");
$numrows = mysql_num_rows($queryget);
if ($numrows != 0)
{
$_SESSION['username'] = $username;
echo "You have been logged in. <a href='members.php'> Go to members area.</a>";
}
else
{
echo "Your username was not found.<a href='index.php'>Register here.</a>";
}
}
else
{
echo "You did not provide the proper info needed for login.";
include ("loginpage.php");
}
?>
p.s. i also have md5 encryption on the register script and id also like to know how to add it to the loin script so it finds the right password, that's not why i am having these troubles though because i made a dummy account without an encryption to test it.
and as for the adding the date to the database.
i am trying to make a registration script for my website iv got it mostly done but i am wondering how to get the date of birth into the database with my format.
i am using a drop down menu for the date of birth
like this..
<select name='birthdate1' id='birthdate1'><option value='0'>--Day--</option>
<select name=;birthdate2' id='birthdate2'><option value='0'>--Month--</option>
<select name='birthdate3' id='birthdate3'><option value='0'>--Year--</option>
and in my php code i have
$fullname = $_POST['name'];
$username = $_POST['username'];
$password = $_POST['password'];
$cpass= $_POST['cpass'];
$email = $_POST['email'];
$cemail = $_POST['cemail'];
$dob1 = $_POST['birthdate1'];
$dob2 = $_POST['birthdate2'];
$dob3 = $_POST['birthdate3'];
and to insert it into my data base i use
$register = mysql_query ("INSERT INTO users VALUES('','$username',$password')
since the date of birth has 3 "attributes"($dob1, $dob2, $dob3) i hope that's what there called :S correct me if i am wrong, anyway back to the point
how can i get the date of birth into the database properly?