Advertisement

03.23.2008 at 07:10PM PDT, ID: 23263287
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

php5, safari
Tags: php5, safari
php redirect succeeds using php5 on local apche2 server but fails using php5 on remote server.
the php redirection code is: header('Location: '.$target_file)
Start your free trial to view this solution
Question Stats
Zone: Web Development
Question Asked By: nutronstar
Solution Provided By: RQuadling
Participating Experts: 1
Solution Grade: A
Views: 0
Translate:
Loading Advertisement...
03.23.2008 at 07:14PM PDT, ID: 21191556

Rank: Sage

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
03.23.2008 at 09:42PM PDT, ID: 21191976

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
03.24.2008 at 03:18PM PDT, ID: 21197736

Rank: Sage

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
03.24.2008 at 07:43PM PDT, ID: 21199167

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
03.24.2008 at 07:45PM PDT, ID: 21199176

Rank: Sage

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
03.24.2008 at 07:46PM PDT, ID: 21199183

Rank: Sage

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
03.25.2008 at 05:21AM PDT, ID: 21201140

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
03.25.2008 at 10:36PM PDT, ID: 21209100

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
03.28.2008 at 09:40PM PDT, ID: 21235558

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
03.30.2008 at 03:49PM PDT, ID: 21242267

Rank: Sage

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
Loading Advertisement...
Microsoft
  • Internet Protocols
  • Applications
  • Development
  • OS
  • Hardware
  • Windows Security
Apple
  • Operating Systems
  • Hardware
  • Programming
  • Networking
  • Software
Internet
  • Search Engines
  • File Sharing
  • WebTrends / Stats
  • Spy / Ad Blockers
  • Web Browsers
  • New Net Users
  • Web Development
  • Chat / IM
  • Anti Spam
  • Web Servers
  • Anti-Virus
  • Email Clients
Gamers
  • Tips
  • Online / MMORPG
  • Puzzle
  • Emulators
  • Action / Adventure
  • Role Playing
  • Consoles
  • Game Programming
  • Strategy
  • Sports
  • Misc
  • Computer Games
Digital Living
  • Hardware
  • New Net Users
  • New Users
  • Software
  • Digital Music
  • Gaming World
  • Home Security
  • Apple
  • Networking Hardware
Virus & Spyware
  • Vulnerabilities
  • IDS
  • Encryption
  • Anti-Virus
  • Operating Systems Security
  • Software Firewalls
  • WebApplications
  • Cell Phones
  • Operating Systems
  • Internet
  • Hardware Firewalls
Hardware
  • Handhelds / PDAs
  • Displays / Monitors
  • Components
  • Networking Hardware
  • Peripherals
  • Laptops/Notebooks
  • Storage
  • Servers
  • Desktops
  • New Users
  • Misc
  • Apple
Software
  • System Utilities
  • Industry Specific
  • Network Management
  • Photos / Graphics
  • Page Layout
  • VMWare
  • Misc
  • Web Development
  • OS
  • CYGWIN
  • Voice Recognition
  • Message Queue
  • Quality Assurance
  • Security
  • Firewalls
  • MultiMedia Applications
  • Development
  • Database
  • Office / Productivity
  • Business Management
  • OS/2 Apps
  • Server Software
  • Internet / Email
ITPro
  • OS
  • Storage
  • Encryption
  • Operating Systems Security
  • Apple Hardware
  • Laptops & Notebooks
  • Servers
  • Networking Hardware
  • Peripherals
  • Devices
  • Displays / Monitors
  • WebTrends / Stats
  • Search Engines
  • Firewalls
  • WebApplications
  • IDS
  • Vulnerabilities
  • Email Clients
  • File Sharing
  • Spy / Ad Blockers
  • Web Browsers
  • Web Servers
  • Networking
  • Anti-Virus
  • Chat / IM
  • Anti Spam
Developer
  • Web Servers
  • Web Browsers
  • Game Programming
  • Dev Tools
  • Industry Specific
  • Office / Productivity
  • Database
  • CYGWIN
  • Web Development
  • Search Engines
  • File Sharing
  • WebTrends / Stats
  • Programming
  • Content Management
  • Application Servers
  • Protocols
Storage
  • Removable Backup Media
  • Storage Technology
  • Servers
  • Grid
  • Remote Access
  • Backup / Restore
  • Misc
  • Hard Drives
