Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    PHP


SuperbHosting.net have generously sponsored dedicated servers to ensure a reliable and scalable dedicated hosting solution for BigResource.com.





Login Script Doesn't Display If The Login Is Correct Or Incorrect.


Below is the script I am using for my login page. It doesn't display if the login is correct or incorrect. All it does is clear the username and password box when I hit submit. I want it to display an error message if the login is incorrect and if it is correct redirect them to their own web page. I am putting the MySQL connection script in the header of the login.html is this wrong? Can someone please give me some pointers on how to get this script working?

<?php session_start();
$username = $_POST['username'];
$userpass = md5($_POST['password']);
$sql = "select * from usertable where username='$username' and password='$userpass'";
$result = mysql_query($sql);
if (mysql_num_rows($result)!= 1) {
$error = "Login failed";
} else {
$row = mysql_fetch_array($result);
$_SESSION['username'] = "$username";
$_SESSION['ip'] = $_SERVER['REMOTE_ADDR'];
header("Location: h*tp://www.w-------.com/$row['USLP']");
}
?>




View Complete Forum Thread with Replies

Related Forum Messages:
Login Script That Doesn't Let Me Login Or Redirect.
I have a login script that doesn't let me login or redirect. Code:

View Replies !
Cannot Login Although Password And Username Are Correct
well, actually i m facing 2 problems when using php...

1. cannot login although password and username are correct - after click login button it's still remain the same page

2. can't run some install.php, after click install button, it's still remain the same page.

View Replies !
Login Script Correct User Name Or Password Problem
I'm having trouble with this login. I can register a new account without a problem, but cannot login. It always says that I didn't provide the correct user name or password. Code:

View Replies !
Pass Information Through A Link That Will Tell The User That Their Login Information Is Incorrect.
i am trying to pass information through a link that will tell the user that their login information is incorrect. the link for the login page looks like this

<a href="index.php?act=login">

now on that page i have this if statement

if (isset($_GET['error'])) {
echo 'Invalid login data supplied. Please try again.'
}


I have tried to make the link
<a href="index.php?act=forgotpass&amp;error=1"> but the error will not display any thoughts?

View Replies !
Login Problem - Can't Login(login Is Done In Index.php)
This is origially PMsys, I have edited it, and here is what I have done with the original
replace all $_COOKIE into $_SESSION changed all setcookie() into session_start() and defined those $_SESSION now the problem is I can't login(login is done in index.php), does anyone here got an idea why? I uploaded the whole pakage, but I think you only need to look at index.php and include/global.php.

View Replies !
Session Problem - Login Screen Continually Reloads After Pressing The Login Button
I am trying to get sessions to work on a log in screen to give certain
users access to certain pages/directories. The problem is that when
the login button is pushed (or the enter key pressed) the login screen
redraws, never loading the next page. I don't get any error messages.
I am using FreeBSD-5.1/Apache-2.0.46/MySQL-4.1.0.1/PHP-4.4.3.4

I have pasted the code below:

View Replies !
Login Lgout And Login Without Closing Session Gives Redirection Error
I am stepping through a text book that sets up different websites. The
one I am testing is user registration.

I set up the scripts and this is what I observe:

Login (verifying against a mysql db) - no problem.
Logout - no problem.

Close the browser and try again - no problem.

Login > Logout > Login WITHOUT closing browser I get:

An error occurred while loading http://login.php when it should redirect
me to http://localhost/index.php.

I read somewhere on the news group that the
header("Location: http://" . $_SERVER['HTTP_HOST'] . dirname
($_SERVER['PHP_SELF']) . "/index.php") (in my example code) is called
once and so the error?

The logout.php destroys the $_SESSION variables, session itself and any
cookies so I thought it would be "like new" the second time around?

It appears to be linked to sessions but don't know enough to know how to
correct.

View Replies !
How To Write A Simple Login Code For Users To Be Able To Login To My Site.
does anybody know how to write a simple login code for users to be able to login to my site.

View Replies !
How To Display Username After Login?
I need a tutorial or help to display the username after login. I use php and mysql.

