länkar sidan så den som vill kan ta en titt om det på nåt sätt kan hjälpa till att lösa problemet...
[code:html, php, css]<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html>
<head>
<title>Jontees</title>
<style type="text/css">
body {
background:#C0DEED url('bg.png');
background-position: left 40px;
background-attachment: fixed;
background-repeat: no-repeat;}
.main { margin:15px auto 0px; auto; background:#fff; width:930px; height: 500px; padding:0px; border:1px solid
#c0deed;}
.list { margin:0px 0px; 0px; auto; width:500px; height:auto;}
.login {margin:0px 0px auto auto; width:300px; padding:25px; border-left:1px dotted
#ccc; border-bottom:1px dotted
#ccc; float:right;}
.top {width:100%; background:#a8d0e3; height:40px; border:1px solid 9dc8dc;}
.top-right {margin:7px 0px auto auto; width:400px; float:right; }
.top-left {margin:10px auto auto 50px; width:500px; float:left;}
.top-left a:hover {background:#8ec1da; color:#000; border:1px solid
#9dc8dc}
.top-left a {background:#a8d0e3; color:#000; padding:5px; text-decoration:none;}
.uppladdning {}
</style>
</head>
<body>
<?php
session_start();
$loggedin = false;
$fp = fopen("users.dat", "r");
$count = fread($fp, 1024);
$username = $_POST[username] ;
$password = $_POST[password] ;
if($username != "" && $password != ""){
$users = file("users.dat", "r");
if(!ereg("$username|", $users[0])) print("Användarnamn '$username' hittades inte.");
$users = explode(",", $users[0]);
foreach($users as $luser){
if(strstr($luser, $username)){
list($user, $pass) = explode("|", $luser);
if($password == $pass){
$_SESSION['username'] = $_POST['username'];
$loggedin = true;
}else{
print ("invalid login");
}
break;
}
}
}
if(isset($_GET['logout'])) {
$_SESSION['username'] = '';
header('Location: ' . $_SERVER['PHP_SELF']);
}
?>
<div class="top">
<div class="top-left">
<a href="?page=startsida">Startsida</a>
<a href="#">Om oss</a>
<a href="?page=registrera">Registrera</a>
</div>
<div class="top-right">
<form name="login" action="<?=$PHP_SELF?>" method="post">
<input type="text" name="username" value="Användarnamn">
<input type="password" name="password" value="Lösenord">
<input type="submit" name="submit" value="Login" />
</form>
</div>
<div>/div>
</div>
<div class="main">
<div class="login">
<?php if ($loggedin != true): ?>
<form name="login" action="<?=$PHP_SELF?>" method="post">
Username: <input type="text" name="username" value="Användarnamn">br />
Password: <input type="password" name="password" value="Lösenord">br />
<input type="submit" name="submit" value="Login" />
</form>
<?php endif; ?>
<?php if($_SESSION['username']): ?>
<a href="
http://jonte.sehl.in/skolanse/startsida.php?logout=1">Logout</a>
<?php endif; ?>
</div>
<div class="list">
<?php echo $count; ?>
<?php
$fileName = file('senaste.txt');
$rows = count($fileName);
for ($i=0; $i < 10; $i++)
{
echo $fileName [$i];
}
?>
<div class="uppladdning">
<?php if($_SESSION['username']): ?>
<strong>Uppladdning</strong>
<br />
<form action="upload_file.php" method="post"
enctype="multipart/form-data">
<label for="file">Filnamn:</label>
<input type="file" name="file" id="file" />
<br />
<input type="submit" name="submit" value="Ladda upp!" />
</form>
</div>
<strong>Filer:</strong></td>
<?php
$dirnamee = $_POST['username'];
$dirname = $dirnamee;
$dir = opendir($dirname);
while(false != ($file = readdir($dir)))
{
if(($file != ".") and ($file != ".."))
{
echo("<a href='$dirname/$file'>$file</a> <br />");
}
}
?>
<?php endif; ?>
</div>
</div>
</body>
</html>[/code]