OS
  • Miscellaneous
  • Security
  • Development
  • Linux
  • VMWare
  • MainFrame OS
  • Unix
  • Apple
  • OS / 2
  • AS / 400
  • BeOS
  • Microsoft
  • VMS / OpenVMS
Database
  • Oracle
  • Miscellaneous
  • MySQL
  • Software
  • Sybase
  • Contact Management
  • PostgreSQL
  • Data Manipulation
  • Clarion
  • InterSystems Cache
  • Siebel
  • MUMPS
  • OLAP
  • SQLBase
  • SAS
  • GIS & GPS
  • 4GL
  • Berkeley DB
  • DB2
  • Informix
  • Interbase / Firebird
  • FoxPro
  • Reporting
  • LDAP
  • Filemaker Pro
  • MS SQL Server
  • dBase
  • MS Access
Security
  • Misc
  • Web Browsers
  • Software Firewalls
  • Operating Systems Security
  • File Sharing
  • Spy / Ad Blockers
  • Vulnerabilities
  • WebApplications
  • IDS
  • Anti-Virus
  • Encryption
  • Anti Spam
  • Email Clients
  • VPN
  • Chat / IM
Programming
  • Editors IDEs
  • Installation
  • Handhelds / PDAs
  • Multimedia Programming
  • System / Kernel
  • Algorithms
  • Game
  • Signal Processing
  • Project Management
  • Open Source
  • Database
  • Misc
  • Languages
  • Processor Platforms
  • Theory
Web Development
  • Scripting
  • Blogs
  • Web Servers
  • Software
  • Search Engines
  • Web Graphics
  • Images
  • Internet Marketing
  • Images and Photos
  • Components
  • Document Imaging
  • Web Languages/Standards
  • Illustration
  • WebApplications
  • Fonts
  • WebTrends / Stats
  • Authoring
  • Digital Camera Software
  • Miscellaneous
Networking
  • Protocols
  • Apple Networking
  • Network Management
  • Message Queue
  • Application Servers
  • Content Management
  • File Servers
  • Email Servers
  • Misc
  • Java Editors & IDEs
  • Wireless
  • Networking Hardware
  • Backup / Restore
  • System Utilities
  • ISPs & Hosting
  • Web Servers
  • Storage Technology
  • Removable Backup Media
  • Servers
  • Broadband
  • Grid
  • OS / 2
  • Novell Netware
  • Unix Networking
  • Windows Networking
  • Security
  • Telecommunications
  • Operating Systems
  • Linux Networking
Other
  • Community Advisor
  • Lounge
  • Community Support
  • New Net Users
  • Philosophy / Religion
  • Math / Science
  • Miscellaneous
  • URLs
  • Expert Lounge
  • Politics
  • Puzzles / Riddles
Community Support
  • Suggestions
  • New to EE
  • New Topics
  • Community Advisor
  • CleanUp
  • Announcements
  • General
  • Feedback
  • Input
  • EE Bugs
 
03.23.2008 at 07:14PM PDT, ID: 21191556

Rank: Sage

Can you provide a live URL?
 
03.23.2008 at 09:42PM PDT, ID: 21191976
Take a look at:   http://www.take5research.com/al/newtest/surveyshort.htm  Thank you.
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
action:php
<?php
global $postdata;
require_once './handle_form.php';
ini_set ( 'allow_call_time_pass_reference','On');
ini_set ( 'detect_unicode','On');
ini_set ( 'display_errors','On');
ini_set ( 'error_reporting','6135');
ini_set ( 'magic_quotes_gpc','Off');
ini_set ( 'memory_limit','32M' );
ini_set ( 'open_basedir','httpdocs:/tmp');
ini_set ( 'output_buffering', 'On' );
$postdata = $_POST;
$target=process ();
/* Redirect to a different page in the current directory that was requested */
redirect($target);
exit
?>
===================================
handle_form.php:
<?
require_once ('./auxfunctions.php');
require_once ('./mysqlfuns.php');
require_once ('./db_config.php');
 
function prepare_data() {
.
.
.
	return $error;
}
 
function load_file() {
.
.
.
	return false;
}
 
function load_db() {
.
.
.
.
	return ($error);
}
 
function redirect($p)
	{
	/* Redirect to a different page in the current directory that was requested */
	header("Location: ".$p);
	exit ();
	}
 
