Topic: directory problem with User access class (Read 1741 times)
World Wide Whale
Gender:
Posts: 154
1052 credits Members referred : 0
« on: Dec 14, 2006, 05:48:10 pm »
O.K. I got the script working beautifully, doing everything I want/need it to do. The only problem is that if you are not logged in and you hit a password protected page, you go to my 404 error page instead of my login page.
I would prefer, instead of it taking you to the login page, like it is trying to do, to take you to a, "You must be logged in to have access to this page" message, or page. Because I am getting ready to put a login form on my index page.
I would post code or something here, but I am not even sure what would be needed.
Thanks, Newbie
Moderator Community Supporter?
Jedai Sword Master
Gender:
Posts: 6691
34714 credits Members referred : 374
It's time to use PHP5!
« Reply #1 on: Dec 14, 2006, 07:47:32 pm »
hi,
Quote
O.K. I got the script working beautifully, doing everything I want/need it to do. The only problem is that if you are not logged in and you hit a password protected page, you go to my 404 error page instead of my login page.
the path is wrong!
Quote
I would prefer, instead of it taking you to the login page, like it is trying to do, to take you to a, "You must be logged in to have access to this page" message, or page. Because I am getting ready to put a login form on my index page.
I would post code or something here, but I am not even sure what would be needed.
Its up to you to put this text on your login page
World Wide Whale
Gender:
Posts: 154
1052 credits Members referred : 0
« Reply #2 on: Dec 14, 2006, 07:53:45 pm »
But where is it wrong? Where should I change the path? The links work if you are logged in, just not if you are not logged in. So, I know I have screwed up somewhere, I'm just not sure why. Thanks
Moderator Community Supporter?
Jedai Sword Master
Gender:
Posts: 6691
34714 credits Members referred : 374
It's time to use PHP5!
« Reply #3 on: Dec 14, 2006, 09:31:52 pm »
check the url where you get the 404 and verify the setting in the config file
World Wide Whale
Gender:
Posts: 154
1052 credits Members referred : 0
« Reply #4 on: Dec 14, 2006, 09:57:15 pm »
Code:
<?php // use this pathes and/or define the pathes for the "standard" pages define("CLASS_PATH", dirname($_SERVER['PHP_SELF'])."/"); // the location where the class is executed $sec_path = "/WebFolder/TestLoginPhp/classes/access_user/"; // a second location where the scripts should be define("APPLICATION_PATH", $sec_path);
// modify these constants to fit your environment define("DB_SERVER", "blahblah"); define("DB_NAME", "blahblah"); define ("DB_USER", "blahblah"); define ("DB_PASSWORD", "blahblah");
// Important! use this setting to store the session data in your Mysql database // disable this feature if your host doesn't support this session handler. define("USE_MYSQL_SESSIONS", true); // "false" to disable thios setting
// these are the names for the standard table names // !!! Important // It's possible that your server doesn't allTeow the database name inside a query // if this forms a problem don't use them here and unescape the mysql_select_db() function // inside the connect_db() method. define("USER_TABLE", DB_NAME.".users"); define("PROFILE_TABLE", DB_NAME.".users_profile"); define("COUNTRY_TABLE", DB_NAME.".countries"); // an optional table with countruy names and codes define("SESSION_TABLE", DB_NAME.".sessions");
// variables (locations) standard pages (combine the pathes from the top or use your own) define("LOGIN_PAGE", CLASS_PATH."login.php"); define("START_PAGE", "/blahblahblah/index.htm"); define("ACTIVE_PASS_PAGE", APPLICATION_PATH."activate_password.php"); define("DENY_ACCESS_PAGE", APPLICATION_PATH."deny_access.php"); define("ADMIN_PAGE", APPLICATION_PATH."admin_user.php"); define("LOGOUT_PAGE", APPLICATION_PATH."logout.php"); // if you use the setting "USE_MYSQL_SESSIONS" you need a logout page without class object to clear the old session data from the database
// your path must be related to the site root.
// change this constants to the right mail settings define("WEBMASTER_MAIL", "blahblah"); define("WEBMASTER_NAME", "blahblah"); define("ADMIN_MAIL", "blahblah"); define("ADMIN_NAME", "blahblah");
// change this vars if you need... define("PW_LENGTH", 4); define("LOGIN_LENGTH", 6);
////////////////////////////////////////////////// // constants and field names user profile table // /////////////////////////////////////////////// // // stamdard fields are: address, postcode, city, country, phone, fax, homepage, textfield // variables must match your user profile table design // use this four user defined fields (type varchar(100) too // change the value of a constant but change them in the mysql table too // otherwise you wil get some ERROR'S !!! define("TBL_USERFIELD_1", "user_1"); define("TBL_USERFIELD_2", "user_2"); define("TBL_USERFIELD_3", "user_3"); define("TBL_USERFIELD_4", "user_4"); define("TBL_USERFIELD_5", "user_5"); define("TBL_USERFIELD_6", "user_6"); ?>
OK, I checked it & i still can't figure out what it is. I filled in the personal information with "blahblah", that of course is not what is in the actual code.
I want to apologize. I have taught myself, HTML, CSS, & JavaScript. I am trying to learn PHP. I can't say I feel very confident with it. I really appreciate all of your help, my next PHP project will be to make it a CSS switcher, not really looking forward to that.....
Thanks again....
« Last Edit: Jun 07, 2007, 05:05:02 pm by PHPNewbie-KY »
Moderator Community Supporter?
Jedai Sword Master
Gender:
Posts: 6691
34714 credits Members referred : 374
It's time to use PHP5!
« Reply #5 on: Dec 15, 2006, 08:00:07 am »
do you have this script on some website? what is the URL?
World Wide Whale
Gender:
Posts: 154
1052 credits Members referred : 0
« Reply #6 on: Dec 15, 2006, 02:54:58 pm »
Yes, it is on an active website. Is there any way to send you the URL without posting it here?
Moderator Community Supporter?
Jedai Sword Master
Gender:
Posts: 6691
34714 credits Members referred : 374