Functions Problems
Posted by: broknspyrl
Posted on: 2006-09-21 12:01:00
Hi i have a script and i have included a file to the page. i am working in PHP and i have a function check_keve($user,$pass,$level) and when i pass the variables to the function the page hangs:
http://www.intouchmusic.net/?go=login
user: test
pass: n0rtel
it just hangs out and i don't know why.
The function on the included page does an SQL lookup and the coding is sound as it works on every other server i test it on, just not on my DH server, any ideas?!?!!? help me
some of the code lol sorry:
function get_user_info($user)
{
$query = mysql_query("SELECT * FROM cmu06 WHERE uname = '$user'");
$rows = mysql_fetch_array($query);
return $rows;
}
function check_level($user,$pass,$level)
{
$user_info = get_user_info($user);
$query = mysql_query("SELECT * FROM cmug06 WHERE cmuid = '$user_info[id]' AND cmgid = '$level'");
$numrows = mysql_num_rows($query);
return $numrows;
}
These two functions are from the takelogin.php file, below is code from the index.php file:
<?PHP
include '../takelogin.php';
$username = $_COOKIE['USER_NAME'];
$password = $_COOKIE['PASS'];
$check = check_level($username,$password,1);
echo $check;
?>
i use the function to return if the username exists, in numerical value so i can pass to an if statement to determine what is shown to logged in users, admin users and logged out users
any help again would be very much appreciated
Regards,
Chris.
//EDIT//
MySQL dump of the two tables used:
CREATE TABLE `cmu06` (
`id` int(11) NOT NULL auto_increment,
`uname` text NOT NULL,
`md5pwd` text NOT NULL,
`email` text NOT NULL,
`regdate` date NOT NULL,
`confcode` text NOT NULL,
`active` int(1) NOT NULL default '0',
`regip` text NOT NULL,
`reghost` text NOT NULL,
`lastlogindate` text NOT NULL,
`lastloginip` text NOT NULL,
`ugroup` int(11) NOT NULL default '1',
PRIMARY KEY (`id`)
) ENGINE=MyISAM
and
CREATE TABLE `cmug06` (
`id` int(11) NOT NULL auto_increment,
`cmuid` text NOT NULL,
`cmgid` text NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM
It could be as simple as i missed out a letter or mispelled something and i'm not seeing it, but i don't know and i'm so frustrated haha!
The MySQL Connection function works perfectly as you can login which is another function contained in takelogin.php
Regards,
Chris.
Edited by broknspyrl on 09/21/06 02:33 PM (server time).