Theres no ERROR!!!!
Posted: Wed Feb 18, 2004 8:52 am
THERES NO ERROR! thats realy wierd, I just started out with PHP (and im switching from ASP to PHP) and i made a simple login script (wich threw tons of errors) and now that i fixed em, there are no errors.
In fact, its not returning anything!
Dont worry about the registered thing, i need the login right now.
thanks in advanced
EDIT: o yea, i know i dont have anything that takes action to accually logging in, but later on i will make it set a cookie and session.
In fact, its not returning anything!
Dont worry about the registered thing, i need the login right now.
Code: Select all
<?php
if ($_Get['a'] == "reg") {
$user="ne0";
$password="****";
$database="db";
mysql_connect(localhost,$user,$password);
@mysql_select_db($database) or die("Unable to select database<br>");
$name = $_POST['username'];
$p = $_POST['password'];
$email = $_POST['email'];
$sig = $_POST['signature'];
$avatar = $_POST['avatar'];
$web = $_POST['web'];
$query = "INSERT INTO users (id,name,password,email,sig,avatar,web) VALUES ('','$name','$p','$email','$sig','$avatar','$email')";
$result = mysql_query($query) or die (mysql_error());
if ($result) {
echo("Logged in succesfully");
} else {
echo("Invalid UserName or Password");
}
echo("echo");
mysql_close();
}
if ($_Get['a'] == "login") {
$user="ne0";
$password="****";
$database="db";
mysql_connect(localhost,$user,$password);
@mysql_select_db($database) or die("Unable to select database<br>");
$query="SELECT * FROM users WHERE name=" . $_Post['username'] ." and password=" . $_Post['password'] . "";
$result = mysql_query($query) or die (mysql_error());
if ($result) {
echo("Logged in succesfully");
} else {
echo("Invalid UserName or Password");
}
echo("please work");
mysql_close();
}
?>EDIT: o yea, i know i dont have anything that takes action to accually logging in, but later on i will make it set a cookie and session.