Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> PHP
Author Message
bugsTHoR
Involved
Involved



Joined: Apr 05, 2006
Posts: 263

PostPosted: Tue Sep 27, 2011 8:54 am Reply with quote

off topic for raven distro.
sorry if wrong forum.

i tried this on my website andi keep geting a 404 error pages.
[ Only registered users can see links on this board! Get registered or login! ]

i`m with host papa is it me or do i have to ask my host or is it the php code ?

_________________
LUV RAVEN DISTROBUTION BEBE

Clanthemes.com are great (free advertisements for now until i get to 20,000 posts LoL) 
View user's profile Send private message
Palbin
Site Admin



Joined: Mar 30, 2006
Posts: 2583
Location: Pittsburgh, Pennsylvania

PostPosted: Tue Sep 27, 2011 11:22 am Reply with quote

Sounds like your form is not making it to the php script. Are you sure the "action" in the form is pointing to where you have the file?

_________________
"Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." — Brian W. Kernighan. 
View user's profile Send private message
bugsTHoR







PostPosted: Tue Sep 27, 2011 2:40 pm Reply with quote

yes its in my www/root/ i did just notice a small typo , fixed that.
now i get a blank page.

thanks for making me check again Very Happy
 
bugsTHoR







PostPosted: Wed Sep 28, 2011 1:18 pm Reply with quote

tried it again got a blank page there was title of the php was mispelt grrr

now getting blank page , try it again later when back in for more typos and links.
 
killing-hours
RavenNuke(tm) Development Team



Joined: Oct 01, 2010
Posts: 438
Location: Houston, Tx

PostPosted: Wed Sep 28, 2011 2:08 pm Reply with quote

What type of contact form are you wanting?? I've updated my SlideInContact which uses Javascript to slide in from the right. I've updated it to use either a single email address or a company directory, shows a fax if it's filled in and is pretty secure as far as I can tell against spammers trying to send spam from the form. (i've had plenty hit it in the three days I've had it online)

I'll be cleaning up the code and putting it all together pretty soon. You can see it in action on [ Only registered users can see links on this board! Get registered or login! ]

_________________
Money is the measurement of time - Me
"You can all go to hell…I’m going to Texas" -Davy Crockett 
View user's profile Send private message
bugsTHoR







PostPosted: Thu Sep 29, 2011 11:46 am Reply with quote

like this

instead of "comment", its a request for a qoute , and his clients can give there info of job requierd or what ever their question is " book an apoint for a qoute" say...

tried different ones but this one suited him more, its for a friends website so i said i would knock something together for him, and he`s just paid £££ for his website to be found in YELLOW pages so his auto email is important to him.
so any help i could get will be appreciated.
 
bugsTHoR







PostPosted: Thu Sep 29, 2011 11:51 am Reply with quote

your slide in javascript is really nice, with the secure code for ggrrr spambots.

i have java already for the gallery it would not interfer would it.
 
killing-hours







PostPosted: Thu Sep 29, 2011 12:10 pm Reply with quote

That captcha works there, then in the processing script there are 2 more checks to ensure it's not spam. So far I haven't had a successful spam come from it even though someone tries everyday.

Back to your form though.. I spent less than 3 mins setting up the link you provided and it worked perfectly from the get go.

Step 1:

Create a new file in your root folder named w/e you want it to be called. (I'd suggest you don't call it someing like contact or email as it will draw unwanted attention)

Copy this code to it and save.
Code:
<?php

echo '<form name="contactform" method="post" action="eProcess.php">
<table width="450px">
</tr>
<tr>
 <td valign="top">
  <label for="first_name">First Name *</label>
 </td>
 <td valign="top">
  <input  type="text" name="first_name" maxlength="50" size="30">
 </td>
</tr>
 
<tr>
 <td valign="top"">
  <label for="last_name">Last Name *</label>
 </td>
 <td valign="top">
  <input  type="text" name="last_name" maxlength="50" size="30">
 </td>
