I am getting this error on my test server but not on the godaddy server.
Notice: Undefined index: admin in /Applications/XAMPP/xamppfiles/htdocs/test_new/specials.php on line 24
<?php
$page = current(split("\.", substr($_SERVER['SCRIPT_NAME'], 1)));
$x = mysql_query("select * from specials where id in (select id from specials_pages where page='$page')");
while ($y = mysql_fetch_array($x))
{
$y['text'] = str_replace("\n", "<br/>", $y['text']);
if ($y['car_id'] > 0)
{
$x = mysql_query("select id from images where car_id=" . $y['car_id'] . " and main=1");
$picId = @end(mysql_fetch_array($x, MYSQL_ASSOC));
if (!empty($picId)) {
?>
<a href="viewcar.php?id=<?=$y['car_id']?>"><img border=0 src="images/vehicles/<?=$y['car_id']?>-<?=$picId?>.jpg" width=226 style="margin-bottom: 10px;"></a>
<?php }
}
?>
<div <?php if ($_SESSION['admin'] == "1") { ?>onclick="javascript:location='admin/addspecials.php?id=<?=$y['id']?>';"<?php } ?> class="special" style="margin-bottom: 10px; background: #<?=$y['bgcolor']?>; color: #<?=$y['color']?>;"><?=$y['text']?></div>
<?php
}
?>
<?php if ($_SESSION['admin'] == "1") { ?><a style="color: white;" href="admin/addspecials.php">Add special</a><?php } ?>
line 24 is so that when you are logged in as an admin to the site you would see the link to add a special. This is a live website that works on godaddy. I have it on my test server making changes to it and I get the error. Is there anything I'm missing?
This is line 24
if ($_SESSION['admin'] == "1") { ?><a style="color: white;" href="admin/addspecials.php">Add special</a><?php }