Jump to content

Archived

This topic is now archived and is closed to further replies.

musicmaker001

PHP script runs on 1 server but not another...

Recommended Posts

Modified Post 04-06-06


I think I'm almost squared away. My script is running through all the code except for the last few lines. Someone Please help me, I have been sqouring the web for an answer to no avail. Here is the last bit of code that seems to be snafuing the whole script.




$message=stripslashes($message);

$subject="Website Applicant";
$address="craig@hoaxdesign.com";
$email="$emailaddy";
$mail="$message";
$success=mail($address,$subject,$mail,"From: $email");
header("Refresh: 0;url=http://www.hoaxdesign.com/success.html");
?><?php
}
?>

Share this post


Link to post
Share on other sites
please post some code so we can see what your working with and telling us what errors you get might also help

Share this post


Link to post
Share on other sites
The error is a Cannot find server or DNS Error

The old script was removed from this post.

I posted the changed script below.

Share this post


Link to post
Share on other sites
ist it not finding this page [a href=\"http://www.hoaxdesign.com/success.html\" target=\"_blank\"]http://www.hoaxdesign.com/success.html[/a]

Share this post


Link to post
Share on other sites
It fails with process.php in the address bar.

The working script goes to the success page with no problems.

Share this post


Link to post
Share on other sites
does it keep saying it cant find server and wher you refresh it it says you did not enter all requested data

Share this post


Link to post
Share on other sites
every time it says cant find server that is a server error and not code error and when it says cant find server and you refresh it it is looseing all the veriables if you are usein the same server as the one that work just useing a different domain name then it is probaly the server that is hosting the domain name haveing errors

Share this post


Link to post
Share on other sites
The servers are definately not the same. I know the working script is on an Apache UNIX server. I do not know about the other server. Will this make a difference? The script has been tested several times over the passed week on the other server with the same result each time. Any ideas as to what I should do?

Share this post


Link to post
Share on other sites
both apachi servers may be configured differently(example: one is on a lenux os and if the other one is on a windows os they would be configured different and may read code different) and that could be the problem plus another problem you might run into is if on server is running php4 and the other is running php5 some of the php4 code will not run on php5 because of the the changes but the problem you are haveing is the server because when you hit the submit button the browser says can not find server and when you hit the refresh button the page displays with the error

Share this post


Link to post
Share on other sites
The hosting company for the site sent this to me.

"I have global variables turned off for security reasons, so you may need to reference the variables by object."

I don't know how to change the code to do that. Perhaps you could explain it to me, maybe an example would help...from the code I already have.

Share this post


Link to post
Share on other sites
The host should have said -- "I have register_globals disabled. This is the default behavior for PHP for the last several years"

Please read the section on [a href=\"http://www.php.net/register_globals\" target=\"_blank\"]register_globals[/a] in the PHP manual for more information.

Ken

Share this post


Link to post
Share on other sites
Thanks a ton Ken,

I made changes to my script, which I'll include below. I have the same scenario, it works on one server but not the other. I can't see what the problem is, perhaps someone could point it out to me?


<?php
$errors=0;
$error="The following errors occured while processing your form input.<ul>";
$First=$_POST['First'];
$Last=$_POST['Last'];
$emailaddy=$_POST['emailaddy'];
$Address=$_POST['Address'];
$City=$_POST['City'];
$State=$_POST['State'];
$ZipCode=$_POST['ZipCode'];
$Phone=$_POST['Phone'];
$CellPhone=$_POST['CellPhone'];
$DriverLicNo=$_POST['DriverLicNo'];
$IssuingState=$_POST['IssuingState'];
$YearsDriving=$_POST['YearsDriving'];
$Endorsement=$_POST['Endorsement'];
$EmergencyName=$_POST['EmergencyName'];
$EmergencyPhone=$_POST['EmergencyPhone'];
$Position=$_POST['Position'];
$Certifications=$_POST['Certifications'];
$Certifications2=$_POST['Certifications2'];
$Certifications3=$_POST['Certifications3'];
$Certifications4=$_POST['Certifications4'];
$Certifications5=$_POST['Certifications5'];
$Certifications6=$_POST['Certifications6'];
$OtherCertifications=$_POST['OtherCertifications'];
$violations=$_POST['violations'];
$accidents=$_POST['accidents'];
$ticketaccidentexp=$_POST['ticketaccidentexp'];
$drive=$_POST['drive'];
$driveexp=$_POST['driveexp'];
$limitations=$_POST['limitations'];
$limitationsexp=$_POST['limitationsexp'];
$crime=$_POST['crime'];
$crimeexp=$_POST['crimeexp'];
$HS=$_POST['HS'];
$HSAddress=$_POST['HSAddress'];
$HSYears=$_POST['HSYears'];
$Degree=$_POST['Degree'];
$College=$_POST['College'];
$CollegeAddress=$_POST['CollegeAddress'];
$CollegeYears=$_POST['CollegeYears'];
$CollegeDegree=$_POST['CollegeDegree'];
$schoolother=$_POST['schoolother'];
$GradAddress=$_POST['GradAddress'];
$GradYears=$_POST['GradYears'];
$GradDegree=$_POST['GradDegree'];
$AvailableStart=$_POST['AvailableStart'];
$AvailableEnd=$_POST['AvailableEnd'];
$overtime=$_POST['overtime'];
$citizen=$_POST['citizen'];
$AlienID=$_POST['AlienID'];
$otherlang=$_POST['otherlang'];
$Skills=$_POST['Skills'];
$Skills2=$_POST['Skills2'];
$Skills3=$_POST['Skills3'];
$Skills4=$_POST['Skills4'];
$Skills5=$_POST['Skills5'];
$Skills6=$_POST['Skills6'];
$Skills7=$_POST['Skills7'];
$Skills8=$_POST['Skills8'];
$Skills9=$_POST['Skills9'];
$Instruments=$_POST['Instruments'];
$experience=$_POST['experience'];
$whyapply=$_POST['whyapply'];
$affiliations=$_POST['affiliations'];
$source=$_POST['source'];
$Reference1=$_POST['Reference1'];
$Reference2=$_POST['Reference2'];
$Reference3=$_POST['Reference3'];
$Employer=$_POST['Employer'];
$EmployerAddress=$_POST['EmployerAddress'];
$EmployerCity=$_POST['EmployerCity'];
$EmployerState=$_POST['EmployerState'];
$EmployerZip=$_POST['EmployerZip'];
$EmployerPhone=$_POST['EmployerPhone'];
$Supervisor=$_POST['Supervisor'];
$EmployedFrom=$_POST['EmployedFrom'];
$EmployedTo=$_POST['EmployedTo'];
$StartSal=$_POST['StartSal'];
$EndSal=$_POST['EndSal'];
$Duties=$_POST['Duties'];
$Reasonforleaving=$_POST['Reasonforleaving'];
$Employer2=$_POST['Employer2'];
$Employer2Address=$_POST['Employer2Address'];
$Employer2City=$_POST['Employer2City'];
$Employer2State=$_POST['Employer2State'];
$Employer2Zip=$_POST['Employer2Zip'];
$Employer2Phone=$_POST['Employer2Phone'];
$Supervisor2=$_POST['Supervisor2'];
$EmployedFrom2=$_POST['EmployedFrom2'];
$EmployedTo2=$_POST['EmployedTo2'];
$StartSal2=$_POST['StartSal2'];
$EndSal2=$_POST['EndSal2'];
$Duties2=$_POST['Duties2'];
$Reasonforleaving2=$_POST['Reasonforleaving2'];
$Employer3=$_POST['Employer3'];
$Employer3Address=$_POST['Employer3Address'];
$Employer3City=$_POST['Employer3City'];
$Employer3State=$_POST['Employer3State'];
$Employer3Zip=$_POST['Employer3Zip'];
$Employer3Phone=$_POST['Employer3Phone'];
$Supervisor3=$_POST['Supervisor3'];
$EmployedFrom3=$_POST['EmployedFrom3'];
$EmployedTo3=$_POST['EmployedTo3'];
$StartSal3=$_POST['StartSal3'];
$EndSal3=$_POST['EndSal3'];
$Duties3=$_POST['Duties3'];
$Reasonforleaving3=$_POST['Reasonforleaving3'];
$unemployment=$_POST['unemployment'];
$Initials=$_POST['Initials'];
$signdate=$_POST['signdate'];
if($First=="" || $Last=="" || $emailaddy=="" || $Address=="" || $City=="" || $State=="" || $ZipCode=="" || $Phone=="" || $AvailableStart=="" || $AvailableEnd=="" || $Initials=="" || $signdate=="" ){
$errors=1;
$error.="<li>You did not enter one or more of the required fields. Please go back and try again.";
}
if(!eregi("^[a-z0-9]+([_\\.-][a-z0-9]+)*" ."@"."([a-z0-9]+([\.-][a-z0-9]+)*)+"."\\.[a-z]{2,}"."$",$emailaddy)){
$error.="<li>Invalid email address entered";
$errors=1;
}
if($errors==1) echo $error;
else{
$where_form_is="http".($HTTP_SERVER_VARS["HTTPS"]=="on"?"s":"")."://".$SERVER_NAME.strrev(strstr(strrev($PHP_SELF),"/"));
$message="--PERSONAL INFO
".$First." ".$Last."
".$emailaddy."
".$Address."
".$City.", ".$State." ".$ZipCode."
".$Phone."
Cell Phone: ".$CellPhone."

Driver Lic No: ".$IssuingState." ".$DriverLicNo."
Years Driving: ".$YearsDriving."
Endorsements: ".$Endorsement."

Emergency Contact Name: ".$EmergencyName."
Emergency Contact Phone: ".$EmergencyPhone."


Position Applying For: ".$Position."
Safety Certifications: ".$Certifications.", ".$Certifications2.",
".$Certifications3.", ".$Certifications4.", ".$Certifications5.", ".$Certifications6."
Other Certifications: ".$OtherCertifications."

Moving Violations in Last 3 Years: ".$violations."
Any Accidents: ".$accidents."
Violation & Accident Explanation: ".$ticketaccidentexp."
Willing to Drive Bus or Van: ".$drive."
Drive Explanation: ".$driveexp."

Work Limitations: ".$limitations."
Explanation of Limitations: ".$limitationsexp."


--CRIMINAL RECORD
Convictions: ".$crime."
Explanation of Convictions: ".$crimeexp."


--EDUCATION
High School: ".$HS."
HS Address: ".$HSAddress."
HS Years: ".$HSYears."
HS Degree Acheived: ".$HSDegree."

College: ".$College."
College Address: ".$CollegeAddress."
College Years: ".$CollegeYears."
College Degree Acheived: ".$CollegeDegree."

Other School Attended: ".$schoolother."
Other School Address: ".$GradAddress."
Other School Years: ".$GradYears."
Other School Degrees Acheived: ".$GradDegree."


--AVAILABILITY
Available to Start as of: ".$AvailableStart."
Must End Employment on: ".$AvailableEnd."
Willing to work overtime: ".$overtime."


--CITIZENSHIP
US Citizen: ".$citizen."
Alien ID: ".$AlienID."


Other Languages: ".$otherlang."


Skills: ".$Skills.", ".$Skills2.", ".$Skills3.", ".$Skills4."
".$Skills5.", ".$Skills6.", ".$Skills7.", ".$Skills8.", ".$Skills9."

Musical Instruments: ".$Instruments."


experience: ".$experience."
why apply: ".$whyapply."
affiliations: ".$affiliations."
How they found TW: ".$source."

Reference 1: ".$Reference1."

Reference 2: ".$Reference2."

Reference 3: ".$Reference3."



--EMPLOYMENT HISTORY


EMPLOYER 1

".$Employer."
".$EmployerAddress."
".$EmployerCity.", ".$EmployerState." ".$EmployerZip."
Phone: ".$EmployerPhone."
Supervisor: ".$Supervisor."
Employed From: ".$EmployedFrom." to ".$EmployedTo."
Start Sal: ".$StartSal."
End Sal: ".$EndSal."
Duties: ".$Duties."
Reason for leaving: ".$Reasonforleaving."


EMPLOYER 2

".$Employer2."
".$Employer2Address."
".$Employer2City.", ".$Employer2State." ".$Employer2Zip."
Phone: ".$Employer2Phone."
Supervisor: ".$Supervisor2."
Employed From: ".$EmployedFrom2." to ".$EmployedTo2."
Start Sal: ".$StartSal2."
End Sal: ".$EndSal2."
Duties: ".$Duties2."
Reason for leaving: ".$Reasonforleaving2."


EMPLOYER 3

".$Employer3."
".$Employer3Address."
".$Employer3City.", ".$Employer3State." ".$Employer3Zip."
Phone: ".$Employer3Phone."
Supervisor: ".$Supervisor3."
Employed From: ".$EmployedFrom3." to ".$EmployedTo3."
Start Sal: ".$StartSal3."
End Sal: ".$EndSal3."
Duties: ".$Duties3."
Reason for leaving: ".$Reasonforleaving3."

Periods of unemployment explanation: ".$unemployment."

Agreement Initials: ".$Initials."
Agreement Initialed date: ".$signdate."
";
$message = stripslashes($message);

$subject = "Website Applicant";
$address = "craig@hoaxdesign.com";
$email = "$emailaddy";
$mail = "$message";
$success = mail($address, $subject, $mail, "From: $email");
header("Refresh: 0;url=http://www.hoaxdesign.com/success.html");
?><?php
}
?>

Share this post


Link to post
Share on other sites
its not your code it is the server when you first hit submit it says cant find server then when you refresh the page it loads but loses all the variables

Share this post


Link to post
Share on other sites
I put an intentional gliche in the script to test where it stopped. It stops at the last few lines of code.

The security on this server is rather high & other PHP scripts are running on it. It seems unlikely that it's a server issue if other php scripts are running doesn't it?

I really do believe that the last section of code is the problem. Please take a look at it, I have posted the section again below. Somewhere in here, it is going bad.


$message=stripslashes($message);

$subject="Website Applicant";
$address="craig@hoaxdesign.com";
$email="$emailaddy";
$mail="$message";
$success=mail($address,$subject,$mail,"From: $email");
header("Refresh: 0;url=http://www.hoaxdesign.com/success.html");
?><?php
}
?>

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.