yes it is for a login script for the admin panel of the CMS. here is the code for the login part
login.php:
<?php
include("config.php");
$ip=$_SERVER['REMOTE_ADDR'];
if($_POST['Submit'])
{
$user = $_POST['user'];
$pass = $_POST['pass'];
if($user == "$admin[user]" && $pass == "$admin[pass]")
{
setcookie('user', $user, time()+3600000);
setcookie('pass', $pass, time()+3600000);
echo "Welcome $user, you are now logged in! <a href='admin.php'>Continue to the admin section?</a>";
}
else
{
echo 'Wrong username and/or password! Your IP ('.$ip.') has been logged incase of a hacking attempt!';
}
}
else
{
?>
<form action="<?php $_SERVER['PHP_SELF']; ?>" method="post"><table border="0">
<tr>
<td>Username:</td>
<td><input name="user" type="text" id="user"></td>
</tr>
<tr>
<td>Password:</td>
<td><input name="pass" type="password" id="pass"></td>
</tr>
<tr>
<td> </td>
<td><input type="submit" name="Submit" value="Login"></td>
</tr>
</table></form>
<?php
};
?>
and the admin users and passes are stored in config.php which is where the arrays come in.
config.php (wrong version):
<?php
$admin = array(
'user' => 'admin',
'pass' => 'password'
);
$admin = array(
'user' => 'admin2',
'pass' => 'password'
);
but if i changed "config.php" to:
<?
$admin= array(
'user' => 'admin',
'pass' => 'password'
);
array(
'user' => 'admin2',
'pass' => 'password'
);
?>
then i could login as admin, or admin2?
oh and in login.php i know there isn't anything to log the ip i am gonna work on that later. lol
Edited by ShadowDeath01, 22 August 2006 - 09:35 PM.