Jump to content

Trizen

Members
  • Posts

    43
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Male
  • Location
    Dallas, TX

Trizen's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. yo read my post i said sorry.
  2. ok i have been trying to figure this out but what happens when i fill out the form and put in the incorrect code(on purpose) it is supposed to redirect me back to the join.php page witht he form filled like it was when they hit submit. but it doesnt. can anyone help or know how i can do this differently?
  3. ok i have this script to save my form data so that i can have it available on the page when they have to go back because of an invalid security code <!-- /* Author: Alex Osipov (alex@acky.net) Publisher: ACKY.NET */ // Global variables. domain = ''; path = '/'; secure = 0; // Function to save a field. function save_field(obj) { var cookie_value = ''; var objType = new String(obj.type); switch(objType.toLowerCase()) { case "checkbox" : if (obj.checked) cookie_value = obj.name + '=[1]' else cookie_value = obj.name + '=[0]' break; case "undefined" : // a.k.a. radio field. for (var i = 0; i < obj.length; i++) { if (obj[i].checked) cookie_value = obj[i].name + '=[' + i + ']' } break; case "select-one" : cookie_value = obj.name + '=[' + obj.selectedIndex + ']'; break; case "select-multiple" : cookie_value = obj.name + '=['; for (var i = 0; i < obj.options.length; i++) { if (obj.options[i].selected) cookie_value += '+' + i } cookie_value += ']'; break; default : // We assume all other fields will have // a valid obj.name and obj.value cookie_value = obj.name + '=[' + obj.value + ']'; } if (cookie_value) { var expires = new Date(); expires.setYear(expires.getYear() + 1); document.cookie = cookie_value + ((domain.length > 0) ? ';domain=' + domain : '') + ((path) ? ';path=' + path : '') + ((secure) ? ';secure' : '') + ';expires=' + expires.toGMTString(); } return 1; } // Function to retrieve a field. function retrieve_field(obj) { var cookie = '', real_value = ''; cookie = document.cookie; var objType = new String(obj.type); if (obj.name) var objName = new String(obj.name); else var objName = new String(obj[0].name); var offset_start = cookie.indexOf(objName + '=['); if (offset_start == -1) return 1; var offset_start_length = objName.length + 2; offset_start = offset_start + offset_start_length; var offset_end = cookie.indexOf(']', offset_start); real_value = cookie.substring(offset_start, offset_end); switch(objType.toLowerCase()) { case "checkbox" : if (real_value == '1') obj.checked = 1 else obj.checked = 0 break; case "undefined" : obj[real_value].checked = 1; break; case "select-one" : obj.selectedIndex = real_value; break; case "select-multiple" : for (var i = 0; i < obj.options.length; i++) { if ((real_value.indexOf('+' + i)) > -1) obj.options[i].selected = 1; else obj.options[i].selected = 0; } break; default : obj.value = real_value; break; } return 1; } // End JavaScript --> This is the page with the form <html> <body onLoad= "retrieve_field(document.form.First_Name); retrieve_field(document.form.Age); retrieve_field(document.form.Last_Name); retrieve_field(document.form.Job); retrieve_field(document.form.Email); retrieve_field(document.form.Tue); retrieve_field(document.form.Wed);retrieve_field(document.form.Thur); retrieve_field(document.form.Frid); retrieve_field(document.form.Sat); retrieve_field(document.form.Sun); retrieve_field(document.form.Mon); retrieve_field(document.form.Sponsor); retrieve_field(document.form.Languages); retrieve_field(document.form.Link); retrieve_field(document.form.Open_Source); retrieve_field(document.form.Help); retrieve_field(document.form.Help1); retrieve_field(document.form.Policy);"> <span style="font-style:regular;"> <table width="820" cellspacing="0" cellpadding="0"> <tr> <td style="font-size:11px;text-align:left;padding-top:10px;padding-left:20px;padding-right:10px;padding-bottom:10px;"> <script src="includes/savecookie.js" type="text/javascript"></script> <script language="JavaScript" type="text/javascript"> <!-- function validate(form) { if (form.First_Name.value == "") { alert("\"First Name\" is required"); form.First_Name.focus(); return (false); } if (form.Age.value == "") { alert("\"Age\" is required"); form.Age.focus(); return (false); } if (form.Last_Name.value == "") { alert("\"Last Name\" is required"); form.Last_Name.focus(); return (false); } if (form.Job.value == "") { alert("\"Job\" is required"); form.Job.focus(); return (false); } if (form.Email.value == "") { alert("\"Email Address\" is required"); form.Email.focus(); return (false); } if (form.Email.value.search("@") == -1 || form.Email.value.search("[.*]") == -1) { alert("Please enter a valid Email Address"); form.Email.focus(); return false; } if (form.Tue.value == "") { alert("\"Tue Availibilty\" is required"); form.Tue.focus(); return (false); } if (form.Wed.value == "") { alert("\"Wed Availibilty\" is required"); form.Wed.focus(); return (false); } if (form.Thur.value == "") { alert("\"Thur Availibilty\" is required"); form.Thur.focus(); return (false); } if (form.Frid.value == "") { alert("\"Frid Availibilty\" is required"); form.Frid.focus(); return (false); } if (form.Sat.value == "") { alert("\"Sat Availibilty\" is required"); form.Sat.focus(); return (false); } if (form.Sun.value == "") { alert("\"Sun Availibilty\" is required"); form.Sun.focus(); return (false); } if (form.Mon.value == "") { alert("\"Mon Availibilty\" is required"); form.Mon.focus(); return (false); } if (form.Sponsor.value == "") { alert("\"Sponsor\" is required"); form.Sponsor.focus(); return (false); } if (form.Languages.value == "") { alert("\"Program Languages\" are required"); form.Languages.focus(); return (false); } if (form.Link.value == "") { alert("\"Project Link\" is required"); form.Link.focus(); return (false); } if (form.Open_Source.value == "") { alert("All Fields must be filled out\"\" this is required"); form.Open_Source.focus(); return (false); } if (form.Offer.value == "") { alert("\"What can you offer to the community?\" is required"); form.Offer.focus(); return (false); } if (form.Help.value == "") { alert("\"What do you need help with the most?\" is required"); form.Help.focus(); return (false); } if (form.Help1.value == "") { alert("\"How can we help you?\" is required"); form.Help1.focus(); return (false); } if (form.Policy.value == "") { alert("\"Have you read the Policy of this site and fully understand and Agree with it?\" is required"); form.Policy.focus(); return (false); } if (form.captcha_code.value == "") { alert("\"Security Code\" is required"); form.captcha_code.focus(); return (false); } return true; } //--> </script> <?php if (empty($_POST)) { ?> <form method="post" action="/mail.php" name="form" onSubmit="return validate(this); save_field(this.First_Name); save_field(this.Last_Name); save_field(this.Age); save_field(this.Job); save_field(this.Email); save_field(this.Tue); save_field(this.Wed); save_field(this.Thur); save_field(this.Frid); save_field(this.Sat); save_field(this.Sun); save_field(this.Mon); save_field(this.Sponsor); save_field(this.Languages); save_field(this.Link); save_field(this.Open_Source); save_field(this.Help); save_field(this.Help1); save_field(this.Policy)"> <strong>First Name</strong><br /> <input type="text" class="post" name="First_Name" size="25" maxlength="40" value="" /> <br /> <br /> <b>Last Name</b><br /> <input type="text" class="post" name="Last_Name" size="25" maxlength="40" value="" /> <br /> <br /> <b>Age</b><br /> <input type="text" class="post" name="Age" size="25" maxlength="40" value="" /> <br /> <br /> <b>Job</b><br /> <input type="text" class="post" name="Job" size="25" maxlength="40" value="" /> <br /> <br /> <b>Email Adress</b><br /> <input type="text" class="post" name="Email" size="25" maxlength="40" value="" /> <br /> <br /> <br> <b>What is your availability like?</b> (if not available the please put none in the boxes)<br> <TABLE> <TR> <TD style="font-size:11px;text-align:left;padding-top:10px;padding-left:20px;padding-right:10px;padding-bottom:10px;"> <b>Tue:</b></TD> <TD> <input type="text" class="post" name="Tue" size="25" maxlength="40" value="" /><br></TD> </TR> <TR> <TD style="font-size:11px;text-align:left;padding-top:10px;padding-left:20px;padding-right:10px;padding-bottom:10px;"> <b>Wed:</b></TD> <TD> <input type="text" class="post" name="Wed" size="25" maxlength="40" value="" /><br></TD> </TR> <TR> <TD style="font-size:11px;text-align:left;padding-top:10px;padding-left:20px;padding-right:10px;padding-bottom:10px;"> <b>Thur:</b></TD> <TD> <input type="text" class="post" name="Thur" size="25" maxlength="40" value="" /><Br></TD> </TR> <TR> <TD style="font-size:11px;text-align:left;padding-top:10px;padding-left:20px;padding-right:10px;padding-bottom:10px;"> <b>Fri:</b></TD> <TD> <input type="text" class="post" name="Frid" size="25" maxlength="40" value="" /><Br></TD> </TR> <TR> <TD style="font-size:11px;text-align:left;padding-top:10px;padding-left:20px;padding-right:10px;padding-bottom:10px;"> <b>Sat:</b></TD> <TD> <input type="text" class="post" name="Sat" size="25" maxlength="40" value="" /><br></TD> </TR> <TR> <TD style="font-size:11px;text-align:left;padding-top:10px;padding-left:20px;padding-right:10px;padding-bottom:10px;"> <b>Sun:</b></TD> <TD> <input type="text" class="post" name="Sun" size="25" maxlength="40" value="" /><br></TD> </TR> <TR> <TD style="font-size:11px;text-align:left;padding-top:10px;padding-left:20px;padding-right:10px;padding-bottom:10px;"> <b>Mon:</b></TD> <TD> <input type="text" class="post" name="Mon" size="25" maxlength="40" value="" /><br></TD> </TR> </TABLE> <p><br /> <b>Do you know anyone in the Community who will sponsor you?</b><br /> <input type="text" class="post" name="Sponsor" size="25" maxlength="40" value="" /> <br /> <br /> <b>List your the languages you can program in.</b><br /> <textarea rows="5" cols="25" name="Languages"></textarea> <br /> <br /> <b>Link one of you more successful web projects.</b><br /> <input type="text" class="post" name="Link" size="25" maxlength="100" value="" /> <br /> <br /> <b>Can you handle working with others in an open source enviornment with the knowledge that some people may use<br> the information obtained here for there projects and may make a personal gain? Everything is free here and if to<br> be used as you see fit, webdevolpments.com will own all<br> information on the site once submitted and will share all information to<br> all registered members of the community to use as anyone sees fit.</b><br /> <input type="text" class="post" name="Open_Source" size="25" maxlength="40" value="" /> <br /> <br /> <b>What can you offer to the community?</b><br /> <textarea rows="5" cols="25" name="Offer"></textarea> <br /> <br /> <b>What do you need help with the most?</b><br /> <input type="text" class="post" name="Help" size="25" maxlength="40" value="" /> <br /> <br /> <b>How can we help you?</b><br /> <textarea rows="5" cols="25" name="Help1"></textarea> <br /> <br /> <br /> Have you read the Policy of this site and fully understand and Agree with it?<br /> <input type="text" class="post" name="Policy" size="25" maxlength="40" value="" /> </p> <a href="#" onClick="document.getElementById('captcha').src = '/securimage/securimage_show.php?' + Math.random(); return false">Reload Image</a> <p> </p> <p><br /> <img id="captcha" src="/securimage/securimage_show.php" alt="CAPTCHA Image" /></p> <p> Please type the security code you see in the box above.<br> <input type="text" name="captcha_code" size="10" maxlength="6" /> </p> <p> <br /> <input type="submit" value="Submit Application" /> </p> </form> <?php } else { //form is posted include("securimage.php"); $img = new Securimage(); $valid = $img->check($_POST['code']); if($valid == true) { echo "<center>Thanks, you entered the correct code.</center>"; } else { echo "<center>Sorry, the code you entered was invalid. <a href=\"javascript:history.go(-1)\">Go back</a> to try again.</center>"; } } ?> </body> </html> Im not sure what im doing wrong but here is some other info if it helps to see what else is going on. my form handler <?PHP include_once $_SERVER['DOCUMENT_ROOT'] . '/webdevolpments/securimage/securimage.php'; $securimage = new Securimage(); if ($securimage->check($_POST['captcha_code']) == false) { die (header("Location:captcha_error.php")); } $date = date ("l, F jS, Y"); $time = date ("h:i A"); $location = "appsubmit.php"; $to = 'anthonym321@verizon.net'; $From = 'admin@webdevolpments.com'; $subject = 'Application'; $forward ="1"; $headers = "App"; $msg = "Application. It was submitted on $date at $time.\n\n"; if ($_SERVER['REQUEST_METHOD'] == "POST") { foreach ($_POST as $key => $value) { $msg .= ucfirst ($key) ." : ". $value . "\n"; } } else { foreach ($_GET as $key => $value) { $msg .= ucfirst ($key) ." : ". $value . "\n"; } } mail($to, $subject, $msg, $headers); if ($forward == 1) { header ("Location:$location"); } else { echo "Thank you for your Application."; } if ($forward == 1) { header ("Location:$location"); } ?> This one is my captcha error page <?php echo ("<script>alert('Incorrect Security Code Entered')</script>"); ?> <script type="text/javascript"> <!-- window.location = "javascript:history.go(-1);" //--> </script> If you need anything else let me know, also my pages are called dynamically with php if that makes a difference, which i dont think it should. my web site is webdevolpments.com Thanks for any help i can get to make this work. Also in the javascript page what are the values of global variables supposed to be: domain = '';path = '/';secure = 0;
  4. i got it i used the <?php include_once $_SERVER['DOCUMENT_ROOT'] . '/webdevolpments/securimage/securimage.php'; $securimage = new Securimage(); if ($securimage->check($_POST['captcha_code']) == false) { header("Location: captcha_error.php") } ?> then made captcha_error.php like this <?php echo ("<script>alert('Incorrect Security Code Entered')</script>"); ?> <script type="text/javascript"> <!-- window.location = "http://webdevolpments.com/?p=join" //--> </script> now it notifies them they input the incorrect code and sends them back to the page.
  5. ok i got a header error because it says that there was already a header output. anyways sorry for going off, i was up till 5 in the morning and had to get up to go see the folks. but i was responding the post before mine which the guy posted about the alert script added to my existing script which he said it would most likely give me an error which i was just confirming for him.
  6. ok so your going to flame me about telepathy cause your not sherlock holmes... pay attention to the differences and maybe you wouldnt find the need to act like a douche and make other mad.
  7. anyone got any ideas, i tried the http_referer but i got errors on that too.
  8. Ok i would like to change this ever so slightly to not only go back to the page i need but also display a message in a popup or on the page somewhere that they entered an invalid security code. im at a loss. i might just be im trying to do this at 4 in the morning... include_once $_SERVER['DOCUMENT_ROOT'] . '/webdevolpments/securimage/securimage.php'; $securimage = new Securimage(); if ($securimage->check($_POST['captcha_code']) == false) { // the code was incorrect // handle the error accordingly with your other error checking // or you can do something really basic like this die (header("Location: http://webdevolpments.com/?p=join")); Thanks for your help in advance
  9. Thanks rajivgonsalves you the man i tried your script and it works like a charm i love it im going to use it from now on. Thanks a Lot
  10. thats what i been asking for. how to i make a script to find all the filenames then and then populate my definedpages array with those names.
  11. make a validation checking for the file ext to look for .doc .pdf .xls or .ppt.
  12. because i would not have to update my script every time i add a link to the site it would do it for me.
  13. no look at my first post. thats what i want to do.
  14. i know photoshop has the ability to convert our images into a source template. i would try that then post the source into something like dreamweaver and then edit as needed then copy the template in the the $message area.
×
×
  • 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.