halmstad Posted February 28, 2007 Share Posted February 28, 2007 hi i am new to PHP im building a site where the user after authenticating will move to next page mian.php i have both of my php pages inmy C drive how do i specify the location part in header My code is <?php session_start(); $errorMessage = ''; if (isset($_POST['txtUserId']) && isset($_POST['txtPassword'])) { // check if the username and password combination is correct if ($_POST['txtUserId'] === 'theadmin' && $_POST['txtPassword'] === 'chumbawamba') { // the username and password match, // set the session $_SESSION['basic_is_logged_in'] = true; // after login we move to the main page header('Location:main.php'); exit; } else { $errorMessage = 'Sorry, wrong username / password'; } } ?> pls do help me Link to comment https://forums.phpfreaks.com/topic/40509-header-help/ Share on other sites More sharing options...
paul2463 Posted February 28, 2007 Share Posted February 28, 2007 if the main.php is in the same folder as page that yu have provided the script above for, then the header address is correct Link to comment https://forums.phpfreaks.com/topic/40509-header-help/#findComment-196001 Share on other sites More sharing options...
nloding Posted February 28, 2007 Share Posted February 28, 2007 First, put your code between CODE tags, it's easier to read and takes up less space. You need to know your DOCUMENT_ROOT. Type "echo $_SERVER['DOCUMENT_ROOT']" and that will tell you the base directory for everything. So say your DOCUMENT_ROOT is "C:\". If "main.php" is in the "C:\website\" folder, you just type: "header('Location: website/main.php'). Is that what you were asking? Link to comment https://forums.phpfreaks.com/topic/40509-header-help/#findComment-196005 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.