Jump to content

Alternative to using ini_set in a PHP Form


daniel_lee_hill

Recommended Posts

Hi,

This is my first of hopefully many posts on this forum.

I am reasonably new to php, and have self taught myself, the very basics.

 

I have recently completed a php mail form for a client, and although it worked fine on the test server, it is not on the host server.

The hosting companies tech support (or lack of) have told me it is to do with my coding and more specifically;

 

"ini_set is unavailable as it allows some of the options in our global php configuration to be overridden. If wanting to use the functionality obtained in ini_set, you can add additional paths by using:

 

<?php

$path = '/usr/lib/pear';

set_include_path(get_include_path() . PATH_SEPARATOR . $path);

?>

 

to use sessions variables is possible but you need to do so without using ini_set"

 

here is the code for the form.php page, i really hope someone can help here.

 

 

<?php

ini_set('session.use_only_cookies',1);

session_start();

 

//check server

  if ($_SERVER['REQUEST_METHOD'] != 'POST'){

      $me = $_SERVER['PHP_SELF'];

//define page setup 

$head='<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"

"http://www.w3.org/TR/html4/loose.dtd">

<html>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

 

<title>Dennis Transport - Port Lincoln, South Australia</title>

 

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

 

<style type="text/css">

<!--

.style1 {

color: #CC0000;

font-weight: bold;

}

-->

</style>

<script language="JavaScript" type="text/JavaScript">

<!--

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.indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a;}}

}

 

function MM_swapImgRestore() { //v3.0

  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a)&&x.oSrc;i++) x.src=x.oSrc;

}

 

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[n];

  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers.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))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}

}

//-->

</script>

<script type="text/javascript" language="javascript" src="gallery/lytebox.js"></script>

<link rel="stylesheet" href="gallery/lytebox.css" type="text/css" media="screen" />

</head>

 

<body onLoad="MM_preloadImages(\'images/rollovers/welcome_02.jpg\',\'images/but_profile2.jpg\',\'images/rollovers/solutions_02.jpg\',\'images/rollovers/locations_02.jpg\',\'images/rollovers/gallery_02.jpg\',\'images/rollover/enquiry_02.jpg\',\'images/rollovers/download_02.jpg\')">

<table width="810" border="0" align="center" cellpadding="0" cellspacing="0">

  <tr>

    <td><img src="images/top.jpg" width="810" height="93"></td>

  </tr>

  <tr>

    <td valign="top" background="images/bg_white.jpg"><table width="98%"  border="0" align="center" cellpadding="0" cellspacing="0">

          <tr>

        <td><div align="center"><a href="index.html" target="_self" onMouseOver="MM_swapImage(\'Image1\',\'\',\'images/rollovers/welcome_02.jpg\',1)" onMouseOut="MM_swapImgRestore()"><img src="images/rollovers/welcome_01.jpg" alt="Welcome To Dennis Transport - Transport Services Port Lincoln South Australia" name="Image1" width="112" height="142" border="0" id="Image1"></a></div></td>

        <td><div align="center"><a href="profile.htm" target="_self" onMouseOver="MM_swapImage(\'Image2\',\'\',\'images/rollovers/profile_02.jpg\',1)" onMouseOut="MM_swapImgRestore()"><img src="images/rollovers/profile_01.jpg" alt="About Dennis Transport - Transport Services Port Lincoln South Australia" name="Image2" width="112" height="142" border="0" id="Image2"></a></div></td>

        <td><div align="center"><a href="solutions.htm" target="_self" onMouseOver="MM_swapImage(\'Image3\',\'\',\'images/rollovers/solutions_02.jpg\',1)" onMouseOut="MM_swapImgRestore()"><img src="images/rollovers/solutions_01.jpg" alt="Dennis Transport Solutions - Transport Services Port Lincoln South Australia" name="Image3" width="112" height="142" border="0" id="Image3"></a></div></td>

        <td><div align="center"><a href="locations.htm" target="_self" onMouseOver="MM_swapImage(\'Image4\',\'\',\'images/rollovers/locations_02.jpg\',1)" onMouseOut="MM_swapImgRestore()"><img src="images/rollovers/locations_01.jpg" alt="Dennis Transport Locations - Transport Services Port Lincoln South Australia" name="Image4" width="112" height="142" border="0" id="Image4"></a></div></td>

        <td><div align="center"><a href="gallery.htm" target="_self" onMouseOver="MM_swapImage(\'Image5\',\'\',\'images/rollovers/gallery_02.jpg\',1)" onMouseOut="MM_swapImgRestore()"><img src="images/rollovers/gallery_01.jpg" alt="Image Gallery of Dennis Transport - Transport Services Port Lincoln South Australia" name="Image5" width="112" height="142" border="0" id="Image5"></a></div></td>

        <td><div align="center"><a href="form.php" target="_self" onMouseOver="MM_swapImage(\'Image6\',\'\',\'images/rollovers/enquiry_02.jpg\',1)" onMouseOut="MM_swapImgRestore()"><img src="images/rollovers/enquiry_01.jpg" alt="Enquiry/Contact Form for Dennis Transport - Transport Services Port Lincoln South Australia" name="Image6" width="112" height="142" border="0" id="Image6"></a></div></td>

        <td><div align="center"><a href="downloads.htm" target="_self" onMouseOver="MM_swapImage(\'Image7\',\'\',\'images/rollovers/download_02.jpg\',1)" onMouseOut="MM_swapImgRestore()"><img src="images/rollovers/download_01.jpg" alt="Downloads Dennis Transport - Transport Services Port Lincoln South Australia" name="Image7" width="112" height="142" border="0" id="Image7"></a></div></td>

      </tr>

    </table></td>

  </tr>

  <tr>

    <td valign="top" background="images/bg_white.jpg">

