Announcements | Last Post | |
---|---|---|
SoC Curricula | 09/30/2017 01:08PM | |
Demarcation or scoping of examinations and assessment | 02/13/2017 07:59AM | |
School of Computing Short Learning Programmes | 11/24/2014 08:37AM | |
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 |
Registered: 11 years ago Posts: 51 Rating: 0 |
i've changed the connection part with the new database created on the webhosting area.I am using orgfree.com.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>"; ?>
Re: header location of my login page doesn't work on the web hosting October 22, 2013 06:09PM |
Admin Registered: 11 years ago Posts: 6,606 Rating: 396 |
Re: header location of my login page doesn't work on the web hosting October 23, 2013 09:28AM |
Registered: 11 years ago Posts: 51 Rating: 0 |
Re: header location of my login page doesn't work on the web hosting October 23, 2013 09:34AM |
Admin Registered: 11 years ago Posts: 6,606 Rating: 396 |
Re: header location of my login page doesn't work on the web hosting October 23, 2013 11:22AM |
Registered: 11 years ago Posts: 51 Rating: 0 |
Re: header location of my login page doesn't work on the web hosting October 23, 2013 01:20PM |
Admin Registered: 18 years ago Posts: 10,001 Rating: 353 |
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"; ..