Chrisj Posted October 7, 2013 Share Posted October 7, 2013 I'd like to change this code so that upon logging-in the user is redirected to upload.php. Can you help as to where in this code to make that change, please? <?php error_reporting (E_ALL); include_once ('classes/config.php'); include_once ('classes/sessions.php'); if ( $enable_forum == 1 ) header("Location: " . $smf_bridge_register); $referer = $_SERVER[HTTP_REFERER]; if ( !ereg ($base_url, $referer) ) $referer = $base_url; $type = mysql_real_escape_string( $_GET['type'] ); if ( $_POST['submitted'] != 'yes' ) { $show_signup = 0; $show_login = 1; if ( !isset($form_submitted) || ($form_submitted == '') ) { if ( defined('SMF_INSTALLED') ) $show_login = 2; $template = "themes/$user_theme/templates/main_1.htm"; $inner_template1 = "themes/$user_theme/templates/inner_signup_form.htm"; $TBS = new clsTinyButStrong; $TBS->NoErr = true; $TBS->LoadTemplate("$template"); $TBS->Render = TBS_OUTPUT; $TBS->Show(); @mysql_close(); die(); } } if ( $_POST['submitted'] == 'yes' && !isset($_POST['user_name_login']) || ($_POST['user_name_login'] == '') || !isset($_POST['password_login']) || ($_POST['password_login'] == '')) { //display form with error message $error_message = $config['incorrect_logins']; $message_type = $lang_error; $blk_notification = 1; $show_signup = 0; $show_login = 1; $template = "themes/$user_theme/templates/main_1.htm"; $inner_template1 = "themes/$user_theme/templates/inner_signup_form.htm"; $TBS = new clsTinyButStrong; $TBS->NoErr = true; $TBS->LoadTemplate("$template"); $TBS->Render = TBS_OUTPUT; $TBS->Show(); @mysql_close(); die(); } // GET LOGIN INFORMATION AND CHECK AGAINST DATABASE $user_name_login = mysql_real_escape_string($_POST['user_name_login']); $password_login = mysql_real_escape_string($_POST['password_login']); $password_login = md5($password_login); $remember_me = mysql_real_escape_string($_POST['remember_me']); $cookie_time = mysql_real_escape_string($_POST['cookie_time']); $referer_url = mysql_real_escape_string($_POST['referer_url']); $config_redirect = 'yes'; if ($cookie_time == '-1' ) $cookie_time = 43200; // case insensitive login and registration $user_name_login = strtolower($user_name_login); $sql = "SELECT user_name, password FROM member_profile WHERE user_name = '$user_name_login' AND password = '$password_login'"; $query = @mysql_query($sql); $result = @mysql_fetch_array($query); $result_display_username = $result['user_name']; $result_username = strtolower($result['user_name']); if ( $result_username == $user_name_login ) { //success login - checkinng if user has confirmed email $sql = "SELECT user_name, user_id, password, passwordSalt, account_status FROM member_profile WHERE user_name = '$user_name_login' AND password = '$password_login'"; $query = @mysql_query($sql); $outcome = @mysql_fetch_array($query); $result = $outcome['account_status']; if ( $result == 'new' ) { //email not confirmed $notification_type = $config['notification_error']; $message = $config['email_not_confirmed']; $blk_notification = 1; $template = "themes/$user_theme/templates/main_1.htm"; $inner_template1 = "themes/$user_theme/templates/inner_notification.htm"; $TBS = new clsTinyButStrong; $TBS->NoErr = true; $TBS->LoadTemplate("$template"); $TBS->Render = TBS_OUTPUT; $TBS->Show(); @mysql_close(); die(); } elseif( $result == 'suspended' ) { //account suspended $notification_type = $config['notification_error']; $error_message = $config['account_suspended']; $blk_notification = 1; $template = "themes/$user_theme/templates/main_1.htm"; $inner_template1 = "themes/$user_theme/templates/inner_notification.htm"; $TBS = new clsTinyButStrong; $TBS->NoErr = true; $TBS->LoadTemplate("$template"); $TBS->Render = TBS_OUTPUT; $TBS->Show(); @mysql_close(); die(); } elseif( $result == 'active' ) { @session_start(); @session_register('user_id'); @session_register('user_name'); @session_register('user_group'); $_SESSION['user_id'] = $outcome['user_id']; $_SESSION['user_name'] = $result_display_username; $_SESSION['user_group'] = $outcome['user_group']; $password = $outcome['password']; $passwordSalt = $outcome['passwordSalt']; $loggedin = 1; // remember me if ( $remember_me == 'remember_me' ) { $how_long = (60 * $cookie_time); $cookie_pass = sha1( sha1($password) . sha1($passwordSalt) ); setcookie('user', $result_display_username, time()+$how_long); setcookie('pass', $cookie_pass, time()+$how_long); } header("Location: index.php"); /* if ( $referer_url == '' ) $referer_url = "index.php"; if ($config_redirect == 'yes') { header("Location: $referer_url"); //redirect to last page } else { header("Location: " . "index.php"); //redirect to Myaccount page } */ } } else { //display form with error message $error_message = $config['incorrect_logins']; $message_type = $lang_error; $blk_notification = 1; $show_login = 1; $template = "themes/$user_theme/templates/main_1.htm"; $inner_template1 = "themes/$user_theme/templates/inner_signup_form.htm"; $TBS = new clsTinyButStrong; $TBS->NoErr = true; $TBS->LoadTemplate("$template"); $TBS->Render = TBS_OUTPUT; $TBS->Show(); @mysql_close(); die(); } ?> Thanks Link to comment https://forums.phpfreaks.com/topic/282780-help-with-re-direct/ Share on other sites More sharing options...
Ch0cu3r Posted October 7, 2013 Share Posted October 7, 2013 I'm guessing change line 147 header("Location: index.php"); to header("Location: upload.php"); Link to comment https://forums.phpfreaks.com/topic/282780-help-with-re-direct/#findComment-1452943 Share on other sites More sharing options...
jazzman1 Posted October 7, 2013 Share Posted October 7, 2013 Don't forget to call the exit function after calling a header() function! EDIT: I meant location header Link to comment https://forums.phpfreaks.com/topic/282780-help-with-re-direct/#findComment-1452944 Share on other sites More sharing options...
Chrisj Posted October 7, 2013 Author Share Posted October 7, 2013 Thanks for all the help. Please tell me how to " call the exit function after calling a location header() function! " Link to comment https://forums.phpfreaks.com/topic/282780-help-with-re-direct/#findComment-1452976 Share on other sites More sharing options...
AbraCadaver Posted October 7, 2013 Share Posted October 7, 2013 Thanks for all the help. Please tell me how to " call the exit function after calling a location header() function! " Here exit; exit; here boy... Link to comment https://forums.phpfreaks.com/topic/282780-help-with-re-direct/#findComment-1452986 Share on other sites More sharing options...
cyberRobot Posted October 8, 2013 Share Posted October 8, 2013 An example of using exit after a header call can be found in the manual: http://php.net/manual/en/function.header.php Link to comment https://forums.phpfreaks.com/topic/282780-help-with-re-direct/#findComment-1453063 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.