</tr>
<tr>
 <td valign="top">
  <label for="email">Email Address *</label>
 </td>
 <td valign="top">
  <input  type="text" name="email" maxlength="80" size="30">
 </td>
 
</tr>
<tr>
 <td valign="top">
  <label for="telephone">Telephone Number</label>
 </td>
 <td valign="top">
  <input  type="text" name="telephone" maxlength="30" size="30">
 </td>
</tr>
<tr>
 <td valign="top">
  <label for="comments">Comments *</label>
 </td>
 <td valign="top">
  <textarea  name="comments" maxlength="1000" cols="25" rows="6"></textarea>
 </td>
 
</tr>
<tr>
 <td colspan="2" style="text-align:center">
  <input type="submit" value="Submit">   <a href="http://www.freecontactform.com/email_form.php">Email Form</a>
 </td>
</tr>
</table>
</form>';

?>


Step 2:

Create a new file in your root folder called "eProcess.php".

Copy this code to it and save.
Code:
<?php


if(isset($_POST['email'])) {
     
    // EDIT THE 2 LINES BELOW AS REQUIRED
    $email_to = "YOUR EMAIL HERE";
    $email_subject = "Your email subject line";
     
     
    function died($error) {
        // your error code can go here
        echo "We are very sorry, but there were error(s) found with the form you submitted. ";
        echo "These errors appear below.<br /><br />";
        echo $error."<br /><br />";
        echo "Please go back and fix these errors.<br /><br />";
        die();
    }
     
    // validation expected data exists
    if(!isset($_POST['first_name']) ||
        !isset($_POST['last_name']) ||
        !isset($_POST['email']) ||
        !isset($_POST['telephone']) ||
        !isset($_POST['comments'])) {
        died('We are sorry, but there appears to be a problem with the form you submitted.');     
    }
     
    $first_name = $_POST['first_name']; // required
    $last_name = $_POST['last_name']; // required
    $email_from = $_POST['email']; // required
    $telephone = $_POST['telephone']; // not required
    $comments = $_POST['comments']; // required
     
    $error_message = "";
    $email_exp = '/^[A-Za-z0-9._%-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}$/';
  if(!preg_match($email_exp,$email_from)) {
    $error_message .= 'The Email Address you entered does not appear to be valid.<br />';
  }
    $string_exp = "/^[A-Za-z .'-]+$/";
  if(!preg_match($string_exp,$first_name)) {
    $error_message .= 'The First Name you entered does not appear to be valid.<br />';
  }
  if(!preg_match($string_exp,$last_name)) {
    $error_message .= 'The Last Name you entered does not appear to be valid.<br />';
  }
  if(strlen($comments) < 2) {
    $error_message .= 'The Comments you entered do not appear to be valid.<br />';
  }
  if(strlen($error_message) > 0) {
    died($error_message);
  }
    $email_message = "Form details below.\n\n";
     
    function clean_string($string) {
      $bad = array("content-type","bcc:","to:","cc:","href");
      return str_replace($bad,"",$string);
    }
     
    $email_message .= "First Name: ".clean_string($first_name)."\n";
    $email_message .= "Last Name: ".clean_string($last_name)."\n";
    $email_message .= "Email: ".clean_string($email_from)."\n";
    $email_message .= "Telephone: ".clean_string($telephone)."\n";
    $email_message .= "Comments: ".clean_string($comments)."\n";
     
     
// create email headers
$headers = 'From: '.$email_from."\r\n".
'Reply-To: '.$email_from."\r\n" .
'X-Mailer: PHP/' . phpversion();
@mail($email_to, $email_subject, $email_message, $headers);
?>
 
<!-- include your own success html here -->
 
Thank you for contacting us. We will be in touch with you very soon.
 
<?php
}
?>


Step 3:

Visit your form. [ Only registered users can see links on this board! Get registered or login! ]

(replace filename with the name you gave it in step 1)

VERY IMPORTANT***

There are NO protections on that form you posted... you will need to come up with some way to ensure that the form is being submitted properly etc. by a real human being and as intended.
 
bugsTHoR