View Replies !
Session Based Login Script Re Login Problem
I have built this login script, it logs u in and shows the first page... i have built it to be require()'ed, when i have required it from a browser script i made it loads the front page, then when i ask for browser.php?edit=file.html

It then asks me to re login and takes me back to the front page! PHP Code:

View Replies !
Create A Separate Page With One Login That Let's Me Login To All Of The Sripts At Once?
I'm building a website using various php scripts from I found on hotscripts. Because I'm not much of a programmer myself I'm using a separate script for the blog, another one for the links section and a different one for the gallery and so on. The downside to this is that I have to login on a separate page to update the gallery and another page to update the blog and so on.

Is there a simple way to either remove the need for a login for all the scripts and just create a separate page with one login that let's me login to all of the sripts at once?
Or if there's a script that can kinda save the passwords and logs in for me?

View Replies !
Secure Place To Store Login Info And How To Login With It
I had an idea to store my login code: ftp_login... in a separate file outside of the public_html dir and set full permission (777) to it.

1. Is that safe?

2. How do I call this function from inside another file?

function Login()
{
$connection= ftp_connect('ftp.me.com');
return ftp_login($connection, "me", "pass");
}

I was hoping to return connection but I don't know how to send pointers in php.

View Replies !
How To Develop A Login System That I Can Configure For 3 Or 5 Login Attempts?
This may have been asked before but I would like to learn how to develop a login system that I can configure for 3 or 5 login attempts.

Is there anyone that knows what I mean? as I am sure that it's a counter thing that I need to do but really not sure where to start. Code:

View Replies !
Display The Users Name Upon Successful Login.
I have a login.php, members.php and members.html. Right now, if you login successfully you are taken to members.php. I want to display the users name upon successful login. I can do this in members.php, however I want to display it in members.html (because in HTML pages I can make layout tables/cells). I store the users first name (f_name) and last name (l_name) in session variables with the following code (from login.php):

View Replies !
Display Images Based On Last Login
i have a image upload system in my site.in admin control panel i can see all the uploaded images with in particular dates for example 10-jan-2007 to 20-jan-2007 like this.

now i want to put a button so that when i click that button it should display only those images that are uploaded after my last login and till to date.

View Replies !
Proper Page To Display After Login
If a user pastes a session-needed url into into their address bar, they'll hit the page and the script checks to see the logged in value in the cookie. If it's set, the pages loads, if it's not set user gets the login form. but once the user logs in, they hit a welcome page instead of the initial URL they entered to the address bar.

View Replies !
Login Problem - Display The Table Results - I Get Nothing.
I am setting up a member form for users. When the person submits there information.  The database checks to make sure the record doesn't already exist - if it does, it should tell them it does and direct them to the login page.  If it doesn't exist, it should insert a record into the database.

My problem - it displays like it is putting the records into the table but when I display the table results - I get nothing.  It worked when I just had an insert statement but when I put that inside an if statement to satisfy the criteria I listed above - it seems to have stopped working. Code:

View Replies !
Get A Login Section To Only Display If The User Have Not Logged In Yet
am trying to get a login section to only display if the user have not logged in yet, and disappears if they are.