<table width="98%"  border="0" align="center" cellpadding="2" cellspacing="0">

        <tr>

          <td colspan="2" height="30" valign="top"><img src="images/demo_solution.jpg" width="348" height="30"></td>

        </tr>

        <tr>

          <td width="35%" rowspan="2" valign="top">

            <img src="images/form_photo.jpg" width="384" height="293"></td>

            <td width="65%" valign="top"><span class="style1"><img src="images/sect_enquiry.jpg" alt="Dennis Transport Enquiry Page" width="280" height="30" align="left"></span></td>

        </tr><tr>

          <td height="263" style="overflow:auto; vertical-align:top">         

<strong>Please complete the below information form & a consultant will contact you shortly</strong>';

 

$form='<div align="center" style="height:230px; width:99%; overflow: auto; vertical-align:top">

  <form name="form1" method="post" action="form.php">

    <?//php session_register("SESSION"); ?>

    <table width="98%" border="0" cellspacing="0" cellpadding="0"  align="center" style="vertical-align:top">

      <!--DWLayoutTable-->

      <tr>

        <td height="15" colspan="5" valign="top"><p><strong>Contact Details</strong></p></td>

                <td width="3"></td>

              </tr>

      <tr>

        <td width="49" height="4"></td>

                <td width="74"></td>

                <td width="95"></td>

                <td width="14"></td>

                <td width="154"></td>

                <td></td>

              </tr>

      <tr>

        <td height="20" valign="top"><label>Name*

         

          </label></td>

                <td colspan="3" valign="top"><input name="name" type="text" id="name" tabindex="1" size="22"></td>

                <td rowspan="4" valign="top"><div align="center"><strong>All fields marked

                  with a * must<br>

                  be completed.</strong></div></td>

                <td></td>

              </tr>

     

      <tr>

        <td height="20" valign="top"><label>Phone*

          </label></td>

                <td colspan="3" valign="top"><input name="phone" type="text" id="phone" tabindex="2" size="22"></td>

                <td></td>

              </tr>

      <tr>

        <td height="8"></td>

                <td></td>

                <td></td>

                <td></td>

                <td></td>

              </tr>

      <tr>

        <td height="20" valign="top"><label>Email                                                            </label></td>

                    <td colspan="3" valign="top"><input name="email" type="text" id="email" tabindex="3" size="22"></td>

                    <td></td>

              </tr>

     

              <tr>

                <td height="13"></td>

                <td></td>

                <td></td>

                <td></td>

                <td></td>

                <td></td>

              </tr>

      <tr>

        <td height="15" colspan="2" valign="top"><strong>Freight Details</strong></td>

                <td></td>

                <td></td>

                <td></td>

                <td></td>

              </tr>

      <tr>

        <td height="5"></td>

                <td></td>

                <td></td>

                <td></td>

                <td></td>

                <td></td>

              </tr>

      <tr>

        <td height="50" colspan="5" valign="top"><label>Pick Up Address * <br>

          <textarea name="from" cols="46" rows="2" id="from" tabindex="4">Please insert the address of the freight pick up point.</textarea>

                                                                                                                                              </label></td>

                    <td></td>

              </tr>

      <tr>

        <td height="50" colspan="5" valign="top"><label>Delivery Address * <br>

          <textarea name="to" cols="46" rows="2" id="to" tabindex="5">Please insert the address of the freight delivery point.</textarea>

                                </label></td>

                    <td></td>

              </tr>

      <tr>

        <td height="5"></td>

                <td></td>

                <td></td>

                <td></td>

                <td></td>

                <td></td>

              </tr>

      <tr>

        <td height="21" colspan="3" valign="top"><label>Dimension

          <input name="size" type="text" id="size"  tabindex="6" value="HxWxD" size="16">

                                    </label></td>

  <td> </td>

                <td valign="top"><label>Weight

                  <input name="weight" type="text" id="size" size="6" tabindex="7">

                  Kg

                  </label></td>

                <td></td>

              </tr>

      <tr>

        <td height="7"></td>

                <td></td>

                <td></td>

                <td></td>

                <td></td>

                <td></td>

              </tr>

      <tr>

        <td height="65" colspan="5" valign="top"><label>Description Of Freight*  <br>

          <textarea name="description" cols="46" rows="3" id="description" tabindex="8">Please accurately describe your freight and any special requirements you may need</textarea>

          </label>            </td>

                <td></td>

              </tr>

      <tr>

        <td height="7"></td>

                <td></td>

                <td></td>

                <td></td>

                <td></td>

                <td></td>

              </tr>

      <tr>

        <td height="97" colspan="5" valign="top" align="center">Type the text from the image below & hit submit 

          <br>

                                <input id="security_code" name="security_code" type="text" tabindex="10">