function process() {
.
.
.
	return $target;
 
}
?>
Open in New Window
 
03.24.2008 at 03:18PM PDT, ID: 21197736

Rank: Sage

You are going to have to do some debugging.

Can you change ...

header("Location: " . $p);

to

echo "About to set Location: $p";


Let's make sure the $p is being generated correctly.

If this is incorrect, then we need to move backwards through the code to find the fault.
 
03.24.2008 at 07:43PM PDT, ID: 21199167
I made the change you suggested.  I commented out header("Location: ".$p). and added the coding you suggested.  No printing at all took place on the page action.php.  You can test this out yourself.
 
03.24.2008 at 07:45PM PDT, ID: 21199176

Rank: Sage

So, this looks like you need to go further back.

Take a look at the code which calls redirect();
 
03.24.2008 at 07:46PM PDT, ID: 21199183

Rank: Sage

The function process() is not returning an appropriate value.

You may need to supply more code for us to see.
 
03.25.2008 at 05:21AM PDT, ID: 21201140

I have included the contents of two files.  action.php and handle_form.php.  These work fine on my macbook apache2/php installtion but, as you observe, not on www.take5research.com.
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
100:
101:
102:
103:
104:
105:
106:
107:
108:
109:
110:
111:
112:
113:
114:
115:
116:
117:
118:
119:
120:
121:
122:
123:
124:
125:
126:
127:
128:
129:
130:
131:
132:
133:
134:
135:
136:
137:
138:
139:
140:
141:
142:
143:
144:
145:
146:
147:
148:
149:
150:
151:
152:
153:
154:
155:
156:
157:
158:
159:
160:
161:
162:
163:
164:
165:
166:
167:
168:
169:
170:
171:
172:
173:
174:
175:
176:
177:
178:
179:
180:
181:
182:
183:
184:
185:
action.php:
<?php
global $postdata;
require_once './handle_form.php';
ini_set ( 'allow_call_time_pass_reference','On');
ini_set ( 'detect_unicode','On');
ini_set ( 'display_errors','On');
ini_set ( 'error_reporting','6135');
ini_set ( 'magic_quotes_gpc','Off');
ini_set ( 'memory_limit','32M' );
ini_set ( 'open_basedir','httpdocs:/tmp');
ini_set ( 'output_buffering', 'On' );
$postdata = $_POST;
$target=process ();
/* Redirect to a different page in the current directory that was requested */
redirect($target);
exit;
?>
handle_form.php:
<?
require_once ('./auxfunctions.php');
require_once ('./mysqlfuns.php');
require_once ('./db_config.php');
 
function prepare_data() {
	global $id, $frmId, $postdata, $hder, $record;
	$error = false;
	ini_set ( 'display_errors', 1 );
	error_reporting ( E_ALL & - E_NOTICE );
	
	/*generate date and time*/
	$date = date ( 'm/d/Y' );
	$time = date ( 'h:i:s A' );
	
	$frmId = $postdata['formId'];
	
	//Add record identifier
	$id_array = array ('RecId' => $id);
	$postdata = array_merge ( $id_array, $postdata );
	
	/* Extract email address and mail thank you*/
	
	if (array_key_exists ( 'email', $postdata )) {
		$email = $postdata ['email'];
		$to = $email;
		$subject = "Thank you for your response";
		$body = "Your prize will arrive shortly";
		mail ( $to, $subject, $body );
		array_delete_key('email',$postdata);
	}
	
	/* Clean out the 'submit' fields*/
	if(array_key_exists('submit',$postdata)){array_delete_item('submit',$postdata);}
	if(array_key_exists('submit_x',$postdata)){array_delete_item('submit_x',$postdata);}
	if(array_key_exists('submit_y',$postdata)){array_delete_item('submit_y',$postdata);}
	if(array_key_exists('process',$postdata)){array_delete_item('process',$postdata);}
 
	/* Add date and time field headers*/
	$postdata=array_merge($postdata,array('date'=>$date,'time'=>$time));
	
	$keys = array_keys ( $postdata );
	
	/*Header array -> comma delimited string + end of record mark*/
	$akeys=array();
	foreach ( $keys as $k )
	{
	    $akeys=array_merge($akeys,array(pad_with_quotes($k)));
	}
	$hder = implode ( $akeys, "," ) . "\n";
	
	$avals = array_values ( $postdata );
	
	/*Surround values with quotes*/
	
	$vals = array ( );
	foreach ( $avals as $v ) {
		$vals = array_merge ( $vals, array (pad_with_quotes ( $v ) ) );
	}
	/*Value array -> comma delimited strings + end of record mark*/
	$record = implode ( $vals, "," ) . "\n";
	
	return $error;
}
 
