Jump to content

[SOLVED] .PHP form works on site with 4.4.4 but not with 5.0.5


shaunmacie

Recommended Posts

I have a form that works on an old website that has php version 4.4.4. I need to put the form on a new site that has php version 5.0.5 and the form isn't working there. Is there something that needs to be changed in my code to work with the newer version of php?

 

Here are the settings for each site:

.PHP 4.4.4 site : http://www.creativetypeco.com/info.php

.PHP 5.0.5 site : http://www.campuscalm.com/info.php

 

Here is the code of my .php file that works on 4.4.4 but not 5.0.5:

 

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Campus Calm | Students, Parents, Educators, School, Stress, Happy, Successful, Relaxation</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<Meta Name="description" Content="Campus Calm ... where students speak out about grades, high school and college student stress and personal well-being">
<Meta Name="keywords" Content="stress, college student, grades, time management, personal well-being, body image, college campus, high-school student, anxiety, depression, insomnia">
<meta Name="revisit-after" Content="10 Days">
<meta Name="robots" Content="Index, Follow">
<meta Name="googlebot" Content="Index, Follow">
<meta Name="developer" Content="Creative Type Co.">
<meta name="copyright" content="Copyright © 2007 Shaun Maciejewski and Maria Pascucci - Campus Calm, All Rights Reserved">
<meta name="doc-rights" content="Copywritten Work">