<img src="CaptchaSecurityImages.php?width=100&height=25&characters=5" alt="captcha" align="absbottom" /><br />

            <br>                    <label>

<input type="submit" name="submit" id="submit" value="Submit"  tabindex="11">

 

                                                                                                      </label>

            <label>

              <input type="reset" name="reset" id="reset" value="Reset"  tabindex="12">

              </label></td>

                <td></td>

              </tr>

            </table>

              </form>

    </div>';

$finish=' </td></tr></table></td>

  </tr>

  <tr>

    <td height="30"><img src="images/base.jpg" width="810" height="30"></td>

  </tr>

</table>

</body>

</html>';

 

// draw page up

 

echo "$head

 

$form

 

$finish";

 

}else{

 

//define page setup 

$head='<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"

"http://www.w3.org/TR/html4/loose.dtd">

<html>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

 

<title>Dennis Transport - Port Lincoln, South Australia</title>

 

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

 

<style type="text/css">

<!--

.style1 {

color: #CC0000;

font-weight: bold;

}

-->

</style>

<script language="JavaScript" type="text/JavaScript">

<!--

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.indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a;}}

}

 

function MM_swapImgRestore() { //v3.0

  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a)&&x.oSrc;i++) x.src=x.oSrc;

}

 

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[n];

  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers.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))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}

}

//-->

</script>

<script type="text/javascript" language="javascript" src="gallery/lytebox.js"></script>

<link rel="stylesheet" href="gallery/lytebox.css" type="text/css" media="screen" />

</head>

 

<body onLoad="MM_preloadImages(\'images/rollovers/welcome_02.jpg\',\'images/but_profile2.jpg\',\'images/rollovers/solutions_02.jpg\',\'images/rollovers/locations_02.jpg\',\'images/rollovers/gallery_02.jpg\',\'images/rollover/enquiry_02.jpg\',\'images/rollovers/download_02.jpg\')">

