Problem: Fatal Error: Function name must be as string

Hello, I got this error on my site when you try to login “Fatal Error: Function name must be a string in login.php on line 29” The login still works (it still logs you in it just gives mes that error.)
Here is the line that the error is coming from:

[php]
$result = mysql_query(“SELECT * FROM Users”);
[/php]

Help please.

Hello,

That line looks okay to me so that tells me that it’s something else in your scripts. Can you please post all of your code so we may look at all aspects of your code.

Thanks.

[php]

<?php include "Header.php"; error_reporting(0); $connect = mysql_connect("nottelling","nottelling","nottelling"); if (!$connect) { die('Could not connect: ' . mysql_error()); } mysql_select_db("Mydatabase", $connect); if (isset($_REQUEST['attempt'])) { $username = mysql_real_escape_string(strip_tags(stripslashes($_POST['username']))); $password = mysql_real_escape_string(strip_tags(stripslashes(sha1($_POST['password'])))); $username1 = $_GET['username']; $query = mysql_query("SELECT username FROM Users WHERE username = '$username' AND password = '$password'") or die (mysql_error()); $total = mysql_num_rows($query); if ($total > 0) { session_start(); mysql_query("UPDATE Users SET Online=1 WHERE username='$username' AND password='$password'"); $_SESSION['username'] = $username1; header('location: dashboard.php'); $result = mysql_query("SELECT * FROM Users"); $row = mysql_fetch_assoc($result()); $_SESSION['ban'] = $row['ban'] or die (mysql_error()); $_SESSION['user_level'] = $row['user_level']or die (mysql_error()); } else { echo "
There Was An Error Please Try Again!

"; } } ?>
Please Login
<?php if(isset($_SESSION['username'])) { echo "You are already logged in!"; } else { // Not logged in echo ' Username:
Password:
Login! '; } ?>
<?php

include “Footer.php”;
?>
[/php]

Hello,

I tried your script in my local environment and it works like it should. I received no errors when I ran it. Now I did comment out the header and the footer so for some reason it may be in one of those scripts. But as far as your login script is concerned, there are no errors.

Cheers!

There are errors in this script here it is:
"
Fatal error: Function name must be a string in /home/vol2/xtreemhost.com/xth_10851093/htdocs/login.php on line 32

Warning: Unknown: Your script possibly relies on a session side-effect which existed until PHP 4.2.3. Please be advised that the session extension does not consider global variables as a source of data, unless register_globals is enabled. You can disable this functionality and this warning by setting session.bug_compat_42 or session.bug_compat_warn to off, respectively in Unknown on line 0
"

Sponsor our Newsletter | Privacy Policy | Terms of Service