<style type="text/css">
<!--
body {
background-image: url(campuscalmimages/background.gif); ; background-repeat: repeat-x;
}
-->
<!--
.style1 {color: #FFFFFF}
-->
</style>

<link href="cc_styles.css" rel="stylesheet" type="text/css">

<script type="text/javascript" src="ufo.js"></script>
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//-->
</script>
</head>

<body bgcolor="#7FC31C" topmargin="25" onLoad="MM_preloadImages('campuscalmimages/calm_beginnings_on.gif','campuscalmimages/free_tips_on.gif','campuscalmimages/free_articles_on.gif','campuscalmimages/did_you_know_on.gif','campuscalmimages/calm_for_students_on.gif','campuscalmimages/educators_on.gif','campuscalmimages/products_on.gif','campuscalmimages/media_kit_on.gif','campuscalmimages/calm_perspectives_on.gif','campuscalmimages/sound_off_on.gif','campuscalmimages/blog_on.gif','campuscalmimages/contact_on.gif','campuscalmimages/parents_forum_on.gif')">
<table width="775" border="0" align="center" cellpadding="0" cellspacing="0" background="campuscalmimages/green_background_filler.gif" bgcolor="#FFFFFF">
  <tr>
    <td height="195" colspan="7" scope="col"><a href="http://www.campuscalm.com"><img src="campuscalmimages/header_1.gif" alt="campus calm" width="179" height="195" border="0"></a><a href="http://www.campuscalm.com"><img src="campuscalmimages/header_2.gif" alt="student personal well-being" width="450" height="195" border="0"></a><img src="campuscalmimages/header_3.jpg" width="146" height="195"></td>
  </tr>
  <tr>
    <td width="162" rowspan="6" valign="top" scope="col"><div align="center"><a href="http://www.campuscalm.com/calm_beginnings.html" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('calm beginnings','','campuscalmimages/calm_beginnings_on.gif',1)"><img src="campuscalmimages/calm_beginnings_off.gif" alt="calm beginnings" name="calm beginnings" width="162" height="40" border="0"></a><a href="http://www.campuscalm.com/free_tips.html" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('free tips','','campuscalmimages/free_tips_on.gif',1)"><img src="campuscalmimages/free_tips_off.gif" alt="free college success tips" name="free tips" width="162" height="32" border="0"></a><a href="http://www.campuscalm.com/free_articles.html" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('free articles','','campuscalmimages/free_articles_on.gif',1)"><img src="campuscalmimages/free_articles_off.gif" alt="free college success articles" name="free articles" width="162" height="31" border="0"></a><a href="http://www.campuscalm.com/did_you_know.html" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('did you know','','campuscalmimages/did_you_know_on.gif',1)"><img src="campuscalmimages/did_you_know_off.gif" alt="did you know" name="did you know" width="162" height="37" border="0"></a><a href="http://www.campuscalm.com/students.html" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('calm for students','','campuscalmimages/calm_for_students_on.gif',1)"><img src="campuscalmimages/calm_for_students_off.gif" alt="calming hints and tips for students" name="calm for students" width="162" height="45" border="0"></a><a href="http://www.campuscalm.com/parents.html" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('parents forum','','campuscalmimages/parents_forum_on.gif',1)"><img src="campuscalmimages/parents_forum_off.gif" alt="the parents forum" name="parents forum" width="162" height="34" border="0"></a><a href="http://www.campuscalm.com/educators.html" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('educators','','campuscalmimages/educators_on.gif',1)"><img src="campuscalmimages/educators_off.gif" alt="information for educators" name="educators" width="162" height="30" border="0"></a><a href="http://www.campuscalm.com/products.html" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('products','','campuscalmimages/products_on.gif',1)"><img src="campuscalmimages/products_off.gif" alt="campus calm products" name="products" width="162" height="29" border="0"></a><a href="http://www.campuscalm.com/media_kit.html" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('media kit','','campuscalmimages/media_kit_on.gif',1)"><img src="campuscalmimages/media_kit_off.gif" alt="campus calm media kit" name="media kit" width="162" height="32" border="0"></a><a href="http://www.campuscalm.com/calm_perspectives.html" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('calm perspectives','','campuscalmimages/calm_perspectives_on.gif',1)"><img src="campuscalmimages/calm_perspectives_off.gif" alt="calm perspectives" name="calm perspectives" width="162" height="42" border="0"></a><a href="http://www.campuscalm.com/sound_off.html" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('sound off','','campuscalmimages/sound_off_on.gif',1)"><img src="campuscalmimages/sound_off_off.gif" alt="sound off forum" name="sound off" width="162" height="28" border="0"></a><a href="http://www.campuscalm.com/blog.html" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('blog','','campuscalmimages/blog_on.gif',1)"><img src="campuscalmimages/blog_off.gif" alt="campus calm blog" name="blog" width="162" height="27" border="0"></a><a href="http://campuscalm.com/contact.html" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('contact','','campuscalmimages/contact_on.gif',1)"><img src="campuscalmimages/contact_off.gif" alt="contact campus calm" name="contact" width="162" height="57" border="0"> <br>

    <td width="17" rowspan="3" valign="top" background="campuscalmimages/left_filler.gif" scope="col"><img src="campuscalmimages/left_vert.gif" width="17" height="251"></td>
    <td width="293" height="35" scope="col"><img src="campuscalmimages/top_text.gif" width="293" height="35"></td>
    <td height="35" colspan="3" valign="top" scope="col"><img src="campuscalmimages/top_signup.jpg" width="277" height="35"></td>
    <td width="26" rowspan="3" valign="top" background="campuscalmimages/right_filler.gif" scope="col"><img src="campuscalmimages/right_vert.jpg" width="26" height="251"></td>
  </tr>
  <tr>
    <td width="293" rowspan="2" valign="top" bgcolor="#095AA6" scope="col">

<?php
$myemail = "maria@campuscalm.com";


function checkOK($field)
{
if (eregi("\r",$field) || eregi("\n",$field)){
  print "<meta http-equiv=\"refresh\" content=\"0;URL=error.html\">";
  exit;
    
}
}

$visitormail = Trim(stripslashes($_POST['visitormail'])); 
checkOK($visitormail);
   
$validationOK=true;
if (Trim($visitormail)=="") $validationOK=false;
if (!$validationOK) {
  print "<meta http-equiv=\"refresh\" content=\"0;URL=http://www.campuscalm.com/error.html\">";
  exit;
}

$validationOK=true;
if (Trim($visitor)=="") $validationOK=false;
if (!$validationOK) {
  print "<meta http-equiv=\"refresh\" content=\"0;URL=http://www.campuscalm.com/error.html\">";
  exit;
}
  
  ?>
  
  	<p><span class="headline2">Welcome <?php echo $visitor ?>,</span><br>
        <br>
        <span class="style1"><br>
        <br>
        Thank you for subscribing to Campus Calm Connections - a bi-weekly e-zine
         designed to help you reduce stress, increase self-confidence and achieve
         a sense of calm in our hectic, achievement obsessed world. <br>
        <br>
	</span> </p></td>
    <td width="24" height="195" valign="top" scope="col"><img src="campuscalmimages/left_signup.gif" width="24" height="195"></td>
    <td width="133" valign="top" bgcolor="FFF7E5" scope="col"><form method="post" action="http://www.campuscalm.com/signup.php">
          <input type="hidden" name="sitename" value="Welcome to Campus Calm" />
          <input type="hidden" name="redirectlink" value="http://www.campuscalm.com/signup.php"/>
          <span class="signup"><br><strong>Sign up today! </strong><br>
          <br>
          First Name:           
          <input type="text" name="visitor" size="12" />
          <br>
         Primary E-mail:            
         <input type="text" name="visitormail" size="12" />
         <br></span>
         <input name="submit2" type="submit" value="Free Guide" /></form> 
        
          <span class="privacy">Privacy: We never rent, trade or sell your e-mail address to anyone</span></td>
    <td width="120" height="195" valign="top" scope="col"><img src="campuscalmimages/right_signup.jpg" width="120" height="195"></td>
  </tr>
  <tr>
    <td height="60" colspan="3" valign="top" bgcolor="#095AA6" scope="col"><img src="campuscalmimages/bottom_signup.jpg" width="277" height="21">
</td>
  </tr>
  <tr>
    <td width="17" background="campuscalmimages/left_filler.gif" scope="col"><img src="campuscalmimages/left_filler.gif" width="17" height="100%"></td>
    <td colspan="4" valign="top" bgcolor="#095AA6" scope="col">	      
        <p> <span class="style1">You will receive an email shortly with a link to your free special report- 
        "Ten Mindsets Students Need to be Happy And Successful."<br>
        <br>
        To ensure you receive future emails from Campus Calm, please add <a href="mailto:maria@campuscalm.com">maria@campuscalm.com</a>        to your address book/safe list. <br>
          <br>
          <br>
        To your health, happiness & success,<br>
       <br>
       Maria Pascucci<br>
      Email: <a href="mailto:maria@campuscalm.com">maria@campuscalm.com</a></span></p>
        
          <?php
$ip = getenv("REMOTE_ADDR");
if (!isset($visitormail))
echo "Error - Please enter a valid email address</font>" ;
$todayis = date("l, F j, Y, g:i a") ;
$notes = stripcslashes($notes); $messageis = "$todayis <p>\n
Hi $visitor,<p>\n


Thank you for subscribing to <strong>Campus Calm Connections </strong> - where
  students meet to speak out about grades, stress and personal well-being.<p>
This bi-weekly e-zine will be delivered to your inbox full of crafty ideas
  and fr*ee tutorial articles designed to help you reduce stress, increase self-confidence
  and achieve a sense of calm in our hectic, achievement oriented world. <p>
<strong>Every second week you will find tips on: </strong><p>
&#8226; How to ditch your inner perfectionist - Like accepting the fact that it's
  OK to be happy with 80s sometimes because 80s aren't bad! <p>
&#8226; Balancing your social life & school - What social life? Who's got time
  for that? You do, dear friend. Discover why making time for fun and relaxation
  will help you to become better students and better leaders. <p>
&#8226; Developing a sense of identity that has nothing to do with grades,
  awards or designer jeans. - If you're not getting good grades, working or volunteering,
  winning awards or planning for your future, do you know whom you are? It'll
  be the most important and liberating question you will ever answer! <p>
And all those other real world issues they don't teach in the classroom.
  We will feature interviews with college counselors; career coaches and other
  experts who want you to get the most out of your academic years - minus all
  the stress, anxiety and headaches. You'll also hear from fellow high-achieving
  students & recent grads who have managed to achieve the campus calm and
  can't wait to show you how, too! <p>
I hope you enjoy your Campus Calm Connections! <p>
PS - Don't forget to download your FR*EE special report, <a href='http://www.creativetypeco.com/CampusCalmFreeGift.pdf'>Ten Mindsets
  Students Must Have To be Happy and Successful</a> by clicking the link! If the link does not work, copy and paste the following address into a web browser to download the report: http://www.creativetypeco.com/CampusCalmFreeGift.pdf <p>
Campus Calm<br>
372 Aurora Street<br>
Lancaster, New York 14086<p>
You are receiving this email from Campus Calm because you subscribed on our
  website or via e-mail. To ensure that you continue to receive emails from us,
  add maria@campuscalm.com to your address book today. To no longer receive our
  emails, <a href='mailto:maria@campuscalm.com?subject=Unsubscribe'>please click this link</a> or email to: maria@campuscalm.com with Unsubscribe from Campus Calm Connections as the subject line. <p>\n

<ul>\n";



$messageis .= "</ul>\n";

$headers = "From: $myemail\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";

$headers2 = "From: $visitormail\r\n";
$headers2 .= "MIME-Version: 1.0\r\n";
$headers2 .= "Content-type: text/html; charset=iso-8859-1\r\n";

$messageme = $ip . " &nbsp |  &nbsp $todayis <p>\n
Visitor Name: $visitor<p>\n ";

$from = "From: $myemail\r\n";

$signup = "Campus Calm Mailing List";

if ($myemail != "")
mail($myemail, $signup, $messageme, $headers2);
if ($visitormail != "")
mail($visitormail, $sitename, $messageis, $headers);
?>
          <!-- ********** End of php script *********** --></p>   

<a href="http://www.campuscalm.com/students.html"> 
      </a></td>
    <td width="26" background="campuscalmimages/right_filler.gif" scope="col"><img src="campuscalmimages/right_filler.gif" width="26" height="100%"></td>
  </tr>
  <tr>
    <td colspan="6" valign="top" scope="col"><img src="campuscalmimages/bottom.gif" width="613" height="38"></td>
  </tr>
  <tr>
    <td colspan="6" valign="top" class="creativetype" scope="col">All material
      © 2007 - Campus Calm | site design by<a href="http://www.creativetypeco.com" target="_blank"> Creative Type Co. </a>    <br><br><br><br><br></td>
  </tr>
</table>
</body>
</html>

 

Any suggestions?  ???

Link to comment
Share on other sites

It doesn't give error messages, it just doesn't transfer the info that is entered in the 'vistor' and 'visitormail' fields when submitted.

 

Here is the page where it does work (processes on the site using 4.4.4): http://www.campuscalm.com/products.html

Here is the page where it does not work (processes on the site using 5.0.5): http://www.campuscalm.com/products2.html

 

The page that doesn't work doesn't get past the validation because empty files are being checked. If I take off the validation, the form goes through but the fields echo blank.

Link to comment
Share on other sites

Also, here is a page using the php 5.0.5 with the validation off.

 

http://www.campuscalm.com/products3.html

 

The form goes through, but it doesn't transmit the information I need it to (like the 'visitor' field that is supposed to echo at the top). Also, when the email goes through it is supposed to echo the name and email subject line, which it does not. Both come through empty.

Link to comment
Share on other sites

Sorry it took me so long the problem is that you have register globals turned on in php 4 and its off in php 5.

 

Register globals is BAD and should be turned off.  The problem is that you have

 

$validationOK=true;
if (Trim($visitor)=="") $validationOK=false;
if (!$validationOK) {
  print "<meta http-equiv=\"refresh\" content=\"0;URL=http://www.campuscalm.com/error.html\">";
  exit;
}

it should be

 

$validationOK=true;

$visitor = $_POST['visitor']; //<---- here is the change

if (Trim($visitor)=="") $validationOK=false;
if (!$validationOK) {
  print "<meta http-equiv=\"refresh\" content=\"0;URL=http://www.campuscalm.com/error.html\">";
  exit;
}

 

I hope this works

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.