<table width="810" border="0" align="center" cellpadding="0" cellspacing="0">

  <tr>

    <td><img src="images/top.jpg" width="810" height="93"></td>

  </tr>

  <tr>

    <td valign="top" background="images/bg_white.jpg"><table width="98%"  border="0" align="center" cellpadding="0" cellspacing="0">

          <tr>

        <td><div align="center"><a href="index.html" target="_self" onMouseOver="MM_swapImage(\'Image1\',\'\',\'images/rollovers/welcome_02.jpg\',1)" onMouseOut="MM_swapImgRestore()"><img src="images/rollovers/welcome_01.jpg" alt="Welcome To Dennis Transport - Transport Services Port Lincoln South Australia" name="Image1" width="112" height="142" border="0" id="Image1"></a></div></td>

        <td><div align="center"><a href="profile.htm" target="_self" onMouseOver="MM_swapImage(\'Image2\',\'\',\'images/rollovers/profile_02.jpg\',1)" onMouseOut="MM_swapImgRestore()"><img src="images/rollovers/profile_01.jpg" alt="About Dennis Transport - Transport Services Port Lincoln South Australia" name="Image2" width="112" height="142" border="0" id="Image2"></a></div></td>

        <td><div align="center"><a href="solutions.htm" target="_self" onMouseOver="MM_swapImage(\'Image3\',\'\',\'images/rollovers/solutions_02.jpg\',1)" onMouseOut="MM_swapImgRestore()"><img src="images/rollovers/solutions_01.jpg" alt="Dennis Transport Solutions - Transport Services Port Lincoln South Australia" name="Image3" width="112" height="142" border="0" id="Image3"></a></div></td>

        <td><div align="center"><a href="locations.htm" target="_self" onMouseOver="MM_swapImage(\'Image4\',\'\',\'images/rollovers/locations_02.jpg\',1)" onMouseOut="MM_swapImgRestore()"><img src="images/rollovers/locations_01.jpg" alt="Dennis Transport Locations - Transport Services Port Lincoln South Australia" name="Image4" width="112" height="142" border="0" id="Image4"></a></div></td>

        <td><div align="center"><a href="gallery.htm" target="_self" onMouseOver="MM_swapImage(\'Image5\',\'\',\'images/rollovers/gallery_02.jpg\',1)" onMouseOut="MM_swapImgRestore()"><img src="images/rollovers/gallery_01.jpg" alt="Image Gallery of Dennis Transport - Transport Services Port Lincoln South Australia" name="Image5" width="112" height="142" border="0" id="Image5"></a></div></td>

        <td><div align="center"><a href="form.htm" target="_self" onMouseOver="MM_swapImage(\'Image6\',\'\',\'images/rollovers/enquiry_02.jpg\',1)" onMouseOut="MM_swapImgRestore()"><img src="images/rollovers/enquiry_01.jpg" alt="Enquiry/Contact Form for Dennis Transport - Transport Services Port Lincoln South Australia" name="Image6" width="112" height="142" border="0" id="Image6"></a></div></td>

        <td><div align="center"><a href="downloads.htm" target="_self" onMouseOver="MM_swapImage(\'Image7\',\'\',\'images/rollovers/download_02.jpg\',1)" onMouseOut="MM_swapImgRestore()"><img src="images/rollovers/download_01.jpg" alt="Downloads Dennis Transport - Transport Services Port Lincoln South Australia" name="Image7" width="112" height="142" border="0" id="Image7"></a></div></td>

      </tr>

    </table></td>

  </tr>

  <tr>

    <td valign="top" background="images/bg_white.jpg">

<table width="98%"  border="0" align="center" cellpadding="2" cellspacing="0">

        <tr>

          <td colspan="2" height="30" valign="top"><img src="images/demo_solution.jpg" width="348" height="30"></td>

        </tr>

        <tr>

          <td width="35%" rowspan="2" valign="top">

            <img src="images/form_photo.jpg" width="384" height="293"></td>

            <td width="65%" valign="top"><span class="style1"><img src="images/sect_enquiry.jpg" alt="Dennis Transport Enquiry Page" width="280" height="30" align="left"></span></td>

        </tr><tr>

          <td height="263" style="overflow:auto; vertical-align:top">';

 

