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 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 !
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 !
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 !
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 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 !
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 !
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 !
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 !
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 !
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>  Password: <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 !
|