Jeg er ikke så stærk i php, men her er hele kildekoden:
<?php
if($_SESSION['rank'] == 1){
?>
<?
require("config.php");
$pr_side = 5;
$antal = mysql_result(mysql_query("SELECT COUNT(*) FROM nyhedsdatabase"),0) or die(mysql_error());
$vis_fra = (isset($_GET["visfra"]) && is_numeric($_GET["visfra"]) && $_GET["visfra"] < $antal) ? $_GET["visfra"] : 0;
$query = mysql_query("SELECT overskrift, url, kilde, type, beskrivelse, DATE_FORMAT(CONVERT_TZ(datetime, '+00:00', '+01:00'), '%d-%m-%Y %H:%i:%s') as dato, id FROM nyhedsdatabase ORDER BY dato desc, overskrift limit $vis_fra, $pr_side") or die(mysql_error());
while($row = mysql_fetch_assoc($query)) {
define('MAX_HEADLINE_WIDTH', 25);
$link = (strlen($row['url'])>MAX_HEADLINE_WIDTH) ? substr($row['url'], 0, MAX_HEADLINE_WIDTH-3)."..." : $row['url'];
?>
<?php
$newurl = htmlspecialchars("$row[url]", ENT_QUOTES);
?>
<?php
$link = htmlspecialchars("$link", ENT_QUOTES);
?>
<div class="indholdtop"><?php echo"<h1>".$row['overskrift']."</h1><h2>Tilføjet: ".$row['dato']." af Webmaster</h2>"; ?></div>
<div class="indholdcontent">
<div class="news"><?php echo"<b>Link:</b> <a href=\"
http://".$newurl."\" target=\"_blank\">".$link."</a>"; ?></div>
<div class="news"><?php echo"<b>Kilde:</b> ".$row['kilde']."";?></div>
<div class="news"><?php echo"<b>Type:</b> ".$row['type'].""; ?></div><br>
<div class="news"><?php echo"<b>Beskrivelse:</b><br>".$row['beskrivelse'].""; ?></div>
<br>
<div class="news"><?php echo"<a href=\"index.php?pageid=16&id=".$row['id']."\">Ret/Slet</a> "; ?></div>
</div>
<div class="indholdbund"></div>
<br><br>
<?php
}
?>
<div class="sideskift">
<?
if ($vis_fra > 0) {
$back= $vis_fra - $pr_side;
echo "<a href='$_SERVER[PHP_SELF]?pageid=3&visfra=$back'><</a> ";
}
$page = 1;
for ($start = 0; $antal > $start; $start = $start + $pr_side) {
if($vis_fra != $page * $pr_side - $pr_side) {
echo "<a href='$_SERVER[PHP_SELF]?pageid=3&visfra=$start'>$page</a>";
} else {
echo "<b>$page</b>";
}
$page++;
}
if ($vis_fra < $antal - $pr_side) {
$next = $vis_fra + $pr_side;
echo " <a href='$_SERVER[PHP_SELF]?pageid=3&visfra=$next'>></a>";
}
?>
</div>
<?php
} else {
require("config.php");
$pr_side = 5;
$antal = mysql_result(mysql_query("SELECT COUNT(*) FROM nyhedsdatabase"),0) or die(mysql_error());
$vis_fra = (isset($_GET["visfra"]) && is_numeric($_GET["visfra"]) && $_GET["visfra"] < $antal) ? $_GET["visfra"] : 0;
$query = mysql_query("SELECT overskrift, url, kilde, type, beskrivelse, DATE_FORMAT(CONVERT_TZ(datetime, '+00:00', '+01:00'), '%d-%m-%Y %H:%i:%s') as dato, id FROM nyhedsdatabase ORDER BY dato desc, overskrift limit $vis_fra, $pr_side") or die(mysql_error());
while($row = mysql_fetch_assoc($query)){
define('MAX_HEADLINE_WIDTH', 25);
$link = (strlen($row['url'])>MAX_HEADLINE_WIDTH) ? substr($row['url'], 0, MAX_HEADLINE_WIDTH-3)."..." : $row['url'];
?>
<?php
$newurl = htmlspecialchars("$row[url]", ENT_QUOTES);
?>
<?php
$link = htmlspecialchars("$link", ENT_QUOTES);
?>
<div class="indholdtop"><?php echo("<h1>".$row['overskrift']."</h1><h2>Tilføjet: ".$row['dato']." af Webmaster</h2>"); ?></div>
<div class="indholdcontent">
<div class="news"><?php echo("<b>Link:</b> <a href=\"
http://".$newurl."\" target=\"_blank\">".$link."</a>"); ?></div>
<div class="news"><?php echo("<b>Kilde:</b> ".$row['kilde']."");?></div>
<div class="news"><?php echo("<b>Type:</b> ".$row['type'].""); ?></div><br>
<div class="news"><?php echo("<b>Beskrivelse:</b><br>".$row['beskrivelse'].""); ?></div>
</div>
<div class="indholdbund"></div>
<br><br>
<?php
}
?>
<div class="sideskift">
<?
if ($vis_fra > 0) {
$back= $vis_fra - $pr_side;
echo "<a href='$_SERVER[PHP_SELF]?pageid=3&visfra=$back'><</a> ";
}
$page = 1;
for ($start = 0; $antal > $start; $start = $start + $pr_side) {
if($vis_fra != $page * $pr_side - $pr_side) {
echo "<a href='$_SERVER[PHP_SELF]?pageid=3&visfra=$start'>$page</a>";
} else {
echo "<b>$page</b>";
}
$page++;
}
if ($vis_fra < $antal - $pr_side) {
$next = $vis_fra + $pr_side;
echo " <a href='$_SERVER[PHP_SELF]?pageid=3&visfra=$next'>></a>";
}
?>
</div>
<?php
}
?>
Kan du se om jeg forterer på det rigtige??