Denne side viser bare overskriften på en nyhed, også et lin til at kunne "rediger" det
retside.php
<?php
session_start();
include("connect.php");
if($_SESSION['loget_in'] == 1) {
if(isset($_GET['rediger']) ) { // checker om $_GET['slet'] eksisterer
$id = addslashes($_GET['rediger']); // gør du der ikke bliver lavet onsindet kode
$_SESSION[retid] = $id;
header('Location: http://22tirsdag.wizzo.dk/retside-ok1.php');
}
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<style type="text/css">
body {
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
background-color:#999;
}
.copyright {
font-family: Verdana, Geneva, sans-serif;
color: #FFF;
}
</style>
</head>
<body>
<table width="100%" height="100%" border="0" cellspacing="0" cellpadding="0" z-index="-1">
<tr>
<td align="center" valign="top"><table width="840" height="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td bgcolor="#FFFBF0">Topbanner kommer...</td>
</tr>
<tr>
<td bgcolor="#D6D6D6" max-height="20px" min-height="20px" height="20px"><table width="840" height="20px" border="1" bordercolor="#720000" cellspacing="0" cellpadding="0">
<tr>
<td><?php
$siderquery = mysql_query("SELECT * FROM sider ORDER BY id ASC");
while($sidedata = mysql_fetch_assoc($siderquery))
{
print "| <a href=\"/?side=".$sidedata[url]."\">".$sidedata[overskrift]."</a> |";
}
?>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td bgcolor="#FFFBF0" valign="top">
<?php
$resultat = mysql_query("select * FROM sider order by id desc"); // henter db info
while ($row = mysql_fetch_array($resultat)) { // viser info
echo "<br>";
echo "$row[overskrift]";
echo "<br>";
?>
<a href="retside.php?rediger=<? echo "$row[id]" ?> ">Rediger</a><br>
<?php
}
?>
</td>
</tr>
<tr>
<td align="center" bgcolor="#2A9FAA" class="copyright">Copyright © 8. klasse projektuge. uge13. Andreas, Abbas, Mads L og Kristian <a href="adminlogin.php">Admin</a> <a href="logud.php">Log ud</a></td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>
<?php
}
else
{
echo "Hvad med lige at logge ind...";
echo "<br>";
echo "<a href=adminlogin.php>Login her</a>";
}
?>
her er så siden
retside-ok1.php
hvor den gerne skulle vise nyheden i en form så man kan ændre den men den siger der er fejl i linje 61"Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /customers/wizzo.dk/wizzo.dk/httpd.www/22tirsdag/retside-ok1.php on line 61"
<?php
session_start();
include("connect.php");
if($_SESSION['loget_in'] == 1) {
if($_GET['do'] == "opret")
{
header('Location: http://22tirsdag.wizzo.dk/retside-ok2.php');
}
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<style type="text/css">
body {
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
background-color:#999;
}
.copyright {
font-family: Verdana, Geneva, sans-serif;
color: #FFF;
}
</style>
</head>
<body>
<table width="100%" height="100%" border="0" cellspacing="0" cellpadding="0" z-index="-1">
<tr>
<td align="center" valign="top"><table width="840" height="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td bgcolor="#FFFBF0">Topbanner kommer...</td>
</tr>
<tr>
<td bgcolor="#D6D6D6" max-height="20px" min-height="20px" height="20px"><table width="840" height="20px" border="1" bordercolor="#720000" cellspacing="0" cellpadding="0">
<tr>
<td><?php
$siderquery = mysql_query("SELECT * FROM sider ORDER BY id ASC");
while($sidedata = mysql_fetch_assoc($siderquery))
{
print "| <a href=\"/?side=".$sidedata[url]."\">".$sidedata[overskrift]."</a> |";
}
?>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td bgcolor="#FFFBF0" valign="top">
<?PHP
$test = mysql_query("select * FROM sider order by id WHERE id = '$_SESSION[retid]'"); // henter db info
while ($row = mysql_fetch_array($test)){
$overskrift = $row[overskrift];
$indhold = $row[indhold];
$url = $row[url];
}
?>
<form method="post" action="?do=rediger">
Overskrift:<br>
<input type="input" name="overskrift" value="<?PHP print $overskrift; ?>"><br>
Indhold:<br>
<textarea style="width:400px; height: 450px;" name="indhold" value="<?PHP print $indhold; ?>"></textarea><a href="javascript:popUp()">BBcodes</a><br>
URL: (fx: ?side=php)<br>
projekt.wizzo.dk/?side= <input type="input" name="url" value="<?PHP print $url; ?>"><br>
<input type="submit" value="Rediger">
</form>
<?php
}
else
{
echo "Hvad med lige at logge ind...";
echo "<br>";
echo "<a href=adminlogin.php>Login her</a>";
}
?>
</td>
</tr>
<tr>
<td align="center" bgcolor="#2A9FAA" class="copyright">Copyright © 8. klasse projektuge. uge13. Andreas, Abbas, Mads L og Kristian <a href="adminlogin.php">Admin</a> <a href="logud.php">Log ud</a></td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>
også siden som hedder retside-ok2.php
<?php
session_start();
include("connect.php");
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<style type="text/css">
body {
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
background-color:#999;
}
.copyright {
font-family: Verdana, Geneva, sans-serif;
color: #FFF;
}
</style>
</head>
<body>
<table width="100%" height="100%" border="0" cellspacing="0" cellpadding="0" z-index="-1">
<tr>
<td align="center" valign="top"><table width="840" height="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td bgcolor="#FFFBF0">Topbanner kommer...</td>
</tr>
<tr>
<td bgcolor="#D6D6D6" max-height="20px" min-height="20px" height="20px"><table width="840" height="20px" border="1" bordercolor="#720000" cellspacing="0" cellpadding="0">
<tr>
<td><?php
$siderquery = mysql_query("SELECT * FROM sider ORDER BY id ASC");
while($sidedata = mysql_fetch_assoc($siderquery))
{
print "| <a href=\"/?side=".$sidedata[url]."\">".$sidedata[overskrift]."</a> |";
}
?>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td bgcolor="#FFFBF0" valign="top">
<?PHP
if($_SESSION['loget_in'] == 1) {
$overskrift = $_POST['overskrift'];
$indhold = $_POST['indhold'];
$url = $_POST['url'];
mysql_query("UPDATE sider SET overskrift='$overskrift', indhold='$indhold', url='$url' WHERE id='$_SESSION[id]' ")
or die(mysql_error());
echo "Siden er nu opdateret";
echo "<br>";
echo "<a href=admin.php>Tryk her for at komme til admin siden</a>";
}
else
{
echo "Hvad med lige at logge ind...";
echo "<br>";
echo "<a href=adminlogin.php>Login her</a>";
}
?>
</td>
</tr>
<tr>
<td align="center" bgcolor="#2A9FAA" class="copyright">Copyright © 8. klasse projektuge. uge13. Andreas, Abbas, Mads L og Kristian <a href="adminlogin.php">Admin</a> <a href="logud.php">Log ud</a></td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>
så hvis nogen kunne hjælpe mig med at få dette til at virke ville jeg blive meget glad