Welcome! Log In Create A New Profile

Advanced

header location of my login page doesn't work on the web hosting

Posted by 46296433 - Julia 
Announcements Last Post
Announcement SoC Curricula 09/30/2017 01:08PM
Announcement Demarcation or scoping of examinations and assessment 02/13/2017 07:59AM
Announcement School of Computing Short Learning Programmes 11/24/2014 08:37AM
Announcement Unisa contact information 07/28/2011 01:28PM
header location of my login page doesn't work on the web hosting
October 22, 2013 10:47AM
Hi there!
I'm opening another subject because i couldn't get any help from the last one.
My application is working probably on local but on the webhosting,the login page doesn't work.It keeps redirecting me on the welcome page.
i'm getting very frustrated and worried.
I have try everything possible,checked that my variable and my fields names are exactly the same as in the database.But still nothing is working.
Bigron11 tried to help me(thanx to him) but i can't get it work,i'm desperate here.
My code:
Language: PHP
<?php //This is the login page.A username is matched with the corresponding password before loging in //   $username = "root";// Mysql username $password = "";// Mysql password $database = "userlogin"; // Database name $server = "127.0.0.1"; // Server name // Connect to server and select database. $db = mysql_connect($server,$username,$password) or DIE("oops,something went wrong"); mysql_select_db($database,$db) or DIE("oops,something went wrong"); //Starting a session session_start(); if(isset($_POST[';submit';])){   $username = $_POST["username"]; //username is stored in $username variable. $password = $_POST["password"]; //password is stored in $password variable.   $match = "select id from login where username = ';$username';and password = ';$password';;"; $qry = mysql_query($match); $num_rows = mysql_num_rows($qry);     //Check if $num_rows variable is true if ($num_rows <= 0){ echo "Sorry, there is no username $username with the specified password."; echo "Try again"; echo "<a href = ';index.php';>Back</a>"; exit; } else { $_SESSION[';user';]= $_POST["username"]; header("location:logged.php");// This is the page where we will be redirect after loging in } }       echo"<body bgcolor=';#E0FFFF';>"; echo"<p>Please enter your username and your password or <a href=';index.php';>click here</a> to go back to the index page</p>"; echo"<form action = '; '; method = ';post';>"; echo"<label>Username:</label>"; echo"<input type = ';text'; name = ';username';/><br/>"; echo"<label>Password:</label>"; echo"<input type = ';password'; name = ';password';/><br/>"; echo"<input type = ';submit'; name=';submit'; value = ';Login';/><br/>"; echo"</form>"; echo"</body>";   ?>
i've changed the connection part with the new database created on the webhosting area.I am using orgfree.com.
avatar Re: header location of my login page doesn't work on the web hosting
October 22, 2013 06:09PM
According to your ISP the only allowable host name is "localhost".
I know that "127.0.0.1" is pretty much the same thing, but its worth a try.

It may also be worthwhile changing your page name to anything other than "login.php".
Re: header location of my login page doesn't work on the web hosting
October 23, 2013 09:28AM
Hi bigron11,
On the webhosting,the server has been changed by "localhost" and the database is changed to the database i have created directly from the webhosting.
I don't understand what you mean by changing the name of login.php,should i delete the login.php page and upload another page with another name?
avatar Re: header location of my login page doesn't work on the web hosting
October 23, 2013 09:34AM
You should be able to change the file name directly on the server. There should be a File Manager which has a rename facility.
(Otherwise rename the file on your computer and upload it - delete the existing login.php).

There is a possibility that login.php is a reserved name. (Worth a try !)


Did you create the database file with the facility specifically for that purpose ? (ie: NOT phpMyAdmin)
Re: header location of my login page doesn't work on the web hosting
October 23, 2013 11:22AM
I have done what you suggested bigron11,it still doing the same thing.I even deleted everything,changed names around and it still doesn't work.It must be something with the redirection header location,but i can't figure out what exactly.Getting tired,i'm writing my exam soon,can't keep going like this,drives me crazyyyyyyyyyyyyyyyyyyyyyyyyy
avatar
Mac
Re: header location of my login page doesn't work on the web hosting
October 23, 2013 01:20PM
Do some self error checking throughout

Language: PHP
$db = mysql_connect($server,$username,$password) or die(mysql_error()); mysql_select_db($database,$db) or die(mysql_error()); .... if(isset($_POST[';submit';])){ .. echo "yeah, post is received"; ... echo "username = $username, password =$password"; ... $num_rows = mysql_num_rows($qry); echo "the num rows is $num_rows"; ..

I do not see a redirect to the welcome page.

Point is, echo out stuff line by line and trace it that way.
Sorry, only registered users may post in this forum.

Click here to login