El kodos
<?php
/** start sessions **/
@session_start();
/** include header **/
include("header.php");
/** set page name **/
$page = 'home';
/** set page title **/
$page_title = 'Member Home';
/** check if user is logegd in **/
if(!isset($_SESSION['logged_in']) || $_SESSION['logged_in'] != true){ redirect($url->url_base . '/account/login'); }
/** get all users urls **/
$query = mysql_query("SELECT * FROM short_urls WHERE owner = '".$userid."'");
$num_urls = mysql_num_rows($query);
while($row = mysql_fetch_array($query)){ $urls[] = $row; }
/** delete url **/
if(isset($_GET['task']) && $_GET['task'] == 'delete_url')
{
/** get url id **/
$url_id = $_GET['id'];
/** delete url **/
$short_url->delete_url($url_id);
}
/** assign smarty variables **/
$smarty->assign('urls', $urls);
$smarty->assign('num_urls', $num_urls);
/** include footer **/
include("footer.php");
?>
Der er rigtig mange includes, så ved slet ikke hvor jeg skal starte. Ved heller ikke hvornår fejlen begyndte for har sidet og redigeret kode så et eller andet har jeg klokket i det.
tpl filen
{include file="header.tpl"}
<div id="subpage2">
<h1>Member Home</h1>
<p id="links"><a href="{$url->url_base}/account/home.php">My Urls</a> | <a href="{$url->url_base}/account/changepass.php">Change Password</a>{if isset($smarty.session.is_admin)} | <a href="{$url->url_base}/admin.php">Site Admin</a>{/if}</p>
{if $num_urls != 0}
<div id="login2" class="clearfix">
<table align="center">
<thead>
<tr class="odd">
<th scope="col">Link</th>
<th scope="col">Stats</th>
<th scope="col">Delete</th>
</tr>
</thead>
<tbody>
{foreach from=$urls item=urls}
<tr class="{cycle values="even,odd"}">
<td><a href="{$url->url_base}/{$urls.url_id}" target="_blank">{$url->url_base}/{$urls.url_id}</a></td>
<td>{$urls.url_hits} hits</td>
<td><a href="{$url->url_base}/account/home?task=delete_url&id={$urls.url_id}" onclick="return confirm('Delete?');"><img src="./assets/images/cross.png" width="16" height="16" alt="Delete" /></a></td>
</tr>
{/foreach}
</tbody>
</table>
</div>
{else}
<div id="info">{$lang.eng.3}</div>
{/if}
</div>
<div class="divider"></div>