CalmSoul
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’][‘usern ame’] . ‘.
‘;
echo ‘Click <a href="index.php?action=log out">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
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’][‘usern
‘;
echo ‘Click <a href="index.php?action=log
}
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</
<?php
}
?>
I am getting following error
Parse error: syntax error, unexpected ':' in /home/XXX/public_html/rdb/
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...
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.
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’][‘usern ame’] . ‘.
‘;
echo ‘Click <a href="index.php?action=log out">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
}
?>
<?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’][‘usern
‘;
echo ‘Click <a href="index.php?action=log
}
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</
<?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
bol
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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
Thanks for the grade, the points, and the fun question.
bol