$form='<div align="center" style="height:230px; width:99%; overflow: auto; vertical-align:top">

  <form name="form1" method="post" action="form.php">

    <?//php session_register("SESSION"); ?>

    <table width="98%" border="0" cellspacing="0" cellpadding="0"  align="center" style="vertical-align:top">

      <!--DWLayoutTable-->

      <tr>

        <td height="15" colspan="5" valign="top"><p><strong>Contact Details</strong></p></td>

                <td width="3"></td>

              </tr>

      <tr>

        <td width="49" height="4"></td>

                <td width="74"></td>

                <td width="95"></td>

                <td width="14"></td>

                <td width="154"></td>

                <td></td>

              </tr>

      <tr>

        <td height="20" valign="top"><label>Name*

         

          </label></td>

                <td colspan="3" valign="top"><input name="name" type="text" id="name" tabindex="1" size="22"></td>

                <td rowspan="4" valign="top"><div align="center"><strong>All fields marked

                  with a * must<br>

                  be completed.</strong></div></td>

                <td></td>

              </tr>

     

      <tr>

        <td height="20" valign="top"><label>Phone*

          </label></td>

                <td colspan="3" valign="top"><input name="phone" type="text" id="phone" tabindex="2" size="22"></td>

                <td></td>

              </tr>

      <tr>

        <td height="8"></td>

                <td></td>

                <td></td>

                <td></td>

                <td></td>

              </tr>

      <tr>

        <td height="20" valign="top"><label>Email                                                            </label></td>

                    <td colspan="3" valign="top"><input name="email" type="text" id="email" tabindex="3" size="22"></td>

                    <td></td>

              </tr>

     

              <tr>

                <td height="13"></td>

                <td></td>

                <td></td>

                <td></td>

                <td></td>

                <td></td>

              </tr>

      <tr>

        <td height="15" colspan="2" valign="top"><strong>Freight Details</strong></td>

                <td></td>

                <td></td>

                <td></td>

                <td></td>

              </tr>

      <tr>

        <td height="5"></td>

                <td></td>

                <td></td>

                <td></td>

                <td></td>

                <td></td>

              </tr>

      <tr>

        <td height="50" colspan="5" valign="top"><label>Pick Up Address * <br>

          <textarea name="from" cols="46" rows="2" id="from" tabindex="4">Please insert the address of the freight pick up point.</textarea>

                                                                                                                                              </label></td>

                    <td></td>

              </tr>

      <tr>

        <td height="50" colspan="5" valign="top"><label>Delivery Address * <br>

          <textarea name="to" cols="46" rows="2" id="to" tabindex="5">Please insert the address of the freight delivery point.</textarea>

                                </label></td>

                    <td></td>

              </tr>

      <tr>

        <td height="5"></td>

                <td></td>

                <td></td>

                <td></td>

                <td></td>

                <td></td>

              </tr>

      <tr>

        <td height="21" colspan="3" valign="top"><label>Dimension

          <input name="size" type="text" id="size"  tabindex="6" value="HxWxD" size="16">

                                    </label></td>

  <td> </td>

                <td valign="top"><label>Weight

                  <input name="weight" type="text" id="size" size="6" tabindex="7">

                  Kg

                  </label></td>

                <td></td>

              </tr>

      <tr>

        <td height="7"></td>

                <td></td>

                <td></td>

                <td></td>

                <td></td>

                <td></td>

              </tr>

      <tr>

        <td height="65" colspan="5" valign="top"><label>Description Of Freight*  <br>

          <textarea name="description" cols="46" rows="3" id="description" tabindex="8">Please accurately describe your freight and any special requirements you may need</textarea>

          </label>            </td>

                <td></td>

              </tr>

      <tr>

        <td height="7"></td>

                <td></td>

                <td></td>

                <td></td>

                <td></td>

                <td></td>

              </tr>

      <tr>

        <td height="97" colspan="5" valign="top" align="center">Type the text from the image below & hit submit 

          <br>

                                <input id="security_code" name="security_code" type="text" tabindex="10">

<img src="CaptchaSecurityImages.php?width=100&height=25&characters=5" alt="captcha" align="absbottom" /><br />

            <br>

        <label>

  <input type="submit" name="submit" id="submit" value="Submit"  tabindex="11">

                                                                                                      </label>

            <label>

              <input type="reset" name="reset" id="reset" value="Reset"  tabindex="12">

              </label></td>

                <td></td>

              </tr>

            </table>

              </form>

    </div>';

$finish=' </td></tr></table></td>

  </tr>

  <tr>

    <td height="30"><img src="images/base.jpg" width="810" height="30"></td>

  </tr>

</table>

</body>

</html>';

 

 

error_reporting(0);

      // initialize a array to

      //hold any errors we encounter

 

//script to process quote & send to email//

  // initialize a variable to

  // put any errors we encounter into an array

  $errors = array();

 

  // test to see if the form was actually

      // posted from our form

      // In testing, if you get an Inavlid referer error

      // comment out or remove the next three lines

    // $page = $_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF'];

    // if (!ereg($page, $_SERVER['HTTP_REFERER']))

      //  $errors[] = "Invalid referer";

//if (!session_is_registered("SESSION")){

  // $errors[] = "Invalid form submission";

