Jump to content

Can I access $_GET['id'] if the page is html? How does this code do it!?


Go to solution Solved by requinix,

Recommended Posts

Can I access $_GET['id'] if the page is HTML? How does this code do it!!?

 

The get some id in the URL and use it to load content on the page. Apparently, this code can be embedded anywhere.

 

How do they do it with Javascript?

<!-- Deadline Funnel -->
<script type="text/javascript" data-cfasync="false">
    function base64_encode(e) {
        var r, t, c, a, h, n, o, A, i = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",
            d = 0,
            l = 0,
            s = "",
            u = [];
        if (!e) return e;
        do r = e.charCodeAt(d++), t = e.charCodeAt(d++), c = e.charCodeAt(d++), A = r << 16 | t << 8 | c, a = A >> 18 & 63, h = A >> 12 & 63, n = A >> 6 & 63, o = 63 & A, u[l++] = i.charAt(a) + i.charAt(h) + i.charAt(n) + i.charAt(o); while (d < e.length);
        s = u.join("");
        var C = e.length % 3;
        var decoded = (C ? s.slice(0, C - 3) : s) + "===".slice(C || 3);
        decoded = decoded.replace("+", "-");
        decoded = decoded.replace("/", "_");
        return decoded;
    }
    var url = base64_encode(location.href);
    var parentUrl = (parent !== window) ? ('/' + base64_encode(document.referrer)) : '';
    (function() {
        var s = document.createElement('script');
        s.type = 'text/javascript';
        s.async = true;
        s.setAttribute("data-scriptid", "dfunifiedcode");
        s.src = "https://df.com/runified/eyJpdiI6IisxXC9PODljVXRubjZQU3JyZGFp9ITEE9PSIsIm1hYyI6Ijk0N2NlNTdmNTY2NmQ2ODQ2OTM3YjlhYzEzODI2OThkMTNhMDBmM2RhMDIzMTFhNDM4ZTIwZmU1OWUxNzE4NDUifQ==/" + url + parentUrl;
        var s2 = document.getElementsByTagName('script')[0];
        s2.parentNode.insertBefore(s, s2);
    })();
</script>

Thanks

Edited by behnampmdg3

You can use $_GET['id'] if you're running PHP code. Whether the page has HTML or something else is irrelevant.

 

Yes, you can do it in Javascript if you haaave to.

 

 

Hello;

 

In general, are such things reliable?

 

For example, redirecting via https://developer.mozilla.org/en-US/docs/Web/API/Location/replace

Or accessing parameters with http://www.jquerybyexample.net/2012/06/get-url-parameters-using-jquery.html

 

No, I don't have access to PHP.

 

Thank you

Edited by behnampmdg3
  • Solution

"Reliable"? If the code is solid then sure, it's reliable. :confused:

 

Method I use:

var id = (document.location.search.match(/[?&]id=([^&]+)/) || [])[1] || "";

And if you don't have access to PHP then it doesn't really make sense to ask this in the PHP forum, does it?

Oh, forgot:

 

Keep in mind document.location.search will be URL-encoded (with percent signs) so if you need to decode that then use decodeURIComponent on the id (or whatever) - not on the full document.location.search value. Like

var email = decodeURIComponent((document.location.search.match(/[?&]email=([^&]+)/) || [])[1] || "");
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.