function load_file() {
	global $site, $frmId, $hder, $record, $doc_root;
	//data file name from formId
	$file_path =$doc_root'/al/newtest/_private';
	$filename = $frmId .'_Data.txt';
	$savepath = $file_path.'/'.$filename;
	//open data file for writing
	if (! file_exists($savepath)) {
		if (!file_put_contents ( $savepath, $hder, FILE_APPEND))
			{
			echo '<p> Error writing data header :'. $filename .'</p>';
			echo '<p> File path is: '.$savepath.'</p>';
			return true;}
		if (!file_put_contents($savepath, $record, FILE_APPEND))
			{
			echo '<p> Error writing data header :'. $filename .'</p>';
			echo '<p> File path is: '.$savepath.'</p>';
			return true;
			}
		}
		else 
		{
		if (!file_put_contents ( $savepath, $record, FILE_APPEND))
			{echo '<p> Error writing data to :'. $filename.' </p>';
			echo '<p> File path is: '.$savepath.'</p>';
			return true;}
			}
	return false;
}
 
function load_db() {
	global $frmId, $hder, $record;
	$error = false;
	$tableId = $frmId . '_Data.tab';
	/* Cant select the DB*/
	if (! sel_db ( DB_USER )) {
		$error = true;
		print ('Cant log into db.');
		return $error;
	}
	
	/*Insert data record into database*/
	if (! tables_exist ( DB_NAME )) {
		table_create ( $tableId, $hder );
		$data = escape_data ( $record );
		insert_into_table ( $tableId, $data );
	}
	return ($error);
}
 
function redirect($p)
	{
	/* Redirect to a different page in the current directory that was requested */
	echo 'About to set Location: $p'; 
	//header("Location: ".$p);
	exit ();
	}
 
function process() {
	global $postdata, $doc_root;
	global $id, $site;
	global $err_mess, $mess;
	$postdata=$_POST;
	$site = 'http://'.$_SERVER['HTTP_HOST'].'/httpdocs/al/newtest';
	$doc_root=$_SERVER['DOCUMENT_ROOT'];
	$mess = 'begin: ';
	$err_mess = '';
	$id = get_rand_id ( 12 );
	$erra = false;
	$errb = false;
	$errc = false;
	if (!prepare_data ()) {
		$mess .= ' + --data prep complete';
		if (!load_file ()) {
			$mess .= ' + --file loading complete';
			/*if(!load_db()&&$erra==false)
				{$mess.=' + db update complete';}
			else
				{$errc=true;$err_mess.=' + failure to load db';}*/
			}
			else 
		{
			$errb = true;
			$err_mess .= ' + failure to load file';
		}
	} 
	else 
	{
		$erra = true;
		$err_mess .= ' + failure in data prep';
	}
	if (($erra || $errb || $errc) == true) {
		$target = $site . "/landing_page.php?" . $id . "&" . $mess . "&" . $err_mess;
	} else {
		$target = $site . "/landing_page.php?" . $id . "&" . $mess;
	}
	$serpd=urlencode(serialize($postdata));
	$target = $target.'&'.$serpd;
	return $target;
}
?>
Open in New Window
 
03.25.2008 at 10:36PM PDT, ID: 21209100
The previous version of the redirect function exists with what I sent you in the previous email.  It still does not work.

Thanks for your patience.

1:
2:
3:
4:
5:
6:
function redirect($p)
	{
	/* Redirect to a different page in the current directory that was requested */
	header("Location: ".$p);
	exit ();
	}
Open in New Window
 
03.28.2008 at 09:40PM PDT, ID: 21235558
I got it to work on the website by carefully going through the coding for the proces function.  I realized I had a permission problem with the _private directory into which I was writing the file.

Thanks for all the help and comments.
 
03.30.2008 at 03:49PM PDT, ID: 21242267

Rank: Sage

Glad to have helped.
Accepted Solution
 
 
20080236-EE-VQP-29 / EE_QW_2_20070628