hi,
can this code be made any better? on some computers it crashes them though it is valid xhtml?
<?
session_start();
$session=session_id();
$time=time();
$ip= $_SERVER['REMOTE_ADDR'];
ini_set('arg_separator.output','&');
?>
<head>
<link rel="icon" href="images/favicon.ico" type="image/x-icon" />
<link rel="shortcut icon" href="images/favicon.ico" type="image/x-icon" />
<script src="Scripts/AC_RunActiveContent.js" type="text/javascript"></script>
<style type="text/css">
<!--
body {
background-color: #FFF2CD;
background-repeat: repeat-x;
}
.style2 {
font-size: 12px;
font-family: Arial, Helvetica, sans-serif;
}
.style14 {font-family: Arial, Helvetica, sans-serif; font-weight: bold; font-size: 12px; }
.itemsbox {
border-right-width: 1px;
border-right-style: solid;
border-right-color: #A6D7FF;
}
a:link {
color: #000000;
text-decoration: none;
}
a:visited {
color: #000000;
text-decoration: none;
}
a:hover {
color: #0033CC;
text-decoration: none;
}
a:active {
color: #000000;
text-decoration: none;
}
body,td,th {
font-family: Arial, Helvetica, sans-serif;
}
.style22 {font-size: 12px}
-->
</style>
</head>
<body><table width="80%" border="0" align="center" cellpadding="0" cellspacing="0" class="header">
<tr>
<td valign="top"><iframe frameborder="0" scrolling="no" width="100%" height="100px" src="IFRAME_header.php"></iframe></td>
</tr>
<tr>
<td align="left" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="190" rowspan="2"><img src="images/navtopcorner.bmp" width="156" height="40" alt="Btronics RC"/><img src="images/navtop.png" width="34" height="40" alt="Btronics RC" /></td>
<td class="mainnavbg"> </td>
</tr>
<tr>
<td> </td>
</tr>
</table>
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="1%" valign="top" bgcolor="#EFEFEF" class="menuleft"><iframe scrolling="no" src="menu.php" class="iframemenu" frameborder="0"></iframe></td>
<td width="100%" align="center" valign="top">
<?
mysql_connect("$host", "$username", "$password")or die("cannot connect to server");
mysql_select_db("$db_name")or die("cannot select DB");
$sql="SELECT * FROM $tbl_name WHERE ip='$ip'";
$result=mysql_query($sql);
$count=mysql_num_rows($result);
if($count=="1"){
?>
<table width="95%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td colspan="3" style="background-image:url(images/line_1x10.png); background-repeat:repeat-x; width:100%; height:1px; padding-top:10px"></td>
</tr>
</table>
<table width="95%" border="0" cellspacing="3" cellpadding="0">
<tr>
<td align="left" valign="middle"><div align="left" class="style14 style2"><em>Welcome Back! </em></div></td>
</tr>
</table>
<table width="95%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td colspan="3" style="background-image:url(images/line_1x10.png); background-repeat:repeat-x; width:100%; height:1px"></td>
</tr>
</table>
<?
}
if($count=="0"){
$sql1="INSERT INTO $tbl_name(session, time, ip)VALUES('$session', '$time', '$ip')";
$result1=mysql_query($sql1);
}
mysql_close();
?>
<table width="95%" border="0" align="center" cellpadding="0" cellspacing="3">
<tr>
<td align="center" valign="middle"><p><img src="images/tra4909_t-maxx_3_3.jpg" alt="Traxxas Maxx Spares - Btronics RC" width="300" border="0" /></p></td>
<td width="5%" align="center" valign="middle" class="line"><p>
</p>
<p> </p></td>
<td align="center" valign="middle"><a href="item.php?id=85"><img name="engine" src="images/engine.png" width="300" height="150" border="0" id="engine" alt="Btronics RC" /></a></td>
<td width="5%" align="center" valign="middle" class="line"> </td>
<td align="center" valign="middle"><span class="style2">
<?php
mysql_connect("")or die("cannot connect server ");
mysql_select_db("")or die("cannot select DB");
$sql="SELECT * FROM banner ORDER BY rand() LIMIT 1";
$result=mysql_query($sql);
$rows=mysql_fetch_array($result);
?>
</span><a href="<? echo $rows['link']; ?>"><img src="<? echo $rows['image']; ?>" border="0" alt="Btronics RC"/></a><span class="style2">
<?
unset($rows);
mysql_close();
?>
</span></td>
</tr>
<tr>
<td colspan="4"></td>
</tr>
</table>
<br />
<table width="95%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td colspan="3" style="background-image:url(images/line_1x10.png); background-repeat:repeat-x; width:100%; height:1px; padding-top:10px"></td>
</tr>
</table>
<table width="95%" border="0" cellspacing="3" cellpadding="0">
<tr>
<td align="left" valign="middle"><div align="left" class="style14 style2"><em>Selected Items </em></div></td>
</tr>
</table>
<table width="95%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td colspan="3" style="background-image:url(images/line_1x10.png); background-repeat:repeat-x; width:100%; height:1px; padding-top:10px"></td>
</tr>
</table>
<table width="95%" border="0" cellpadding="3" cellspacing="3" style="padding-top:5px">
<tr>
<td align="center" valign="top"><?php
mysql_connect("")or die("cannot connect server ");
mysql_select_db("")or die("cannot select DB");
$sql="SELECT * from items WHERE id>50 ORDER BY rand() LIMIT 5";
$result=mysql_query($sql);
while($rows=mysql_fetch_array($result)){
?>
<table border="0" align="center" >
<tr>
<td align="center"><a href="item.php?id=<? echo $rows['id']; ?>" target="_self"><img src="<? echo $rows['image']; ?>" alt="<?
echo "#";
echo $rows['code'];
echo " - ";
echo $rows['name'];
?>" border="0" class="mediumimage"/></a></td>
</tr>
<tr>
<td align="center" valign="middle"><a href="item.php?id=<? echo $rows['id']; ?>" class="style22">#<? echo $rows['code']; ?> - <? echo $rows['name']; ?></a></td>
</tr>
<tr>
<td align="center" valign="middle"><a href="item.php?id=<? echo $rows['id']; ?>" class="style22">£<? echo $rows['price']; ?></a></td>
</tr>
</table></td>
<td>
<?
}
mysql_close(); //close database
?></td>
</tr>
</table>
<table width="95%" border="0" cellpadding="3" cellspacing="3" style="padding-top:5px">
<tr>
<td align="center" valign="top"><?php
mysql_connect("")or die("cannot connect server ");
mysql_select_db("")or die("cannot select DB");
$sql="SELECT * from items WHERE id<50 ORDER BY rand() LIMIT 5";
$result=mysql_query($sql);
while($rows=mysql_fetch_array($result)){
?>
<table border="0" align="center" >
<tr>
<td align="center"><a href="item.php?id=<? echo $rows['id']; ?>" target="_self"><img src="<? echo $rows['image']; ?>" alt="<?
echo "#";
echo $rows['code'];
echo " - ";
echo $rows['name'];
?>" border="0" class="mediumimage"/></a></td>
</tr>
<tr>
<td align="center" valign="middle"><a href="item.php?id=<? echo $rows['id']; ?>" class="style22">#<? echo $rows['code']; ?> - <? echo $rows['name']; ?></a></td>
</tr>
<tr>
<td align="center" valign="middle"><a href="item.php?id=<? echo $rows['id']; ?>" class="style22">£<? echo $rows['price']; ?></a></td>
</tr>
</table></td>
<td><?
}
mysql_close(); //close database
?></td>
</tr>
</table>
<table width="95%" border="0" cellpadding="3" cellspacing="3" style="padding-top:5px">
<tr>
<td align="center" valign="top"><?php
mysql_connect("")or die("cannot connect server ");
mysql_select_db("")or die("cannot select DB");
$sql="SELECT * from items ORDER BY rand() LIMIT 5";
$result=mysql_query($sql);
while($rows=mysql_fetch_array($result)){
?>
<table border="0" align="center" >
<tr>
<td align="center"><a href="item.php?id=<? echo $rows['id']; ?>" target="_self"><img src="<? echo $rows['image']; ?>" alt="<?
echo "#";
echo $rows['code'];
echo " - ";
echo $rows['name'];
?>" border="0" class="mediumimage"/></a></td>
</tr>
<tr>
<td align="center" valign="middle"><a href="item.php?id=<? echo $rows['id']; ?>" class="style22">#<? echo $rows['code']; ?> - <? echo $rows['name']; ?></a></td>
</tr>
<tr>
<td align="center" valign="middle"><a href="item.php?id=<? echo $rows['id']; ?>" class="style22">£<? echo $rows['price']; ?></a></td>
</tr>
</table></td>
<td><?
}
mysql_close(); //close database
?></td>
</tr>
</table>
<p> </p></td>
</tr>
</table></td></tr>
</table>
</body>
Thanks