Jump to content

mikebyrne

Members
  • Posts

    780
  • Joined

  • Last visited

Posts posted by mikebyrne

  1. Its posting to mailer.php instead of contact-us.shtml???

     

    <?php
    
    function curPageURL() {
    
    
    
    $pageURL = 'http';
    
    
    
    if ($_SERVER["HTTPS"] == "on") {$pageURL .= "s";}
    
    
    
    $pageURL .= "://";
    
    
    
    if ($_SERVER["SERVER_PORT"] != "80") {
    
    
    
    
    
    $pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
    
    
    
    } else {
    
    
    
    
    
    $pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
    
    
    
    }
    
    
    
    return $pageURL;
    }
    // The form was submitted //
    if (isset($_POST['button'])) {
    
    
    
    if (isset($_REQUEST['name']) && $_REQUEST['name'] != '' && isset($_REQUEST['email']) && $_REQUEST['email'] != ''){
    
    
    
    
    
    
    
    
    $fun = array(
    
    
    
    
    
    
    
    'virusandmalwareremoval',
    
    
    
    
    
    
    
    'fullservice',
    
    
    
    
    
    
    
    'quickfix',
    
    
    
    
    
    
    
    'upgrade',
    
    
    
    
    
    
    
    'xbox360drivereplacement',
    
    
    
    
    
    
    
    'xbox360laserreplacement',
    
    
    
    
    
    
    
    'xbox360rrodrepair',
    
    
    
    
    
    
    
    'ps3drivereplacement',
    
    
    
    
    
    
    
    'ps3laserreplacement',
    
    
    
    
    
    
    
    'ps3ylodrepair',
    
    
    
    
    
    
    
    'databackup',
    
    
    
    
    
    
    
    'websites',
    
    
    
    
    
    
    
    'datarecovery',
    
    
    
    
    
    
    
    'networkinstallation',
    
    
    
    
    
    
    
    'mobilephoneissues',
    
    
    
    
    
    
    
    'emailconfiguration'
    
    
    
    
    
    );
    
    
    
    
    
    
    
    
    
    
    foreach ($fun as $value) {
    
    
    
    
    
    
    
    ${$value} = (isset($_REQUEST[$value]) ? $value . "\n" : '');
    
    
    
    
    
    }
    
    
    
    
    
    $name = $_REQUEST['name'];
    
    
    
    
    
    $email = $_REQUEST['email'];
    
    
    
    
    
    $enquiry = $_REQUEST['enquiry'];
    
    
    
    
    
    
    
    
    
    
    if (ereg("[\r\n]", $name) || ereg("[\r\n]", $email)) {
    
    
    
    
    
    
    
    header( "Location: http://www.parkersmedia.com/byrne" );
    
    
    
    
    
    }
    
    
    
    
    
    
    
    
    
    
    $mailcontent = "Name: ".$name;
    
    
    
    
    
    $mailcontent.= "\n\nEmail: ".$email;
    
    
    
    
    
    $mailcontent.= "\n\nInterested in: \n". $virusandmalwareremoval . $fullservice . $quickfix . $upgrades . $xbox360drivereplacement . $xbox360laserreplacement . $xbox360rrodrepair . $ps3drivereplacement . $ps3laserreplacement . $ps3ylodrepair . $databackup . $websites . $datarecovery . $networkinstallation . $mobilephoneissues . $emailconfiguration;
    
    
    
    
    
    $mailcontent.= "\n\nEnquiry: " . $enquiry;
    
    
    
    
    
    if (mail( "info@byrnecomputingservices.ie", "Enquiry from Byrne Computing Services","$mailcontent", "From: $name <$email>" )) {
    
    
    
    
    
    
    
    header( "Location: http://www.parkersmedia.com/byrne/thankyou.shtml" );
    
    
    
    
    
    } else {
    
    
    
    
    
    
    
    echo 'Mail not sent';
    
    
    
    
    
    }
    
    
    
    } else {
    
    
    
    
    
    echo 'Required fields are empty';
    
    
    
    }
    }
    
    ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Byrne Computing Services</title>
    <link href="styles.css" rel="stylesheet" type="text/css" />
    <script src="SpryAssets/SpryMenuBar.js" type="text/javascript"></script>
    <link href="SpryAssets/SpryMenuBarHorizontal.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript" src="inc/jquery.js"></script>
    <script type="text/javascript" src="inc/easySlider.js"></script>
    <script type="text/javascript">
    
    
    
    $(document).ready(function(){
    
    
    
    
    
    
    
    
    $("#slider").easySlider();
    
    
    
    });
    
    
    
    
    </script>
    </head>
    
    <body>
    <div id="wrapper">
    
    
    
    <!--#include file="inc_header.html" -->
      <!--#include file="inc_scrollingimages.html" -->
      <div id="boxesholder">
        <!--#include file="inc_specials.html" -->
      <div id="main">
        <div id="mainheader">
        
    
    
    
    Contact Us</div>
      
    
    
    
    <div id="maincontent2">
      
    
    
    
      <h2>Fill in the form below and we will contact you shortly.</h2>
      
    
    
    
      <p><img src="images/binarycode.jpg" alt="Binary Code" width="167" height="600" class="images" /><form id="form1" name="form1" method="post" action="contact-us.html">
      
    
    
    
        <strong>Name: </strong><br />
    
    
    
          <input name="name" type="text" class="formsingle" id="name" />
            <br />
            <br />
            <strong>Email:</strong><br />
            <input name="email" type="text" class="formsingle" id="emailaddress" />
            <br />
            <br />
            <strong>Interested in:</strong><br />
      
    
    
    
        <table border="0" cellspacing="0" cellpadding="0" class="table">
      
    
    
    
          <tr>
      
    
    
    
            <td class="interestedin"><strong>Computer Repair</strong></td>
      
    
    
    
            <td class="interestedin"><strong>Console Repair</strong></td>
      
    
    
    
            <td class="interestedin"><strong>Other Services</strong></td>
    
    
    
            </tr>
      
    
    
    
          <tr>
      
    
    
    
            <td class="interestedin">
      
    
    
    
              <input name="virusandmalwareremoval" type="checkbox" class="formcheckbox" id="virusandmalwareremoval" value="virusandmalwareremoval" />
      
    
    
    
              <label for="virusandmalwareremoval">Virus and Malware Removal</label>
      
    
    
    
            </td>
      
    
    
    
            <td class="interestedin">
      
    
    
    
              <input name="xbox360drivereplacement" type="checkbox" class="formcheckbox" id="xbox360drivereplacement" value="xbox360drivereplacement" />
                  <label for="ps3drivereplacement">Xbox 360 Drive Replacement</label>
      
    
    
    
            </td>
      
    
    
    
            <td class="interestedin">
      
    
    
    
              <input name="databackup" type="checkbox" class="formcheckbox" id="databackup" value="databackup" />
                  <label for="databackup">Data Backup</label>
      
    
    
    
            </td>
    
    
    
            </tr>
      
    
    
    
          <tr>
      
    
    
    
            <td class="interestedin">
      
    
    
    
              <input name="fullservice" type="checkbox" class="formcheckbox" id="fullservice" value="fullservice" />
                  <label for="fullservice">Full Service</label>
      
    
    
    
            </td>
      
    
    
    
            <td class="interestedin">
      
    
    
    
              <input name="xbox360laserreplacement" type="checkbox" class="formcheckbox" id="xbox360laserreplacement" value="xbox360laserreplacement" />
                  <label for="ps3laserreplacement">Xbox 360 Laser Replacement</label>
      
    
    
    
            </td>
      
    
    
    
            <td class="interestedin">
      
    
    
    
              <input name="websites" type="checkbox" class="formcheckbox" id="websites" value="websites" />
                  <label for="websites">Web Design</label>
      
    
    
    
            </td>
    
    
    
            </tr>
      
    
    
    
          <tr>
      
    
    
    
            <td class="interestedin">
      
    
    
    
              <input name="quickfix" type="checkbox" class="formcheckbox" id="quickfix" value="quickfix" />
                  <label for="quickfix">Quick Fix</label>
      
    
    
    
            </td>
      
    
    
    
            <td class="interestedin">
      
    
    
    
              <input name="xbox360rrodrepair" type="checkbox" class="formcheckbox" id="xbox360rrodrepair" value="xbox360rrodrepair" />
                  <label for="ps3ylodrepair">Xbox 360 RROD Repair</label>
      
    
    
    
            </td>
      
    
    
    
            <td class="interestedin">
      
    
    
    
              <input name="datarecovery" type="checkbox" class="formcheckbox" id="datarecovery" value="datarecovery" />
                  <label for="datarecovery">Data Recovery</label>
      
    
    
    
            </td>
    
    
    
            </tr>
      
    
    
    
          <tr>
      
    
    
    
            <td class="interestedin">
      
    
    
    
              <input name="upgrades" type="checkbox" class="formcheckbox" id="upgrades" value="upgrades" />
      
    
    
    
              <label for="upgrades">Upgrades</label>
    
    
    
              </td>
      
    
    
    
            <td class="interestedin"><input name="ps3drivereplacement" type="checkbox" class="formcheckbox" id="ps3drivereplacement" value="ps3drivereplacement" />
      
    
    
    
              <label for="ps3drivereplacement">PS3 Drive Replacement</label></td>
      
    
    
    
            <td class="interestedin">
      
    
    
    
              <input name="networkinstallation" type="checkbox" class="formcheckbox" id="networkinstallation" value="networkinstallation" />
      
    
    
    
              <label for="networkinstallation">Network Installation</label>
    
    
    
              </td>
    
    
    
    
            </tr>
      
    
    
    
          <tr>
      
    
    
    
            <td> </td>
      
    
    
    
            <td class="interestedin"><input name="ps3laserreplacement" type="checkbox" class="formcheckbox" id="ps3laserreplacement" value="ps3laserreplacement" />
      
    
    
    
            PS3
      
    
    
    
              <label for="ps3laserreplacement"> Laser Replacement</label></td>
      
    
    
    
            <td class="interestedin">
      
    
    
    
              <input name="mobilephoneissues" type="checkbox" class="formcheckbox" id="mobilephoneissues" value="mobilephoneissues" />
      
    
    
    
              <label for="mobilephoneissues">Mobile Phone Issues</label>
    
    
    
              </td>
    
    
    
            </tr>
      
    
    
    
          <tr>
      
    
    
    
            <td> </td>
      
    
    
    
            <td class="interestedin"><input name="ps3ylodrepair" type="checkbox" class="formcheckbox" id="ps3ylodrepair" value="ps3ylodrepair" />
      
    
    
    
              <label for="ps3ylodrepair">PS3 YLOD Repair</label></td>
      
    
    
    
            <td class="interestedin">
      
    
    
    
              <input name="emailconfiguration" type="checkbox" class="formcheckbox" id="emailconfiguration" value="emailconfiguration" />
      
    
    
    
              <label for="emailconfiguration">Email Configuration</label></td>
    
    
    
            </tr>
    
    
    
          </table>
      
    
    
    
        <br />
      
    
    
    
        
      
    
    
    
        <strong>Enquiry: </strong><br />
            <textarea name="enquiry" class="formmulti" id="enquiry"></textarea>
            <br />
            <br />
            <input type="submit" name="button" id="button" value="Submit" />
          </form>
          </p>
      
    
    
    
      
      
    
    
    
      <p><br />
    
    
    
        </p>
      
    
    
    
    </div>
      </div>
    </div>
      <!--#include file="inc_offers.html" -->
    
    
    
    <!--#include file="inc_footer.html" -->
    </body>
    </html>
    

  2. If changed it to

     

    <form id="form1" name="form1" method="post" action="contact-us.html">
    

     

    I'm not sure what you mean by

     

    "You and do this by checking for the $_POST of your submit button."

     

    <input type="submit" name="button" id="button" value="Submit" />
    

     

     

     

     

  3. I'm not 100% sure how to code the page to post to itself. Does it involve changing

     

    <input type="submit" name="button" id="button" value="Submit" />
    

     

    The commbined code looks like this:

     

    <?php 
    function curPageURL() {
    $pageURL = 'http';
    if ($_SERVER["HTTPS"] == "on") {$pageURL .= "s";}
    $pageURL .= "://";
    if ($_SERVER["SERVER_PORT"] != "80") {
      $pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
    } else {
      $pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
    }
    return $pageURL;
    }
    
    if (isset($_REQUEST['name']) && $_REQUEST['name'] != '' && isset($_REQUEST['email']) && $_REQUEST['email'] != ''){
    
    
    
    $fun = array(
    
    
    
    
    
    'virusandmalwareremoval',
    
    
    
    
    
    'fullservice',
    
    
    
    
    
    'quickfix',
    
    
    
    
    
    'upgrade',
    
    
    
    
    
    'xbox360drivereplacement',
    
    
    
    
    
    'xbox360laserreplacement',
    
    
    
    
    
    'xbox360rrodrepair',
    
    
    
    
    
    'ps3drivereplacement',
    
    
    
    
    
    'ps3laserreplacement',
    
    
    
    
    
    'ps3ylodrepair',
    
    
    
    
    
    'databackup',
    
    
    
    
    
    'websites . $datarecovery',
    
    
    
    
    
    'networkinstallation',
    
    
    
    
    
    'mobilephoneissues',
    
    
    
    
    
    'emailconfiguration'
    
    
    
    );
    
    
    
    
    
    
    foreach ($fun as $value) {
    
    
    
    
    
    ${$value} = (isset($_REQUEST[$value]) ? $value . "\n" : '');
    
    
    
    }
    
    
    
    
    
    
    $name = $_REQUEST['name'];
    
    
    
    $email = $_REQUEST['email'];
    
    
    
    $enquiry = $_REQUEST['enquiry'];
    
    
    
    
    
    
    if (ereg("[\r\n]", $name) || ereg("[\r\n]", $email)) {
    
    
    
    
    
    header( "Location: http://www.parkersmedia.com/byrne" );
    
    
    
    }
    
    
    
    $mailcontent = "Name: ".$name;
    
    
    
    $mailcontent.= "\n\nEmail: ".$email;
    
    
    
    $mailcontent.= "\n\nInterested in: \n". $virusandmalwareremoval . $fullservice . $quickfix . $upgrades . $xbox360drivereplacement . $xbox360laserreplacement . $xbox360rrodrepair . $ps3drivereplacement . $ps3laserreplacement . $ps3ylodrepair . $databackup . $websites . $datarecovery . $networkinstallation . $mobilephoneissues . $emailconfiguration;
    
    
    
    $mailcontent.= "\n\nEnquiry: " . $enquiry;
    
    
    
    
    
    
    
    
    if (mail( "info@byrnecomputingservices.ie", "Enquiry from Byrne Computing Services","$mailcontent", "From: $name <$email>" )) {
    
    
    
    
    
    header( "Location: http://www.parkersmedia.com/byrne/thankyou.shtml" );
    
    
    
    
    
    
    } else {
    
    
    
    
    
    echo 'Mail not sent';
    
    
    
    }
    } else {
    
    
    
    echo 'Required fields are empty';
    }
    
    
    
    
    ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Byrne Computing Services</title>
    <link href="styles.css" rel="stylesheet" type="text/css" />
    <script src="SpryAssets/SpryMenuBar.js" type="text/javascript"></script>
    <link href="SpryAssets/SpryMenuBarHorizontal.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript" src="inc/jquery.js"></script>
    <script type="text/javascript" src="inc/easySlider.js"></script>
    <script type="text/javascript">
    $(document).ready(function(){	
    	$("#slider").easySlider();
    });	
    </script>
    </head>
    
    <body>
    <div id="wrapper">
    <!--#include file="inc_header.html" -->
      <!--#include file="inc_scrollingimages.html" -->
      <div id="boxesholder">
        <!--#include file="inc_specials.html" -->
      <div id="main">
        <div id="mainheader">
        	Contact Us</div>
      	<div id="maincontent2">
      	  <h2>Fill in the form below and we will contact you shortly.</h2>
      	  <p><img src="images/binarycode.jpg" alt="Binary Code" width="167" height="600" class="images" /><form id="form1" name="form1" method="post" action="mailer.php?mail=1">
      	    <strong>Name: </strong><br />
          <input name="name" type="text" class="formsingle" id="name" />
            <br />
            <br />
            <strong>Email:</strong><br />
            <input name="email" type="text" class="formsingle" id="emailaddress" />
            <br />
            <br />
            <strong>Interested in:</strong><br />
      	    <table border="0" cellspacing="0" cellpadding="0" class="table">
      	      <tr>
      	        <td class="interestedin"><strong>Computer Repair</strong></td>
      	        <td class="interestedin"><strong>Console Repair</strong></td>
      	        <td class="interestedin"><strong>Other Services</strong></td>
            </tr>
      	      <tr>
      	        <td class="interestedin">
      	          <input name="virusandmalwareremoval" type="checkbox" class="formcheckbox" id="virusandmalwareremoval" value="virusandmalwareremoval" />
      	          <label for="virusandmalwareremoval">Virus and Malware Removal</label>
      	        </td>
      	        <td class="interestedin">
      	          <input name="xbox360drivereplacement" type="checkbox" class="formcheckbox" id="xbox360drivereplacement" value="xbox360drivereplacement" />
                  <label for="ps3drivereplacement">Xbox 360 Drive Replacement</label>
      	        </td>
      	        <td class="interestedin">
      	          <input name="databackup" type="checkbox" class="formcheckbox" id="databackup" value="databackup" />
                  <label for="databackup">Data Backup</label>
      	        </td>
            </tr>
      	      <tr>
      	        <td class="interestedin">
      	          <input name="fullservice" type="checkbox" class="formcheckbox" id="fullservice" value="fullservice" />
                  <label for="fullservice">Full Service</label>
      	        </td>
      	        <td class="interestedin">
      	          <input name="xbox360laserreplacement" type="checkbox" class="formcheckbox" id="xbox360laserreplacement" value="xbox360laserreplacement" />
                  <label for="ps3laserreplacement">Xbox 360 Laser Replacement</label>
      	        </td>
      	        <td class="interestedin">
      	          <input name="websites" type="checkbox" class="formcheckbox" id="websites" value="websites" />
                  <label for="websites">Web Design</label>
      	        </td>
            </tr>
      	      <tr>
      	        <td class="interestedin">
      	          <input name="quickfix" type="checkbox" class="formcheckbox" id="quickfix" value="quickfix" />
                  <label for="quickfix">Quick Fix</label>
      	        </td>
      	        <td class="interestedin">
      	          <input name="xbox360rrodrepair" type="checkbox" class="formcheckbox" id="xbox360rrodrepair" value="xbox360rrodrepair" />
                  <label for="ps3ylodrepair">Xbox 360 RROD Repair</label>
      	        </td>
      	        <td class="interestedin">
      	          <input name="datarecovery" type="checkbox" class="formcheckbox" id="datarecovery" value="datarecovery" />
                  <label for="datarecovery">Data Recovery</label>
      	        </td>
            </tr>
      	      <tr>
      	        <td class="interestedin">
      	          <input name="upgrades" type="checkbox" class="formcheckbox" id="upgrades" value="upgrades" />
      	          <label for="upgrades">Upgrades</label>
              </td>
      	        <td class="interestedin"><input name="ps3drivereplacement" type="checkbox" class="formcheckbox" id="ps3drivereplacement" value="ps3drivereplacement" />
      	          <label for="ps3drivereplacement">PS3 Drive Replacement</label></td>
      	        <td class="interestedin">
      	          <input name="networkinstallation" type="checkbox" class="formcheckbox" id="networkinstallation" value="networkinstallation" />
      	          <label for="networkinstallation">Network Installation</label>
              </td>
            </tr>
      	      <tr>
      	        <td> </td>
      	        <td class="interestedin"><input name="ps3laserreplacement" type="checkbox" class="formcheckbox" id="ps3laserreplacement" value="ps3laserreplacement" />
      	        PS3
      	          <label for="ps3laserreplacement"> Laser Replacement</label></td>
      	        <td class="interestedin">
      	          <input name="mobilephoneissues" type="checkbox" class="formcheckbox" id="mobilephoneissues" value="mobilephoneissues" />
      	          <label for="mobilephoneissues">Mobile Phone Issues</label>
              </td>
            </tr>
      	      <tr>
      	        <td> </td>
      	        <td class="interestedin"><input name="ps3ylodrepair" type="checkbox" class="formcheckbox" id="ps3ylodrepair" value="ps3ylodrepair" />
      	          <label for="ps3ylodrepair">PS3 YLOD Repair</label></td>
      	        <td class="interestedin">
      	          <input name="emailconfiguration" type="checkbox" class="formcheckbox" id="emailconfiguration" value="emailconfiguration" />
      	          <label for="emailconfiguration">Email Configuration</label></td>
            </tr>
          </table>
      	    <br />
      	    
      	    <strong>Enquiry: </strong><br />
            <textarea name="enquiry" class="formmulti" id="enquiry"></textarea>
            <br />
            <br />
            <input type="submit" name="button" id="button" value="Submit" />
          </form>
          </p>
      	  
      	  <p><br />
        </p>
      	</div>
      </div>
    </div>
      <!--#include file="inc_offers.html" -->
    <!--#include file="inc_footer.html" -->
    </body>
    </html>
    

  4. Like this?

     

    
    if ((isset($_REQUEST['name']) && $_REQUEST['name'] != '' && isset($_REQUEST['email']) && $_REQUEST['email'] != ''){
    mail( "info@byrnecomputingservices.ie", "Enquiry from Byrne Computing Services",
        "$mailcontent", "From: $name <$email>" );
    }
    header( "Location: http://www.parkersmedia.com/byrne/thankyou.shtml" );
    
    

  5. I'm looking for a bit of help introducing some validation into my "contact us" page. I'm looking to make the user have to enter an email address into textbox And something into the Enquiry box.

     

    My 2 files are below:

     

     

    contact-us.shtml

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Byrne Computing Services</title>
    <link href="styles.css" rel="stylesheet" type="text/css" />
    <script src="SpryAssets/SpryMenuBar.js" type="text/javascript"></script>
    <link href="SpryAssets/SpryMenuBarHorizontal.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript" src="inc/jquery.js"></script>
    <script type="text/javascript" src="inc/easySlider.js"></script>
    <script type="text/javascript">
    $(document).ready(function(){	
    	$("#slider").easySlider();
    });	
    </script>
    </head>
    
    <body>
    <div id="wrapper">
    <!--#include file="inc_header.html" -->
      <!--#include file="inc_scrollingimages.html" -->
      <div id="boxesholder">
        <!--#include file="inc_specials.html" -->
      <div id="main">
        <div id="mainheader">
        	Contact Us</div>
      	<div id="maincontent2">
      	  <h2>Fill in the form below and we will contact you shortly.</h2>
      	  <p><img src="images/binarycode.jpg" alt="Binary Code" width="167" height="600" class="images" /><form id="form1" name="form1" method="post" action="mailer.php?mail=1">
      	    <strong>Name: </strong><br />
          <input name="name" type="text" class="formsingle" id="name" />
            <br />
            <br />
            <strong>Email:</strong><br />
            <input name="email" type="text" class="formsingle" id="emailaddress" />
            <br />
            <br />
            <strong>Interested in:</strong><br />
      	    <table border="0" cellspacing="0" cellpadding="0" class="table">
      	      <tr>
      	        <td class="interestedin"><strong>Computer Repair</strong></td>
      	        <td class="interestedin"><strong>Console Repair</strong></td>
      	        <td class="interestedin"><strong>Other Services</strong></td>
            </tr>
      	      <tr>
      	        <td class="interestedin">
      	          <input name="virusandmalwareremoval" type="checkbox" class="formcheckbox" id="virusandmalwareremoval" value="virusandmalwareremoval" />
      	          <label for="virusandmalwareremoval">Virus and Malware Removal</label>
      	        </td>
      	        <td class="interestedin">
      	          <input name="xbox360drivereplacement" type="checkbox" class="formcheckbox" id="xbox360drivereplacement" value="xbox360drivereplacement" />
                  <label for="ps3drivereplacement">Xbox 360 Drive Replacement</label>
      	        </td>
      	        <td class="interestedin">
      	          <input name="databackup" type="checkbox" class="formcheckbox" id="databackup" value="databackup" />
                  <label for="databackup">Data Backup</label>
      	        </td>
            </tr>
      	      <tr>
      	        <td class="interestedin">
      	          <input name="fullservice" type="checkbox" class="formcheckbox" id="fullservice" value="fullservice" />
                  <label for="fullservice">Full Service</label>
      	        </td>
      	        <td class="interestedin">
      	          <input name="xbox360laserreplacement" type="checkbox" class="formcheckbox" id="xbox360laserreplacement" value="xbox360laserreplacement" />
                  <label for="ps3laserreplacement">Xbox 360 Laser Replacement</label>
      	        </td>
      	        <td class="interestedin">
      	          <input name="websites" type="checkbox" class="formcheckbox" id="websites" value="websites" />
                  <label for="websites">Web Design</label>
      	        </td>
            </tr>
      	      <tr>
      	        <td class="interestedin">
      	          <input name="quickfix" type="checkbox" class="formcheckbox" id="quickfix" value="quickfix" />
                  <label for="quickfix">Quick Fix</label>
      	        </td>
      	        <td class="interestedin">
      	          <input name="xbox360rrodrepair" type="checkbox" class="formcheckbox" id="xbox360rrodrepair" value="xbox360rrodrepair" />
                  <label for="ps3ylodrepair">Xbox 360 RROD Repair</label>
      	        </td>
      	        <td class="interestedin">
      	          <input name="datarecovery" type="checkbox" class="formcheckbox" id="datarecovery" value="datarecovery" />
                  <label for="datarecovery">Data Recovery</label>
      	        </td>
            </tr>
      	      <tr>
      	        <td class="interestedin">
      	          <input name="upgrades" type="checkbox" class="formcheckbox" id="upgrades" value="upgrades" />
      	          <label for="upgrades">Upgrades</label>
              </td>
      	        <td class="interestedin"><input name="ps3drivereplacement" type="checkbox" class="formcheckbox" id="ps3drivereplacement" value="ps3drivereplacement" />
      	          <label for="ps3drivereplacement">PS3 Drive Replacement</label></td>
      	        <td class="interestedin">
      	          <input name="networkinstallation" type="checkbox" class="formcheckbox" id="networkinstallation" value="networkinstallation" />
      	          <label for="networkinstallation">Network Installation</label>
              </td>
            </tr>
      	      <tr>
      	        <td> </td>
      	        <td class="interestedin"><input name="ps3laserreplacement" type="checkbox" class="formcheckbox" id="ps3laserreplacement" value="ps3laserreplacement" />
      	        PS3
      	          <label for="ps3laserreplacement"> Laser Replacement</label></td>
      	        <td class="interestedin">
      	          <input name="mobilephoneissues" type="checkbox" class="formcheckbox" id="mobilephoneissues" value="mobilephoneissues" />
      	          <label for="mobilephoneissues">Mobile Phone Issues</label>
              </td>
            </tr>
      	      <tr>
      	        <td> </td>
      	        <td class="interestedin"><input name="ps3ylodrepair" type="checkbox" class="formcheckbox" id="ps3ylodrepair" value="ps3ylodrepair" />
      	          <label for="ps3ylodrepair">PS3 YLOD Repair</label></td>
      	        <td class="interestedin">
      	          <input name="emailconfiguration" type="checkbox" class="formcheckbox" id="emailconfiguration" value="emailconfiguration" />
      	          <label for="emailconfiguration">Email Configuration</label></td>
            </tr>
          </table>
      	    <br />
      	    
      	    <strong>Enquiry: </strong><br />
            <textarea name="enquiry" class="formmulti" id="enquiry"></textarea>
            <br />
            <br />
            <input type="submit" name="button" id="button" value="Submit" />
          </form>
          </p>
      	  
      	  <p><br />
        </p>
      	</div>
      </div>
    </div>
      <!--#include file="inc_offers.html" -->
    <!--#include file="inc_footer.html" -->
    </body>
    </html>
    

     

    Mailer.php

    <?php 
    function curPageURL() {
    $pageURL = 'http';
    if ($_SERVER["HTTPS"] == "on") {$pageURL .= "s";}
    $pageURL .= "://";
    if ($_SERVER["SERVER_PORT"] != "80") {
      $pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
    } else {
      $pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
    }
    return $pageURL;
    }
    
    if (isset($_REQUEST['name'])) {
    
    $name = $_REQUEST['name'] ;
    $email = $_REQUEST['email'] ;
      $enquiry = $_REQUEST['enquiry'] ;
    if (isset($_REQUEST['virusandmalwareremoval'])){
    	$virusandmalwareremoval = $_REQUEST['virusandmalwareremoval'] . "\n";
    } else {
    	$virusandmalwareremoval = "";
    }
    if (isset($_REQUEST['fullservice'])){
    	$fullservice = $_REQUEST['fullservice'] . "\n";
    } else {
    	$fullservice = "";
    }
    if (isset($_REQUEST['quickfix'])){
    	$quickfix = $_REQUEST['quickfix'] . "\n";
    } else {
    	$quickfix = "";
    }
    if (isset($_REQUEST['upgrades'])){
    	$upgrades = $_REQUEST['upgrades'] . "\n";
    } else {
    	$upgrades = "";
    }
    if (isset($_REQUEST['xbox360drivereplacement'])){
    	$xbox360drivereplacement = $_REQUEST['xbox360drivereplacement'] . "\n";
    } else {
    	$xbox360drivereplacement = "";
    }
    if (isset($_REQUEST['xbox360laserreplacement'])){
    	$xbox360laserreplacement = $_REQUEST['xbox360laserreplacement'] . "\n";
    } else {
    	$xbox360laserreplacement = "";
    }
    if (isset($_REQUEST['xbox360rrodrepair'])){
    	$xbox360rrodrepair = $_REQUEST['xbox360rrodrepair'] . "\n";
    } else {
    	$xbox360rrodrepair = "";
    }
    if (isset($_REQUEST['ps3drivereplacement'])){
    	$ps3drivereplacement = $_REQUEST['ps3drivereplacement'] . "\n";
    } else {
    	$ps3drivereplacement = "";
    }
    if (isset($_REQUEST['ps3laserreplacement'])){
    	$ps3laserreplacement = $_REQUEST['ps3laserreplacement'] . "\n";
    } else {
    	$ps3laserreplacement = "";
    }
    if (isset($_REQUEST['ps3ylodrepair'])){
    	$ps3ylodrepair = $_REQUEST['ps3ylodrepair'] . "\n";
    } else {
    	$ps3ylodrepair = "";
    }
    if (isset($_REQUEST['databackup'])){
    	$databackup = $_REQUEST['databackup'] . "\n";
    } else {
    	$databackup = "";
    }
    if (isset($_REQUEST['websites'])){
    	$websites = $_REQUEST['websites'] . "\n";
    } else {
    	$websites = "";
    }
    if (isset($_REQUEST['datarecovery'])){
    	$datarecovery = $_REQUEST['datarecovery'] . "\n";
    } else {
    	$datarecovery = "";
    }
    if (isset($_REQUEST['networkinstallation'])){
    	$networkinstallation = $_REQUEST['networkinstallation'] . "\n";
    } else {
    	$networkinstallation = "";
    }
    if (isset($_REQUEST['mobilephoneissues'])){
    	$mobilephoneissues = $_REQUEST['mobilephoneissues'] . "\n";
    } else {
    	$mobilephoneissues = "";
    }
    if (isset($_REQUEST['emailconfiguration'])){
    	$emailconfiguration = $_REQUEST['emailconfiguration'] . "\n";
    } else {
    	$emailconfiguration = "";
    }
    
    if ( ereg( "[\r\n]", $name ) || ereg( "[\r\n]", $email ) ) {
    
    header( "Location: http://www.parkersmedia.com/byrne" );
    
    }
    $mailcontent = "Name: ".$name;
    $mailcontent.= "\n\nEmail: ".$email;
    $mailcontent.= "\n\nInterested in: \n". $virusandmalwareremoval . $fullservice . $quickfix . $upgrades . $xbox360drivereplacement . $xbox360laserreplacement . $xbox360rrodrepair . $ps3drivereplacement . $ps3laserreplacement . $ps3ylodrepair . $databackup . $websites . $datarecovery . $networkinstallation . $mobilephoneissues . $emailconfiguration;
    $mailcontent.= "\n\nEnquiry: " . $enquiry;
    
    mail( "info@byrnecomputingservices.ie", "Enquiry from Byrne Computing Services",
        "$mailcontent", "From: $name <$email>" );
    }
    header( "Location: http://www.parkersmedia.com/byrne/thankyou.shtml" );	
    ?>
    

     

    Any help on this would be great!

  6. Im looking at trying to replace all single spacing between fields with double spacing

     

    At present my file looks like this

     

    3 Caxxxan Maxxxet Waxxxxe Axxxxxxy Co.Kildare

     

    but after the double spacing, I want it to look like

     

    3  Caxxxan  Maxxxet  Waxxxxe  Axxxxxxy  Co.Kildare

     

    The code I have so far is

     

    <?php
    $fields=file('C:\Users\Mike\Desktop\5april.txt');
        foreach($fields as $i=>$field)
        {
           $field=str_replace(' ',',',$field);
           $field=str_replace('  ',',',$field);
           $fields[$i]=$field;
        }
        file_put_contents('C:\Users\Mike\Desktop\test.txt',implode("\r",$fields));
    ?> 
    

     

    Any help would be great

  7. Im trying to code something that wiil put the words ,Athy, Co.Kildare at the end of each line in my textfile

     

    At present the file looks like this

     

    John, Smith, ABCDE

     

    And after running the code I would like the line to look like this

     

    John, Smith, ABCDE, Athy, Co.Kildare

     

    Any help on this would be great! So far I have

     

    <?php
    $fields=file('C:\Users\Mike\Desktop\5april.txt');
        foreach($fields as $i=>$field)
        {
           $field=str_replace(',Athy',Co.Kildare',$field);
           $fields[$i]=$field;
        }
        file_put_contents('C:\Users\Mike\Desktop\test.txt',implode("\r",$fields));
    ?>
    

     

  8. I've come accross two pieces of code that havn't any comments to tell me what they do and I cant remember either!

     

    The code is

     

    <?php
    $fields=file('C:\Users\Mike\Desktop\5april.txt');
        foreach($fields as $i=>$field)
        {
           $field=str_replace('  ',',',$field);
           $field=str_replace(', ',',',$field);
           $fields[$i]=$field;
        }
        file_put_contents('C:\Users\Mike\Desktop\test.txt',implode("\r",$fields));
    ?>
    

     

    And the other is

     

    <?php
    $lines = file('C:\Users\Mike\Desktop\test.txt');
    $output = "";
    foreach($lines as $line) {
       $line = str_replace("  ", " ", $line);
       $output .= $line;
    }
    file_put_contents( 'C:\Users\Mike\Desktop\final.csv', $output );
    ?>
    

     

    Any help with what these do would be great!

     

     

  9. I currently have a database of names and addresses which looks like this:

     

    ,1,Caxxan,Cathy,Wxxxde,Ardreigh,Axy,Co.xxxe

    ,2,Caxxan,Liam,Wxxxde,Ardreigh,Axy,Co.xxxe

    ,3,Caxxan,Margaret,Wxxxde,Ardreigh,Axy,Co.xxxe

     

    I want to run a piece of php that will insert "The $Sname Family" in a new column where $Sname is the varible of the surname of that row.

     

    Any idea how I can code this??

     

     

  10. I have a form with two input boxes "n" and "m" which I want to place into the following formula

     

    1-n/(n+m)

     

    How do I code the php to do this?

     

    my form looks like this:

     

    <form>
    First name:
    <input type="text" name="N" />
    <br />
    Last name:
    <input type="text" name="M" />
    </form>
    

  11. I've written a piece of code to convert a pdf doc to a txtfile (still not working) but at present the pdf doc is predefined within the code.

     

    How can I recode this so the user has the option to select any chosen file??

     

    my code is

     

    <?php
    // Function    : pdf2txt()
    // Arguments   : $filename - Filename of the PDF you want to extract
    // Description : Reads a pdf file, extracts data streams, and manages
    //               their translation to plain text - returning the plain
    //               text at the end
    // Authors      : Jonathan Beckett, 2005-05-02
    //                            : Sven Schuberth, 2007-03-29
    
    function pdf2txt($filename){    
    
        $pdftext = pdf2txt('C:\Users\Mike\Desktop\Athy Database\Athy Register.pdf');
    
        $data = getFileData($filename);
       
        $s=strpos($data,"%")+1;
       
        $version=substr($data,$s,strpos($data,"%",$s)-1);
        if(substr_count($version,"PDF-1.2")==0)
            return handleV3($data);
        else
            return handleV2($data);
    
       
    }
    // handles the verson 1.2
    function handleV2($data){
           
        // grab objects and then grab their contents (chunks)
        $a_obj = getDataArray($data,"obj","endobj");
       
        foreach($a_obj as $obj){
           
            $a_filter = getDataArray($obj,"<<",">>");
       
            if (is_array($a_filter)){
                $j++;
                $a_chunks[$j]["filter"] = $a_filter[0];
    
                $a_data = getDataArray($obj,"stream\r\n","endstream");
                if (is_array($a_data)){
                    $a_chunks[$j]["data"] = substr($a_data[0],
    strlen("stream\r\n"),
    strlen($a_data[0])-strlen("stream\r\n")-strlen("endstream"));
                }
            }
        }
    
        // decode the chunks
        foreach($a_chunks as $chunk){
    
            // look at each chunk and decide how to decode it - by looking at the contents of the filter
            $a_filter = split("/",$chunk["filter"]);
           
            if ($chunk["data"]!=""){
                // look at the filter to find out which encoding has been used           
                if (substr($chunk["filter"],"FlateDecode")!==false){
                    $data =@ gzuncompress($chunk["data"]);
                    if (trim($data)!=""){
                        $result_data .= ps2txt($data);
                    } else {
                   
                        //$result_data .= "x";
                    }
                }
            }
        }
       
        return $result_data;
        file_put_contents('C:\Users\Mike\Desktop\txtfile.txt', pdf2txt('C:\Users\Mike\Desktop\Athy Database\Athy Register.pdf'));
    }
    
    //handles versions >1.2
    function handleV3($data){
        // grab objects and then grab their contents (chunks)
        $a_obj = getDataArray($data,"obj","endobj");
        $result_data="";
        foreach($a_obj as $obj){
            //check if it a string
            if(substr_count($obj,"/GS1")>0){
                //the strings are between ( and )
                preg_match_all("|\((.*?)\)|",$obj,$field,PREG_SET_ORDER);
                if(is_array($field))
                    foreach($field as $data)
                        $result_data.=$data[1];
            }
        }
        return $result_data;
        file_put_contents('C:\Users\Mike\Desktop\txtfile.txt', pdf2txt('C:\Users\Mike\Desktop\Athy Database\Athy Register.pdf'));
    }
    
    function ps2txt($ps_data){
        $result = "";
        $a_data = getDataArray($ps_data,"[","]");
        if (is_array($a_data)){
            foreach ($a_data as $ps_text){
                $a_text = getDataArray($ps_text,"(",")");
                if (is_array($a_text)){
                    foreach ($a_text as $text){
                        $result .= substr($text,1,strlen($text)-2);
                    }
                }
            }
        } else {
            // the data may just be in raw format (outside of [] tags)
            $a_text = getDataArray($ps_data,"(",")");
            if (is_array($a_text)){
                foreach ($a_text as $text){
                    $result .= substr($text,1,strlen($text)-2);
                }
            }
        }
        return $result;
        file_put_contents('C:\Users\Mike\Desktop\txtfile.txt', pdf2txt('C:\Users\Mike\Desktop\Athy Database\Athy Register.pdf'));	
    }
    
    function getFileData($filename){
        $handle = fopen($filename,"rb");
        $data = fread($handle, filesize($filename));
        fclose($handle);
        return $data;
    }
    
    function getDataArray($data,$start_word,$end_word){
    
        $start = 0;
        $end = 0;
        unset($a_result);
       
        while ($start!==false && $end!==false){
            $start = strpos($data,$start_word,$end);
            if ($start!==false){
                $end = strpos($data,$end_word,$start);
                if ($end!==false){
                    // data is between start and end
                    $a_result[] = substr($data,$start,$end-$start+strlen($end_word));
                }
            }
        }
        return $a_result;
        file_put_contents('C:\Users\Mike\Desktop\txtfile.txt', pdf2txt('C:\Users\Mike\Desktop\Athy Database\Athy Register.pdf'));
    }
    ?>
    

     

     

  12. I'm putting together a piece of code to pull the text from a pdf and place it into a textfile.

     

    It seems to work fine and passes all error checks but it just produces a blank text file????

     

    My code is

     

    <?php
    // Function    : pdf2txt()
    // Arguments   : $filename - Filename of the PDF you want to extract
    // Description : Reads a pdf file, extracts data streams, and manages
    //               their translation to plain text - returning the plain
    //               text at the end
    // Authors      : Jonathan Beckett, 2005-05-02
    //              : Sven Schuberth, 2007-03-29
    error_reporting(E_ALL);
    ini_set('display_errors', TRUE);
    $path = 'C:\\Users\\Mike\\Desktop\\';
    file_put_contents($path . 'txtfile.txt', pdf2txt($path . 'Athy Register.pdf'));
    
    if (file_exists($path . 'txtfile.txt')) {
        echo "File txtfile.txt has been created succesfully and contains <br><br><pre>";
        echo file_get_contents($path . 'txtfile.txt');
    }else {
        echo "File txtfile.txt was not created due to an issue.";
    }
    
    function pdf2txt($filename){    
    
        $data = getFileData($filename);
       
        $s=strpos($data,"%")+1;
       
        $version=substr($data,$s,strpos($data,"%",$s)-1);
        if(substr_count($version,"PDF-1.2")==0)
            return handleV3($data);
        else
            return handleV2($data);
    
       
    }
    // handles the verson 1.2
    function handleV2($data){
           
        // grab objects and then grab their contents (chunks)
        $a_obj = getDataArray($data,"obj","endobj");
       
         $j = -1;
        foreach($a_obj as $obj){
           
            $a_filter = getDataArray($obj,"<<",">>");
       
            if ((is_array($a_filter)) && (count($a_filter) > 0)) {
                $j++;
                $a_chunks[$j]["filter"] = $a_filter[0];
    
                $a_data = getDataArray($obj,"stream\r\n","endstream");
                if ((is_array($a_data)) && (count($a_data) > 0)) {
                    $a_chunks[$j]["data"] = substr($a_data[0],
    strlen("stream\r\n"),
    strlen($a_data[0])-strlen("stream\r\n")-strlen("endstream"));
                }
            }
        }
    
        // decode the chunks
        foreach($a_chunks as $chunk){
    
            // look at each chunk and decide how to decode it - by looking at the contents of the filter
            $a_filter = split("/",$chunk["filter"]);
           
            if (isset($chunk['data'])) {
                // look at the filter to find out which encoding has been used           
                if (substr($chunk["filter"],"FlateDecode")!==false){
                    $data =@ gzuncompress($chunk["data"]);
                    if (trim($data)!=""){
                        $result_data .= ps2txt($data);
                    } else {
                   
                        //$result_data .= "x";
                    }
                }
            }
        }
       
        if (isset($result_data)) {
        return $result_data;
    } else {
        return false;
    }
    }
    
    //handles versions >1.2
    function handleV3($data){
        // grab objects and then grab their contents (chunks)
        $a_obj = getDataArray($data,"obj","endobj");
        $result_data="";
        foreach($a_obj as $obj){
            //check if it a string
            if(substr_count($obj,"/GS1")>0){
                //the strings are between ( and )
                preg_match_all("|\((.*?)\)|",$obj,$field,PREG_SET_ORDER);
                if(is_array($field))
                    foreach($field as $data)
                        $result_data.=$data[1];
            }
        }
        return $result_data;
    
    }
    
    function ps2txt($ps_data){
        $result = "";
        $a_data = getDataArray($ps_data,"[","]");
        if (is_array($a_data)){
            foreach ($a_data as $ps_text){
                $a_text = getDataArray($ps_text,"(",")");
                if (is_array($a_text)){
                    foreach ($a_text as $text){
                        $result .= substr($text,1,strlen($text)-2);
                    }
                }
            }
        } else {
            // the data may just be in raw format (outside of [] tags)
            $a_text = getDataArray($ps_data,"(",")");
            if (is_array($a_text)){
                foreach ($a_text as $text){
                    $result .= substr($text,1,strlen($text)-2);
                }
            }
        }
        return $result;
    }
    
    function getFileData($filename){
        $handle = fopen($filename,"rb");
        $data = fread($handle, filesize($filename));
        fclose($handle);
        return $data;
    }
    
    function getDataArray($data,$start_word,$end_word){
    
        $start = 0;
        $end = 0;
        $a_result = array();
       
        while ($start!==false && $end!==false){
            $start = strpos($data,$start_word,$end);
            if ($start!==false){
                $end = strpos($data,$end_word,$start);
                if ($end!==false){
                    // data is between start and end
                    $a_result[] = substr($data,$start,$end-$start+strlen($end_word));
                }
            }
        }
        return $a_result;
    }
    ?>
    

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