<?php if(!(isset($_SESSION['MM_Username'])) { $loging_box = "<td bgcolor='#000000'><form id='form1' name='form1' method='POST' action='<?php echo $loginFormAction; ?>'>";
$loging_box .= "<span class='style114'>Membership Number<input type='text' name='textfield' /><br />Password</span><input type='text' name='textfield2' />";
$loging_box .= "<br /><input type='submit' name='Submit' value='Login' /></form></td>";
echo $loging_box;}
?>

am getting a parse error, on the first line.

View Replies !
Authenticate The User With The Login.html, Login.php.
I am setting up a registration/login for my website with PHP and MYSQL. I have a register.html, register.php & a login.html, login.php.

I can successfully register a user (using register.html, register.php) into my database. Now, I am trying to authenticate the user with the login.html, login.php.

When I try to do so, however, I always recieve my error message "failed." It will not authenticate (despite several attempts of logging in with the same username and password of that which is in my database.) Code:

View Replies !
Hiding Login & Password Fields After Login
I am hoping to do the following, the homepage shows a username and password field. Once the user enters a scucessfull login, these fields are removed.

In order to achieve this, must the page be based on one big IF ELSE statement? so...

If user logged in hide username & password fields
Else show page with username and password fields?

OR is this acheived by redirecting the user to a page that is not the homepage after a successfull login? so...

the user would login sucessfully and be redirected to a homepage identical to the one with the fields but will have the username & password fields removed?

View Replies !
Main Page Login = Forum Login
This is going to be a website for a club im in at University. Now, I only want members of that club to be able to register.

The problem is that they pay a member fee. I want to know a way that when they pay me the fee (in person) I can give them a unique confirmation number from which they can register properly (sorta like a CD-Key). Code:

View Replies !
Login Problem - Script For Login To My Web Site
i have a php script for login to my web site.it works very well when i test it in localhost but when i upload it to my site it is not allowing me login. Code:

View Replies !
Login Script Forcing Me To Login Twice?
I have built a login script and for some strange reason its forcing me to login twice. Not saying the user/pass is wrong first time, it moves the headers fine, it just show the old page with the login any ideas? Code:

View Replies !
Login Page Not Redirecting After Login
I've used this same snippet of code in other login forms without a problem (with some slight modifications from script to script) but this one seems to baffle me.

Basically it takes the login and validates the entries (validation works, error messages display if left blank), then checks the database for a match. If there's a match then it is supposed to forward the person onto the proper page using the 'header' function. Problem is it's not. Basically it's reverting back to the 'index.php' page (login page) and the display is completely blank. Here's the code for index.php: Code:

View Replies !
Email An HTTPS Address With Encrypted Login For Users To "Click And Login"
I have developed a web site that monitors the state of the user's routers (UP/DOWN & WHY) it has the usual login web page, since the web site monitors the devices and sends emails when there is a problem, i wanted to send an email with an embedded https link, where the user could click and be directed straight onto the web site, without the need to login.

View Replies !
Mail Server - Use My Page Login For The Mail Login User Is Stored In $_SESSION
I have a problem and no time to google it and i hope someone will guide me. I have a linux server (slack10) php/mysql and a website where you can create accounts and login.

i need to install a mail server with a web interface, i need to have a script that creates automaticly an email account when my page creates an account and a way to use my page login for the mail login user is stored in $_SESSION and the mail will be shown in iframe any sugestions?

View Replies !
Session Question - How To Change The Link Of "login" To "logout" After User Login
i have two questions:

1). there's a "welcome $username" on top of a form after user login, but when the user use the same form again, the "welcome $username" still there.
HOW can i get rid of it?

2). how to change the link of "login" to "logout" after user login and "logout" to "login" after user left?

View Replies !
Php Login And MySQL Login
can anyone tell me the advantages of a login created with mySQL over just using php and writing to text files(if this is posible)?is mySQL safer and more secure in any way or just easier?

View Replies !
Timestamp Display Incorrect Time
This is the code that I use to display the current time.

<?php
$timestamp = time();
$date_now = date('m/d/y g:i a', $timestamp);
print $date_now;
?>


It is 12:03pm at where I live (USA West) But for some reason the above code gives me 08/28/05 4:03 am Is there a way to specify the time for US West?

View Replies !
Login Script That Checks Long Long It Has Been Since A Last Login
i need to make a login script that checks long long it has been since a last login. I have Mysql so i can use that to store the last login date. Can someone help me figure out how to find how many days ahve passed since a previous login. Like what format should the last loin date be stored in. Also how i get it to figure out how many days have passed since the last login.

View Replies !
Display An Echo Or Msgbox Displaying 'password Incorrect!'
What I need to do is make sure that the textbox 'password' is the same as 'verify'. if the passwords are not the same i need it to display an echo or msgbox displaying 'password Incorrect!' but not go on to the next page. Code:

View Replies !
Mail Form - Display An Asterisk If The Email Is Incorrect
I have a simple mail form that I would like users on my site to submit. All I have is a name, email, subject, and message. When the user clicks submit, I want the page to validate and to display an asterisk if the email is incorrect or any of the fields are blank. I can not get the code to work. Code:

