runnerjp Posted November 25, 2007 Share Posted November 25, 2007 hey guys gonna try keep this simple as possible lol ok so i have my page set out like so <?php require_once('http://www.website.com/settings.php'); checkLogin('1 2'); ?> <?php echo 'Hello <em><b><u>' . get_username ( $_SESSION['user_id'] ) . '</u></b></em>!<br />You are now logged in.<br /><br />.'; ?> settings has this at the start <?php require ( 'http://www.website.com/lib/connection.php' ); // - the connection class needed to operate with mysql require ( 'http://www.website.com/functions.php' ); // - the functions and functions holds this part of the code that is supposed to work function checkLogin ( $levels ) { session_start (); global $db; $kt = split ( ' ', $levels ); if ( ! $_SESSION['logged_in'] ) { $access = FALSE; if ( isset ( $_COOKIE['cookie_id'] ) ) {//if we have a cookie $query = 'SELECT * FROM ' . DBPREFIX . 'users WHERE ID = ' . $db->qstr ( $_COOKIE['cookie_id'] ); if ( $db->RecordCount ( $query ) == 1 ) {//only one user can match that query $row = $db->getRow ( $query ); //let's see if we pass the validation, no monkey business if ( $_COOKIE['authenticate'] == md5 ( getIP () . $row->Password . $_SERVER['USER_AGENT'] ) ) { //we set the sessions so we don't repeat this step over and over again $_SESSION['user_id'] = $row->ID; $_SESSION['logged_in'] = TRUE; //now we check the level access, we might not have the permission if ( in_array ( get_level_access ( $_SESSION['user_id'] ), $kt ) ) { //we do?! horray! $access = TRUE; } } } } } else { $access = FALSE; if ( in_array ( get_level_access ( $_SESSION['user_id'] ), $kt ) ) { $access = TRUE; } } if ( $access == FALSE ) { header('Location: http://website.com/members/index.php'); } } yet im getting the error code Call to undefined function: checklogin() as it works on other pages outside the members folder how comes this does not work?? Quote Link to comment https://forums.phpfreaks.com/topic/78817-solved-sessions-help/ Share on other sites More sharing options...
PHP_PhREEEk Posted November 25, 2007 Share Posted November 25, 2007 You are asking for the function checklogin(), but the actual function is called checkLogin(). You got bit by the capital letter variable bug... PhREEEk Quote Link to comment https://forums.phpfreaks.com/topic/78817-solved-sessions-help/#findComment-398867 Share on other sites More sharing options...
runnerjp Posted November 25, 2007 Author Share Posted November 25, 2007 but i have used this command before and it worked fine outside of the folder im using? also when correcting it i get this error <?php require_once('http://www.website.com/settings.php'); checkLogin('1 2').; echo 'Hello <em><b><u>' . get_username ( $_SESSION['user_id'] ) . '</u></b></em>!<br />You are now logged in.<br /><br />.'; ?> Parse error: syntax error, unexpected ';' in /home/runningp/public_html/members/profile.php on line 17 i have used require_once('http://www.website.com/settings.php'); checkLogin('1 2'); before and it worked fine :S Quote Link to comment https://forums.phpfreaks.com/topic/78817-solved-sessions-help/#findComment-398872 Share on other sites More sharing options...
phpSensei Posted November 25, 2007 Share Posted November 25, 2007 You are asking for the function checklogin(), but the actual function is called checkLogin(). You got bit by the capital letter variable bug... PhREEEk He didnt miss the capital... Quote Link to comment https://forums.phpfreaks.com/topic/78817-solved-sessions-help/#findComment-398873 Share on other sites More sharing options...
phpSensei Posted November 25, 2007 Share Posted November 25, 2007 but i have used this command before and it worked fine outside of the folder im using? also when correcting it i get this error <?php require_once('http://www.website.com/settings.php'); checkLogin('1 2').; echo 'Hello <em><b><u>' . get_username ( $_SESSION['user_id'] ) . '</u></b></em>!<br />You are now logged in.<br /><br />.'; ?> Parse error: syntax error, unexpected ';' in /home/runningp/public_html/members/profile.php on line 17 i have used require_once('http://www.website.com/settings.php'); checkLogin('1 2'); before and it worked fine :S what is line 17? Quote Link to comment https://forums.phpfreaks.com/topic/78817-solved-sessions-help/#findComment-398874 Share on other sites More sharing options...
PHP_PhREEEk Posted November 25, 2007 Share Posted November 25, 2007 The OP said: > yet im getting the error code Call to undefined function: checklogin() Does the error handler do a strtolower function on function names? I saw that in his code he posted, he had it correctly capitalized, but I thought maybe he was calling checklogin() from somewhere else too (something that wasn't posted). Oh well... PhREEEk Quote Link to comment https://forums.phpfreaks.com/topic/78817-solved-sessions-help/#findComment-398881 Share on other sites More sharing options...
revraz Posted November 25, 2007 Share Posted November 25, 2007 Function names are not case sensitive. Quote Link to comment https://forums.phpfreaks.com/topic/78817-solved-sessions-help/#findComment-398884 Share on other sites More sharing options...
runnerjp Posted November 25, 2007 Author Share Posted November 25, 2007 sorry line 17 is just checkLogin('1 2'); this is because got loads writing for myself above it n forgot lol sorry Quote Link to comment https://forums.phpfreaks.com/topic/78817-solved-sessions-help/#findComment-398885 Share on other sites More sharing options...
phpSensei Posted November 25, 2007 Share Posted November 25, 2007 sorry line 17 is just checkLogin('1 2'); this is because got loads writing for myself above it n forgot lol sorry change your require_once to require_once("settings.php"); Also check the filename of where the function is. Quote Link to comment https://forums.phpfreaks.com/topic/78817-solved-sessions-help/#findComment-398894 Share on other sites More sharing options...
runnerjp Posted November 25, 2007 Author Share Posted November 25, 2007 yes but the file im using to call it is in members file and settings is just in route folder Quote Link to comment https://forums.phpfreaks.com/topic/78817-solved-sessions-help/#findComment-398899 Share on other sites More sharing options...
phpSensei Posted November 25, 2007 Share Posted November 25, 2007 yes but the file im using to call it is in members file and settings is just in route folder <?php require ( 'http://www.website.com/lib/connection.php' ); // - the connection class needed to operate with mysql require ( 'http://www.website.com/functions.php' ); // - the functions to <?php require ( 'lib/connection.php' ); // - the connection class needed to operate with mysql require ( 'functions.php' ); // - the functions Quote Link to comment https://forums.phpfreaks.com/topic/78817-solved-sessions-help/#findComment-398901 Share on other sites More sharing options...
runnerjp Posted November 25, 2007 Author Share Posted November 25, 2007 wow ok that just made MAJOR errors Warning: main() [function.main]: open_basedir restriction in effect. File(/lib/connection.php) is not within the allowed path(s): (/home/runningp:/usr/lib/php:/usr/php4/lib/php:/usr/local/lib/php:/usr/local/php4/lib/php:/tmp) in /home/runningp/public_html/settings.php on line 2 Warning: main(/lib/connection.php) [function.main]: failed to open stream: Operation not permitted in /home/runningp/public_html/settings.php on line 2 Warning: main() [function.main]: open_basedir restriction in effect. File(/lib/connection.php) is not within the allowed path(s): (/home/runningp:/usr/lib/php:/usr/php4/lib/php:/usr/local/lib/php:/usr/local/php4/lib/php:/tmp) in /home/runningp/public_html/settings.php on line 2 Warning: main(/lib/connection.php) [function.main]: failed to open stream: Operation not permitted in /home/runningp/public_html/settings.php on line 2 Fatal error: main() [function.require]: Failed opening required '/lib/connection.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/runningp/public_html/settings.php on line 2 Quote Link to comment https://forums.phpfreaks.com/topic/78817-solved-sessions-help/#findComment-398904 Share on other sites More sharing options...
phpSensei Posted November 25, 2007 Share Posted November 25, 2007 wow ok that just made MAJOR errors Warning: main() [function.main]: open_basedir restriction in effect. File(/lib/connection.php) is not within the allowed path(s): (/home/runningp:/usr/lib/php:/usr/php4/lib/php:/usr/local/lib/php:/usr/local/php4/lib/php:/tmp) in /home/runningp/public_html/settings.php on line 2 Warning: main(/lib/connection.php) [function.main]: failed to open stream: Operation not permitted in /home/runningp/public_html/settings.php on line 2 Warning: main() [function.main]: open_basedir restriction in effect. File(/lib/connection.php) is not within the allowed path(s): (/home/runningp:/usr/lib/php:/usr/php4/lib/php:/usr/local/lib/php:/usr/local/php4/lib/php:/tmp) in /home/runningp/public_html/settings.php on line 2 Warning: main(/lib/connection.php) [function.main]: failed to open stream: Operation not permitted in /home/runningp/public_html/settings.php on line 2 Fatal error: main() [function.require]: Failed opening required '/lib/connection.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/runningp/public_html/settings.php on line 2 Might just be how i included the files, since I don't know the exact root. Try putting those lines I edited right on your page where your using your functions. Quote Link to comment https://forums.phpfreaks.com/topic/78817-solved-sessions-help/#findComment-398906 Share on other sites More sharing options...
runnerjp Posted November 25, 2007 Author Share Posted November 25, 2007 but i cant as .. settings and function is in my rote folder my page im calling them all from is infolder members/page.php and obviusly the connection is on libs folder Quote Link to comment https://forums.phpfreaks.com/topic/78817-solved-sessions-help/#findComment-398910 Share on other sites More sharing options...
trq Posted November 25, 2007 Share Posted November 25, 2007 You'll want to use.... <?php require '../lib/connection.php'; require '../functions.php'; ?> Using a url to include files will (most likely) break when you move to a remote host. Because, as I told you in another thread, this feature is commonly disabled. Quote Link to comment https://forums.phpfreaks.com/topic/78817-solved-sessions-help/#findComment-398917 Share on other sites More sharing options...
runnerjp Posted November 25, 2007 Author Share Posted November 25, 2007 SOLVED thanks guys for taking your time to solve my error... any thing i do in return ever pm me Quote Link to comment https://forums.phpfreaks.com/topic/78817-solved-sessions-help/#findComment-398926 Share on other sites More sharing options...
phpSensei Posted November 25, 2007 Share Posted November 25, 2007 Yes I am sorry, I wanted to put those ../ but I jsut thought he was including them directly from index.php to lib/connections.php Quote Link to comment https://forums.phpfreaks.com/topic/78817-solved-sessions-help/#findComment-398927 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.