What does ? stand for in PHP (after href operator)? [duplicate] - php

This question already has answers here:
What is the "?" symbol in URL used for in php?
(7 answers)
What the meaning of "?" in the PHP URL [duplicate]
(7 answers)
Closed 4 years ago.
I have the following problem:
I use a template page for a specific application, and for the login through "steam" there is a button. The button refers to a php file, and in the php file you can find the following line of code:
<a href="?login"><div id="sign-in-steam" style="margin-left: 74px;color: black;">
What does the "?login" exactly mean, I know it stands for a file but I cant find a file named like that, can anyone help me out?

The part behind the question mark in any URL is the Query String as per RFC 3986 section 3.4 and hence is not a PHP functionality (even though PHP can read it, see PHP $_SERVER superglobal docs, especially $_SERVER['QUERY_STRING']).

The hyper reference
?login
refers to the web-apps main page, which gets called using the parameter login a a GET parameter.
Quite likely, this would call the same script equivalently:
index.php?login

Related

web page and php connection [duplicate]

This question already has answers here:
Reference - What does this error mean in PHP?
(38 answers)
Closed 2 years ago.
connection using php is possible but when I give an example ... databaza.php so the page does not go at all and when I give databaza.html (I mean it as a subpage)
so the page goes but in the part where the connection table should be errory
I would like the page to work but with the .php extension. because when I give the .html extension, the page goes but the connection to the database does not and vice versa
where can be the mistake?enter image description here
Check naming of files, also mozilla firefox loads better for php files if making just php files to load. hope this helps.

$_GET difference when calling URL with or without anchor [duplicate]

This question already has answers here:
Why is the hash part of the URL not available on the server side?
(4 answers)
Closed 4 years ago.
Why does $_GET deliver different results if I call an URL with an anchor compared to without?
example:
https://www.myurl.com/#anchor?param1=x&param2=y
if I read the GET params, REQUEST, $_SERVER['QUERY_STRING'], parse_url($url, PHP_URL_QUERY)
all are emtpy
but with
https://www.myurl.com/?param1=x&param2=y
everything works as expected.
Can anyone explain me this please?
Basically the hash component of the page URL (the part following the # sign) is processed by the browser only - the browser never passes it to the server. This sadly is part of the HTML standard and is the same whether or not you are using IE or any other browser (and for that matter PHP or any other server side technology).
Check the explanation from here.
Anchors go at the end, hence the name. :)
https://www.myurl.com/?param1=x&param2=y#anchor

how to get the entire url in php including the # symbol with values [duplicate]

This question already has answers here:
Can I read the hash portion of the URL on my server-side application (PHP, Ruby, Python, etc.)?
(12 answers)
Closed 9 years ago.
abcd.com/indexreadmore.php?#cat2
This is what the url in which I want to get all the parts like above mentioned, I can get a bit but not able to get the #cat2 and help me fetch entire url in php from the url bar.
The hashtags are not sent to the server, only the browser so PHP wouldn't be able to parse that from the address. You'd have to use javascript:
<script type="text/javascript">alert(window.location.hash);</script>
You cannot get the URL after the # in PHP..
The maximum you can attain is abcd.com/indexreadmore.php , To verify this you could just do a print_r($_SERVER); on your PHP code.
The content after the # can be retrieved only through JavaScript.
If you mean to parse the url, then there is parse_url function.
var_dump(parse_url('abcd.com/indexreadmore.php?#cat2'));
The browser does not send the hash fragment to the server if you mean get it in indexreadmore.php.

jQuery Ajax PHP security [duplicate]

This question already has answers here:
PHP code is not being executed, but the code shows in the browser source code
(35 answers)
Closed 6 years ago.
Is there any way to prevent jQuery AJAX retreiving a complete PHP file instead of its server output ?
I just tried to obtain text only output, expecting what ever php decides to return, but got the whole file.
Not ideal if as on some files it would reveal potential hacking targets such as database tables etc
The host was not allowing config of private files, the solution was to move provider and place php above the root directory.

What does /#!/ mean in URL? [duplicate]

This question already has answers here:
Closed 12 years ago.
Possible Duplicate:
What's the shebang (#!) in Facebook and new Twitter URLs for?
It usually comes straight after the domain name.
I see it all the time, like in Twitter and Facebook urls.
Is it some special sort of routing?
# is the fragment separator. Everything before it is handled by the server, and everything after it is handled by the client, usually in JavaScript (although it will advance the page to an anchor with the same name as the fragment).
after # is the hash of the location; the ! the follows is used by search engines to help index ajax content. After that can be anything, but is usually rendered to look as a path (hence the /). If you want to know more, read this.

Categories