View Replies !
Displaying Date - Doesn't Display The NOW() Value
When I echo $query it doesn't display the NOW() value. Why is this?

$query = "UPDATE notes SET note = '".$note."' WHERE date = NOW()";

View Replies !
Contact Form Doesn't Display The Errors
i'm testing with safari + firefox on mac. the page loads fine (no errors) and shows the form. but when submitted, it doesn't display the errors if those fields aren't filled in. Code:

View Replies !
Redirect From The Login Page To The Login Page
I have been working on a cms, and I got the login and main admin page working, so what I am trying to do is make it so if your not logged it, it redirects you to the login page. But the problem is once it gets to the login page, it continues to redirect from the login page to the login page, so its nonstop. How can I fix this.. Code:

View Replies !
Help With Login
The problem is that the very last part of the code is not working the last if..else condition that has been set doesnt work, ie, when session remains and cookie expires...whenever there is such a condition a few notices are displayed and nothing else..

} else if (!isset($_COOKIE['user'])) {
if (session_is_registered("password")) {
echo "else if part";
}
}?>

View Replies !
Login
how to login ...

<form name="form1" method="post" action="">
<input type="text" name="user">
<input type="password" name="id">
<input type="submit" name="Submit" value="Submit">
</form>

In the above form..i want to fetch data from database of mysql ..to
the field of name and id .....when
will enter to the name and id it will compare to mysql fields how to
write to this form code in mysql queries through php..........

View Replies !
SSL Login
Recently, my company has decided that session-based login isnt secure enough (Layoffs are coming, they probably expect lots of angry people) and have decided that encrypted login is necessary, even on internal networks.

Can someone please give me somewhere to start on implementing this? I have a pretty solid understanding of encryption in general, but the articles I have read are cryptic.

View Replies !
Login Box
I'm having a bit of trouble with a login box. My website has all the common stuff - news etc. and it has a login box up the top.

What I want to do is have it linked to a database and you can login, and when you login it says something like:

Welcome, *User*.

Type thing. How would I go about doing this?

View Replies !
Last Login
I would like to show the list of last login members on my web page. How do I do it?

View Replies !
After Login In
I am trying to create a basic login page in PHP whitout using a database to reduce complexity at the moment ,but after I get the login successful, I have no idea on how to redirect the page to lets say a folder or page. Code:

View Replies !
Won't Login
I have created a login in page for my site but when i try to login in, even though the user name and password are correct, it tells me that they are invalid. Here is the code from the login.php page:

View Replies !
Login And Get Value
I want to let users log in, get their username and password verfied against my mysql-db, and each user are associated with one of five accessgroups, named by "A", "B" ... "E".

My db have these fields:

username password accessgroup

Users with username and password matched from the db assosicated by for example "B" should then be redirected to a special page, a page which should not be accessible by any other goups of users. And so on.

This might perhaps be solved with sessions?

View Replies !
Login.php
This is my login.php

<html>
<body>
<?php
if (isset($_COOKIE["uname"]))
echo "Welcome " . $_COOKIE["uname"] . "!<br />";
else
echo "You are not logged in!<br />";
?>
</body>
</html>

What im trying to do is if i have the right password and right username it lets me in, but if one or another is wrong i want it to say something like Invalid username or password.

View Replies !
Login Help
I am in the process of building a membership system. However, logging in is proving to be impossible, and even the correct password and username combo are denied. I think I have the problem narrowed down to a single 'if' statement, but cannot tell what is wrong with it. Here it is: PHP Code:

$get_user = mysql_query("SELECT * FROM `pet_game` WHERE 'username' = '".$_POST['username']."' AND 'user_password' = '".md5($_POST['password'])."'");
$q = mysql_fetch_object($get_user);
    if($q==FALSE)
     {die("Login Failure: An error occured, please verify your username and password are correct.");}
    else
     { header("Location: http://staggy11.byethost3.com/home.php"); }

View Replies !
Login?
Is there anyway to make it so I can have members on my webpage. I would like to have it to where they have to go through all the steps od regestering and after they login, it will show their name in the top right or some where.

