Zenax
Active Member
- Messages
- 1,377
- Reaction score
- 4
- Points
- 38
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
Warning: session_register() [function.session-register]: Cannot send session cache limiter - headers already sent (output started at /home/zenax/public_html/index.php:17) in /home/zenax/public_html/index.php on line 45
Both appear after loggin in:
I recieved this when running a script. I am not entirely sure what it means or anything. All I know is that my script ran fine, and this is the first time I have updated the script, even though I have not changed anything regarding the sessions.
I am not complaining as I can run it on my machine, I was just letting you know what I recieved.
Many Kind regards,
Zenax
EDIT: Amended script using a different way of creating the sessions. This removed the error messages. They only seem to appear when using the session_register function.
Original Script:
PHP:
<?php
// Require once the DB script
require_once('connect_db.php');
$username = $_POST['username'];
$password = $_POST['password'];
// Creating an SQL Query
$q = "SELECT * FROM users WHERE users = '$username' and password = '$password'";
$check = mysql_query($q);
// Counting the table row
// If the result is matched then $username, $password must be row 1
$count = mysql_num_rows($check);
// Performing login
if ($count == 1) {
session_register('username');
session_register('password');
echo 'Welcome '. $_SESSION['username'] .'You are now logged in!';
} else {
echo 'Wrong username or password specified';
}
?>
Fixed with:
PHP:
<?php
// Require once the DB script
require_once('connect_db.php');
$username = $_POST['username'];
$password = $_POST['password'];
// Creating an SQL Query
$q = "SELECT * FROM users WHERE users = '$username' and password = '$password'";
$check = mysql_query($q);
// Counting the table row
// If the result is matched then $username, $password must be row 1
$count = mysql_num_rows($check);
// Performing login
if ($count == 1) {
$_SESSION['username'] = $username;
$_SESSION['password'] = $password;
echo 'Welcome '. $_SESSION['username'] .'You are now logged in!';
} else {
echo 'Wrong username or password specified';
}
?>
Just in case you wanted to know how I fixed the problem.
Last edited: