Jump to content

Need help capturing ip address of form user


rambot

Recommended Posts

I run a small taxi company and use a php form generated user enquiry at the following url http://www.brightonairportcabs.co.uk/bookingform.html. i would like to capture the ip address of the user of my form.

 

I have read lots of ways of doing it but do not understand where to put the code.

 

i have a processor.php file and the webform itself,

 

Please can someone explain how i would go about getting the user ip to stop some spam that i am getting.

 

This is an example of the email i get through from a user submitting the form.

 

Online Booking:

 

Passenger Booking Name: ------

Email: example@email isp

Telephone: ----- ------

No of Adults: 2

No of Children: 

Field question 1: 

Journey Type: Single-One Way

Vehicle Type: 1-4 Passenger, 2-3 Cases + Hand Luggage

I wish to be picked up from: Home Address

I wish to be dropped at: Heathrow Airport

Journey Date 1: 12/24/2011

Journey Date 2: 

Any Comments, Collection Address, Collection Time, etc: Collection Address:

 

 

Journey Collection Time: 11am

 

hopefully you can help in easy instructions,

 

please let me know if you need any other information such as the coding from the form itself.

 

many thanks in anticipation

 

Merry Christmas to all users and i am glad i have come across the forum, i will be a regular visitor but cannot probably input any help, although you never know.

 

Link to comment
Share on other sites

so in that case it would be the processor.php file. i enclose the script itself below please could you point out where i would insert the code, i have tried this and the ip address does not come through to me on the submitted email php form,

<?php

$where_form_is="http://".$_SERVER['SERVER_NAME'].strrev(strstr(strrev($_SERVER['PHP_SELF']),"/"));

