Sux0rZh@jc0rz
11-23-2003, 11:07 PM
alrighty... I hope pyro is on to come to my rescue and point out an easy answer that i just cant find cause am a phpnewb...(As in "has no experience with SQL at all in php" newb.)
ready for this? here goes....
Config.php file:$host = "www.****.org:3306";
$user = "****";
$dbpassword = "****";
$database = "xaxei";
$prefix = "loginadv_";
$Link = mysql_connect ($host, $user, $dbpassword);
Signup.html<form action="/signup.php">
<input type="text name="username"><br>
<input type="password" name="password"<br>
<input type="submit">
</form>
Signup.php<?php
include "http://www.aspfreeserver.com/xaxei/config.php";
$username = $_POST["username"];
$userpass = $_POST["password"];
if (($username) AND ($userpass)){
$query = "SELECT * from ". $prefix . "users where(`username` = '$username')";
$result = mysql_db_query($database,$query,$Link);
$logindetail = mysql_fetch_array($result);
$userpass = md5($userpass);
if (($username == $logindetail[username]) AND ($userpass == $logindetail[password])){
print "<h2>Signup Successful.</h2>"
} else {
print "Incorrect login";
}
} else {
print "please login";
print "<br><a href=login.php>login</a>";
}
?>
now my friend made that signup.php.... and i think he was confused as to what i wanted him to do and i think he made an actual login instead of signup... shouldn't it be CREATE blah blah blah? please post the code i should be using to CREATE a username and password into my database so that i can actually use a login script to search the database... if you want to put the code for a signup AND a login, that would be most helpful... i am trying to learn how sql works by example... and so far i understand alot, but i cant make it work for me yet because i have gaps still..
thanks in advance,
cheers.
ready for this? here goes....
Config.php file:$host = "www.****.org:3306";
$user = "****";
$dbpassword = "****";
$database = "xaxei";
$prefix = "loginadv_";
$Link = mysql_connect ($host, $user, $dbpassword);
Signup.html<form action="/signup.php">
<input type="text name="username"><br>
<input type="password" name="password"<br>
<input type="submit">
</form>
Signup.php<?php
include "http://www.aspfreeserver.com/xaxei/config.php";
$username = $_POST["username"];
$userpass = $_POST["password"];
if (($username) AND ($userpass)){
$query = "SELECT * from ". $prefix . "users where(`username` = '$username')";
$result = mysql_db_query($database,$query,$Link);
$logindetail = mysql_fetch_array($result);
$userpass = md5($userpass);
if (($username == $logindetail[username]) AND ($userpass == $logindetail[password])){
print "<h2>Signup Successful.</h2>"
} else {
print "Incorrect login";
}
} else {
print "please login";
print "<br><a href=login.php>login</a>";
}
?>
now my friend made that signup.php.... and i think he was confused as to what i wanted him to do and i think he made an actual login instead of signup... shouldn't it be CREATE blah blah blah? please post the code i should be using to CREATE a username and password into my database so that i can actually use a login script to search the database... if you want to put the code for a signup AND a login, that would be most helpful... i am trying to learn how sql works by example... and so far i understand alot, but i cant make it work for me yet because i have gaps still..
thanks in advance,
cheers.