View Replies !
Login Php
does anyone know how to create a login script which connects to a database of mysql.

View Replies !
New Problem With Login...
Alright I have a new problem...i tried to print out the error but it wont print it out. It says the warning is on line 14....I will indicate what line 14 is....let me know what you think Thanks.


body>
<div align="center">
<center>
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="91%" id="AutoNumber1">
<tr>
<td width="100%">
****LINE 14 ***** <img border="0" src="http://www.mountclubsports.com/dance/Images/bckgrnd_logo.jpg" width="900" height="110"></td>
</tr>
</table>
</center>
</div>


<div align="center">
<center>
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="91%" id="AutoNumber2">
<tr>
<td width="100%">
<img border="0" src="http://www.mountclubsports.com/dance/Images/bckgrnd_green.JPG" width="900" height="350">
<DIV STYLE="position:absolute; top:180px; left:156px; width:655px; height:25px">
<center><FONT SIZE="+02" COLOR="000000">Admin Log In</FONT>
<br>
<FORM METHOD="POST" ACTION="login.php">
Username: <INPUT TYPE="TEXT" NAME="Username"><BR>
&nbspPassword: <INPUT TYPE="PASSWORD" NAME="Password"><BR>
<br>
<INPUT type = "submit" name = "Login" value= "Log In!">
</FORM>


<?php

$hostname = "*****";
$username = "*****";
$password = "*****";
$Username = $_POST['Username'];
$Password = $_POST['Password'];
$URL = "*****";

// Check to see if the form has been posted
if (isset($_POST['Login']))
{
// It has, now lets check to make sure they filled in all fields
if (isset($_POST['Username']) && isset($_POST['Password']))
{
// Open a MySQL Connection & Select Database
$dbh = mysql_connect ($hostname, $username, $password) or die ("I cannot connect to the database because: " . mysql_error());
$db = mysql_select_db("*****", $dbh);
// Perform Query to see if the user exists
$CheckUser="SELECT * FROM Admin_Users WHERE Username='".$Username."' AND Password='".$Password."'";
$CheckUser_Result=mysql_query($CheckUser) or die(mysql_error());
// Check the Result
if (mysql_num_rows($CheckUser_Result)==1)
{

***LINE 63*** header("$URL") or die(mysql_error());
}else
{

$Error="Sorry your Username & Password were not found, please try again.";
}
}else
{
$Error="Please enter both your Username & Password.";
}
}
// Check to see if we need to display any error message
if (isset($Error))
{
echo "$Error<BR><BR>";
}
?>

</DIV>


</body>

ERROR: Warning: Cannot modify header information - headers already sent by (output started at /home/mountclu/public_html/dance/login.php:14) in /login.php on line 63

I have gotten this on all the scripts I have tried...what does it mean? I tried putting "the domain name" instead of the $URL and that didn't work either

View Replies !
Login Questions
I have 2 books 1.) MySQL/PHP Database Applications and 2.) PHP4 Bible. My problem is that in both books the only way they show how to use a login form is to use the HTTP_AUTH. Which I don't want to use, I want my script to do the login and log out Like VB does. Where or how would I go about doing this? I can enter data into MySQL, but I know i am missing some steps, such as Md5ing the Password and sessions and such. Any info would be great.

View Replies !
Conditional Login..
I have a form with a username & password field along with 3 radio buttons.

What I basically want to achieve is if radio button A is checked it will post the username & pass to a.php, If button B is checked it will post the username & pass to b.php and so on for button C.

View Replies !
Remote Login
I m working on a module where i want to write a script which when run should allow me to login to a perticular site, which i call remote login (dont know if its right or wrong). Can we do this in PHP? I heard something called CURL...can we do it using this?

e.g.
suppose i have www.yahoo.com
and i want to login to yahoo from my program..may be passing some username and password in a string and then I want to retrieve inner page content.
I have valid username and password of the site I want to work.

View Replies !
Login Script For Php
I'm a VERY basic webmeister for a non-profit group and need to password
protect an area. How does that work? Is there some boilerplate script
I can drop in?

View Replies !

Copyright © 2005-08 www.BigResource.com, All rights reserved