Hi there, i am back because i learnt PHP but i am being hit with an error 500 for over an hour and have no clue whats going on, since the code is already being used in the site. so please be nice im a novice still but i am still pretty good a PHP.
here is the code:
<?php
$links = mysql_query("SELECT * FROM `posts` ORDER BY id DESC LIMIT 0 , 5");
while ($link = mysql_fetch_assoc($links)) {
$address = $link['address'];
$name = $link['name'];
$id = $link['id'];
echo "<a href=\\"$address\\">$name</a><br>";
}
?>
and the index.php file its in:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
<link type="text/css" rel="stylesheet" href="./content/includes/style.css" >
<title>Torque CMS - Home</title>
</head>
<?php
include('./system/database/dbconnect.php');
include('./content/core/index_content/footer.php');
//This will start a session
ob_start();
session_start();
?>
<body>
<div id="header"><center><h3>Torque CMS</h3></center></div>
<div id="content">
<center>
<?php
$result = mysql_query("SELECT * FROM `posts` ORDER BY id DESC LIMIT 0 , 5");
while ($article = mysql_fetch_assoc($result)) {
echo "<br><h2>";
echo $article['heading'];
echo "</h2><br>";
$body = $article['paragraph'];
echo $body;
$id = $article['id'];
echo "<hr />";
}
?>
</center>
</div>
<div id="sb"><center><h4>Menu!</h4><br>
<br>
<?php
$links = mysql_query("SELECT * FROM `posts` ORDER BY id DESC LIMIT 0 , 5");
while ($link = mysql_fetch_assoc($links)) {
$address = $link['address'];
$name = $link['name'];
$id = $link['id'];
echo "<a href=\\"$address\\">$name</a><br>";
}
?>
<br>
<hr>
<?php
// assign the variables.
$username = $_SESSION['login'];
$password = $_SESSION['pass'];
//Check do we have username and password
if(!$username && !$password){
//if there is no username or password set, Set name as guest
echo "Welcome Guest! <br> <form action='./system/user_system/login.php' method='post'>"
//print the form for login
."Username: <br> <input type='text' name='login' size='30'><br>"
."Password: <br> <input type='password' name='pass' size='30'><br>"
."<input type='submit' value='Login'>"
."</form>"
."<br>"
."<a href='./signup.html'>Signup!</a>";
}else{
//if there is a session set, Use the values.
echo "Welcome ".$username." (<a href=./system/user_system/logout.php>Logout</a> <br>)";
$query = mysql_query("SELECT * FROM login");
$level = mysql_fetch_assoc( $query );
$level1 = $level['level'];
if ($level1 == 'admin') {
echo '<a href="./admin/index.php">Admin Panel</a>';
}else{
echo '<a href="./user/index.php">User Panel</a>';
}
}
?>
</center></div>
<div id="footer"><br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<center>© <?php echo $year['year']; ?> As Is Hosting - <?php echo $version['version']; ?> | <?php echo $mode['mode']; ?> MODE</center></div>
</body>
<?php ob_flush(); ?>
</html>
thanks