Viewing file: admin.php (1.36 KB) -rw-r--r-- Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
@session_start();
if(empty($_POST[pass])){
print('<form action="" method=post>
<table><tr><td>Name:<td><input type=text name=id>
<tr><td>Password:<td><input type=password name=pass>
<tr><td colspan=2><input type=submit value=Enter>
</form>');
}else{
if($_POST[id]=='fanshop' && $_POST[pass]=='fanshop'){
session_start();
$_SESSION[admin]='akarmi';
print('Sikeres bejelentkezés');
$today = date("Y. m. d. G:i:s");
$ip = gethostbyaddr($_SERVER[REMOTE_ADDR]);
$somecontent = "[ADMINLOGIN][ MIKOR: ".$today." ][ IP: ".$ip." ] \n";
$filename = 'log.txt';
// Let's make sure the file exists and is writable first.
if (is_writable($filename)) {
// In our example we're opening $filename in append mode.
// The file pointer is at the bottom of the file hence
// that's where $somecontent will go when we fwrite() it.
if (!$handle = fopen($filename, 'a')) {
echo "Cannot open file ($filename)";
exit;
}
// Write $somecontent to our opened file.
if (fwrite($handle, $somecontent) === FALSE) {
echo "Cannot write to file ($filename)";
exit;
}
fclose($handle);
}
}
}
if(isset($_SESSION[admin])){
print('<a href=admin.php?logout=1>Kijelentkezés</a>');
}
if(isset($_SESSION[admin]) && isset($_GET[logout])){
session_unset();
session_destroy();}
?>
|