Computer Forums

Celebrating Three Years Online
July 27th 2005 - July 27th 2008

Go Back   Computer Forums > Internet > Website Development

Website Development HTML, traffic, hosting, and more... this is the forum for every webmaster.

Register Now for FREE!
Computer Forums

Username: Password: Confirm Password: E-Mail: Confirm E-Mail:
Agree to forum rules 


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 03-28-2008, 06:22 PM
jam's Avatar
jam jam is online now
CompuForums Moderator
 
Join Date: 02 Mar 2008
Location: In My Own Little World
Posts: 550
jam has a reputation beyond reputejam has a reputation beyond reputejam has a reputation beyond reputejam has a reputation beyond reputejam has a reputation beyond reputejam has a reputation beyond reputejam has a reputation beyond reputejam has a reputation beyond reputejam has a reputation beyond reputejam has a reputation beyond reputejam has a reputation beyond repute
Default PHP Email form help

Hey,
So I'm making this site atm, and on one page, I have an Email form.
At the moment, it just emails me, and uses a CAPATCHA (sp?).
I want to include a part where people can upload photos only. (.jpg, .gif, .png)

I have looked on the net, but I can't find what I'm looking for. I would greatly appreciate it if someone could help me out!

Here is my code so far:

HTML:
Code:
<form method="post" action="scripts/captcha.php">
  	Your Email: *<br><input name="email" type="text" size="40"/><br><br>
  	Message:<br>
  	<textarea name="message" rows="8" cols="35">Write Comment Here</textarea><br>
	<img src="scripts/captcha_image.php" /><br />
	<input type="text" name="captcha_input" size="15"><br />
  	<input type="submit" value="Send To Jam"/>
	</form>
PHP:
Code:
<?

session_start();



if ($_SERVER["REQUEST_METHOD"] <> "POST")

	die("You can only reach this page by posting from the html form");



if ($_POST["captcha_input"] == $_SESSION["pass"])

{


  $email = $_REQUEST['email'] ;
  $message = $_REQUEST['message'] ; 

  mail( "XXX@hotmail.com", "POACHER 2008 - www.theworldofjam.com",
    $message, "From: $email" );
  header( "Location:../thankyou.html" );    

       



} else {

	echo "Sorry, The CAPTCHA You Entered Was Incorrect.";
	echo "<br/>";
	echo "Please Go Back And Try Again.";

}

?>
Thanks In Advice!
...And I would gladly link to your site if you could help me
__________________


Become a Premium Member today!
- Advert Free - Increased PM Storage - 1,000,000 C$ - Increased Avatar Size - Access To Premium Members Forum - Colored Username -
_______________________________________
Excellent day for putting Slinkies on
an escalator.


JamsUbuntu.blogspot.com
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 03-28-2008, 10:14 PM
Mr Pickles's Avatar
Gone
 
Join Date: 15 Feb 2008
Location: Colchester, Essex
Posts: 759
Mr Pickles has a reputation beyond reputeMr Pickles has a reputation beyond reputeMr Pickles has a reputation beyond reputeMr Pickles has a reputation beyond reputeMr Pickles has a reputation beyond reputeMr Pickles has a reputation beyond reputeMr Pickles has a reputation beyond reputeMr Pickles has a reputation beyond reputeMr Pickles has a reputation beyond reputeMr Pickles has a reputation beyond reputeMr Pickles has a reputation beyond repute
Default

Jam, Do u know perl? as I have a better soloution using perl.
Quote:
<form name="formname" method="post" enctype="multipart/form-data" action="upload.asp">
<input type="file" name="filetoupload">
<input name="Submit" value="Submit" type="submit">
The perl solution would be:

Quote:
## All query data is stored in %qs from a standard read/parse.
## Maximum number of pics allowed for upload?
$uploads_allowed = 2;

## If 0 images is not possible just start at 1.
if (! $qs{'num_pics'}) {
$form = qq¦
<form method="post" action="yourscript">
Please enter how many pics you will upload (if none, select 0.)
<select name="num_pics">
¦;
for $i (0..$uploads_allowed) {
$form .= qq¦<option value="$i">$i</option>\n¦;
}
$form .= qq¦
</select>
<input type="submit" value="Continue">
</form>
¦;
}

