Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

I.P. Submission form 2

Status
Not open for further replies.

Bmstenner

Technical User
Jul 22, 2002
88
AU
Hi Guys,

On my old web hosting service, I built an I.P. Submission form (Cold Fusion) that would live on my hosting, and when you loaded it, you would enter an email address and it would send the global I.P. address of your computer to the email address specified, we found this useful because many of our clients are on VPN's with dynamic (non-fixed) I.P. addresses, and we need to access them to support their systems, it can be viewed here:


Basically, I get a HTTP 405 error, I have contacted IPOWERWEB and they don't support CFM extentions, Does anyone have a suggestion as to what programming language I can use as an alternative to this?

Ipowerweb supports the following:
* CGI-Bin
* PHP
* MySQL
* Frontpage 2000 extensions
* SSL secure server

Any ideas would be appreciated, if anyone would also like the source for the I.P. submission form, and details on how to use it, let me know, I would be happy to share it.

Thanks.


Brendan.
 
Hi mate,

I just checked and they also support SSI, so that gives you the choice of using either PHP, SSI or Perl.

If you use SSI, then you still need either a Perl or PHP script to send the form but you could just echo the IP into a hidden field of the form before submission.

Hope this helps

Wullie

sales@freshlookdesign.co.uk

The pessimist complains about the wind. The optimist expects it to change. The leader adjusts the sails. - John Maxwell
 
Using php, just change the ip input to this:

<input type=&quot;hidden&quot; name=&quot;ip&quot; value=&quot;<?= GetHostByName($REMOTE_ADDR); ?>&quot;>

Rick
 
Ristmo,

So you suggest changing the line (in the CFM format) from:
Your IP Address is #cgi.REMOTE_ADDR# (on the second form after you click &quot;submit&quot; with the email address, to:

<input type=&quot;hidden&quot; name=&quot;ip&quot; value=&quot;<?= GetHostByName($REMOTE_ADDR); ?>&quot;>

I know it needs an email address connected to it when its CFM, does it need the same for PHP? I've used my email (on the specific websites mail server) but it does not seem to come through, have I changed the input type in the correct section?

I've also renamed both the files from CFM to PHP, is this correct??

Thanks for the help so far, much appreciated,


Brendan
 
Hi,
I don't know what is in the CFM page, because I can't view the source, but this is what I'd do. In this form from the first page, add the line I posted earlier:

<form name=&quot;form1&quot; method=&quot;post&quot; action=&quot;IpSub_action.cfm&quot;>
<!--/*##Add Line HERE##*/-->
<table width=&quot;27%&quot; border=&quot;0&quot; cellspacing=&quot;0&quot; cellpadding=&quot;0&quot; align=&quot;center&quot;>
<tr>
<td width=&quot;43%&quot;>
<input type=&quot;text&quot; name=&quot;email&quot; size=&quot;31&quot;>
</td>
<td width=&quot;57%&quot;>
<input type=&quot;image&quot; border=&quot;0&quot; name=&quot;imageField&quot; src=&quot;BUTTON.gif&quot; width=&quot;98&quot; height=&quot;19&quot;>
</td>
</tr>
</table>
</form>

What this does is sends the email and ip address to the IpSub_action.cfm page. I'm assuming that IpSub_action.cfm is somehow storing the email and ip somewhere. If you want to then display the ip address on the second page, simply do this:

Your ip address is: <?= GetHostByName($REMOTE_ADDR); ?>

Rick
 
Ok,

Changed the code, on the first page &quot;ipsub.php&quot; it will display the I.P. address on the far left hand side, but upon trying to email it, It returns a 404 error, I have checked the links and it looks fine to me, I will paste the code into here from the originals (CFM):
----------------------------------------------------------

(code from ipsub.cfm):

<html>
<head>
<title>IP Submission Form</title>
<meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=iso-8859-1&quot;>
</head>

