Link to home
Start Free TrialLog in
Avatar of CalmSoul
CalmSoulFlag for United States of America

asked on

Error

<?php
require_once ‘config.inc.php’;
require_once ‘db.inc.php’;
require_once ‘functions.inc.php’;

if (logged_in())
{
  if (isset($_GET[‘action’]) && $_GET[‘action’] == ‘logout’)
  {
    logout();
    Header(‘Location: index.php’);
    exit();
  }
  echo ‘You are currently logged is as: ‘ . $_SESSION[’secure’][‘username’] . ‘.
‘;
  echo ‘Click <a href="index.php?action=logout">here</a> to logout’;
}
if (isset($_POST[‘login’]))
{
  $username = $_GET[‘username’];
  $password = $_GET[‘password’];
  if (login($username, $password))
  {
    Header(‘Location: index.php’);
    exit();
  }
  else
  {
    echo ‘Invalid username/password combination.’;
  }
}
else
{
?>
<form action="" method="post" name="form1">
Username: <input type="text" name="username" value="">
Password: <input type="password" name="password" value="">
<input type="submit" name="login" value="Login">
</form>

Click <a href="register.php">here</a> to register;
<?php
}
?>

I am getting following error

Parse error: syntax error, unexpected ':' in /home/XXX/public_html/rdb/index.php on line 11
Avatar of wakemup
wakemup

Is this the index file or another file? Chance are your 'Header' is being sent and it's the index page where the error is...
Avatar of Steve Bink
Yupyup...  the header is firing and redirecting to index.php, which contains a syntax error.  Post the first 15 lines of index.php, and we can isolate the problem for you.
Avatar of CalmSoul

ASKER

this is index.php page....

<?php
require_once ‘config.inc.php’;
require_once ‘db.inc.php’;
require_once ‘functions.inc.php’;

if (logged_in())
{
  if (isset($_GET[‘action’]) && $_GET[‘action’] == ‘logout’)
  {
    logout();
    Header(‘Location: index.php’);
    exit();
  }
  echo ‘You are currently logged is as: ‘ . $_SESSION[’secure’][‘username’] . ‘.
‘;
  echo ‘Click <a href="index.php?action=logout">here</a> to logout’;
}
if (isset($_POST[‘login’]))
{
  $username = $_GET[‘username’];
  $password = $_GET[‘password’];
  if (login($username, $password))
  {
    Header(‘Location: index.php’);
    exit();
  }
  else
  {
    echo ‘Invalid username/password combination.’;
  }
}
else
{
?>
<form action="" method="post" name="form1">
Username: <input type="text" name="username" value="">
Password: <input type="password" name="password" value="">
<input type="submit" name="login" value="Login">
</form>

Click <a href="register.php">here</a> to register;
<?php
}
?>
Maybe it is just my browser (or maybe my eyes) but it seems like you are using slanted quotes instead of a single quote (aka apostrophe).  PHP will work with double quotes or single quotes (') but the slanted quotes (at times not even matching) should cause an error.  They seem to be in both pages.

bol
ASKER CERTIFIED SOLUTION
Avatar of b0lsc0tt
b0lsc0tt
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I'm glad I could help.  I'm especially glad it wasn't my eyes or monitor. :)

Thanks for the grade, the points, and the fun question.

bol