Hey guys, I just made a few tweaks to my website and uploaded it and suddenly its showing me the following warnings when i try to use the login system which I haven't even touched.
The warnings are:
Interesting thing is, on my local wamp server the pages run just fine. If it helps my PHP version on local wamp server is 5.1.36 whereas that on my host is 5.0.22 . Could that be creating the issue? But I doubt that because the same login ran fine earlier even on the remote server.
My PHP code is as follows:
Please help, i have searched alot online but just couldn't get an answer.
The warnings are:
Code:
Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in C:\Inetpub\vhosts\clues2college.com\httpdocs\index.php on line 59
Warning: Cannot modify header information - headers already sent by (output started at C:\Inetpub\vhosts\clues2college.com\httpdocs\index.php:59) in C:\Inetpub\vhosts\clues2college.com\httpdocs\index.php on line 80
Interesting thing is, on my local wamp server the pages run just fine. If it helps my PHP version on local wamp server is 5.1.36 whereas that on my host is 5.0.22 . Could that be creating the issue? But I doubt that because the same login ran fine earlier even on the remote server.
My PHP code is as follows:
Code:
<?php error_reporting (E_ALL ^ E_NOTICE); ?>
<?php
define('INCLUDE_CHECK',true);
require 'connect.php';
require 'functions.php';
// Those two files can be included only if INCLUDE_CHECK is defined
session_name('c2cLogin');
// Starting the session
session_set_cookie_params(2*7*24*60*60);
// Making the cookie live for 2 weeks
session_start();
if($_SESSION['user_id'] && !isset($_COOKIE['c2cRemember']) && !$_SESSION['rememberMe'])
{
// If you are logged in, but you don't have the c2cRemember cookie (browser restart)
// and you have not checked the rememberMe checkbox:
$_SESSION = array();
session_destroy();
// Destroy the session
}
if(isset($_GET['logoff']))
{
$_SESSION = array();
session_destroy();
header("Location: index.php");
exit;
}
if($_POST['submit']=='Login')
{
// Checking whether the Login form has been submitted
$err = array();
// Will hold our errors
if(!$_POST['username'] || !$_POST['password'])
$err[] = 'All the fields must be filled in!';
if(!count($err))
{
$_POST['username'] = mysql_real_escape_string($_POST['username']);
$_POST['password'] = mysql_real_escape_string($_POST['password']);
$_POST['rememberMe'] = (int)$_POST['rememberMe'];
// Escaping all input data
[COLOR="red"]Line 59- [/COLOR]$row = mysql_fetch_assoc(mysql_query("SELECT user_id,user_name FROM c2c_members WHERE user_name='{$_POST['username']}' AND user_password='{$_POST['password']}'"));
if($row['user_name'])
{
// If everything is OK login
$_SESSION['user_name']=$row['user_name'];
$_SESSION['user_id'] = $row['user_id'];
$_SESSION['rememberMe'] = $_POST['rememberMe'];
// Store some data in the session
setcookie('c2cRemember',$_POST['rememberMe']);
}
else $err[]='Wrong username and/or password!';
}
if($err)
$_SESSION['msg']['login-err'] = implode('
',$err);
// Save the error messages in the session
[COLOR="red"]Line 80 - [/COLOR] header("Location: index.php");
exit;
}
Please help, i have searched alot online but just couldn't get an answer.