PostPosted: Thu Sep 29, 2011 12:33 pm Reply with quote

thanks for the help i`ll give this ago on my site tomorrow when i have more time.
and let you know how it goes.
and find myself a security code that works with it.

the funny thing is i did tell him i would prefer to put a forum on his site so less complication dif topics and such, he can delete old posts but hes a total technophobe lol.
 
Guardian2003
Site Admin



Joined: Aug 28, 2003
Posts: 6799
Location: Ha Noi, Viet Nam

PostPosted: Thu Sep 29, 2011 4:11 pm Reply with quote

If he's using RN I could donate a copy of my Contact Plus module if it will help you out.
 
View user's profile Send private message Send e-mail
bugsTHoR







PostPosted: Thu Sep 29, 2011 7:09 pm Reply with quote

Kudos now drunk its my 40th in two days time i`m in pratice with vodka lol

chat tommorrow me messed up at the min lmao slightly Very Happy
you guys and girls are great love ya in an none gay way Very Happy
gaurdian thank you and you know why !!! you back this side if the small pond yet ?
 
Guardian2003







PostPosted: Fri Sep 30, 2011 2:35 am Reply with quote

Off-topic @ bugsTHoR - nope, I'm in Czech Republic till next summer.
 
bugsTHoR







PostPosted: Mon Oct 03, 2011 4:23 am Reply with quote

it must me doing something wrong
Sad
[ Only registered users can see links on this board! Get registered or login! ]

sorry to be a neusance

this is how i did it just incase there is a small error like the user lol

Contact_us.html
Code:
<!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>GoldStar</title>
<style type="text/css">
<!--
body {
   background-color: #FFFFFF;
}
-->
</style>
<link href="css/layout.css" rel="stylesheet" type="text/css" />
</head>

<body>
<div id="wrapper">
  <div id="logo"><a href="index_2.html"><img src="images/Goldstar_logo.jpg" alt="goldstar_logo" width="800" height="250" /></a></div>
  <div id="navigation_div"></div>
  <div id="certifieds_images"></div>
  <div id="body">
 
  <div id="left_margin">
  <div id="Links">

                    <p><a href="index.html">Home</a>
               <p><a href="windows_doors.html">Windows and Doors</a></p>
               <p><a href="conservatories.html">Conservatories</a></p>
               <p><a href="trade_supply.html">Trade Supply</a></p>
                    <p><a href="gallery.html">Gallery</a></p>
                    <p><a href="free_quote.html">Free Quote</a></p>
                    <p><a href="contact_us.html">Contact Us</a></p>
                 <br />
                 </div>
               <div id="form">
               <div>
                 <p><b><u>LOCAL LINKS </u> </b>  </p>
                 <p><br />
                 </p>
                 <li><a href="http://www.shoppingcentre.colwynbay.towntalk.co.uk/">Colwyn bay town talk</a>
               <br />
               
                 <li><a href="http://www.colwynbaypetshop.co.uk/">pet shop</a></li>
                 <br />
             <li><a href="http://www.egohairdressing.com/">ego salon</a></li>
                    <br /> 
             <li><a href="http://www.computershopcolwynbay.co.uk/home.html">computer shop</a></li>
               <br />
             <li><a href="http://www.egohairdr">ego salon</a></li>
</div>
</div>
  </div>
 
  <div id="Main_Body">
    <p>&nbsp;</p>
    <p>Address and Direct contact at the bottom of page </p>
    <p>&nbsp;</p>
    <p><br />
    </p>
    <h3>
      <p>Contact Us:-</p>
     </h3>   
                   <div id="form"> <form name="contactus" method="post" action="send_form_email.php">
<table width="450px">
</tr>
<tr>
 <td valign="top">
  <label for="first_name">First Name *</label>
 </td>
 <td valign="top">
  <input  type="text" name="first_name" maxlength="50" size="30">
 </td>
</tr>
 
<tr>
 <td valign="top"">
  <label for="last_name">Last Name *</label>
 </td>
 <td valign="top">
  <input  type="text" name="last_name" maxlength="50" size="30">
 </td>
