Pixelpost

Authentic Photoblog Flavour


Go Back   Pixelpost Forum > DEVELOPMENT > Addons

Post Reply
 
Thread Tools
  #1  
Old 09-01-2005, 05:33 PM
brian connolly Offline
pp veteran
 
Join Date: Aug 2005
Posts: 59
Contact and Recommend Us Form

I've see mention of a "contact us" form and "recommend us" form.

Anyone actually have one working that they'd like to share?

Thanks in advance.

Brian
http://www.606eleven.com
Reply With Quote
  #2  
Old 09-01-2005, 08:53 PM
fotogram's Avatar
fotogram Offline
pp veteran
 
Join Date: May 2005
Location: Walnut Creek, CA
Posts: 92
I have a "contact" template in my site:

http://www.fotogram.com/pixelpost/index.php?x=contact

The front end is just plain HTML. You can basically add any HTML file to the folder of current templates you are using and name it whatever_template.html. If you call the index.php and pass a ?x=whatever in the URL, it will load the whatever_template.html view.

My contact_template.html file is a simple HTML form, and what does the trick is the "action" attribute in the "form" tag. It is set to the formmail.cgi that my host (www.dreamhost.com) provides to all users. Any thing I add to the form will be sent to me in the email body.

You should check with your provider if they support formmail.cgi and it should be pretty straight forward to set up.
__________________
Guilherme Pinto
http://www.fotogram.com
Reply With Quote
  #3  
Old 09-01-2005, 10:16 PM
Joe[y]'s Avatar
Joe[y]+ Offline
Team Pixelpost
 
Join Date: Mar 2005
Location: UK
Posts: 3,101
Send a message via MSN to Joe[y]
http://photos.jlspurling.com/contact

also got one there as well... check the code if you wanna see what i did. used a premade script as well from some site or another (will post it if i can remember)
Reply With Quote
  #4  
Old 09-02-2005, 08:41 AM
Joe[y]'s Avatar
Joe[y]+ Offline
Team Pixelpost
 
Join Date: Mar 2005
Location: UK
Posts: 3,101
Send a message via MSN to Joe[y]
i emailed you the code.
Reply With Quote
  #5  
Old 09-02-2005, 01:08 PM
brian connolly Offline
pp veteran
 
Join Date: Aug 2005
Posts: 59
Thank you.

Now, not to sound ungrateful but... anyone have any thoughts on a "recommend us" script?
Reply With Quote
  #6  
Old 09-02-2005, 10:45 PM
GeoS's Avatar
GeoS+ Offline
Team Pixelpost
 
Join Date: Apr 2005
Location: Warsaw, Poland
Posts: 3,613
Send a message via ICQ to GeoS Send a message via Skype™ to GeoS
Such things can be dangerous coz some of people/BOTs can use such future for sending SPAM!
__________________
photoblog | portfolio | addons | Donate
Reply With Quote
  #7  
Old 09-02-2005, 11:21 PM
fotogram's Avatar
fotogram Offline
pp veteran
 
Join Date: May 2005
Location: Walnut Creek, CA
Posts: 92
That's indeed a concern of mine. Especially with formmail.pl, since the email address is a hidden text field in the html form.

Joe[y], if you can email me the code you used also, I'll see if that would be less prone to SPAM, and eventually use it.

Thanks,

Guilherme
__________________
Guilherme Pinto
http://www.fotogram.com
Reply With Quote
  #8  
Old 09-03-2005, 01:35 AM
GeoS's Avatar
GeoS+ Offline
Team Pixelpost
 
Join Date: Apr 2005
Location: Warsaw, Poland
Posts: 3,613
Send a message via ICQ to GeoS Send a message via Skype™ to GeoS
It can be secured by filling up with some marks from randomously generated images.

In that condition it is enough to protect from SPAM (I think).

Thats an idea for next addon
__________________
photoblog | portfolio | addons | Donate
Reply With Quote
  #9  
Old 09-03-2005, 07:19 PM
Joe[y]'s Avatar
Joe[y]+ Offline
Team Pixelpost
 
Join Date: Mar 2005
Location: UK
Posts: 3,101
Send a message via MSN to Joe[y]
Create includes/contact.php and insert the following... obviously you need to change the variables relevant to my site.

PHP Code:
<?php

// get posted data into local variables
$EmailFrom Trim(stripslashes($_POST['EmailFrom'])); 
$EmailTo "jspurling@blahblah.com";
$Subject "Message from photos.jlspurling.com";
$Name Trim(stripslashes($_POST['Name'])); 
$Message Trim(stripslashes($_POST['Message'])); 

// validation
$validationOK=true;
if (
Trim($EmailFrom)==""$validationOK=false;
if (!
$validationOK) {
  print 
"<meta http-equiv=\"refresh\" content=\"0;URL=error.htm\">";
  exit;
}

// prepare email body text
$Body "";
$Body .= "Name: ";
$Body .= $Name;
$Body .= "\n";
$Body .= "Message: ";
$Body .= $Message;
$Body .= "\n";

// send email 
$success mail($EmailTo$Subject$Body"From: <$EmailFrom>");

// redirect to success page 
if ($success){
  print 
"<meta http-equiv=\"refresh\" content=\"0;URL=http://photos.jlspurling.com/contactok\">";
}
else{
  print 
"<meta http-equiv=\"refresh\" content=\"0;URL=error.htm\">";
}
?>
Next create contact_template.html. Insert:

HTML Code:
<form method="post" action="../includes/contact.php">
<p />&nbsp;&nbsp;&nbsp;&nbsp;Name:<br />
<input type="text" name="Name" />
<p />&nbsp;&nbsp;&nbsp;&nbsp;Email: <br />
<input type="text" name="EmailFrom" />
<p />&nbsp;&nbsp;&nbsp;&nbsp;Message:<br />
<textarea name="Message" rows="8" cols="40"></textarea>
<p />&nbsp;&nbsp;&nbsp;&nbsp;<input type="submit" name="submit" value="Submit" />
</form>
This redirects to whatever you put in contactok_template.html.

I've had no spam problems as yet.. but that's probably lucky. you can probably change the form names etc to make it less obvious to robots.

Last edited by blinking8s; 09-04-2005 at 01:46 AM.
Reply With Quote
  #10  
Old 09-04-2005, 01:46 AM
blinking8s's Avatar
blinking8s+ Offline
über loafer
 
Join Date: Oct 2004
Location: Bowling Green, Ky
Posts: 3,428
Send a message via ICQ to blinking8s Send a message via AIM to blinking8s Send a message via MSN to blinking8s Send a message via Skype™ to blinking8s
i updated your post joey...we have php and html tags on the new boards
__________________
i should say more clever stuff
Reply With Quote
Post Reply


Thread Tools




All times are GMT. The time now is 06:14 PM.

Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd. | Style Design: d3 designs