Admin Button only.......!!
Posted: Wed Apr 27, 2005 8:03 pm
Im having a bit of a problem making a link just for the admin.. I want it where admin can go to the admin page while logged in instead of having to logout and logging back in i have it where the admin logs in same login as the users but the main problem is i dont know how to make a link so only admins can see... because my menu is in html not in php and im using sessions and i dont know if there is different ways of making a admin link so here is a look at the login script if that helps you any....
And also i would like to have a remember me check box put on this script as well and well every time i try doing it it gives me an error i dont know if im doing the if statement right or not.....
Thank You
Smackie
And also i would like to have a remember me check box put on this script as well and well every time i try doing it it gives me an error i dont know if im doing the if statement right or not.....
Code: Select all
<?php
ob_start();
// dBase file
include "dbConfig.php";
if ($_GET["op"] == "login")
{
if (!$_POST["username"] || !$_POST["password"])
{
die("Please go back and Supply a username and password.");
}
// Create query
$q = "SELECT * FROM `dbUsers` "
."WHERE `username`='".$_POST["username"]."' "
."AND `password`=PASSWORD('".$_POST["password"]."') "
."LIMIT 1";
// Run query
$r = mysql_query($q);
if ( $obj = @mysql_fetch_object($r) )
{
// Login O.K., create session variables
$_SESSION["valid_id"] = $obj->id;
$_SESSION["valid_user"] = $_POST["username"];
$_SESSION["valid_time"] = time();
// Redirect to member page
Header("Location: http://www.hauntedgraveyard.net/members.php");
}
else
{
// Login not successful
die("Sorry, could not log you in. Wrong login information.");
}
}
else
{
echo "<form action=\"http://www.hauntedgraveyard.net/login.php?op=login\" method=\"POST\">";
echo "Username: <input name=\"username\" size=\"15\" color=\"#FF0000\"><br />";
echo "Password: <input type=\"password\" name=\"password\" size=\"15\"><br />";
echo "<input type=\"submit\" value=\"Login\">";
echo "</form>";
}
?>Thank You
Smackie