|
|
|
|
![]() ![]() |
Mar 4 2005, 12:29 PM
Post
#1
|
|
|
Super Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 362 Joined: 2-March 05 From: The Netherlands Member No.: 4,097 |
I finally have my first page done (index.php) but I know from experience that there always is something wrong (
So I would like some feedback on my index script CODE <html> <head> <title>Gamer Online</title> <meta name="Title" content="Gamer Online"> <meta name="Description" content="Where Gamers meet!"> <meta name="Keywords" content="Game, gamer, community, online, gunbound, raycrash, cybots, asdf, asdf game, global, massive, everquest, dutch, login, register, reply, great, polls, reviews, submissions, technology, website, webdesign, webhosting, free, freebies"> <meta name="Revisit-after" content="1"> <meta name="Author" content="Ridouan Ben Chammach"> <link rev="made" href="mailto:thehmmz@gmail.com"> <meta http-equiv="Reply-to" content="thehmmz@gmail.com"> <meta name="Copyright" content="HmmZ 2005"> <meta http-equiv="Content-language" content="en"> <meta name="Rating" content="General"> <style> a:link { color: #868585; } a:visited { color: #868585; } a:hover { color: #ffffff; } a:active { color: #868585; } menubarlink a:link { color: #716F6F; } menubarlink a:visited { color: #716F6F; } menubarlink a:hover { color: #ffffff; } menubarlink a:active { color: #716F6F; } footer a:link { color: #555454; } footer a:visited { color: #555454; } footer a:hover { color: #ff0000; } footer a:active { color: #555454; } </style> </head> <body> <!-- Navigation Header Start --> <table border="0" cellpadding="0" cellspacing="0" width="100%" background="#ffffff"> <tr> <td height="150" bgcolor="#ffffff"> <a href="/"> <img border="0" src="logo.gif" width="800" height="150" /></a></td> </tr> <tr> <td height="10" bgcolor="#82B5D4" background="logomenusep.gif"></td> </tr> </table> <!-- Navigation Header End --> <!-- Main Start --> <table border="0" cellspacing="0" cellpadding="0" background="#ffffff" width="100%"> <tr> <td height="10" bgcolor="#ffffff" background="images/logomenusep.gif"></td> </tr> <!-- Navigation --> <table border="#" style="border-style: groove; border-color: grey;" width="150" height="250" align="left" valign="top"> <tr> <td bgcolor="#dadada"><font color="#000000"><b>Main</b></font></td> <td bgcolor="#ffffff"><img src="images/menu_img.gif"><a class="menubarlink" href="/">Home</a></td> <td bgcolor="#ffffff"><img src="images/menu_img.gif"><a class="menubarlink" href="forum">Forum</a></td> <td bgcolor="#ffffff"><img src="images/menu_img.gif"><a class="menubarlink" href="Reviews.php">Reviews</a></td> <td bgcolor="#ffffff"><img src="images/menu_img.gif"><a class="menubarlink" href="Downloads.php">Downloads</a></td> </tr> </table> <table border="0" cellspacing="0" cellpadding="0" align="left" valign="top"> <tr> <td height="10"><img src="images/logomenusep.gif></td> </tr> </table> <table border="#" style="border-style: groove; border-color: grey;" width="150" height="250" align="left" valign="top"> <tr> <td bgcolor="#dadada"><font color="#000000"><b>Members</b></font></td> <?php print $_server['REMOTE_ADDR']; ?> <?error_reporting(E_ALL); session_start(); include("config.php"); include("functions.php"); if(!isset($_COOKIE['last_active'])) { if(isset($_SESSION['user_id'])) { mysql_query("UPDATE tbl_users SET user_lastactive = NOW() WHERE user_id = '" . $_SESSION['user_id'] . "'") or die(mysql_error()); setcookie("last_active",true,time()+5); } } if(!isset($_SESSION['user_id'])) { if(isset($_POST['login'])) { $query = mysql_query("SELECT * FROM tbl_users WHERE user_name = '" . $_POST['user'] . "' AND user_pass = '" . md5($_POST['pass']) . "'"); $result = mysql_num_rows($query); if(empty($result)) { echo "<script>alert('Login Incorrect.'); document.location.href=('index.php')</script>"; } else { while($row = mysql_fetch_assoc($query)) { $user_id = $row['user_id']; } header("Location: index.php"); $_SESSION['user_id'] = $user_id; } } else { ?> <b><strong>Log In</b></strong> <form method="POST"> <input type="hidden" value="1" name="login"> Username : <input type="text" name="user" maxlength="15"><br> Password : <input type="password" name="pass" maxlength="15"><br><br> <input type="Submit" value="Login"><br><br> <img src="icons/register.gif"> <a href="register.php">Register</a><br> <img src="icons/memberlist.gif"> <a href="memberlist.php">Memberlist</a> <? } } else { $query = mysql_query("SELECT * FROM tbl_users WHERE user_id = '" . $_SESSION['user_id'] . "'"); while($row = mysql_fetch_assoc($query)) { echo "Username : <b>" . $row['user_name']. "</b>"; if($row['user_pm']) { $msg = mysql_result(mysql_query("SELECT COUNT(1) FROM tbl_msg WHERE msg_to = '" . $_SESSION['user_id'] . "'"),0); if(empty($msg)) { $msg = "<font color=\"#008000\">Empty</font>"; } elseif($msg >= $cfg['max_msg']) { $msg = "<font color=\"#FF0000\">FULL</font>"; } else { $msg = $msg . " / " . $cfg['max_msg']; } echo "<br>\n"; echo "Inbox : <b>". $msg ."</b> ( <a href=\"msg.php?act=inbox\">Open</a> )"; } } echo "<br>\n<br>\n"; if(isset($_SESSION['admin_login'])) { echo "<img src=\"icons/admin.gif\"> <a href=\"admin.php\">Admin Page</a>"; echo "<br>\n"; } echo "<img src=\"icons/memberlist.gif\"> <a href=\"memberlist.php\">Memberlist</a>"; echo "<br>\n"; echo "<img src=\"icons/profile.gif\"> <a href=\"profile.php?act=edit_profile\">Change Profile</a>"; echo "<br>\n"; echo "<img src=\"icons/profile.gif\"> <a href=\"profile.php?act=view&user_id=" . $_SESSION['user_id'] . "\">My Profile</a>"; echo "<br>\n"; echo "<img src=\"icons/logoff.gif\"> <a href=\"logoff.php\">Log Off</a>"; } ?> </tr> </table> <table border="0" cellspacing="0" cellpadding="0" valign="top"> <tr> <td height="10"><img src="images/logomenusep.gif></td> </tr> </table> <table border="#" style="border-style: groove; border-color: grey;" width="150" height="250" align="left" valign="top"> <tr> <td bgcolor="#dadada"><font color="#000000"><b>Affiliates</b></font></td> <td bgcolor="#ffffff"><img src="images/menu_img.gif"><a class="menubarlink" href="http://www.trap17.com">Trap17</a></td> <td bgcolor="#ffffff"><img src="images/menu_img.gif"><a class="menubarlink" href="">Empty</a></td> <td bgcolor="#ffffff"><img src="images/menu_img.gif"><a class="menubarlink" href="">Empty</a></td> <td bgcolor="#ffffff"><img src="images/menu_img.gif"><a class="menubarlink" href="">Empty</a></td> <td bgcolor="#dadada">Get<a clas="menubarlink" href="mailto: thehmmz@gmail.com?subject=Affiliate Request">Affiliated</a></td> </tr> </table> <table border="0" cellspacing="0" cellpadding="0" valign="top"> <tr> <td height="10"><img src="images/logomenusep.gif></td> </tr> </table> <table border="#" style="border-style: groove; border-color: grey;" width="150" height="250" align="left" valign="top"> <tr> <td bgcolor="#dadada"><font color="#000000"><b>Community</b></font></td> <td bgcolor="#ffffff"><img src="images/menu_img.gif"><a class="menubarlink" href="games.php">Games</a></td> <td bgcolor="#ffffff"><a class="menubarlink" href=" "></a></td> <td bgcolor="#ffffff"><a class="menubarlink" href=" "></a></td> </tr> </table> <-- Navigation End --> <table border="#" style="border-style: solid; border-color: darkgrey;" width="400" height="200" align="center" valign="top"> <tr> <td bgcolor="#dadada"><font color="#ff0000">Welcome to Gamer Online<br>The only Community with it's goal set to provide it's users with massive information<br> and to give the users a nice experience<br> in both information displays as in interactivity.</font></td> </tr> </table> <table border="0" cellspacing="0" cellpadding="0" valign="top"> <tr> <td height="10"><img src="images/logomenusep.gif></td> </tr> </table> <table border="0" cellspacing="0" cellpadding="0" valign="top"> <tr> <td height="10"><img src="images/logomenusep.gif></td> </tr> </table> <table border="0" cellspacing="0" cellpadding="0" valign="top"> <tr> <td height="10"><img src="images/logomenusep.gif></td> </tr> </table> <table border="0" cellspacing="0" cellpadding="0" align="center" valign="top"> <tr> <td> <?PHP $number = "5"; include("path/to/show_news.php"); ?> </td> </tr> <-- Main End --> <-- Footer Start --> <table border="0" background="images/Footer.gif" cellspacing="0" cellpadding="0" valign="bottom" width="100%" height="100"> <tr> <td><font class="footer">Copyright© <a class="menubarlink" href="/">HmmZ</a> 2005</font></td> <td><font class="footer">This website was created and designed by Ridouan Ben Chammach</font></td> </tr> </table> <-- Footer End --> </tr> </td> </table> ?> </body></html> The last tag closings are just for insurance (I understand they shouldn't hurt the script) |
|
|
|
Mar 4 2005, 03:57 PM
Post
#2
|
|
|
Super Moderator ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 346 Joined: 8-February 05 Member No.: 3,660 |
you should put it up online. so we can actually see the site aswell, then we could probably give a better feedback. Cause i dont think people wanna check over the whole script for errors...its kinda long...
|
|
|
|
Mar 4 2005, 04:37 PM
Post
#3
|
|
|
Super Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 245 Joined: 3-March 05 Member No.: 4,125 |
it's quite a long script to have for your homepage
|
|
|
|
Mar 4 2005, 04:47 PM
Post
#4
|
|
|
Member [Level 1] ![]() ![]() ![]() ![]() Group: Members Posts: 73 Joined: 1-February 05 Member No.: 3,539 |
You could probably condense that some...........
|
|
|
|
Mar 4 2005, 05:12 PM
Post
#5
|
|
|
Privileged Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 702 Joined: 17-February 05 Member No.: 3,817 |
You can condense some code or put outside the index.php and call them with functions. For example code like cascading style sheet can be outside the index for sure. Likewise you can do others too so that it will fasten the page loading reducing undue waiting time which users get irritated and usually don't feel like visiting the site again.
|
|
|
|
Mar 4 2005, 08:06 PM
Post
#6
|
|
|
It's Miller Time ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 167 Joined: 8-February 05 Member No.: 3,672 |
wow, how big is that file in kb??? thats going to suck for the people who have dial up to load
|
|
|
|
Mar 4 2005, 11:01 PM
Post
#7
|
|
|
Super Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 362 Joined: 2-March 05 From: The Netherlands Member No.: 4,097 |
It actually only is 9kb
If i make a seperate header and footer and menu, would i need to do the following to each page? include("header.php"); include("menu.php"); include("footer.php"); would that work? And for the CSS, it's a small style piece, wouldn't need a whole new .css file, and, if i do the menu.php seperate (include("menu.php") Ow, I would LOVE to put it up, But i've requested the free hosting package 2 days ago now and still no response >.>. Ill try to check it out on php designer 2005 |
|
|
|
![]() |