hi, i want to log in as admin, get to an area or say admin.php, from where to compose(maybe) send email to the users in my database.
any tips or useful links on this ?????
10x in advance
newsletter
Moderator: General Moderators
I dont know what you want help with. If you want to have an admin area, ...
that is a basic way of having an admin area.
note in login.php it chekcs the submitted variables against a table, this way you can have more than one user able to log on (good for blogs with multiple authors).
Hope this helps
Code: Select all
// login.php
<?php session_start();
header("Cache-control: private"); //IE 6 Fix
include ("connect.php"); // database connection settings in this file
if($_POSTї'username'] || $_POSTї'passw'])
{
if(!get_magic_quotes_gpc())
{
$username = addslashes($_POSTї'username']);
$passw = addslashes($_POSTї'passw']);
}else{
$username = $_POSTї'username'];
$passw = $_POSTї'passw'];
}
$sql="SELECT * FROM users WHERE username='".$username."' AND password='".md5($passw)."'";
$res=mysql_query($sql) or die("Error: ".mysql_error());
if(mysql_num_rows($res)>0)
{
$_SESSIONї'name'] = $username;
header("Location: admin.php");
}
if($username && mysql_num_rows($res)<1){echo "Invalid username or password";}
}
?>
<html>
<head>
<?php
echo"<title>$SiteTitle</title>";
echo"<link rel="stylesheet" href="$cssfile" type="text/css">"
?>
</head>
<body>
<p>Please login:</p>
<form name="form1" method="post" action="<?php echo $PHP_SELF ?>">
<p>
<input type="text" name="username">
Username</p>
<p>
<input type="password" name="passw">
Password
</p>
<p>
<input type="submit" name="Submit" value="Submit">
</p>
</form>
// admin.php
<?php
session_start();
header("Cache-control: private");
?>
<html>
<head>
</head>
<body>
<h1 style="font-family: verdana;"><?php echo "$SiteTitle"; ?></h1><br><br>
<p>You are in the admin section</p>
<?php
if (isset($_SESSIONї'name']))
{
echo 'your logged on';
}
else {
echo 'You have to sign in first ';
echo '<a href="login.php" title="Login">Login</a>';
}
?>note in login.php it chekcs the submitted variables against a table, this way you can have more than one user able to log on (good for blogs with multiple authors).
Hope this helps
-
d3ad1ysp0rk
- Forum Donator
- Posts: 1661
- Joined: Mon Oct 20, 2003 8:31 pm
- Location: Maine, USA
uffff
sry 4 not making me understood, not the admin area is the problem, i want to compose 1 mail and send it to all the users / email in my data.
-
d3ad1ysp0rk
- Forum Donator
- Posts: 1661
- Joined: Mon Oct 20, 2003 8:31 pm
- Location: Maine, USA