njdubois Posted January 30, 2012 Share Posted January 30, 2012 I have a site up where my client can enter some text in a box, and save it to a database. But the page keeps timing out. I can't get it to happen in Firefox or Chrome so it leads me to believe that its a setting in IE? This is what I have tried: set_time_limit(0) which i understand sets the time limit for the script to unlimitted. ini_set("session.use_cookies", 1); ini_set("session.cookie_lifetime", 0); Turns cookies on, and makes them last forever. session_set_cookie_params(3600); Makes a cookies last for an hour. I have tried all of these, and I have tried them in pieces. [EDIT] I do places all before session_start I have read that some of this can go into the php.ini file, but I cannot figure out exactly what I am supposed to add? Our current php.ini is the default: * CODE ******************************************************************************* register_globals = off allow_url_fopen = off expose_php = Off max_input_time = 60 variables_order = "EGPCS" extension_dir = ./ upload_tmp_dir = /tmp precision = 12 SMTP = relay-hosting.secureserver.net url_rewriter.tags = "a=href,area=href,frame=src,input=src,form=,fieldset=" ; Only uncomment zend optimizer lines if your application requires Zend Optimizer support ;[Zend] ;zend_optimizer.optimization_level=15 ;zend_extension_manager.optimizer=/usr/local/Zend/lib/Optimizer-3.3.3 ;zend_extension_manager.optimizer_ts=/usr/local/Zend/lib/Optimizer_TS-3.3.3 ;zend_extension=/usr/local/Zend/lib/Optimizer-3.3.3/ZendExtensionManager.so ;zend_extension_ts=/usr/local/Zend/lib/Optimizer_TS-3.3.3/ZendExtensionManager_TS.so ; -- Be very careful to not to disable a function which might be needed! ; -- Uncomment the following lines to increase the security of your PHP site. ;disable_functions = "highlight_file,ini_alter,ini_restore,openlog,passthru, ; phpinfo, exec, system, dl, fsockopen, set_time_limit, ; popen, proc_open, proc_nice,shell_exec,show_source,symlink" * CODE ******************************************************************************* Where do I go from here? What is my next step? Thanks for taking the time to read my post, and thanks for the help! Nick Quote Link to comment https://forums.phpfreaks.com/topic/256021-timeout-issue-only-in-ie/ Share on other sites More sharing options...
scootstah Posted January 30, 2012 Share Posted January 30, 2012 PHP doesn't really care what browser accesses it. It isn't run by a browser so it behaves the same on every browser. So post the code so we can see what is going on. Quote Link to comment https://forums.phpfreaks.com/topic/256021-timeout-issue-only-in-ie/#findComment-1312464 Share on other sites More sharing options...
PFMaBiSmAd Posted January 30, 2012 Share Posted January 30, 2012 Also, define: the page keeps timing out? We are not standing right next to you and don't have a clue which of the half-dozen different things that statement could mean and at exactly what point in the process it is occurring at. Quote Link to comment https://forums.phpfreaks.com/topic/256021-timeout-issue-only-in-ie/#findComment-1312465 Share on other sites More sharing options...
njdubois Posted January 30, 2012 Author Share Posted January 30, 2012 Thank you for the fast replies! Code Part One: <? // My last ditch effort was to try them all. ini_set('session.gc_maxlifetime',60*60); ini_set('session.gc_probability',1); ini_set('session.gc_divisor',1); ini_set("session.use_cookies", 1); ini_set("session.cookie_lifetime", 0); session_set_cookie_params(3600); set_time_limit(0); session_start(); if(!session_is_registered(myusername)){ $_SESSION['redirect_url']=$_SERVER['REQUEST_URI']; header("location:club_p4.html"); } // ***************************************************** THE BASICS START *** $member_id=$_SESSION['userid']; $member_Name=$_SESSION['WholeName']; $member_username=$_SESSION['myusername']; $member_status=$_SESSION['status']; $member_date=$_SESSION['date']; $member_dealership=$_SESSION['dealership']; $ok=1; switch($member_status) { case 'main_admin': $ok=0; } if($ok==1) { header("location:clubp4.php"); } // ***************************************************** THE BASICS END *** // ***************************************************** PAGE VARIABLES START *** $view_actual_name = $_POST['contact']; if ($view_actual_name=='') { $view_actual_name = $_GET['contact']; } $email_to=$_GET['em']; $submit_date=$_GET['sd']; $replace_img=$_GET['n']; $profile_id=$_GET['PI']; $contact_id=$_GET['CI']; $id=$_GET['file']; $critique_s=$_GET['s']; $view = $_GET['view']; if ($view=='') { $view='month'; } $view_dealership = $_SESSION['current_view_dealer']; if ($_POST['dealership']!='') { if ($view_dealership!=$_POST['dealership']) { $view_dealership=$_POST['dealership']; $_SESSION['current_view_dealer']=$_POST['dealership']; } } if ($view_dealership=='') { $view_dealership = $member_dealership; $_SESSION['current_view_dealer']=$view_dealership; } $chk_count=$_GET['cnt']; // ***************************************************** PAGE VARIABLES END *** // ***************************************************** DATE STUFF START *** list($curMonth, $curDay, $curYear) = explode("/", $member_date); $first_day_of_month_var=getdate(mktime(0,0,0,$curMonth,1,$curYear)); $first_day_name = $first_day_of_month_var[weekday]; $month_name=$first_day_of_month_var[month]; $month_day_count = cal_days_in_month(CAL_GREGORIAN, $curMonth, $curYear); $current_week_num=0; $end_week_day=''; $d=1; while ($week_found!='1') { $current_day_of_month_var=getdate(mktime(0,0,0,$curMonth,$d,$curYear)); $current_day_name = $current_day_of_month_var[weekday]; if ($current_day_name==$first_day_name) { $current_week_num++; if ($curDay <= $d+6) { $week_start_day = $d; $end_week_day = $d+6; if ($end_week_day>$month_day_count) {$end_week_day = $month_day_count; } $week_found='1'; } } $d++; } list($ThiscurMonth, $ThiscurDay, $ThiscurYear) = explode("/", $member_date); $Thisfirst_day_of_month_var=getdate(mktime(0,0,0,$ThiscurMonth,1,$ThiscurYear)); $Thisfirst_day_name = $Thisfirst_day_of_month_var[weekday]; $Thismonth_day_count = cal_days_in_month(CAL_GREGORIAN, $ThiscurMonth, $ThiscurYear); $Thiscurrent_week_num=0; $Thisend_week_day=''; $Thisd=1; while ($Thisweek_found!='1') { $Thiscurrent_day_of_month_var=getdate(mktime(0,0,0,$ThiscurMonth,$Thisd,$ThiscurYear)); $Thiscurrent_day_name = $Thiscurrent_day_of_month_var[weekday]; if ($Thiscurrent_day_name==$Thisfirst_day_name) { $Thiscurrent_week_num++; if ($ThiscurDay <= $Thisd+6) { $Thisweek_start_day = $Thisd; $Thisend_week_day = $Thisd+6; if ($Thisend_week_day>$Thismonth_day_count) {$Thisend_week_day = $Thismonth_day_count; } $Thisweek_found='1'; } } $Thisd++; } // ***************************************************** DATE STUFF END *** if(isset($_POST['SaveChanges'])) { $error_message = ''; if (strlen($error_message) > 0) { } else { $where_str = ""; $Profiles_Con = mysql_connect("marcomprofiles.db.6872771.hostedresource.com","***","***"); if (!$Profiles_Con) {die('Could not connect: ' . mysql_error());} mysql_select_db("marcomprofiles", $Profiles_Con); $Profiles_All_SQL="SELECT * FROM profiles" . $where_str; $Profiles_All_results=mysql_query($Profiles_All_SQL); $mng_str = ''; $sal_str = ''; $add_str = ''; $cur_name_cnt=0; $cur_name='chk_'.$cur_name_cnt; while ($row = mysql_fetch_array($Profiles_All_results)) { if ($row['Status']=='main_admin') { $add_str.='<input type="checkbox" name="'.$cur_name.'" value="'.$row[0].'" />' . $row['ActualName'] . ' - ' . $row['email'] . '<br />'; $cur_name_cnt=$cur_name_cnt+1; $cur_name='chk_'.$cur_name_cnt; } if ($row['Dealership']==$view_dealership) { if($row['id']==$profile_id) { if($row['email']!='unknown' ) { $sal_str.='<input type="checkbox" name="'.$cur_name.'" value="'.$row[0].'" checked />' . $row['ActualName'] . ' - ' . $email_to . '<br />'; $cur_name_cnt=$cur_name_cnt+1; $cur_name='chk_'.$cur_name_cnt; } } if($row['Status']=='manager') { $mng_str.= '<input type="checkbox" name="'.$cur_name.'" value="'.$row[0].'" checked />'.$row['ActualName'] . ' - ' . $row['email'] . '<br />'; $cur_name_cnt=$cur_name_cnt+1; $cur_name='chk_'.$cur_name_cnt; } } } $tmp_str .= '<form name="select_email" method="post" action="clubp4_admin_viewcall.php?file='.$id.'&cnt=' . $cur_name_cnt . '">'; $tmp_str .= '<p>sales person<br />'.$sal_str.'<br/>Managment<br/>'.$mng_str.'<br/>Admins<br/>'.$add_str.'</p>'; $tmp_str .= '<table width="100%"><tr><td align="right"><input type="submit" value="Send Email" name="Submit_email" id="Submit_email"></td></tr></table></form>'; $critique_con = mysql_connect("marcomprofiles.db.6872771.hostedresource.com","***","***"); if (!$critique_con) { $output_str .= 'Could not connect: ' . mysql_error() . '<br />'; } mysql_select_db("marcomprofiles", $critique_con); $critique_SET_str=''; if ($critique_s=='y') { $critique_SET_str .= " SET message='" . $_POST['critique'] ."'"; $where_str = " WHERE call_id=" . $id . ""; $critique_All_SQL="UPDATE critique" . $critique_SET_str . $where_str; //echo $critique_All_SQL; if (!mysql_query($critique_All_SQL,$critique_con)) { $output_str = 'Critique Error : ' . mysql_error() . '<br />'; } } else { //$critique_SET_str .= ' SET message=' . $_POST['critique']; $where_str = " VALUES('" . $id . "', '" . $_POST['critique'] . "')"; $critique_All_SQL="INSERT INTO critique (call_id, message)" . $where_str; //echo $critique_All_SQL; if (!mysql_query($critique_All_SQL,$critique_con)) { $output_str = 'Critique Error : ' . mysql_error() . '<br />'; } } mysql_close($critique_con); if ($output_str=='') { $output_str = 'Message Saved!<br />' . $tmp_str; } } } There is a lot more code between that last function and the form code below. Access database, pull record, display... The timeout has to be happening before the critique gets saved to the database because it doesn't get saved. The Submit Form. echo '<form method="post" enctype="multipart/form-data" action="clubp4_admin_viewcall.php?file='. $id.'&s=' .$s . '&em=' . $salesperson_email .'&PI=' . $tmp_profile_id . '&CI=' . $tmp_contact_id . '">'; echo '<span style="font-size:medium;">Please enter final Critique :</span><br /><textarea id="critique" name="critique" rows="5" cols="30">'.$critique_Message.'</textarea><br />'; echo '<input type="submit" value="Save Changes" name="SaveChanges" id="SaveChanges"></form>'; As to the when and what. All I can say is that when you click the submit button, a white screen and black text comes back saying the page as timed out. And its instant, click...page times out. No numbers, or error codes. Another note, I can get the page to timeout during times of heavier internet traffic rarely, but now at 12:30 am it will not happen. So I can't cut and paste the text itself. My client gets it almost every time, any time. I understand that php is ran on the server. That the browser should not matter. Still, I cannot get a timeout error in any browser but IE. I apologize if I come across as amateur, I have only been working with php for a month or 2 and its been learn as I go. Thanks for the help! Nick Quote Link to comment https://forums.phpfreaks.com/topic/256021-timeout-issue-only-in-ie/#findComment-1312473 Share on other sites More sharing options...
PFMaBiSmAd Posted January 30, 2012 Share Posted January 30, 2012 The first thing that stands out is that every header() redirect needs an exit; statement after it to prevent the remainder of the code on the page from running while the browser performs that redirect. Letting the remainder of the code run while the browser requests another page can produce unpredictable results and different results for different browsers. Also, you need to ALWAYS use full opening <?php tags. Without the actual 'time out' message (its likely a php execution error), we cannot directly help you. P.S. session_is_registered was depreciated almost 10 years ago and has been completely removed as of php5.4 (soon to be released.) Quote Link to comment https://forums.phpfreaks.com/topic/256021-timeout-issue-only-in-ie/#findComment-1312596 Share on other sites More sharing options...
njdubois Posted January 30, 2012 Author Share Posted January 30, 2012 Great! I will complete all my<? tags changing them to <?php Also will add exits after headers. the depreciated function bothers me. I wish google would know better than to show results 10 years old. Either way I can look into fixing that on my own. Thanks for the heads up! As for the error. All it says is "there was a timeout error please try again." That may not be exact because I cannot reproduce the problem, though I have seen it. I had to call my client to double check and he confirmed what the error reads. "There was a timeout error, please try again." No error codes or anything that would point to a specific area that could be causing the problem. Black text, in the upper right. Hope this gives you an idea? Again, thanks for the replies. Nick Quote Link to comment https://forums.phpfreaks.com/topic/256021-timeout-issue-only-in-ie/#findComment-1312676 Share on other sites More sharing options...
PFMaBiSmAd Posted January 30, 2012 Share Posted January 30, 2012 That error text is not a php produced error and is most likely a message produced and output by the code itself. Without all the code (less any database username/password) that would be needed to reproduce the problem or even find what condition in the code corresponds to that message, it is not directly possible to help you with what your code is doing. Quote Link to comment https://forums.phpfreaks.com/topic/256021-timeout-issue-only-in-ie/#findComment-1312678 Share on other sites More sharing options...
scootstah Posted January 30, 2012 Share Posted January 30, 2012 Is your client the only one with the problem? Has he tried a different browser? Quote Link to comment https://forums.phpfreaks.com/topic/256021-timeout-issue-only-in-ie/#findComment-1312679 Share on other sites More sharing options...
darkfreaks Posted January 30, 2012 Share Posted January 30, 2012 i formatted your code so it isn't too hard on the eye also replaced session_is_registered with isset <?php ini_set('session.gc_maxlifetime', 60 * 60); ini_set('session.gc_probability', 1); ini_set('session.gc_divisor', 1); ini_set("session.use_cookies", 1); ini_set("session.cookie_lifetime", 0); session_set_cookie_params(3600); set_time_limit(0); session_start(); if (!isset($_SESSION['myusername'])) { //setting $_SESSION['myusername'] $_SESSION['redirect_url'] = $_SERVER['REQUEST_URI']; header("location:club_p4.html"); } $member_id = $_SESSION['userid']; $member_Name = $_SESSION['WholeName']; $member_username = $_SESSION['myusername']; $member_status = $_SESSION['status']; $member_date = $_SESSION['date']; $member_dealership = $_SESSION['dealership']; $ok = 1; switch ($member_status) { case 'main_admin': $ok = 0; } if ($ok == 1) { header("location:clubp4.php"); } $view_actual_name = $_POST['contact']; if ($view_actual_name === '') { $view_actual_name = $_GET['contact']; } $email_to = $_GET['em']; $submit_date = $_GET['sd']; $replace_img = $_GET['n']; $profile_id = $_GET['PI']; $contact_id = $_GET['CI']; $id = $_GET['file']; $critique_s = $_GET['s']; $view = $_GET['view']; if ($view === '') { $view = 'month'; } $view_dealership = $_SESSION['current_view_dealer']; if ($_POST['dealership'] !== '') { if ($view_dealership !== $_POST['dealership']) { $view_dealership = $_POST['dealership']; $_SESSION['current_view_dealer'] = $_POST['dealership']; } } if ($view_dealership ==='') { $view_dealership = $member_dealership; $_SESSION['current_view_dealer'] = $view_dealership; } $chk_count = $_GET['cnt']; list($curMonth, $curDay, $curYear) = explode("/", $member_date); $first_day_of_month_var = getdate(mktime(0, 0, 0, $curMonth, 1, $curYear)); $first_day_name = $first_day_of_month_var[weekday]; $month_name = $first_day_of_month_var[month]; $month_day_count = cal_days_in_month(CAL_GREGORIAN, $curMonth, $curYear); $current_week_num = 0; $end_week_day = ''; $d = 1; while ($week_found !== '1') { $current_day_of_month_var = getdate(mktime(0, 0, 0, $curMonth, $d, $curYear)); $current_day_name = $current_day_of_month_var[weekday]; if ($current_day_name == $first_day_name) { $current_week_num++; if ($curDay <= $d + 6) { $week_start_day = $d; $end_week_day = $d + 6; if ($end_week_day > $month_day_count) { $end_week_day = $month_day_count; } $week_found = '1'; } } $d++; } list($ThiscurMonth, $ThiscurDay, $ThiscurYear) = explode("/", $member_date); $Thisfirst_day_of_month_var = getdate(mktime(0, 0, 0, $ThiscurMonth, 1, $ThiscurYear)); $Thisfirst_day_name = $Thisfirst_day_of_month_var[weekday]; $Thismonth_day_count = cal_days_in_month(CAL_GREGORIAN, $ThiscurMonth, $ThiscurYear); $Thiscurrent_week_num = 0; $Thisend_week_day = ''; $Thisd = 1; while ($Thisweek_found !== '1') { $Thiscurrent_day_of_month_var = getdate(mktime(0, 0, 0, $ThiscurMonth, $Thisd, $ThiscurYear)); $Thiscurrent_day_name = $Thiscurrent_day_of_month_var[weekday]; if ($Thiscurrent_day_name == $Thisfirst_day_name) { $Thiscurrent_week_num++; if ($ThiscurDay <= $Thisd + 6) { $Thisweek_start_day = $Thisd; $Thisend_week_day = $Thisd + 6; if ($Thisend_week_day > $Thismonth_day_count) { $Thisend_week_day = $Thismonth_day_count; } $Thisweek_found = '1'; } } $Thisd++; } if (isset($_POST['SaveChanges'])) { $error_message = ''; if (strlen($error_message) > 0) { } else { $where_str = ""; $Profiles_Con = mysql_connect("marcomprofiles.db.6872771.hostedresource.com", "***", "***"); if (!$Profiles_Con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("marcomprofiles", $Profiles_Con); $Profiles_All_SQL = "SELECT * FROM profiles" . $where_str; $Profiles_All_results = mysql_query($Profiles_All_SQL); $mng_str = ''; $sal_str = ''; $add_str = ''; $cur_name_cnt = 0; $cur_name = 'chk_' . $cur_name_cnt; while ($row = mysql_fetch_array($Profiles_All_results)) { if ($row['Status'] === 'main_admin') { $add_str .= '<input type="checkbox" name="' . $cur_name . '" value="' . $row[0] . '" />' . $row['ActualName'] . ' - ' . $row['email'] . '<br />'; $cur_name_cnt = $cur_name_cnt + 1; $cur_name = 'chk_' . $cur_name_cnt; } if ($row['Dealership'] === $view_dealership) { if ($row['id'] === $profile_id) { if ($row['email'] != 'unknown') { $sal_str .= '<input type="checkbox" name="' . $cur_name . '" value="' . $row[0] . '" checked />' . $row['ActualName'] . ' - ' . $email_to . '<br />'; $cur_name_cnt = $cur_name_cnt + 1; $cur_name = 'chk_' . $cur_name_cnt; } } if ($row['Status'] === 'manager') { $mng_str .= '<input type="checkbox" name="' . $cur_name . '" value="' . $row[0] . '" checked />' . $row['ActualName'] . ' - ' . $row['email'] . '<br />'; $cur_name_cnt = $cur_name_cnt + 1; $cur_name = 'chk_' . $cur_name_cnt; } } } $tmp_str .= '<form name="select_email" method="post" action="clubp4_admin_viewcall.php?file=' . $id . '&cnt=' . $cur_name_cnt . '">'; $tmp_str .= '<p>sales person<br />' . $sal_str . '<br/>Managment<br/>' . $mng_str . '<br/>Admins<br/>' . $add_str . '</p>'; $tmp_str .= '<table width="100%"><tr><td align="right"><input type="submit" value="Send Email" name="Submit_email" id="Submit_email"></td></tr></table></form>'; $critique_con = mysql_connect("marcomprofiles.db.6872771.hostedresource.com", "***", "***"); if (!$critique_con) { $output_str .= 'Could not connect: ' . mysql_error() . '<br />'; } mysql_select_db("marcomprofiles", $critique_con); $critique_SET_str = ''; if ($critique_s == 'y') { $critique_SET_str .= " SET message='" . $_POST['critique'] . "'"; $where_str = " WHERE call_id=" . $id . ""; $critique_All_SQL = "UPDATE critique" . $critique_SET_str . $where_str; if (!mysql_query($critique_All_SQL, $critique_con)) { $output_str = 'Critique Error : ' . mysql_error() . '<br />'; } } else { $where_str = " VALUES('" . $id . "', '" . $_POST['critique'] . "')"; $critique_All_SQL = "INSERT INTO critique (call_id, message)" . $where_str; if (!mysql_query($critique_All_SQL, $critique_con)) { $output_str = 'Critique Error : ' . mysql_error() . '<br />'; } } mysql_close($critique_con); if ($output_str ==='') { $output_str = 'Message Saved!<br />' . $tmp_str; } } } Quote Link to comment https://forums.phpfreaks.com/topic/256021-timeout-issue-only-in-ie/#findComment-1312680 Share on other sites More sharing options...
njdubois Posted January 30, 2012 Author Share Posted January 30, 2012 holy wow! Thanks so much!!!! I wish I had more time to really look at it, saddly the day job is calling...ugh. But I can tell just but glancing over it there is a lot I didn't know. '=== ' '!==' ?!?! And then the spacing $blah = '1'; $someother = '2'; Great, will study and learn a lot from that post! Thanks so much. Nick Quote Link to comment https://forums.phpfreaks.com/topic/256021-timeout-issue-only-in-ie/#findComment-1312687 Share on other sites More sharing options...
scootstah Posted January 30, 2012 Share Posted January 30, 2012 holy wow! Thanks so much!!!! I wish I had more time to really look at it, saddly the day job is calling...ugh. But I can tell just but glancing over it there is a lot I didn't know. '=== ' '!==' ?!?! And then the spacing $blah = '1'; $someother = '2'; Great, will study and learn a lot from that post! Thanks so much. Nick For the '===' and '!==', see my reply here: http://www.phpfreaks.com/forums/index.php?topic=352807.msg1666061#msg1666061 The spacing is just to make the code easier to read. Quote Link to comment https://forums.phpfreaks.com/topic/256021-timeout-issue-only-in-ie/#findComment-1312761 Share on other sites More sharing options...
njdubois Posted January 31, 2012 Author Share Posted January 31, 2012 I had the opportunity to talk to a fellow programmer that was a bit more experienced than me. He was able to log in and test it himself and did not have a problem. He had the bright idea to check my clients IE security settings and/or maybe some other privacy software that might be running. So I have a meeting arranged and fingers crossed this solves the issue! Quote Link to comment https://forums.phpfreaks.com/topic/256021-timeout-issue-only-in-ie/#findComment-1312872 Share on other sites More sharing options...
PFMaBiSmAd Posted January 31, 2012 Share Posted January 31, 2012 We still don't have any actual information on the error message that is being output or enough code to be able to reproduce the problem, and well, it's not easy to solve problems in programming without finding out what is actually occurring. You end up wasting a huge amount of time trying things that don't have anything to do with the problem. As you know a picture is worth a 1000 words. A screen shot of the error page would at least pin down which of the 3-4 possible different things the error could be coming from. Quote Link to comment https://forums.phpfreaks.com/topic/256021-timeout-issue-only-in-ie/#findComment-1312913 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.