12 Replies - 385 Views - Last Post: 05 December 2017 - 03:27 AM Rate Topic: -----

#1 spaz998  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 104
  • Joined: 29-July 14

Dynamic Query Strings

Posted 29 November 2017 - 06:04 PM

If I am on a page for example

page1.com.au/incident/PGS53S

On this page I have a button called button1 which I am able to give a url.
I want to do something like this for button1's url

page2.com.au/dowork.php

what I am struggling with is how or if its possible to pass that full first address to a variable on my php page.

like page2.com.au/dowork.php?this.url (not correct syntax but you get what im trying to do i hope)

*I do not have access to anything on page1 except for adding a url to the button so it needs to be done in the url.

The php page then goes off and runs a powershell script which does numerous things with an API but I need to get that URL mainly the last section being a form of incident ID e.g 'PGS53S'
from the url through the button to php and then through to powershell where it can be used to pull up relevant info on said incident.

Is This A Good Question/Topic? 0
  • +

Replies To: Dynamic Query Strings

#2 Dormilich  Icon User is offline

  • 痛覚残留
  • member icon

Reputation: 4139
  • View blog
  • Posts: 13,086
  • Joined: 08-June 10

Re: Dynamic Query Strings

Posted 30 November 2017 - 12:51 AM

View Postspaz998, on 30 November 2017 - 02:04 AM, said:

*I do not have access to anything on page1 except for adding a url to the button so it needs to be done in the url.

then you can only pass non-dynamic urls, as for everything else you need some kind of script (be it client or server side).
Was This Post Helpful? 1
  • +
  • -

#3 spaz998  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 104
  • Joined: 29-July 14

Re: Dynamic Query Strings

Posted 30 November 2017 - 12:54 AM

yeah I was afraid of that but thought I would ask thanks.
Was This Post Helpful? 0
  • +
  • -

#4 spaz998  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 104
  • Joined: 29-July 14

Re: Dynamic Query Strings

Posted 03 December 2017 - 03:47 PM

@dormilich

can I not access the post headers from the php page I am calling in my url? As the string i need is there.
https://imgur.com/a/qDDUu

<?php
    ##tried this
    $post = var_dump($_POST);

    ##and this
    $post = file_get_contents('php://input');

    $var_str = var_export($post, true);
    $var = "<?php\n\n\$text = $var_str;\n\n?>";
    file_put_contents('filename.php', $var);
?>




is their a better way to view the data I am getting sent because currently the above doesn't output to a file and im stuck trying to workout what values I can access from the post.

Also what image extension can i post on these boards both jpg and png wont attach nor will it accept an external image link...




*Update*

So on the iis server logging I can see this info coming through for the server variable

HTTP_REFERER:http://pdoncall/+HTTP_USER_AGENT:Mozilla/5.0+(Windows+NT+10.0;+Win64;+x64)+AppleWebKit/xxx.xx+(KHTML,+like+Gecko)+Chrome/xx.x.xxxx.xxx+Safari/xxx.xx+HTTP_UPGRADE_INSECURE_REQUESTS:1+


Unfortunately it doesn't seem to contain the the extra bit after the url which contains the incident id i am looking for.

This post has been edited by spaz998: 03 December 2017 - 07:13 PM

Was This Post Helpful? 0
  • +
  • -

#5 Dormilich  Icon User is offline

  • 痛覚残留
  • member icon

Reputation: 4139
  • View blog
  • Posts: 13,086
  • Joined: 08-June 10

Re: Dynamic Query Strings

Posted 04 December 2017 - 01:19 AM

Quote

can I not access the post headers from the php page I am calling in my url?

What headers? HTTP headers? POST parameters? (neither of which are shown in the image)

Quote

Unfortunately it doesn't seem to contain the the extra bit after the url which contains the incident id i am looking for.

Why should the referrer contain those data?
Was This Post Helpful? 0
  • +
  • -

#6 spaz998  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 104
  • Joined: 29-July 14

Re: Dynamic Query Strings

Posted 04 December 2017 - 08:11 PM

I think I am a little confused about what chrome is showing under its Headers Tab and the general flow.
HTTP headers is where I think my data is I am looking for and i read somewhere that the referrer contained the full address.

In chromes network console
-General
  -Request URL (info i need is here)
-Response Headers
-Request Headers
  -Referer (info i need is here also)
-Request Payload


This post has been edited by spaz998: 04 December 2017 - 08:13 PM

Was This Post Helpful? 0
  • +
  • -

#7 Dormilich  Icon User is offline

  • 痛覚残留
  • member icon

Reputation: 4139
  • View blog
  • Posts: 13,086
  • Joined: 08-June 10

Re: Dynamic Query Strings

Posted 05 December 2017 - 01:16 AM

Quote

i read somewhere that the referrer contained the full address.

then you read wrong. https://en.wikipedia...ki/HTTP_referer
Was This Post Helpful? 0
  • +
  • -

#8 spaz998  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 104
  • Joined: 29-July 14

Re: Dynamic Query Strings

Posted 05 December 2017 - 02:57 AM

Any suggestions on retrieving what I am after through php?

Worst case scenario I will just put together a form on my php page that a value can be submitted.

It's ugly because users will have to load up the page to submit an ID instead of just clicking a button inside the 3rd party software they are using already.
Was This Post Helpful? 0
  • +
  • -

#9 Dormilich  Icon User is offline

  • 痛覚残留
  • member icon

Reputation: 4139
  • View blog
  • Posts: 13,086
  • Joined: 08-June 10

Re: Dynamic Query Strings

Posted 05 December 2017 - 02:59 AM

Parameters you have passed to an URL are found in $_GET.

This post has been edited by Dormilich: 05 December 2017 - 02:59 AM

Was This Post Helpful? 0
  • +
  • -

#10 spaz998  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 104
  • Joined: 29-July 14

Re: Dynamic Query Strings

Posted 05 December 2017 - 03:07 AM

I wouldn't be passing the parameters though would I... I am just telling it to hit siteb.php in the button and wanting siteb.php to tell me the site it came from sitea.com/incident/FS232 so i can store that < in a variable to pass on to powershell.

tried debug_backtrace which didn't work either.
Was This Post Helpful? 0
  • +
  • -

#11 Dormilich  Icon User is offline

  • 痛覚残留
  • member icon

Reputation: 4139
  • View blog
  • Posts: 13,086
  • Joined: 08-June 10

Re: Dynamic Query Strings

Posted 05 December 2017 - 03:11 AM

that would be $_SERVER['HTTP_REFERER'] if the browser sets it. if it doesn't then you would likely have to pass it as an URL parameter.
Was This Post Helpful? 0
  • +
  • -

#12 spaz998  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 104
  • Joined: 29-July 14

Re: Dynamic Query Strings

Posted 05 December 2017 - 03:14 AM

Yeah it doesn't set it.... From what i read which could also be wrong haha it only sends the referrer data to https??
Think making the page with a submit button is going to be much easier than hacking at this :|
Was This Post Helpful? 0
  • +
  • -

#13 Dormilich  Icon User is offline

  • 痛覚残留
  • member icon

Reputation: 4139
  • View blog
  • Posts: 13,086
  • Joined: 08-June 10

Re: Dynamic Query Strings

Posted 05 December 2017 - 03:27 AM

View Postspaz998, on 05 December 2017 - 11:14 AM, said:

From what i read which could also be wrong haha it only sends the referrer data to https??

That's up to the browser settings.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1