473,586 Members | 2,681 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Error with the loop

13 New Member
have a look for yourself, <REMOVED> (feel free to send emails)
dont enter in the visual code (or enter it incorrectly) (or correctly) and see how all hell breaks loose (the loops of death!) where it should just pop-up with (one) an error message.

Code (mail.php)
[PHP]<?php

$subject = $_POST['subject'];
$message = $_POST['message'];

include 'config.inc.php ';

function alert_redirect( $alert) {
echo "
<html>
<head>
<script language='Javas cript'>
<!--
alert ('$alert')
window.location = '$homepage'
//-->
</script>
<title>$alert </title>
</head>
<body>
<div align='center'>
<h1>$alert</h1>
<form id='' name='' method='post' action='$homepa ge'>
<input type='submit' name='' id='' value='OK' />
</form>
</div>
</body>
</html>
";
}


require_once('r ecaptchalib.php ');
$resp = null;
$error = null;
$publickey = "__REMOVED_ _";
$privatekey = "__REMOVED_ _";
if ($_POST['recaptcha_resp onse_field']) {
$resp = recaptcha_check _answer ($privatekey,
$_SERVER['REMOTE_ADDR'],
$_POST['recaptcha_chal lenge_field'],
$_POST['recaptcha_resp onse_field']);
if ($resp->is_valid) {

} else {
alert_redirect( 'Please re-enter your reCAPTCHA visual identification code.');
exit();
}
}

session_start() ;
if(isset($_SESS ION['LastSent']))
{
if( $_SESSION['LastSent'] > (time() - $delay) )
{
alert_redirect( "You have sent a message in the last $delay seconds. Please wait $delay seconds until trying again.");
exit();
}
}

if( empty($subject) )
{
alert_redirect( 'Your message contained no subject.');
exit();
}
elseif( empty($message) )
{
alert_redirect( 'Your message contained no body.');
exit();
}
elseif (mail($to, $subject, $message, $headers))
{
$_SESSION['LastSent'] = time();
alert_redirect( 'Message sent.');
die();
} else {
alert_redirect( 'Error sending message.');
exit();
}[/PHP]

Code (config.inc.php )
[PHP]<?php

// Edit the below variables but do NOT remove the ' , " , : or ;
// $to - Who the script sends the emails to.
// $homepage - The place in which the script redirects the sender after the error/success message.
// $headers -- From: - Who the email says it is from.
// Reply-To: - Who the email says you should reply to.
// $delay - Amount of time (in seconds) until the sender can send another email. Prevents spamming.
// $publickey - Your reCAPTCHA public key, required to use the visual code confirmation function
// $privatekey - Your reCAPTCHA private key, required to use the visual code confirmation function
// **Get a public and private reCAPTCHA key free from http://recaptcha.net/api/getkey**

$to = '__REMOVED__';

$homepage = '__REMOVED__';

$headers =
"From: noreply@atyndal l.co.nr"

. "\r\n" .

"Reply-To: noreply@atyndal l.co.nr";

$delay = 180;



?>[/PHP]

What is wrong with this script, what code needs to be fixed/changed/deleted?
Sep 4 '07 #1
3 1302
ak1dnar
1,584 Recognized Expert Top Contributor
If there is a specific question, that related with your script you can ask BUT we don't need the links to your web site, because this is considered as web site Advertising.
Sep 4 '07 #2
atyndall
13 New Member
how will they see the millions of problems with the script then?
Sep 4 '07 #3
Atli
5,058 Recognized Expert Expert
Hi.

There are rarely millions of problems, especially in less than 100 lines of code ;)
It is far more likely that you have one problem over and over again, or that one problem is creating a snowball effect and causing the others.

Describe the problems and post any error messages. If there are millions of them then start with the first couple and we will go on from there.
Sep 5 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

5
14599
by: NanQuan | last post by:
I'm hoping someone can help me solve this error since I am at a total loss here. Usually I don't bother posting on any forums or groups on the internet and prefer to solve stuff myself but this is a total mistery. I have a function inside an ASP page as a result of which I get the following error message: Microsoft VBScript compilation...
1
3713
by: Beau | last post by:
Hi all, thanks in advance. Ok, heres the story. What is happening...... -------------------------------- I've got an ASP page that loops. It loops in order to get data in different, sequential date ranges. I.E. from 9/1/2000 - 10/1/2000 then 10/1/2000 - 11/1/2000 etc etc etc. It calls SPs using the 2 dates and an integer used for...
14
10120
by: Abhi | last post by:
FYI: This message is for the benefit of MS Access Community. I found that this prblem has been encounterd by many but there is hardly any place where a complete solution is posted. So I thought I should give back to the community by posting our findings. Thanks you all for all your help till now by posting problems and their solutions. ...
3
15949
by: deko | last post by:
I have a logging routine that's supposed to silently log errors caught by error handler code on certain functions. The problem is sometimes stuff happens and the error handler can get caught in a loop. Is there some way to send a break from VBA code to break out of the loop? Here's what the error handler code looks like: Private...
4
12986
by: OutdoorGuy | last post by:
Greetings, I am attempting to compile the code below, but I am receiving an error message when I do so. The error message is: "CSO161: 'Forloop.CalcAvg(int)': Not all code paths return a value". Any idea as to what I'm doing wrong? I'm sure it's something simple. Thanks in advance! public class ForLoop
1
1783
by: Eric | last post by:
When I run my script it gives error on the following line: strEmail = Right(strEmail, (Len(strEmail) - 1)) I enclose my code and the sample text file too Thanks, ----------------------------------------------------------------------------- Option Compare Database Option Explicit Private Sub Command26_Click()
35
3760
by: jeffc226 | last post by:
I'm interested in an idiom for handling errors in functions without using traditional nested ifs, because I think that can be very awkward and difficult to maintain, when the number of error checks gets about 3 or so. It also gets very awkward in nested loops, where you want to check for normal loop processing in the loop condition, not...
1
4912
by: janakivenk | last post by:
Hello, I am running Oracle 10g R2 in our office. I created the following procedure. It is suppose to access an xml file ( family.xml). The procedure is compiled and when I try to run it, i get the following error. SQL> execute domsample('c:\','song.xml','error.txt') BEGIN domsample('c:\','song.xml','error.txt * ERROR at line 1:...
0
4038
by: janakivenk | last post by:
Hello, I am running Oracle 10g R2 in our office. I created the following procedure. It is suppose to access an xml file ( family.xml). The procedure is compiled and when I try to run it, i get the following error. SQL> execute domsample('c:\','song.xml','error.txt') BEGIN domsample('c:\','song.xml','error.txt * ERROR at line 1:...
11
5569
by: xenoix | last post by:
hey there, im reasonably new to C# and im currently writing a backup application which im using as a learning resource. My PC :- Visual Studio 2005 .NET Framework 2 Component Factory Krypton Tools Test PC :- .Net Framework 2
0
7912
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7839
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8202
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8338
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
8216
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5710
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3865
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1449
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1180
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.