</tr>
<tr>
 <td valign="top">
  <label for="email">Email Address *</label>
 </td>
 <td valign="top">
  <input  type="text" name="email" maxlength="80" size="30">
 </td>
 
</tr>
<tr>
 <td valign="top">
  <label for="telephone">Telephone Number</label>
 </td>
 <td valign="top">
  <input  type="text" name="telephone" maxlength="30" size="30">
 </td>
</tr>
<tr>
 <td valign="top">
  <label for="comments">Comments *</label>
 </td>
 <td valign="top">
  <textarea  name="comments" maxlength="1000" cols="25" rows="6"></textarea>
 </td>
 
</tr>
<tr>
 <td colspan="2" style="text-align:center">
  <input type="submit" value="Submit">   <a href="http://goldstarwindows.net/send_form_email.php">Email Form</a>
 </td>
</tr>
</table>
</form>
</p>
                   
                   </form>
</div></h3>
<p>&nbsp;</p>
    </div>
  <div id="right_margin">pictures
    <div align="center"><a href="images/gallery/conserv/dsc01813.jpg" rel="lightbox[a]"><img src="/images/gallery/conservatories/conservatory_1.jpg" alt="conservatory_01" width="150" height="100" border="0" /><p></a> </div>         
      <div align="center"><a href="images/gallery/conserv/dsc01831.jpg"><img src="/images/gallery/conservatories/conservatory_2.jpg" alt="conservatory_01" width="150" height="100" border="0" /><p></a></div>
    <div align="center"><a href="images/gallery/conserv/patio.jpg" rel="lightbox[a]"><img src="/images/gallery/conservatories/conservatory_3.jpg" alt="con_02" width="150" height="100" border="0" /><p></a>
        <div align="center"><a href="images/gallery/conserv/upvc-window-door-i1.jpg" rel="lightbox[a]"><img src="/images/gallery/conservatories/conservatory_4.jpg" alt="con_04" width="150" height="100" border="0" /></a>   </div>
    </div>
    <div id="Links"></div>
   
      
   
            
            <p>Copyright © Goldstar, 2011        </p>
    
     </div>
  </div>
  <div id="footer_area"><h3>
    <p>GOLDSTAR WINDOWS     </p>
    <p> llewelyn road</p>
    <p> colwyn bay</p>
    <p> conwy      </p>
    <p>LL29 7AP</p>
    <p> 01492 533744 or email</p>
   <p>
<a href="http://jigsaw.w3.org/css-validator/check/referer">
    <img style="border:0;width:88px;height:31px"
        src="http://jigsaw.w3.org/css-validator/images/vcss-blue"
        alt="Valid CSS!" />
</a>
</p>
     
  </h3>
    </div>
  </div>
  </div>
</div>
</body>
</html>


send_form_email.php
Code:


<?php
echo '<form name="contactform" method="post" action="eProcess.php">
<table width="450px">
</tr>
<tr>
 <td valign="top">
  <label for="first_name">First Name *</label>
 </td>
 <td valign="top">
  <input  type="text" name="first_name" maxlength="50" size="30">
 </td>
</tr>
 
<tr>
 <td valign="top"">
  <label for="last_name">Last Name *</label>
 </td>
 <td valign="top">
  <input  type="text" name="last_name" maxlength="50" size="30">
 </td>
</tr>
<tr>
 <td valign="top">
  <label for="email">Email Address *</label>
 </td>
 <td valign="top">
  <input  type="text" name="email" maxlength="80" size="30">
 </td>
 
</tr>
<tr>
 <td valign="top">
  <label for="telephone">Telephone Number</label>
 </td>
 <td valign="top">
  <input  type="text" name="telephone" maxlength="30" size="30">
 </td>
</tr>
<tr>
 <td valign="top">
  <label for="comments">Comments *</label>
 </td>
 <td valign="top">
  <textarea  name="comments" maxlength="1000" cols="25" rows="6"></textarea>
 </td>
 