<body bgcolor=&quot;#FFFFFF&quot; text=&quot;#000000&quot;>
<p align=&quot;center&quot;>&nbsp;</p>
<p align=&quot;center&quot;><font face=&quot;Verdana, Arial, Helvetica, sans-serif&quot; size=&quot;2&quot;><b>Welcome;</b></font></p>
<table width=&quot;30%&quot; border=&quot;0&quot; cellspacing=&quot;0&quot; cellpadding=&quot;0&quot; align=&quot;center&quot;>
<tr>
<td><font face=&quot;Verdana, Arial, Helvetica, sans-serif&quot; size=&quot;2&quot;>Please type
in the email address where you would like the external I.P. address of this
computer to be sent:</font></td>
</tr>
</table>
<form name=&quot;form1&quot; method=&quot;post&quot; action=&quot;IpSub_action.cfm&quot;>
<table width=&quot;27%&quot; border=&quot;0&quot; cellspacing=&quot;0&quot; cellpadding=&quot;0&quot; align=&quot;center&quot;>
<tr>
<td width=&quot;43%&quot;>
<input type=&quot;text&quot; name=&quot;email&quot; size=&quot;31&quot;>
</td>
<td width=&quot;57%&quot;>
<input type=&quot;image&quot; border=&quot;0&quot; name=&quot;imageField&quot; src=&quot;BUTTON.gif&quot; width=&quot;98&quot; height=&quot;19&quot;>
</td>
</tr>
</table>
</form>

</body>
</html>

----------------------------------------------------------

(code from ipsub_action.cfm):

<html>
<head>
<title>IP Submission Form</title>
<meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=iso-8859-1&quot;>
</head>

<body bgcolor=&quot;#FFFFFF&quot; text=&quot;#000000&quot;>
<p align=&quot;center&quot;>&nbsp;</p>
<p align=&quot;center&quot;><font face=&quot;Verdana, Arial, Helvetica, sans-serif&quot; size=&quot;2&quot;><b>The
email has been sent!</b></font></p>
<p align=&quot;center&quot;><font face=&quot;Verdana, Arial, Helvetica, sans-serif&quot; size=&quot;2&quot;><b>
<cfmail to=&quot;#email#&quot;
from=&quot;brendan@mnemonics.com.au&quot;
subject=&quot;IP address from Westlawn Grafton's Firewall&quot;>

Your IP Address is #cgi.REMOTE_ADDR#

</cfmail>
</b></font></p>
<p align=&quot;center&quot;><b></b></p>
</body>
</html>

--------------------------------------------------------
 
Hi mate,

You are trying to use coldfusion on a server that does not support it, you need to use another language to send the email.

The suggestions above were based on you using another language.

Hope this helps Wullie

sales@freshlookdesign.co.uk

The pessimist complains about the wind. The optimist expects it to change. The leader adjusts the sails. - John Maxwell
 
Wullie,

The last posting was for RISTMO, in regards to his information on PHP.


Thanks,

Brendan
 
Hi mate,

Regardless of who the post was to, the following line is coldfusion and will not work on a server that does not support it.

<cfmail to=&quot;#email#&quot;
from=&quot;brendan@mnemonics.com.au&quot;
subject=&quot;IP address from Westlawn Grafton's Firewall&quot;>


You need to convert that to use php, perl etc, but under no circumstances can you use CF if the server does not support it.

Hope this helps Wullie

sales@freshlookdesign.co.uk

The pessimist complains about the wind. The optimist expects it to change. The leader adjusts the sails. - John Maxwell
 
Hi Wullie,

ok, good point... :)

The question is, what type of mailer does PHP use???
 
Here is a script that should do what you want:

code for ipsub.php:
----------------------------------------------------------

<html>
<head>
<title>IP Submission Form</title>
<meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=iso-8859-1&quot;>
</head>

