Jump to content

ndowens

Members
  • Posts

    11
  • Joined

  • Last visited

    Never

Contact Methods

  • Website URL
    http://ndowens.tk

Profile Information

  • Gender
    Not Telling

ndowens's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. As well I tried starting from scratch and nothing <?php class contactme { function contact() { $to = '****'; $_SESSION[input] = $_POST['captcha']; $from = $_POST['from']; $subject = $_POST['subject']; $message = $_POST['message']; $captcha = $_POST['captcha']; if($from && $subject && $message) { mail($to, "$subject", $message, "From:$from"); echo "Thank you, $from, message has been sent"; } else { echo "All fields are required in order to send message"; } } } class captcha { function intCap() { session_start(); $math[1] = rand(0,20); $math[2] = rand(0,20); $_SESSION[ans] = $math[1] + $math[2]; echo "$math[1]".'+'."$math[2]"; $_SESSION[input] = $_POST['captcha']; if(!empty($_POST['captcha']) && $_SESSION[ans] == $_SESSION[input]) { echo "They match"; session_destroy(); } else { echo ""; } } } ?>
  2. I even copied the code you provided, and it still doesn't work, it still doesn't seem to remember the answer and what was typed for the captcha.
  3. <?php session_start(); class contactme { function contact() { $to = 'email@email.com'; $from = $_POST['from']; $subject = $_POST['subject']; $message = $_POST['message']; if($from && $subject && $message) { mail($to, "$subject", $message, "From:$from"); echo "Thank you, $from, message has been sent"; } else { echo "All fields are required in order to send message"; } } } class captcha { function _captcha() { $captchamsg = rand(500,7000); $_SESSION['saved'] = $captchamsg; $captchainput = $_POST['captcha']; echo "$captchamsg <br />"; if(empty($_POST['captcha'])) { echo ""; } if(!empty($_POST['captcha']) && $_SESSION['saved'] == $_POST['captcha']) { $post = new contactme(); $post->contact(); session_destroy(); } else { echo "Sorry CAPTCHA didn't match"; session_destroy(); } } } ?> <form method="post" action="<?php $_SERVER['PHP_SELF'];?>"> Email:<br /> <input type="text" name="from"><br /> Subject:<br /> <input type="text" name="subject"><br /> Message:<br /> <textarea name="message"></textarea> <br /> Captcha: <?php $captcha = new captcha(); $captcha->_captcha(); echo "<br /><input type='text' name='captcha'><br />"; echo "<br />"; echo <<<BODY <br /> <input type="submit" value="Submit Message"> </form> BODY; echo "<br />"; ?> I can not get it to work, from what it appears is that the browser isn't remembering what the answer to the math problem is and what was input'd from the user. I have rewrote this script over and over and it just doesn't want to work.
  4. I am learning PHP, and probably the best way for me to learn is actually by doing. I have created my own breadcrumb and made my site database driven. Now I need a idea on what else I can do on my site that I can do to it with PHP. Keep in mind, don't give me a too hard of a idea lol.
  5. ndowens

    PHP Book

    I am glad, because I have already improved on my online grammer :-)
  6. ndowens

    PHP Book

    HAH that is funny. Figured that teacher should know the subject before teaching.
  7. ndowens

    PHP Book

    Thanks for the reply. So far I have created my own breadcrumb, simple really, and made my site completely database driven. So now hoping to learn more, since I am still a beginner
  8. ndowens

    PHP Book

    I was wanting to get your input about the book "Beginning PHP 5 and MySQL: From Novice to Professional (Paperback)" I bought it, so far haven't got it. I didn't see a whole lot of reviews about it.
  9. Looks like you are right, it only takes two posts, since before this post I am just writing I had two posts and now the captcha isn't there. YAY I am so glad. Makes my posting a whole lot easier to post questions and try and answer
  10. I was wondering about getting rid of the CAPTCHAs but I hope it is right, that after my tenth post it will go away. They get annoying after a while.
  11. You can rename the .html file to .php or in your .htaccess file add AddHandler application/x-httpd-php .php .html
  12. I thought I would say hello to everyone. I am learning PHP. So forgive me if I ask stupid questions. :-)
×
×
  • 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.