login script

I’ve found lots of login script all over the internet but I can’t get any of it to work. I have a MySQL. At first I thought it was just the code, now I think it is my connection options.
First of all I type in my server which is quotaless.com.
Then it ask for the user name which i will simulate as xxxxxx_user1.
then my password xxxxx. I know I have the password right.
And I’m sure I have my database right as well. but what I’m wondering is if the servername would be the full url http://www. and so on. I’ve tried this one other time for a comments installer and it said my access for my account was denied, but I can login just fine. And one other thing about it is that when I login with just xxxxxx_user1 and once logged in it says xxxxxx_user1@localhost does the @localhost matter at all. I when though the code and everything looks fine.
Any help would be much appriciated.
Thanks

Can we see the connection part of your code? Sounds like you just haven’t set up your user permissions yet.

Here’s the registration code that is suppose to be entered in to the database.

<!--p
//Start session
session_start();
//Array to store validation errors
$errmsg_arr = array();
//Validation error flag
$errflag = false;
//Connect to mysql server
$link = mysql_connect("host","user_name","password");
if(!$link) {
die('Failed to connect to server: ' . mysql_error());
}
//Select database
$db = mysql_select_db("username_login");
if(!$db) {
die("Unable to select database");
}
//Function to sanitize values received from the form. Prevents SQL injection
function clean($str) {
$str = @trim($str);
if(get_magic_quotes_gpc()) {
$str = stripslashes($str);
}
return mysql_real_escape_string($str);
}
//Sanitize the POST values
$fname = clean($_POST['fname']);
$lname = clean($_POST['lname']);
$login = clean($_POST['login']);
$password = clean($_POST['password']);
$cpassword = clean($_POST['cpassword']);
//Input Validations
if($fname == '') {
$errmsg_arr[] = 'First name missing';
$errflag = true;
}
if($lname == '') {
$errmsg_arr[] = 'Last name missing';
$errflag = true;
}
if($login == '') {
$errmsg_arr[] = 'Login ID missing';
$errflag = true;
}
if($password == '') {
$errmsg_arr[] = 'Password missing';
$errflag = true;
}
if($cpassword == '') {
$errmsg_arr[] = 'Confirm password missing';
$errflag = true;
}
if( strcmp($password, $cpassword) != 0 ) {
$errmsg_arr[] = 'Passwords do not match';
$errflag = true;
}
//Check for duplicate login ID
$qry = "SELECT count(*) AS c FROM members WHERE login='$login'";
$result = mysql_query($qry);
if($result) {
$result_array = mysql_fetch_assoc($result);
if($result_array['c'-->0) { $errmsg_arr[] = 'Login ID already in use'; $errflag = true; } @mysql_free_result($result); } else { die(&quot;Query failed&quot;); } //If there are input validations, redirect back to the registration form if($errflag) { $_SESSION['ERRMSG_ARR'] = $errmsg_arr; session_write_close(); header(&quot;location: register-form.php&quot;); exit(); } //Create INSERT query $qry = &quot;INSERT INTO members(firstname, lastname, login, passwd) VALUES('$fname','$lname','$login','&quot;.md5($_POST['password']).&quot;')&quot;; $result = mysql_query($qry); //Check whether the query was successful or not if($result) { header(&quot;location: register-success.php&quot;); exit(); }else { die(&quot;Query failed&quot;); } ?&gt;

for the privileges when i made my username, i just allowed all, if those are the privileges you were talking about.
Thanks

Sponsor our Newsletter | Privacy Policy | Terms of Service