PHP webshell pass the value using wget or URL [closed] - php

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 1 year ago.
Improve this question
I have PHP-shall and I want to pass a value for the eval function. I want to pass the value to "mypass", is it possible to do so with URL or command line?
<!--?php eval($_POST[mypass]);?-->

I cannot explain to you how dangerous this is. To have eval in it's own can be a massive hazard to the system, forget having user input being processed by eval. You could run things that would control the entire system. That being said, your php is opening and closing wrong
<?php Not <!--?php
Next your var isnt being accessed as expected, you forgot the dollar sign:
$_POST[$mypass] unless the parameter is "mypass" which it should be $_POST["mypass"]
Lastly, you'll find that in a post, you can't use your browser. Use postman or change $_POST to $_GET

Related

How do you map HTTP inputs to functions? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 3 years ago.
Improve this question
I have a script, let's call it myScript.php. It's one of several scripts.
I want to pass certain things to it via the HTTP address, like this: …/myScript.php?format=xml&action=courses where xml is the format and the action is a query some courses in my database.
But I want also to be able to assign …/myScript.php?format=json&action=courses in the same script.
How can I do this?
You can reference any parameters passed in the url like so in php: $_REQUEST['format'], $_REQUEST['actions']. You can then assign them to a variable and change that variable in your script.
fetch('./myScript.php?format=xml&action=courses')
$_REQUEST['format'] //xml
$_REQUEST['actions'] //courses
REQUEST is the general method but you can also use GET. Refer to this for more info: https://stackoverflow.com/a/1924958/11945488
$_REQUEST=array_merge($_POST,$_GET,$_COOKIE);
in native php global request variable include get post and cookie ..
You should get parameters with global variable $_GET,
if you does $_REQUEST maybe can confusion php

How do I open an url in a new tab via php? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 7 years ago.
Improve this question
Go!
like this code but using php thanks
You can change location with php:
header("location:somewhere.php");
but in the same tab - php will not tell the browser to open it in new tab. This must be done by javascript after reloading by the header function, but you will not know if it will open in new tab or in new window anyway - it is up to the browser settings!
Remember that you cannot output even single character to the browser (no echo, no html tags) before calling header function.
I'm not really sure that's what you want it, but it is what I understood.
<?php
echo 'Go!';
?>
Did you know you can name a file .php and still have php and html code on it? you just have to put at the start and end of the code and then just write rest on html outside of those code brackets.

How do I run PHP unlink command that is stored in a MySQL database [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
can anyone help me to solve my query?
I want to execute php unlink command which is store in DB.
For example:
?php echo eval("?>".unlink('abc.txt')."<?") ?>
Please
?> is a closing PHP tag, and <? is a short open PHP tag, so at a minimum, you have those backwards.
In your code, you don't need these PHP tags at all. They are meant for the parser, not for eval(), which is already in PHP mode.
The best thing to do is not store this sort of thing in your database. I can't think of a single reason why you would put PHP code in your database values. You should instead have that file name, and then run a for loop over the results to unlink.
Basically, your entire solution is broken. You can start by removing those backwards PHP tags and it will work... but is that really what you want? Probably not.

How to set a parameter in php, and how to get its value? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
How can I see the Edit Mode page is the link is written like:
<small><i>Edit Mode</i></small>
In the above case, if I click the Edit Mode button in the homepage, does it mean editz will be assigned a value as 1?
Another question is if I have three php files a.php, b.php and c.php, which all check isset($editz), how can I redirect the page to a.php, rather than file b or c if I click the Edit Mode button?
Sorry maybe my question is too simple a naive, but I am a newbie to php, it is my first time tough php code. Please be kind to share some light:)
Just to give some sort of answer to this, spanning from the comments:
Anything following a ? in a URL is a query string, and the parameters (each separated by &) can be accessed with the $_GET['parameter_name'] function. In this case, $_GET['editz'] was needed.

How to execute bash script with PHP? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
I have a bash script which I want to take a parameter, it all works fine normally so that is not the issue.
What is I want is an HTML (or PHP if need be) which will take text entered into a text field and execute a bash script with it as a parameter.
I had my HTML working last night with some embedded PHP (I didn't attempt to pass argument at this stage):
<?php
exec("/scriptname.sh");
?>
This however would simply not execute the script (yes it is located at /). I had a simple "echo test > testfile" command which obviously did not run.
What is the easiest way to do what I need, and an example would also be great.
Thanks a lot for taking the time to read this.
have a look on shell_exec
$output = shell_exec('/scriptname.sh p1 p2 p3');
Documentation
http://www.php.net/shell_exec

Categories