#1  
Old 2nd October 2012, 03:17
zm1128 zm1128 is offline
Junior Member
 
Join Date: Oct 2012
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default PHP upgrade from PHP4 to PHP5

Hello, I am very new to coding, and need to convert the following script from PHP4 to PHP5. Can anyone please help in telling me what parts I need to change?

Thank you.

**********
<?php
$error=false;
if($_POST['posFName']!=null and $_POST['posLName']!=null and $_POST['posTitle']!=null and $_POST['posCompany']!=null and $_POST['posadd1']!=null and $_POST
['poscity']!=null and $_POST['posState']!=null and $_POST['poszip']!=null and $_POST['posEmail']!=null and $_POST['posphone']!=null and $_POST['stage']!=null){
require_once("PHPMailer/class.phpmailer.php");
$mail = new PHPMailer();
$mail->IsSMTP(); // send via SMTP
$email="js@mail.com"; // Recipients email ID
$name="John Smith"; // Recipient's name
$mail->From = "webform@email.com";
$mail->FromName = "My Company";
$mail->AddAddress($email,$name);
$mail->AddAddress("jjs@mail.com","Jack Smith");
$mail->IsHTML(true); // send as HTML
$mail->Subject = "Live Demo Request Information";
$mail->Body = "<p>You have a new mail from Live Demo Section.<br/><br/>First Name : ".$_POST['posFName']."<br />Last Name : ".$_POST['posLName']." <br />Title : ".
$_POST['posTitle']."<br />Company : ".$_POST['posCompany']."<br />Address 1 : ".$_POST['posadd1']."<br />Address 2 : ".$_POST['posadd2']."<br />City : ".$_POST
['poscity']."<br />State : ".$_POST['posState']."<br />Email : ".$_POST['posEmail']."<br />Telephone - direct : ".$_POST['posphone']."<br />Please indicate the stage
of your initiative : ".$_POST['stage']; //HTML Body
$mail->AltBody = "<p>You have a new mail from Live Demo Section.<br/><br/>First Name : ".$_POST['posFName']."<br />Last Name : ".$_POST['posLName']." <br />Title : ".
$_POST['posTitle']."<br />Company : ".$_POST['posCompany']."<br />Address 1 : ".$_POST['posadd1']."<br />Address 2 : ".$_POST['posadd2']."<br />City : ".$_POST
['poscity']."<br />State : ".$_POST['posState']."<br />Email : ".$_POST['posEmail']."<br />Telephone - direct : ".$_POST['posphone']."<br />Please indicate the stage
of your initiative : ".$_POST['stage']; //Text Body
$mail->Send();
}else{
$error=true;
}
?>


**************************
Reply With Quote
Sponsored Links
  #2  
Old 2nd October 2012, 14:21
Ben Ben is offline
Moderator
 
Join Date: Jul 2006
Posts: 1,029
Thanks: 7
Thanked 62 Times in 56 Posts
Default

Did you have any specific problems? What are the error message?

If not testes so far, just do so.

If you like to proactively change your script to avoid known backwards incompatibility you could either google for e.g. "php4 to 5 compatibility" or directly visit the php docs:

http://www.php.net/manual/en/migration5.php
http://www.php.net/manual/en/migrati...compatible.php

Did you also check whether phpmailer is php5 ready as well?
Reply With Quote
  #3  
Old 2nd October 2012, 14:22
falko falko is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 41,701
Thanks: 1,900
Thanked 2,740 Times in 2,575 Posts
Default

Have you tried running it on PHP5? If there are errors you will know what to change.
__________________
Falko
--
Download the ISPConfig 3 Manual! | Check out the ISPConfig 3 Billing Module!

FB: http://www.facebook.com/howtoforge

nginx-Webhosting: Timme Hosting | Follow me on:
Reply With Quote
  #4  
Old 2nd October 2012, 16:24
zm1128 zm1128 is offline
Junior Member
 
Join Date: Oct 2012
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks Ben, basically the form doesn't send the email. I have a hosting plan on GoDaddy and when I called support, they told me that the reason it doesn't work is because my form was developed in PHP4 and needs to be upgraded to PHP5. I had someone else originally build this as I am not a programmer. I need to know what to change (syntax, I think) to have it be PHP5 compatible.
Reply With Quote
  #5  
Old 2nd October 2012, 16:25
zm1128 zm1128 is offline
Junior Member
 
Join Date: Oct 2012
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks Falko, I am not sure how to run it in PHP5.

I have a hosting plan on GoDaddy and when I called support, they told me that the reason it doesn't work is because my form was developed in PHP4 and needs to be upgraded to PHP5. I had someone else originally build this as I am not a programmer. I need to know what to change (syntax, I think) to have it be PHP5 compatible.
Reply With Quote
  #6  
Old 4th October 2012, 10:29
Ben Ben is offline
Moderator
 
Join Date: Jul 2006
Posts: 1,029
Thanks: 7
Thanked 62 Times in 56 Posts
Default

Quote:
Originally Posted by zm1128 View Post
Thanks Falko, I am not sure how to run it in PHP5.
my suggestion would be to have a lamp / wamp whatsoever test system e.g. in a VM at home to test several things.
Thus you just need to ensure having a webserver with php5 and that gives you access to the logs.

With regards to the logs, do you have access to the webserver logs or can the godaddy support send them to you so we can have a look here?

You could also add the following lines to the begginning of your script (directly after <?) to force the display of all errors. But this won't help if you script is causing a fatal error as it does not come to execution.
PHP Code:
error_reporting(E_ALL);
ini_set('display_errors','On'); 
Reply With Quote
  #7  
Old 7th October 2012, 08:52
TiTex TiTex is offline
Senior Member
 
Join Date: Aug 2011
Location: Cluj-Napoca,Romania
Posts: 125
Thanks: 0
Thanked 17 Times in 17 Posts
Send a message via Skype™ to TiTex
 
Default

zm1128 maybe you are using an old version of the php mailer class (class.phpmailer.php) , try updating it from here http://code.google.com/a/apache-extras.org/p/phpmailer/

make sure to backup your old files first
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Only Problems since Updating from 3.0.3.3 to 3.0.4.1 mbay General 4 17th May 2012 12:56
ubuntu and nginx delgado2061 Installation/Configuration 0 27th November 2011 23:36
Problem with services!! banzaiwebstudio.com Installation/Configuration 7 19th May 2010 21:13
Unable to install ISPConfig bdonecker Installation/Configuration 21 26th May 2009 08:20
Apache2 Freezes celtic Server Operation 31 28th May 2007 17:18


All times are GMT +2. The time now is 00:46.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.