I have some PHP code that takes a post from the index and then allows you to log in. When i run it it say:
parse error: unexpected $end;
If anyone has any ideas please let me know ASAP because need it for a class in school.
<?php
$uname = $_POST["username"];
$resultCount = 0;
class MyDB extends SQLite3
{
function __construct()
{
$this->open('users.db');
}
}
$db = new MyDB();
if(!$db){
echo $db->lastErrorMsg();
}
$sql =<<<EOF
SELECT $uname from users;
EOF;
$ret = $db->exec($sql);
foreach($ret as $uname){
$resultCount++;
}
if($resultCount > 1){
echo "failed to log in!";
echo "please return <a href='index.php'>home</a>";
}
else{
echo "logged in succesfully!";
echo "welcome" . $_POST[username];
}
?>