<body bgcolor=&quot;#FFFFFF&quot; text=&quot;#000000&quot;>
<p align=&quot;center&quot;> </p>
<p align=&quot;center&quot;><font face=&quot;Verdana, Arial, Helvetica, sans-serif&quot; size=&quot;2&quot;><b>Welcome;</b></font></p>
<table width=&quot;30%&quot; border=&quot;0&quot; cellspacing=&quot;0&quot; cellpadding=&quot;0&quot; align=&quot;center&quot;>
<tr>
<td><font face=&quot;Verdana, Arial, Helvetica, sans-serif&quot; size=&quot;2&quot;>Please type
in the email address where you would like the external I.P. address of this
computer to be sent:</font></td>
</tr>
</table>
<form name=&quot;form1&quot; method=&quot;post&quot; action=&quot;IpSub_action.php&quot;>
<table width=&quot;27%&quot; border=&quot;0&quot; cellspacing=&quot;0&quot; cellpadding=&quot;0&quot; align=&quot;center&quot;>
<tr>
<td width=&quot;43%&quot;>
<input type=&quot;text&quot; name=&quot;email&quot; size=&quot;31&quot;>
</td>
<td width=&quot;57%&quot;>
<input type=&quot;image&quot; border=&quot;0&quot; name=&quot;imageField&quot; src=&quot;BUTTON.gif&quot; width=&quot;98&quot; height=&quot;19&quot;>
</td>
</tr>
</table>
</form>

</body>
</html>

----------------------------------------------------------

code for IpSub_action.php:
-------------------------------------------------------
<? mail($email,&quot;IP address from Westlawn Grafton's Firewall&quot;,GetHostByName($REMOTE_ADDR)); ?>
<html>
<head>
<title>IP Submission Form</title>
<meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=iso-8859-1&quot;>
</head>

<body bgcolor=&quot;#FFFFFF&quot; text=&quot;#000000&quot;>
<p align=&quot;center&quot;> </p>
<p align=&quot;center&quot;><font face=&quot;Verdana, Arial, Helvetica, sans-serif&quot; size=&quot;2&quot;><b>The
email has been sent!</b></font></p>
<p align=&quot;center&quot;><font face=&quot;Verdana, Arial, Helvetica, sans-serif&quot; size=&quot;2&quot;><b>

Your IP Address is: <?= GetHostByName($REMOTE_ADDR); ?>

</cfmail>
</b></font></p>
<p align=&quot;center&quot;><b></b></p>
</body>
</html>
--------------------------------------------------------

Let me know if it works,

Rick
 
Hi Guys,

I have put the code online and it works!!!, I am now recieving emails from &quot;Nobody&quot; hehehe,

Just one more question, and I tried to get this to work myself by changing the input types etc, but if I do that, the whole form ceases to work!!!

I want to change the name from &quot;Nobody&quot; to &quot;Ipform Submission&quot; or something similar.

Thanks for all your help Ristmo and Wullie, much appreciated,

Have a great day!,


Brendan.
 
Change the mail function above to this:

<? mail($email,&quot;IP address from Westlawn Grafton's Firewall&quot;,GetHostByName($REMOTE_ADDR),&quot;From: Ipform Submission&quot;); ?>

Rick
 
Thanks Ristmo,

Do you know anywhere that I can read up about POST methods?

e.g. if I wanted to make it so, when the form was opened, it would automatically click &quot;submit&quot; and then close, this would be useful because that form is going to be put onto an NT workstation as a task to run at 9am and email its external I.P to me.

I looked on macromedia's website (I use DW4.0) about forms that would close themselves, but all I could find was a &quot;close window&quot; button, which is not useful.

At present I have a shortcut that points to my web server's address with a link to the PHP form, but that will only open it, nothing more.

Any ideas?

Thanks again for all your help,

Brendan
 
I think that you would want to read more about javascript submitting forms than the &quot;post&quot; method. If should be fairly easy, try this:

First of all, name the form:
<form name=&quot;ip_form&quot;>
Then, change the body to this:
<body onLoad=&quot;document.ip_form.submit();&quot;>

Remember, you may have to give a default value to the email input:
<input type=&quot;text&quot; name=&quot;email&quot; value=&quot;the_email_to_use&quot;>

Then the submit page would be this:
<body onLoad=&quot;this.close()&quot;>

It would be easiest to make 2 separate pages for this, but if you didn't want to, you could use php to check where the user came from and only give the default email and closing of the browser for you.

Rick
 
Thanks Guys, for all your help, much appreciated, you have given me extremely useful and helpful posts,

Brendan.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top