GoFuckYourself.com - Adult Webmaster Forum

GoFuckYourself.com - Adult Webmaster Forum (https://gfy.com/index.php)
-   Fucking Around & Business Discussion (https://gfy.com/forumdisplay.php?f=26)
-   -   Quick question about Javascript without SSI that one of you may have a quick answer for (https://gfy.com/showthread.php?t=1109520)

PornMD 05-15-2013 01:59 AM

Quick question about Javascript without SSI that one of you may have a quick answer for
 
I'm trying to help someone be able to capture a visitor's IP address hidden in an order form without the ability to use server-side includes (it's a hosted form and the limitations seem to prevent SSI or languages like PHP). I found a nice short JavaScript code that returns IP without SSI:

Code:

<script type="text/javascript" src="http://l2.io/ip.js"></script>
The problem is that putting the code in the value= winds up displaying the code rather than the IP the code would normally return.

Is there ANY way to put in code that will work inside form input value quotes to make the input value the visitor's IP in this case?

Harvey Specter 05-15-2013 05:08 AM

Something like this should work..

Code:

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<script type="text/javascript" >
    var backup = document.write;
    var ipaddress = "";
    document.write = function(str) {ipaddress += str;};
</script>
<script type="text/javascript" src="(cant post links)://l2.io/ip.js">  </script>
<script type="text/javascript" >
    document.write = backup;
        function setIP(){
                document.getElementById('formIPaddress').value = ipaddress;
        }
</script>
</head>

<body onload="setIP();">
<form id="formName" name="formName">
<input type="hidden" name="formIPaddress" id="formIPaddress" />
</form>
</body>
</html>


PornMD 05-15-2013 10:02 AM

Quote:

Originally Posted by Harvey Specter (Post 19625670)
Something like this should work..

Code:

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<script type="text/javascript" >
    var backup = document.write;
    var ipaddress = "";
    document.write = function(str) {ipaddress += str;};
</script>
<script type="text/javascript" src="(cant post links)://l2.io/ip.js">  </script>
<script type="text/javascript" >
    document.write = backup;
        function setIP(){
                document.getElementById('formIPaddress').value = ipaddress;
        }
</script>
</head>

<body onload="setIP();">
<form id="formName" name="formName">
<input type="hidden" name="formIPaddress" id="formIPaddress" />
</form>
</body>
</html>


Thanks a lot! They have a limitation in that the HTML code they need this done in is self-contained, i.e. no access to the head or the body tag (similar to if you had to do this entirely through a Wordpress widget that only recognized HTML/Javascript/etc. and not PHP). This is due to this being a hosted page and the system it's created through.

I think if needbe they may be able to switch to a page that can be fully coded. Though in that case, I believe PHP can be used. So I was more trying to see if there was a solution workable within those limitations since changing to a fully coded page AFAIK means changing the URL of the page which presents a whole other set of other things to fix within their order flow. Could this be made workable somehow in the scenario I mentioned?

It felt like there should be a way - using the Javascript code I mentioned in their system did return the IP, so it's just a matter of somehow getting that into the value of a form input.

Harvey Specter 05-15-2013 03:03 PM

Yeah pretty simple with some reworking..
Obviously just change the textbox to a hidden form item when using in production

Code:

<body>
<script type="text/javascript" >
    var backup = document.write;
    var ipaddress = "";
    document.write = function(str) {ipaddress += str;};
</script>
<script type="text/javascript" src="(nolinks)://l2.io/ip.js">  </script>
<script type="text/javascript" >
    document.write = backup;
        function setIP(){
                document.getElementById('textBoxName').value = ipaddress;
        }
        window.onload = setIP;
</script>

<form id="formName" name="formName">
<input type="text" name="textBoxName" id="textBoxName" />
</form>
</body>


PornMD 05-15-2013 07:35 PM

Quote:

Originally Posted by Harvey Specter (Post 19626587)
Yeah pretty simple with some reworking..
Obviously just change the textbox to a hidden form item when using in production

Code:

<body>
<script type="text/javascript" >
    var backup = document.write;
    var ipaddress = "";
    document.write = function(str) {ipaddress += str;};
</script>
<script type="text/javascript" src="(nolinks)://l2.io/ip.js">  </script>
<script type="text/javascript" >
    document.write = backup;
        function setIP(){
                document.getElementById('textBoxName').value = ipaddress;
        }
        window.onload = setIP;
</script>

<form id="formName" name="formName">
<input type="text" name="textBoxName" id="textBoxName" />
</form>
</body>


Thanks again. I just tested this within the system and the field just shows empty. Can't believe how cumbersome this damn thing is. :/

Here is what the source code on the page shows:

Code:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><title>HTML Layer test</title><meta name="robots" content="noindex" />
<script type='text/javascript'>
                        var mr_lp_id = 20;
                </script></head>
<body style="font-family: Verdana; font-size: 16px; margin: 0px;padding:0px; background-color: rgb(255,255,255);background-position: top center;"><center><div style='width: 800px; height: 1000px; position: relative;overflow: hidden;'><DIV style="left:1px;top:5px;height:343px;width:456px;position:absolute;overflow: hidden;overflow-y:auto;line-height: 1.25;text-align: left">
                       
<script type="text/javascript" >
    var backup = document.write;
    var ipaddress = "";
    document.write = function(str) {ipaddress += str;};
</script>
<script type="text/javascript" src="(nolinks)://l2.io/ip.js">  </script>
<script type="text/javascript" >
    document.write = backup;
        function setIP(){
                document.getElementById('textBoxName').value = ipaddress;
        }
        window.onload = setIP;
</script>

<form id="formName" name="formName">
<input type="text" name="textBoxName" id="textBoxName" />
</form>

</DIV></div></center><script src='http://www1.moon-ray.com/tracking.js' type='text/javascript'></script>
<script>
_mri = "7997_lp20.0_2";
mrtracking(0);
</script></body>
</html>


helterskelter808 05-15-2013 08:38 PM

Did you change "(nolinks)" to "http"?

Harvey Specter 05-16-2013 05:12 AM

Quote:

Originally Posted by helterskelter808 (Post 19626957)
Did you change "(nolinks)" to "http"?

this lol:1orglaugh


All times are GMT -7. The time now is 05:49 PM.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123