Har sat login på mit linksystem, men når jeg logger ind via login.php til add.php tilføjer den bare et tomt link. Altså tilføjer den et link hver gang jeg logger ind
.
Nedenstående er add.php
<?php
ob_start();
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Nyt dokument</title>
<meta name="generator" content="TSW WebCoder">
<link type="text/css" rel="stylesheet" href="style.css" />
</head>
<body>
<?php
include "config.php";
include "db.php";
if(isset($_POST['userid']) && isset($_POST['password']))
{
$bruger = mysql_escape_string($_POST['userid']);
$password = mysql_escape_string($_POST['password']);
$query = "SELECT * FROM users where username = '$bruger' AND password = '$password'";
$result = mysql_query($query, $conn);
$row = mysql_fetch_assoc($result);
if (mysql_num_rows($result) >0)
{
$gyldig_bruger = $_POST['userid'];
$_SESSION['gyldig_bruger'] = $gyldig_bruger;
$_SESSION['pass'] = $_POST['password'];
}
}
//end of section
if(isset($_SESSION['gyldig_bruger']) && isset($_SESSION['pass']))
{
?>
<?php
include "object.obj";
$Data = &New Data;
$indsaet = $Data->indsaet();
echo $indsaet;
?>
<form method="post" action="<?=$PHP_SELF;?>">
Linket: (HUSK http://)<br>
<input type="text" class="input" name="link" value="http://"><br>
Sidenavnet (f.eks Google):<br>
<input type="text" class="input" name="over"><br>
Kort info:<br>
<textarea class="text" name="descrip"></textarea><br>
<input type="submit" name="submit" class="button" value="Tilføj link">
<?php
}
elseif(!isset($_SESSION[gyldig_bruger])) {
echo "Du SKAL være logget ind for at se denne side";
}
?>
</body>
</html>