//}

 

      // check to see if a name was entered

 

  if (!$_POST['name'])

      // if not, add that error to our array

      $errors[] = "  •   Contact name<br>";

  // check to see if a subject was entered

  if (!$_POST['phone'])

      // if not, add that error to our array

      $errors[] = "  •  Phone<br>";

    // check to see if a message was entered

  if (!$_POST['from'])

      // if not, add that error to our array

      $errors[] = "  •  Pick Up Address<br>";

    // check to see if a message was entered

  if (!$_POST['to'])

      // if not, add that error to our array

      $errors[] = "  •  Delivery Address<br>";

    // check to see if a message was entered

  if (!$_POST['description'])

      // if not, add that error to our array

      $errors[] = "  •  Description of freight<br>";

    // check to see if a message was entered

 

 

    // if there are any errors, display them

  if (count($errors)>0){

 

  echo $head;

  echo "<strong><br><br>The Following Fields Must Be Completed:</strong><br><br>";

            foreach($errors as $err)

echo  "$err<br>\n";

echo "<br><br><strong>Please hit BACK on your browser and complete all the fields.</strong><br><br>";

echo $finish;

break;

 

 

  } else {

 

  session_start();

  if(($_SESSION['security_code'] == $_POST['security_code']) && (!empty($_SESSION['security_code'])) ) {

 

$mail = "[email protected]"; //"[email protected]";

$subject = "Quote Request From Dennis Transport Website";

$name = $_POST['name'];

$phone = $_POST['phone'];

$email = $_POST['email'];

$from = $_POST['from'];

$to = $_POST['to'];

 

$description = $_POST['desc'];

$dimensions = $_POST['size'];

$weight = $_POST['weight'];

 

$body = "$name has requested a quote to move freight from $from to $to on $date.

The details for this job are as follows:

 

Contact: $name

Phone: $phone

Email: $email

 

Pick Up From: $from

Delivery To: $to

 

Description Of Goods: $desc

Dimensions Of Freight (HxWxD): $size

Weight: $weight Kg";

 

 

if (mail($mail, $subject, $body)){

 

  echo $head;

  echo "Thanks "; echo $name; echo" for taking the time to contact Dennis Transport.<br>

You will be contacted very shortly regarding your quote.<br><br>

Alternatively if you do not hear from us, you can always call us on (08) 8683 4110<br>";

echo $finish;

 

break;

 

 

    } else {

  echo $head;

 

  echo "Sorry "; echo $name; echo", but your quote request failed to send.

Please try again or call Dennis Transport on (08) 8683 4110.

Thanks for your time";

echo $finish;

 

break;

 

}

 

      unset($_SESSION['security_code']);

  } else

  echo $head;

 

  echo "<br><br>Sorry "; echo $name; echo", but you have not entered the correct security code.<br>Please hit BACK on your browser and try again.<br>

Alternatively you can call Dennis Transport on (08) 8683 4110. <br>

Thanks for your time";

echo $finish;

 

break;

 

 

}

 

}

 

?>

 

 

 

Sorry the link for this web site is www.dennistransport.com.au/form.php.

 

Whatever the problem is, is coming from the first few lines

 

<?php

ini_set('session.use_only_cookies',1);

session_start();

 

//check server

  if ($_SERVER['REQUEST_METHOD'] != 'POST'){

      $me = $_SERVER['PHP_SELF'];

 

Any suggestions would really be appreciated.

 

 

Sorry the link for this web site is www.dennistransport.com.au/form.php.

 

Whatever the problem is, is coming from the first few lines

 

So you knew that and you posted all the code nevertheless...

 

I'll refer you to our rules and TOS :P

 

Perhaps you can set it in .htaccess ?

 

Thanks Mchl,

 

"So you knew that and you posted all the code nevertheless..."

I realized after I posted, and now cant modify the original post.

 

"Perhaps you can set it in .htaccess ?"

I'm not certain how to set this in the .htaccess file, like I said I am really new to php.

 

This is all the support I can get from the hosting company;

 

"unfortunetly there is not a very easy way to do this. In your case you are using INI_set to store session variables. This is simply not possible in shared hosting solutions due to the security issues it causes.

 

There are other ways to handle sessions within php however we can not assist you in doing so as it is far outside the level of support we can offer. "

 

Change your hosting, cause they talk bullshit. There are shared hostings, where each account has its own php.ini.

 

http://www.php.net/manual/en/session.configuration.php#ini.session.use-only-cookies

 

As you can see in link above, sessions.use_only_cookies has PHP_INI_ALL in Changeable column.

You can refer to this page to see what it means.

 

Now, how to set it in .htaccess

 

If you already have a .htaccess file in your main directory edit it, otherwise create it and put this line inside:

php_flag sessions.use_only_cookies On

 

 

 

 

 

Archived

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

×
×
  • 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.