
sphinx
Members-
Posts
206 -
Joined
-
Last visited
Everything posted by sphinx
-
sorry, On that note: <?php if (isset($_GET['sent']) && isset($_GET['sent1'])) include('sotw.php'); ?> The above code doesnt display sotw.php on either sent or sent1, however, if i only have one of them it works. Thanks
-
Great thanks.
-
Hi there, I'm currently using the below code to allow one isset which is ?sent, I also want to add another in this case ?sent1 <?php $link ='index.php?sent'; if (!isset($_GET['sent'])) include 'contact.php'; ?> An example of what I mean is below (obviously it doesn't work ) <?php $link ='index.php?sent'; if (!isset($_GET['sent']) & ['sent1'])) include 'contact.php'; ?> Many thanks
-
Hi there, At present i'm using this to check for blank fields: <script language="JavaScript"> var frmvalidator = new Validator("contact_form"); frmvalidator.EnableOnPageErrorDisplaySingleBox(); frmvalidator.EnableMsgsTogether(); frmvalidator.addValidation("name","req","You have not entered a name."); frmvalidator.addValidation("email","req","You must supply an email address."); frmvalidator.addValidation("message","req","You have not entered a message."); frmvalidator.addValidation("email","email","That email address you have supplied is not valid."); frmvalidator.addValidation("sixletterscode","req","Please enter the four characters into the specified box."); </script> which relates too: <form method="POST" name="contact_form" action="/?captcha_fail"> At present, that puts the errors in one block like: You have not entered a name. You must supply an email address. You have not entered a message. Please enter the four characters into the specified box. And is displayed by: <div id='contact_form_errorloc' class='err'></div> Basically, I want to seperate the prompts under each field instead of all clumped together. Many thanks
-
hello, Why is the id field "sixletterscode" displaying in red when i view the source? <label for='message' class="title"><strong>Enter the characters below in the specified box:</strong> <small>(four characters).</small></label> <br><input type="text" style="Arial, Helvetica, sans-serif;font-size : 12px;color: #781351;background: #fee3ad;border: 1px solid #781351; text-align: center; id="sixletterscode" autocomplete="off" maxlength="4" size="10" name="sixletterscode" onkeypress="return isNumberKey(event)"><br> <br><img border="1" src="security.php?rand=1676626762" id='captchaimg' > Many thanks
-
Hello, I'm want to manually configure what URL's can display a frame, in which I'm using this: $frame = 1; I basically need a code in which I can define what links display the frame, otherwise, the below code shows: $frame = 0; All my links follow the following format: http://site.com/link http://site.com/link2 Thanks! PS: I've provided an example of code to help you understand, however, i'm unsure how to allow multiple prefix's and include 'else': $link ='index.php?link'; if (isset($_GET['link'])) $frame = 1; } else { $frame = 0; No echo required, it's a config.php file.
-
Parse error: syntax error, unexpected $end
-
Hello, I'm using the following code to echo what fields have been left blank: if(isset($_POST['submit'])) { $emailconfirm = $_POST['emailconfirm']; $name = trim($_POST['name']); $visitor_email = trim($_POST['email']); $user_message = trim($_POST['message']); if(empty($name)){ $name1 .= "<br>Name is empty."; } if(empty($visitor_email)){ $email1 .= "<br>Email is empty."; } if(empty($user_message)){ $message1 .= "<br>User Message is empty."; } But what seems to happen, is once you submit the form with blank fields, the echo does show, however, when you click submit again, the form submits even though the fields were blank. Is their a way of blocking 'post' if the fields are blank? Thanks
-
Defining what fields have actually been left blank
sphinx replied to sphinx's topic in PHP Coding Help
Sorry this has got me, what's a trim. edit: unexpected '{ Cheers -
Hello, I'm using the below code to determine whether fields have been left blank, however, it only a standard sentence, i'd like to customise it, like: "Email has been left blank" or The email and message has been left blank. My best preference would be to bullet point each line. IE: Email has been left blank. Message has been left blank. $name = $_POST['name']; $visitor_email = $_POST['email']; $user_message = $_POST['message']; if(empty($name)|| empty($visitor_email)|| empty($user_message)) { $errors .= "\n Some of the above fields have not been filled in.<br><br> "; } Many thanks.
-
Sweet stuff, ThAnK You!
-
Aha, most likely $fromnoreply = '[email protected]'; $headers2 = "From: $fromnoreply \r\n"; $headers2 .= "";
-
Thanks for your reply, it's actually echoed as an email 'donotreply' confirmation email: mail($confirmation, $consubject, $body2,$headers2);
-
Hi there, This doesn't seem to echo as attempted, is their a way of doing this? $body2 = "Hello $name, \n <strong>I want to make this paragraph bold!</strong>\n"; Displays as: Hello John Smith, <strong>I want to make this paragraph bold!</strong> I want to format the text making it bold, but it displays the <strong> tags. Thanks
-
Hi guys, I've finally finished the contact form for my domain landing page. Please test it out and let me know of any possible flaws. (etc: Field checker, CAPTCHA etc). Thank you! http://www.gold4fun.co.uk/ Ownership proof: http://domain.gold4fun.co.uk/phpfreaks.txt
-
displaying email at bottom of confirmation email
sphinx replied to sphinx's topic in PHP Coding Help
superb, thanks, ended it with: please do not reply to it.\n"; Worked perfectly, thanks -
// for your case, example 2 "field2" would be an email field. //"field4" would be captcha. if(isset($_POST['submit'])) { $field1 = $_POST['field1']; $field2 = $_POST['field2']; $field3 = $_POST['field3']; if(empty($field1)|| empty($field2)|| empty($field3)) { $errors .= "\n Some of the above fields have not been filled in."; } //Injection not nessessary but recommended to avoid idiots. if(IsInjected($field2)) { $errors .= "\n That email is not valid."; } if(empty($_SESSION['field4'] ) || strcasecmp($_SESSION['field4'], $_POST['field4']) != 0) { $errors .= "\n Those three characters entered are incorrect. Please try again, alternatively click <a href='javascript:refreshCaptcha();'>here</a> to refresh the characters."; } //start of injection function IsInjected($str) { $injections = array('(\n+)', '(\r+)', '(\t+)', '(%0A+)', '(%0D+)', '(%08+)', '(%09+)' ); $inject = join('|', $injections); $inject = "/$inject/i"; if(preg_match($inject,$str)) { return true; } else { return false; } } Remove the captcha part if you don't want it incorporated.
-
Why don't you just add captcha? Or add field checkers.
-
displaying email at bottom of confirmation email
sphinx replied to sphinx's topic in PHP Coding Help
No I don't control the email server and i'm looking at it through out look. Is this likely to be server related? I couldn't see the problem from the code either. Thanks -
Hello, When a user sends a message using my contact form, they will get a confirmation to the supplied email to confirm that the email has been recieved, one problem is, the auto-reply message displays "[email protected]" at the bottom of it, here is some of my code: //AUTO-REPLY CLIENT CODE START $confirmation = $visitor_email; $consubject="Your message has been recieved"; $body2 = "Hello $name, \nThe below message has now been recieved.\n\n >> $user_message <<\n\nWe will reply to you shortly.\n\nThank you,\n\nThe website Team.\n\n\nThis is an automated message, please do not reply to it.\n". $fromnoreply = '[email protected]'; //AUTO-REPLY CLIENT CODE END //TO WEBMAIL CODE START $to = $your_email; $subject="Contact form - $name"; $from = $visitor_email; $from = $your_email; $ip = isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : ''; $body = "A user $name submitted the contact form:\n". "Name: $name\n". "Email: $visitor_email \n". "Message: \n ". "$user_message\n". "IP: $ip\n"; //TO WEBMAIL CODE END //headers $headers = "From: $from \r\n"; $headers .= "Reply-To: $visitor_email \r\n"; $headers2 = "From: $fromnoreply \r\n"; $headers2 .= ""; // the important stuff!, yes definately! JAMES mail($to, $subject, $body,$headers); mail($confirmation, $consubject, $body2,$headers2); header('Location: ?sent'); //where shall i go once message is sent?? Possibly here. *wink* The above code automatically sends the below email to the client aswell as sending the clients message to me. Hello Bob Smith, The below message has now been recieved. >> This is a test << We will reply to you shortly. Thank you, The website Team. This is an automated message, please do not reply to it. [email protected] My objective is to remove the displayed email at the bottom of the message. Many thanks
-
Hello, I'm using this code to display how many characters remain in a text box: <script language = "Javascript"> maxL=500; var bName = navigator.appName; function taLimit(taObj) { if (taObj.value.length==maxL) return false; return true; } function taCount(taObj,Cnt) { objCnt=createObject(Cnt); objVal=taObj.value; if (objVal.length>maxL) objVal=objVal.substring(0,maxL); if (objCnt) { if(bName == "Netscape"){ objCnt.textContent=maxL-objVal.length;} else{objCnt.innerText=maxL-objVal.length;} } return true; } function createObject(objId) { if (document.getElementById) return document.getElementById(objId); else if (document.layers) return eval("document." + objId); else if (document.all) return eval("document.all." + objId); else return eval("document." + objId); } </script> However, when all 500 characters have been filled, it doesn't let you remove any characters, anyone know why? Thanks
-
Thanks!!
-
For some reason, this include function is putting a "1" on my website, why? <?php $link ='index.php?sent'; if (!isset($_GET['sent'])) echo include('contact.php'); ?> Thanks!
-
Hello, I want php to display a random combination of numbers in the text box, im trying: <?php function createRandomPassword() { $chars = "abcdefghijkmnopqrstuvwxyz023456789"; srand((double)microtime()*1000000); $i = 0; $pass = '' ; while ($i <= 5) { $num = rand() % 33; $tmp = substr($chars, $num, 1); $pass = $pass . $tmp; $i++; } return $pass; } $password = createRandomPassword(); echo '<input style="border: 1px solid #0000FF;" type="text" name="tag" size="15" value='.$password.' />'; ?> But the value field output is blank, what am i doing wrong/ Thanks