over the past few weeks ive been learning php, its been quite a daunting task but stack overflow has helped me alot. I am currently having issues with a parse error,
<?php
include('config.php');
function html($html)
{
return htmlentities($html, ENT_QUOTES, 'utf-8');
}
?>
<html xmlns="http://www.w3.org/1999/xhtml"/>
<head>
<meta http-equiv="content-type" content="text/html"/>
<link href="<?php echo $design ?>/style.css" rel="stylesheet" title="Style">
<title><?php echo $title ?></title>
</head>
<body>
<html>
<div class="header">
<a href="<?php echo $root ?>" img src="<?php echo $design ?>/images/<?php echo $logo ?>" alt="home"/>
</div>
<table class="home" cellpadding="0" cellspacing="0">
<tr>
<th class="rank_th">Ranking</th>
<th class="site_th">Site</th>
<th class="votes_th">Votes</th>
</tr>
<?php
//we get #sites
$req1 = mysqli_fetch_array(mysqli_query('SELECT COUNT(id) as # FROM Sites WHERE status="ok"'));
//we get current top
IF (isset($_GET['Page'])) {
$page = intval($_GET['page']);
} else {
$page = 1;
}
//calculate #pages & display page links
$nbpage = ceil($req1['nb'] / $nbpage);
if ($page < 1 or $page > $nbpage);
{ >= 'Pages: ';
if ($page > 1) {
$pages_site .= '<a href="?page='. ($page - 1) .'">'last </a> ';
}
for ($i=1;$i<=$nbpage;$i++)
{
if ($i==$page){
$pages_site .=<strong> .$i. </strong>';
}
}
if ($page < $page<$nbpage){
$pages_site .= '<a href="?page=' . ($page + 1) .'">next</a>')''
}
?>
<tr>
<td colspan="3" class="pages"><?php ECHO $pages_site; ?></td>
</tr>
<div class="new">Please <a href="Register.php">register</a> or <a href="login.php">to add your website.</a> </div>
<?php
//calculate order
$first_site = ($page-1)*$nbpage;
$last_site = $first_site +$nbpage;
$i=$first_site ;
//display sites
$req2 = mysqli_query('select id, url, name, description, banner, votes FROM sites where status="ok" order .by votes desc limit ' .$first_site . ',' .$last_site .);
while($dnn2 = mysqli_fetch_array($req2))
{
$i++;
}
?>
<tr>
<td class="ranking"><?php echo $i; ?> </td>
<td class="site"><a href="http://<?php echo html($dnn2['url']); ?>" style="color:#0000ff;text-decoration:underline;font-weight:bold;"><?php echo html($dnn2['name']); ?></a><br />
<?php echo html($dnn2['description']); ?><br />
<a href="http://<?php echo html($dnn2['url']); ?>" style="color:#0000ff;text-decoration:underline;font-weight:bold;"><?php echo html($dnn2['url']); ?></a>
<div style="text-align:center;"<a href="http://<?php echo html($dnn2['url']?>"><img src="<?php echo html($dnn2['banner'],?>" alt="<?php echo html($dnn2['name']); ?>" style="max-width:500px;max-height:200px;" /></a></div></td>
<td class="votes"><?php echo html($dnn2['votes']); ?> <br /><a href="vote.php<?php echo ($dnn2['id']); ?>">vote</a></td>
</tr>
<?php
}
//display page # again
?>
<tr>
<td colspan="3" class="pages"> <?php echo $pages_site; ?></td>
</tr>
</table>
<div class="footer">
<?php echo $footer ?>
</div>
</body>
</html>
/**
* Created by PhpStorm.
* User: weller
* Date: 19/12/13
* Time: 11:41 AM
*/
is the index.php page.
<?php
//change to your details.
$host = 'localhost';
$user = 'username';
$pass = 'password';
$dbname = 'database';
//connects here(dont change)
$db = mysqli_connect($host, $user, $pass, $dbname);
//webmaster email
$mail1 = 'webmaster@site.com';
//site root url
$root = 'www.site.com/';
//homepage filename
$index = 'index.php';
//pages per index
$nbpages = '10';
//css name
$design = 'default';
//site title
$title = 'LOLOLOL';
//Footer msg
$footer = 'LOLOL';
?>
/**
* Created with PhpStorm.
* User: weller
* Date: 19/12/13
* Time: 11:31 AM
*/
is the config.php
and my parse error is: Parse error: syntax error, unexpected T_IS_GREATER_OR_EQUAL in /home3/crazycr1/public_html/index.php on line 37
every parse error ive had sofar ive been able to solve with google but this one has had me stumped for an hour now. i have tried moving the >= around and i did try a few other ways of doing it but i keep getting the same issue. any help at all is welcome && feel free to check for easier or more secure ways of doing things. THANKS :D weller.