session_start();
if( ($_SESSION['security_code']==$_POST['security_code']) && (!empty($_POST['security_code'])) ) { 
mail("bookings@brightonairportcabs.co.uk","Online Booking Form ","Online Booking:

Passenger Booking Name: " . $_POST['field_1'] . " 
Email: " . $_POST['field_2'] . " 
Telephone: " . $_POST['field_3'] . " 
No of Adults: " . $_POST['field_4'] . " 
No of Children: " . $_POST['field_5'] . " 
Field question 1: " . $_POST['field_6'] . " 
Journey Type: " . $_POST['field_7'] . " 
Vehicle Type: " . $_POST['field_8'] . " 
I wish to be picked up from: " . $_POST['field_9'] . " 
I wish to be dropped at: " . $_POST['field_10'] . " 
Journey Date 1: " . $_POST['field_11'] . " 
Journey Date 2: " . $_POST['field_12'] . " 
Any Comments, Collection Address, Collection Time, etc: " . $_POST['field_13'] . " 
Journey Collection Time: " . $_POST['field_14'] . " 


Brighton Airport Cabs.
");

include("confirm.html");
}
else {
echo "Invalid Captcha String.";
}

?>

Link to comment
Share on other sites

$_SERVER['REMOTE_ADDR'] i managed to find this code ok, i am struggling to insert it, i have tried on a number of occasions and i definately do not get the ip address of the user when the email is sent through to me.

 

i must say this is the quickest forum i have ever been on, thanks for the quick replies

Link to comment
Share on other sites

Parse error: syntax error, unexpected T_STRING in /home/bright56/public_html/processor1.php on line 5 seems to be my troubl;e when i insert the code into the processor.php form,

 

<?php

 

$where_form_is="http://".$_SERVER['SERVER_NAME'].strrev(strstr(strrev($_SERVER['PHP_SELF']),"/"));

 

session_start();"

if( ($_SESSION['security_code']==$_POST['security_code']) && (!empty($_POST['security_code'])) ) {

mail("bookings@brightonairportcabs.co.uk","Online Booking Form ","Online Booking:

 

Ip address: " . $_SERVER['REMOTE_ADDR'] . “

Passenger Booking Name: " . $_POST['field_1'] . "

Email: " . $_POST['field_2'] . "

Telephone: " . $_POST['field_3'] . "

No of Adults: " . $_POST['field_4'] . "

No of Children: " . $_POST['field_5'] . "

Field question 1: " . $_POST['field_6'] . "

Journey Type: " . $_POST['field_7'] . "

Vehicle Type: " . $_POST['field_8'] . "

I wish to be picked up from: " . $_POST['field_9'] . "

I wish to be dropped at: " . $_POST['field_10'] . "

Journey Date 1: " . $_POST['field_11'] . "

Journey Date 2: " . $_POST['field_12'] . "

Any Comments, Collection Address, Collection Time, etc: " . $_POST['field_13'] . "

Journey Collection Time: " . $_POST['field_14'] . "

 

 

 

 

Brighton Airport Cabs.

");

 

include("confirm.html");

}

else {

echo "Invalid Captcha String.";

}

 

?>

 

please could someone take a look and explain to me where i have gone wrong,

Link to comment
Share on other sites

i open the php file and i edit it with notepad and save it back again as a .php file. it does not matter where i enter the code $_SERVER['REMOTE_ADDR'] i get an error, do i have to do anything with the submission form itself.  where will i be looking to see the ip address of the person submitting the form.

 

i have read about this and i have tried now on over 50 occasions and cannot for the life of me see what i am doing wrong,

 

where in this processor.php file would i enter the code $_SERVER['REMOTE_ADDR'] and what if anything would i have to change anywhere else to make this work,

 

thanks for your help

 

<?php

 

$where_form_is="http://".$_SERVER['SERVER_NAME'].strrev(strstr(strrev($_SERVER['PHP_SELF']),"/"));

 

session_start();

if( ($_SESSION['security_code']==$_POST['security_code']) && (!empty($_POST['security_code'])) ) {

mail("bookings@brightonairportcabs.co.uk","Online Booking Form ","Online Booking:

 

Passenger Booking Name: " . $_POST['field_1'] . "

Email: " . $_POST['field_2'] . "

Telephone: " . $_POST['field_3'] . "

No of Adults: " . $_POST['field_4'] . "

No of Children: " . $_POST['field_5'] . "

Field question 1: " . $_POST['field_6'] . "

Journey Type: " . $_POST['field_7'] . "

Vehicle Type: " . $_POST['field_8'] . "

I wish to be picked up from: " . $_POST['field_9'] . "

I wish to be dropped at: " . $_POST['field_10'] . "

Journey Date 1: " . $_POST['field_11'] . "

Journey Date 2: " . $_POST['field_12'] . "

Any Comments, Collection Address, Collection Time, etc: " . $_POST['field_13'] . "

Journey Collection Time: " . $_POST['field_14'] . "

 

 

Brighton Airport Cabs.

");

 

include("confirm.html");

}

else {

echo "Invalid Captcha String.";

}

 

?>

Link to comment
Share on other sites

this is the html code from my online booking form

 

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>

<head>

<title>Brighton Airport Cabs 01273 414144, Airport taxi booking form</title>

<meta http-equiv="content-type" content="text/html; charset=UTF-8"><link href="style.css" rel="stylesheet" type="text/css">

<!-- calendar stuff -->

      <link rel="stylesheet" type="text/css" href="calendar/calendar-blue2.css" />

      <script type="text/javascript" src="calendar/calendar.js"></script>

      <script type="text/javascript" src="calendar/calendar-en.js"></script>

      <script type="text/javascript" src="calendar/calendar-setup.js"></script>

<!-- END calendar stuff -->

 

    <!-- expand/collapse function -->

      <SCRIPT type=text/javascript>

<!--

function collapseElem(obj)

{

var el = document.getElementById(obj);

el.style.display = 'none';

}

 

 

function expandElem(obj)

{

var el = document.getElementById(obj);

el.style.display = '';

}

 

 

//-->

</SCRIPT>

<!-- expand/collapse function -->

 

 

<!-- expand/collapse function -->

    <SCRIPT type=text/javascript>

<!--

 

// collapse all elements, except the first one

function collapseAll()

{

var numFormPages = 1;

 

for(i=2; i <= numFormPages; i++)

{

currPageId = ('mainForm_' + i);

collapseElem(currPageId);

}

}

 

 

//-->

</SCRIPT>

<!-- expand/collapse function -->

 

 

<!-- validate -->

<SCRIPT type=text/javascript>

<!--

function validateField(fieldId, fieldBoxId, fieldType, required)

{

fieldBox = document.getElementById(fieldBoxId);

fieldObj = document.getElementById(fieldId);

 

if(fieldType == 'text'  ||  fieldType == 'textarea'  ||  fieldType == 'password'  ||  fieldType == 'file'  ||  fieldType == 'phone'  || fieldType == 'website')

{

if(required == 1 && fieldObj.value == '')

{

fieldObj.setAttribute("class","mainFormError");

fieldObj.setAttribute("className","mainFormError");

fieldObj.focus();

return false;

}

 

}

 

 

else if(fieldType == 'menu'  || fieldType == 'country'  || fieldType == 'state')

{

if(required == 1 && fieldObj.selectedIndex == 0)

{

fieldObj.setAttribute("class","mainFormError");

fieldObj.setAttribute("className","mainFormError");

fieldObj.focus();

return false;

}

 

}

 

 

else if(fieldType == 'email')

{

if((required == 1 && fieldObj.value=='')  ||  (fieldObj.value!=''  && !validate_email(fieldObj.value)))

{

fieldObj.setAttribute("class","mainFormError");

fieldObj.setAttribute("className","mainFormError");

fieldObj.focus();

return false;

}

 

}

 

 

 

}

 

function validate_email(emailStr)

{

apos=emailStr.indexOf("@");

dotpos=emailStr.lastIndexOf(".");

 

if (apos<1||dotpos-apos<2)

{

return false;

}

else

{

return true;

}

}

 

 

function validateDate(fieldId, fieldBoxId, fieldType, required,  minDateStr, maxDateStr)

{

retValue = true;

 

fieldBox = document.getElementById(fieldBoxId);

fieldObj = document.getElementById(fieldId);

dateStr = fieldObj.value;

 

 

if(required == 0  && dateStr == '')

{

return true;

}

 

 

if(dateStr.charAt(2) != '/'  || dateStr.charAt(5) != '/' || dateStr.length != 10)

{

retValue = false;

}

 

else // format's okay; check max, min

{

currDays = parseInt(dateStr.substr(0,2),10) + parseInt(dateStr.substr(3,2),10)*30  + parseInt(dateStr.substr(6,4),10)*365;

//alert(currDays);

 

if(maxDateStr != '')

{

maxDays = parseInt(maxDateStr.substr(0,2),10) + parseInt(maxDateStr.substr(3,2),10)*30  + parseInt(maxDateStr.substr(6,4),10)*365;

//alert(maxDays);

if(currDays > maxDays)

retValue = false;

}

 

if(minDateStr != '')

{

minDays = parseInt(minDateStr.substr(0,2),10) + parseInt(minDateStr.substr(3,2),10)*30  + parseInt(minDateStr.substr(6,4),10)*365;

//alert(minDays);

if(currDays < minDays)

retValue = false;

}

}

 

if(retValue == false)

{

fieldObj.setAttribute("class","mainFormError");

fieldObj.setAttribute("className","mainFormError");

fieldObj.focus();

return false;

}

}

//-->

</SCRIPT>

<!-- end validate -->

 

 

 

 

</head>

 

<body onLoad="collapseAll()">

 

<div id="mainForm">

 

 

 

 

<div id="formHeader">

<h2 class="formInfo" style="text-align: center"><b>

<span style="font-size: 14pt">BOOKING FORM</span></b></h2>

<p class="formInfo" style="text-align: center"><b>

<font size="3" color="#000000">Brighton Airport Cabs, Taxi Booking Form. 01273 414144</font></b></p>

</div>

 

 

<p style="text-align: center"><b>One of our staff will contact you

either by Email or Telephone to confirm we have received your booking

request. We will also send you a Customer Booking Confirmation by Email

when we have booked your journey. We may ask for further details and we

will contact you if needed. Please wait for confirmation that we have

availability for your journeys and that we have booked them for you. We

take no responsibility for any missed bookings that have not been

confirmed by us. Either by telephone or email.</b><BR/><!-- begin form -->

</p>

<form method=post enctype=multipart/form-data action=processor1.php onSubmit="return validatePage1();"><ul class=mainForm id="mainForm_1">

 

<li class="mainForm" id="fieldBox_1">

<label class="formFieldQuestion">Passenger Booking Name *</label><input class=mainForm type=text name=field_1 id=field_1 size='40' value=''></li>

 

<li class="mainForm" id="fieldBox_2">

<label class="formFieldQuestion">Email *</label><input class=mainForm type=email name=field_2 id=field_2 size=60 value="" style="background-image:url(imgs/email.png); background-repeat: no-repeat;  padding: 2px 2px 2px 25px;"></li>

 

<li class="mainForm" id="fieldBox_3">

<label class="formFieldQuestion">Telephone *</label><input class=mainForm type=phone name=field_3 id=field_3 size=40 value="" style="background-image:url(imgs/phone.png); background-repeat: no-repeat;  padding: 2px 2px 2px 25px;"></li>

 

<li class="mainForm" id="fieldBox_4">

<label class="formFieldQuestion">No of Adults *</label><select class=mainForm name=field_4 id=field_4><option value=''></option><option value="1">1</option><option value="2">2</option><option value="3">3</option><option value="4">4</option><option value="5">5</option><option value="6">6</option><option value="7">7</option><option value="8">8</option></select></li>

 

<li class="mainForm" id="fieldBox_5">

<label class="formFieldQuestion">No of Children</label><select class=mainForm name=field_5 id=field_5><option value=''></option><option value="1">1</option><option value="2">2</option><option value="3">3</option><option value="4">4</option></select></li>

 

<li class="mainForm" id="fieldBox_6">

<label class="formFieldQuestion">Child, Booster Seats</label><select class=mainForm name=field_6 id=field_6><option value=''></option><option value="4yrs up Booster">4yrs up Booster</option><option value="1-4 yrs Toddler Seat">1-4 yrs Toddler Seat</option><option value="0-1 yrs Baby Seat">0-1 yrs Baby Seat</option><option value="Multiple Seats">Multiple Seats</option></select></li>

 

<li class="mainForm" id="fieldBox_7">

<label class="formFieldQuestion">Journey Type *</label><select class=mainForm name=field_7 id=field_7><option value=''></option><option value="Return-Two ways">Return-Two ways</option><option value="Single-One Way">Single-One Way</option></select></li>

 

<li class="mainForm" id="fieldBox_8">

<label class="formFieldQuestion">Vehicle Type <a class=info href=#><img src=imgs/tip_small.png border=0><span class=infobox>Vehicle type is not urgent as we will discuss this with you.</span></a></label><select class=mainForm name=field_8 id=field_8><option value=''></option><option value="1-4 Passenger, 2-3 Cases + Hand Luggage">1-4 Passenger, 2-3 Cases + Hand Luggage</option><option value="1-4 Passengers, 4-5 Small Cases + Hand Luggage Saloon Car">1-4 Passengers, 4-5 Small Cases + Hand Luggage Saloon car</option><option value="1-4 Passenger, 4-5 Cases + Hand Luggage Estate car">1-4 Passenger, 4-5 Cases + Hand Luggage, Estate car</option><option value="5 Passengers, Small MPV, 2-3 Cases + Hand Luggage">5 Passengers, Small MPV, 3 Cases + Hand Luggage</option><option value="5-8 Passengers, up to 12 cases + Hand Luggage">5-8 Passengers, up to 12 cases + Hand Luggage</option></select></li>

 

<li class="mainForm" id="fieldBox_9">

<label class="formFieldQuestion">I wish to be picked up from *</label><select class=mainForm name=field_9 id=field_9><option value=''></option><option value="Home Address">Home Address</option><option value="Heathrow Airport">Heathrow Airport</option><option value="Gatwick Airport">Gatwick Airport</option><option value="Other Airport">Other Airport</option><option value="Other Location">Other Location</option><option value="Business Address">Business Address</option><option value="Port or Ferry Terminal">Port or Ferry Terminal</option></select></li>

 

<li class="mainForm" id="fieldBox_10">

<label class="formFieldQuestion">I wish to be dropped at *</label><select class=mainForm name=field_10 id=field_10><option value=''></option><option value="Home Address">Home Address</option><option value="Heathrow Airport">Heathrow Airport</option><option value="Gatwick Airport">Gatwick Airport</option><option value="Other Airport">Other Airport</option><option value="Other Location">Other Location</option><option value="Business Address">Business Address</option></select></li>

 

<li class="mainForm" id="fieldBox_11">

<label class="formFieldQuestion">Journey Date 1 *</label><input type=text  name=field_11 id=field_11 value=""><button type=reset class=calendarStyle id=fieldDateTrigger_11></button><SCRIPT type='text/javascript'>  Calendar.setup({

inputField    :    "field_11", 

ifFormat      :    "%m/%d/%Y", 

showsTime      :    false,         

button        :    "fieldDateTrigger_11",

singleClick    :    true,         

step          :    1               

});</SCRIPT></li>

 

<li class="mainForm" id="fieldBox_12">

<label class="formFieldQuestion">Journey Date 2</label><input type=text  name=field_12 id=field_12 value=""><button type=reset class=calendarStyle id=fieldDateTrigger_12></button><SCRIPT type='text/javascript'>  Calendar.setup({

inputField    :    "field_12", 

ifFormat      :    "%m/%d/%Y", 

showsTime      :    false,         

button        :    "fieldDateTrigger_12",

singleClick    :    true,         

step          :    1               

});</SCRIPT></li>

 

<li class="mainForm" id="fieldBox_13">

<label class="formFieldQuestion">ADDITIONAL INFORMATION, i.e Collection Address, Suitcase Quantity, Additional addressess, baby buggies,

Flight No etc<a class=info href=#><img src=imgs/tip_small.png border=0><span class=infobox>Please supply as much information as possible, it will enable us to give you a more accurate quote.</span></a></label><textarea class=mainForm  name=field_13 id=field_13 rows=30 cols=50></textarea></li>

 

<li class="mainForm" id="fieldBox_14">

<label class="formFieldQuestion">Outbound Collection Time,

Inbound Landing Time,

Please use AM and PM *</label><input class=mainForm type=text name=field_14 id=field_14 size='20' value=''></li>

 

 

<!-- end of this page -->

 

<!-- page validation -->

<SCRIPT type=text/javascript>

<!--

function validatePage1()

{

retVal = true;

if (validateField('field_1','fieldBox_1','text',1) == false)

retVal=false;

if (validateField('field_2','fieldBox_2','email',1) == false)

retVal=false;

if (validateField('field_3','fieldBox_3','phone',1) == false)

retVal=false;

if (validateField('field_4','fieldBox_4','menu',1) == false)

retVal=false;

if (validateField('field_5','fieldBox_5','menu',0) == false)

retVal=false;

if (validateField('field_6','fieldBox_6','menu',0) == false)

retVal=false;

if (validateField('field_7','fieldBox_7','menu',1) == false)

retVal=false;

if (validateField('field_8','fieldBox_8','menu',0) == false)

retVal=false;

if (validateField('field_9','fieldBox_9','menu',1) == false)

retVal=false;

if (validateField('field_10','fieldBox_10','menu',1) == false)

retVal=false;

if (validateDate('field_11','fieldBox_11','date',1,'','') == false)

retVal=false;

if (validateDate('field_12','fieldBox_12','date',0,'','') == false)

retVal=false;

if (validateField('field_13','fieldBox_13','textarea',0) == false)

retVal=false;

if (validateField('field_14','fieldBox_14','text',1) == false)

retVal=false;

 

if(retVal == false)

{

alert('Please correct the errors.  Fields marked with an asterisk (*) are required');

return false;

}

return retVal;

}

//-->

</SCRIPT>

 

<!-- end page validaton -->

 

 

 

<!-- next page buttons --><li class="mainForm">

<label class="formFieldQuestion">

Type the following: <a class=info href=#><img src=imgs/tip_small.png border=0><span class=infobox>For security purposes, please type the letters in the image.</span></a><BR><img src="CaptchaSecurityImages.php" />

</label>

 

<input id="captchaForm" name="security_code" class="mainForm" type="text"/>

</li><li class="mainForm">

<input id="saveForm" class="mainForm" type="submit" value="Reserve My Taxi" />

</li>

 

</form>

<!-- end of form -->

 

<!-- close the display stuff for this page -->

</ul></div><div id="footer"><p class="footer"><a href="aboutus.html">

Brighton Airport Cabs 01273 414144</a></p></div>

 

</body>

</html>

Link to comment
Share on other sites

Your form code has nothing to do with the issue. Read my previous reply again.

 

Look at this line:

 

Ip address: " . $_SERVER['REMOTE_ADDR'] . “

 

See that last quote? It should be:

 

Ip address: " . $_SERVER['REMOTE_ADDR'] . "

Link to comment
Share on other sites

i have compared what you have put here and i have compared with the code i put in the form, if the problem you think is because i am using word i am not, i am using notepad and saving the file as a php file and not a text file. as soon as i enter the code you have entered on your post the online form returns a syntax error on whichever line i paste the remote add code.

 

as you can see the code is entered exactly as you have written which i have highlighted in bold,

 

 

 

<?php

 

$where_form_is="http://".$_SERVER['SERVER_NAME'].strrev(strstr(strrev($_SERVER['PHP_SELF']),"/"));

 

session_start();"

if( ($_SESSION['security_code']==$_POST['security_code']) && (!empty($_POST['security_code'])) ) {

mail("bookings@brightonairportcabs.co.uk","Online Booking Form ","Online Booking:

 

Ip address: " . $_SERVER['REMOTE_ADDR'] . “

Passenger Booking Name: " . $_POST['field_1'] . "

Email: " . $_POST['field_2'] . "

Telephone: " . $_POST['field_3'] . "

No of Adults: " . $_POST['field_4'] . "

No of Children: " . $_POST['field_5'] . "

Field question 1: " . $_POST['field_6'] . "

Journey Type: " . $_POST['field_7'] . "

Vehicle Type: " . $_POST['field_8'] . "

I wish to be picked up from: " . $_POST['field_9'] . "

I wish to be dropped at: " . $_POST['field_10'] . "

Journey Date 1: " . $_POST['field_11'] . "

Journey Date 2: " . $_POST['field_12'] . "

Any Comments, Collection Address, Collection Time, etc: " . $_POST['field_13'] . "

Journey Collection Time: " . $_POST['field_14'] . "

 

 

 

 

Brighton Airport Cabs.

");

 

include("confirm.html");

}

else {

echo "Invalid Captcha String.";

}

 

?>

Link to comment
Share on other sites

if i had any clue as to what you are talking about i would not be on here asking how to do it, no good keep telling me to look at the last quote, they both appear to me as to be the same thing, you have actually shown me the code 3 times and if ni dint get it the first time i prob wont get it the third time,

 

i have copied the quote you so insistently keep pointing out three times, i have pasted this into a text editor, i have also copied the code i have placed in my php file that you can see from my post as highlighted in bold and i have compared your codes and my code and they are identical. So i really do not know what you are pointing out,

 

perhaps if you could look at my processor.php file and tell me exactly where it goes and if i have enterted it incorrectly or maybe in the wrong position.

 

i find it a complete waste of time to keep going round in circles and you are not willing to help me then stop posting on my thread. This gets you or me absolutely nowhere.

 

If you can see i have made a mistake then point out where and how and then perhaps i can learn the php as you maybe have done. Some of us are not so lucky to be so clever.

 

 

Link to comment
Share on other sites

let me also point out that as soon as i enter anything into the script ityself then i get an immediate syntaxt error. i do not know if this is because there is nowhere iin the form that tallies with the ip address code, or whether it is because my em,ails are sent through justhost servers and the emails is always sent from bright56@justhost.com which is my domain hosting company.

Link to comment
Share on other sites

i had just seen that as you must have been posting, the problem is my eyes are not what they used to be, think its time for new reading glasses, i am having a struggle on my 24inch screen to see the difference now between the comma and a full stop. that's why i did not see what you was pointing out,

 

I have entered that code now into the script and i do not receive the syntax error now. but i also do not actually receive the ip address, please where would i find this and would it be in the actual email itself that comes through to me or would it be in the email parameters

Link to comment
Share on other sites

i apologise that i was not seeing what thorpe was saying, firstly my eyes are not what they used to be and this was very hard to see, The processor.php file was downloaded when i made the form on php form generator so i do not understand it all, i am a complete novice.

 

in thew syntaxt error it was stating that there was a whitespace problem which i presumed to be an extra space somewhere it should not be, so i was not looking at the error in quotation marks i was looking for a space that should not be there.

 

 

Link to comment
Share on other sites

Quickoldcar you say i have a double quote after the session_start();  please can you explain what it should be, php form generator site made this code for me when i made the form online so i have no idea what is wrong, why it is wrong and what it should be instead. i run a small taxi company trying to make a living which is terrible at the moment, i am not even a veru good user of forums and do not know what i am doing really but i do read and have spent 3 days trying to read up on this, i was at the end of my line trying to sort the problem out,

 

i get people using and submitting my form and i only get the information as i posted early on, what i do get is spammers using the form and i would like to get ip address so i can stop them. Where would i actually be looking to see the ip address as it does not come through on the email from the form submission and it is not in the message options where i get the information from my hosting company.

 

the email actually comes from bright56@justhost.com my hosting company as all emails come through their servers, maybe the problem is with justhost and not the emails or the submitted form

Link to comment
Share on other sites

<?php

 

$where_form_is="http://".$_SERVER['SERVER_NAME'].strrev(strstr(strrev($_SERVER['PHP_SELF']),"/"));

 

session_start();

if( ($_SESSION['security_code']==$_POST['security_code']) && (!empty($_POST['security_code'])) ) {

mail("bookings@brightonairportcabs.co.uk","Online Booking Form ","Online Booking:

 

Passenger Booking Name: " . $_POST['field_1'] . "

Email: " . $_POST['field_2'] . "

Telephone: " . $_POST['field_3'] . "

No of Adults: " . $_POST['field_4'] . "

No of Children: " . $_POST['field_5'] . "

Field question 1: " . $_POST['field_6'] . "

Journey Type: " . $_POST['field_7'] . "

Vehicle Type: " . $_POST['field_8'] . "

I wish to be picked up from: " . $_POST['field_9'] . "

I wish to be dropped at: " . $_POST['field_10'] . "

Journey Date 1: " . $_POST['field_11'] . "

Journey Date 2: " . $_POST['field_12'] . "

Any Comments, Collection Address, Collection Time, etc: " . $_POST['field_13'] . "

Journey Collection Time: " . $_POST['field_14'] . "

 

 

Brighton Airport Cabs.

");

 

include("confirm.html");

}

else {

echo "Invalid Captcha String.";

}

 

?>

Link to comment
Share on other sites

just to let you know the ip address comes through with the email now and i have also tested the htacces file and placed my ip address in there and it restricts me from seeing the site, i can now stop the spammers from submitting forms and i can ban them through their ip address, i would like to extend a great big thank you to you all. I would like to offer a sincere apology to Thorpe for my stress i could not see what you was saying, i was looking for a space in the error syntax and not an incorrect character,

 

my last two projects now is to change the date format to UK date and not American and any help with this would be appreciated, do i change it in the form itself or in the php process file.

 

and the other project is to change the type of security on the form to a better one than i am using, and any help on this would be appreciated also.

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.