Hi, I am working on a website that users can log into from one page and administrate their users from another.
first page is index.php and second is admin.php. on the index page I have a form to login with that calls out
to a stand alone .php script called "checklogin.php" here is the code...
<?php
ob_start();
$host=; // Host name
$username=; // Mysql username
$password="; // Mysql password
$db_name="; // Database name
$tbl_name="; // Table name
// Connect to server and select databse.
mysql_connect("$host", "$username", "$password")or die("cannot connect");
mysql_select_db("$db_name")or die("cannot select DB");
// Define $login and $pass
$login=$_POST['login'];
$pass=$_POST['pass'];
// To protect MySQL injection (more detail about MySQL injection)
$login = stripslashes($login);
$pass = stripslashes($pass);
$login = mysql_real_escape_string($login);
$pass = mysql_real_escape_string($pass);
$sql="SELECT * FROM Registration WHERE login='$login' and pass='$pass'";
$result=mysql_query($sql);
// Mysql_num_row is counting table row
$count=mysql_num_rows($result);
// If result matched $login and $pass, table row must be 1 row
if($count==1){
session_register("login");
session_register("pass");
header("location:Admin.php");
}
else {
echo "<script language='javascript'>
alert('Sorry, but you must login to view the members area!')
</script>
<script>
window.location='index.php'
</script>";
}
ob_end_flush();
?>
my admin page has this script on it as a redirect...
<?php
session_start();
if(!session_is_registered(login)){
header("admin.php");
}
?>
my question is...how can I echo out user specific data with this code onto the admin page in a div?
since the code is living outside the admin page, I cant figure out how to do it...any help, thanks!