</tr>
<tr>
 <td colspan="2" style="text-align:center">
  <input type="submit" value="Submit">   <a href="http://goldstarwindows.net/eProcess.php">Email Form</a>
 </td>
</tr>
</table>
</form>';

?>



eprocess.php
Code:


<?php

if(isset($_POST['email'])) {
     
    // EDIT THE 2 LINES BELOW AS REQUIRED
    $email_to = "gazboh@hotmail.com";
    $email_subject = "test";
     
     
    function died($error) {
        // your error code can go here
        echo "We are very sorry, but there were error(s) found with the form you submitted. ";
        echo "These errors appear below.<br /><br />";
        echo $error."<br /><br />";
        echo "Please go back and fix these errors.<br /><br />";
        die();
    }
     
    // validation expected data exists
    if(!isset($_POST['first_name']) ||
        !isset($_POST['last_name']) ||
        !isset($_POST['email']) ||
        !isset($_POST['telephone']) ||
        !isset($_POST['comments'])) {
        died('We are sorry, but there appears to be a problem with the form you submitted.');     
    }
     
    $first_name = $_POST['first_name']; // required
    $last_name = $_POST['last_name']; // required
    $email_from = $_POST['email']; // required
    $telephone = $_POST['telephone']; // not required
    $comments = $_POST['comments']; // required
     
    $error_message = "";
    $email_exp = '/^[A-Za-z0-9._%-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}$/';
  if(!preg_match($email_exp,$email_from)) {
    $error_message .= 'The Email Address you entered does not appear to be valid.<br />';
  }
    $string_exp = "/^[A-Za-z .'-]+$/";
  if(!preg_match($string_exp,$first_name)) {
    $error_message .= 'The First Name you entered does not appear to be valid.<br />';
  }
  if(!preg_match($string_exp,$last_name)) {
    $error_message .= 'The Last Name you entered does not appear to be valid.<br />';
  }
  if(strlen($comments) < 2) {
    $error_message .= 'The Comments you entered do not appear to be valid.<br />';
  }
  if(strlen($error_message) > 0) {
    died($error_message);
  }
    $email_message = "Form details below.\n\n";
     
    function clean_string($string) {
      $bad = array("content-type","bcc:","to:","cc:","href");
      return str_replace($bad,"",$string);
    }
     
    $email_message .= "First Name: ".clean_string($first_name)."\n";
    $email_message .= "Last Name: ".clean_string($last_name)."\n";
    $email_message .= "Email: ".clean_string($email_from)."\n";
    $email_message .= "Telephone: ".clean_string($telephone)."\n";
    $email_message .= "Comments: ".clean_string($comments)."\n";
     
     
// create email headers
$headers = 'From: '.$email_from."\r\n".
'Reply-To: '.$email_from."\r\n" .
'X-Mailer: PHP/' . phpversion();
@mail($email_to, $email_subject, $email_message, $headers);
?>
 
<!-- include your own success html here -->
 
Thank you for contacting us. We will be in touch with you very soon.
 
<?php
}
?>


maybe i missed something :/
 
Palbin







PostPosted: Mon Oct 03, 2011 6:56 am Reply with quote

What is the problem now?
 
bugsTHoR







PostPosted: Mon Oct 03, 2011 8:16 am Reply with quote

no my mistake it works Very Happy

thanks for the help guys , instantly sent and recieved.

cheers killing-hours
 
killing-hours







PostPosted: Tue Oct 04, 2011 7:08 am Reply with quote

yep. Glad you got it working. Wink
 
bugsTHoR







PostPosted: Tue Oct 04, 2011 7:17 am Reply with quote

there just one little thing though even though my page has the boxes when you click submit, it takes me to a new page with boxes, how would i make it send from his web page instead of opening up in a new window to fill the form out again.

just click the link and see yourself.
[ Only registered users can see links on this board! Get registered or login! ]
 
killing-hours







PostPosted: Tue Oct 04, 2011 7:24 am Reply with quote

I'd venture to guess it has something to do with this.

Image
 
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> PHP

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
 
Forums ©