I am trying to write a class for users of my site to login, I haven't gotten very far and am already getting errors.
<?php
function isIn () {
if(isset($_SESSION) && $_SESSION['signed_in'] == TRUE) {
return true;
} else {
return false;
}
}
class User {
public function post($db) {
}
public function LoginForm() { //says problem is on this line
echo '<form method="post">
<div id="textbox">
<input type="text" id="username" name="username" value="Username:" maxlength="100" size="16" onfocus="changeUsername();"/>
</div>
<div id="passbox">
<input type="password" id="password" name="password" value="Password:" maxlength="20" size="16"/>
</div>
<input type="hidden" value="TRUE"name="login"/>
<input type="submit" id="login" value="" />
</form>
<p id="loginlinks"><a href="forgotpass.php">Forgot Password</a> / <a href="register.php">Register</a></p>
</div>';
}
public function Login(){}
}
The error is Parse error: syntax error, unexpected T_CLASS, expecting T_STRING or '(' in C:\xampp\htdocs\WhyImEvil\WIP\member.php on line 15
. I am running PHP Version 5.3.5.
For the life of my I can't figure this out.
Here is the code that includes the file:
<?php
require_once('database.php');
require_once('member.php');
session_start();
$signedIn=isIn();
$person;
$dbc;
if(!signedIn) {
$person=new User();
$dbc=new Database();
}
$dbc->connect();
?>
Are you making a call to public function LoginForm() with a public function LoginForm(STRING)??? (always take off line wrap and make sure that the line matches... sometimes another line can get the blame.)