else {
$form = qq¦
<form method="post" enctype="multipart/form-data" action="yourscript">
<input type="hidden" name="num_pics" value="$qs{'num_pics'}">
¦;

## if number of pics is zero, it will do nothing here.
for $i (1..$qs{'num_pics'}) {
$label = 'File ' . $i;
$obj_name = 'file_' . $i;
$form .= qq¦$label: <input type="file" name="$obj_name"><br>\n¦;
}

$form .= qq¦
<input type="submit" name="submitButton" value="upload">
</form>
¦;
I dont know if any of this is helpful to you or not Jam?
__________________
Mr Pickles
Moderator

Please consider Premium Member Ship Here
Please follow and obey the rules of the forum. Failure to do so could result in an infraction or ban
NO PM's For help, they will be ignored
Please vote in Contributor of the Month
For all your Hosting Centicero




Reply With Quote
  #3 (permalink)  
Old 03-29-2008, 12:39 PM
jam's Avatar
jam jam is online now
CompuForums Moderator
 
Join Date: 02 Mar 2008
Location: In My Own Little World
Posts: 550
jam has a reputation beyond reputejam has a reputation beyond reputejam has a reputation beyond reputejam has a reputation beyond reputejam has a reputation beyond reputejam has a reputation beyond reputejam has a reputation beyond reputejam has a reputation beyond reputejam has a reputation beyond reputejam has a reputation beyond reputejam has a reputation beyond repute
Default

Thanks for the reply justin..
And no, I haven't even looked at perl before.

With this script, is there anyway of still using my capatcha thing with it?
And just wondering, how do I test that code out? Like hat format do I save it in?

Thanks
__________________


Become a Premium Member today!
- Advert Free - Increased PM Storage - 1,000,000 C$ - Increased Avatar Size - Access To Premium Members Forum - Colored Username -
_______________________________________
Excellent day for putting Slinkies on
an escalator.


JamsUbuntu.blogspot.com
Reply With Quote
  #4 (permalink)  
Old 03-29-2008, 02:09 PM
Ash's Avatar
Ash Ash is online now
CF owner
 
Join Date: 27 Jul 2005
Location: Devon, UK
Posts: 4,099
Ash has a reputation beyond reputeAsh has a reputation beyond reputeAsh has a reputation beyond reputeAsh has a reputation beyond reputeAsh has a reputation beyond reputeAsh has a reputation beyond reputeAsh has a reputation beyond reputeAsh has a reputation beyond reputeAsh has a reputation beyond reputeAsh has a reputation beyond reputeAsh has a reputation beyond repute
Default

.pl or .cgi should work fine - you would have to have some kind of Perl / CGI loaded on your development box for it to wor.
__________________
Thanks,
Ash
CF Founder

Great Webhosting. Shared starting at $2 per month. VPSes starting at $6 per month.
www.Centicero.com

Want to get in touch? Send me a PM | Do you want to continue receiving free help? Or do you want this site to close? Become a premium member.
Reply With Quote
  #5 (permalink)  
Old 04-12-2008, 12:56 AM
New Member
 
Join Date: 06 Apr 2008
Posts: 11
abajan will become famous soon enough
Default Re: PHP Email form help

Just one important question, jam: Are you using a free host for your site? If so, bear in mind that if they ever decide to disable PHP, the form will become unusable and you would have no recourse but to switch hosts.

There have been a couple of times where I've spent many hours building elaborate websites, including forms, that required PHP to function correctly, only to have the (free) host yank PHP because users started abusing the system and hogging resources.

By the way, PERL is said to be much more difficult to master than PHP but it's also said to be better by those "in the know". So, if you think you're up to it, more power to you! ;-)
Reply With Quote
  #6 (permalink)  
Old 04-12-2008, 01:22 AM
Ash's Avatar
Ash Ash is online now
CF owner
 
Join Date: 27 Jul 2005
Location: Devon, UK
Posts: 4,099
Ash has a reputation beyond reputeAsh has a reputation beyond reputeAsh has a reputation beyond reputeAsh has a reputation beyond reputeAsh has a reputation beyond reputeAsh has a reputation beyond reputeAsh has a reputation beyond reputeAsh has a reputation beyond reputeAsh has a reputation beyond reputeAsh has a reputation beyond reputeAsh has a reputation beyond repute
Default Re: PHP Email form help

The thing of course with Perl is that it does indeed use plenty of server resources, as opposed to PHP - if you can get something written in PHP rather than Perl, then you should do so.
__________________
Thanks,
Ash
CF Founder

Great Webhosting. Shared starting at $2 per month. VPSes starting at $6 per month.
www.Centicero.com

Want to get in touch? Send me a PM | Do you want to continue receiving free help? Or do you want this site to close? Become a premium member.
Reply With Quote
  #7 (permalink)  
Old 04-12-2008, 03:42 PM
jam's Avatar
jam jam is online now
CompuForums Moderator
 
Join Date: 02 Mar 2008
Location: In My Own Little World
Posts: 550
jam has a reputation beyond reputejam has a reputation beyond reputejam has a reputation beyond reputejam has a reputation beyond reputejam has a reputation beyond reputejam has a reputation beyond reputejam has a reputation beyond reputejam has a reputation beyond reputejam has a reputation beyond reputejam has a reputation beyond reputejam has a reputation beyond repute
Default Re: PHP Email form help

Yes, I have my own hosting space that I'm using.
And I had a go with the perl script, but I think I may of done something wrong, as it wasn't working :S

But anyways, I've decided not to use this idea anymore..
Thanks for the reply though!

Jam
__________________


Become a Premium Member today!
- Advert Free - Increased PM Storage - 1,000,000 C$ - Increased Avatar Size - Access To Premium Members Forum - Colored Username -
_______________________________________
Excellent day for putting Slinkies on
an escalator.


JamsUbuntu.blogspot.com
Reply With Quote
  #8 (permalink)  
Old 04-12-2008, 05:35 PM
Ash's Avatar
Ash Ash is online now
CF owner
 
Join Date: 27 Jul 2005
Location: Devon, UK
Posts: 4,099
Ash has a reputation beyond reputeAsh has a reputation beyond reputeAsh has a reputation beyond reputeAsh has a reputation beyond reputeAsh has a reputation beyond reputeAsh has a reputation beyond reputeAsh has a reputation beyond reputeAsh has a reputation beyond reputeAsh has a reputation beyond reputeAsh has a reputation beyond reputeAsh has a reputation beyond repute
Default Re: PHP Email form help

PHP mail scripts work fine on the server, and so should Perl, unless your reseller has disabled it.
__________________
Thanks,
Ash
CF Founder

Great Webhosting. Shared starting at $2 per month. VPSes starting at $6 per month.
www.Centicero.com

Want to get in touch? Send me a PM | Do you want to continue receiving free help? Or do you want this site to close? Become a premium member.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT. The time now is 08:17 PM.



Powered by: vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Limited.
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
Content © Copyright 2005-2008 CompuForums. All Rights Reserved. Some content © Copyright of the respective owners.
Phoenix Landscaping - Credit Counseling - Internet Marketing - Bad Credit Loans

Content Relevant URLs by vBSEO 3.2.0 RC5