Page 1 of 1

How can I execute php code directly rather than from page?

Posted: Mon Dec 14, 2009 10:32 am
by Mythos44
I'm sorry I'm new to php and am starting to learn but I'm needing to execute a php comand from a page by typing the code in the address bar rather than opening the page and entering the data and clicking submit. I would like to be able to just pass the values directly.


This is the code portion that has a field and the submit button. so I want to send my value and submit it somehow.

Lets say the page it was on was: http://www.mysite.com/index.php

and this is the code for the field and the button:

<p>
enter your user: <input type="text" name="code" size="9" value="" />
<input type="submit" value="enter your user >" />
</p>

What I am wanting to be able to enter this into the address field on the IE is something like this:

http://www.mysite.com/index.php?type=te ... lue=123456

and it would then execute the code. But this doesn't work. I just don't understand PHP enough yet.

Thank you again for all your assistance.

Mythos

Re: How can I execute php code directly rather than from page?

Posted: Mon Dec 14, 2009 10:42 am
by AbraCadaver
You really need to check all of the $_GET vars to make sure they don't contain malicious code, but in the simplist form:

Code: Select all

enter your user: <input type="<?php echo  htmlentities($_GET['type']); ?>" name="<?php echo  htmlentities($_GET['name']); ?>" size="<?php echo  htmlentities($_GET['size']); ?>" value="<?php echo  htmlentities($_GET['value']); ?>" />
<input type="submit" value="enter your user >" />

Re: How can I execute php code directly rather than from page?

Posted: Mon Dec 14, 2009 10:48 am
by Mythos44
I'm sorry I don't understand what you wrote but what I'm trying to do is figure out what I could just type into the IE address bar to just execute that code.

Somthing like this

"http://www.massivemob.com/index.php?typ ... =375273754"

That would execute that portion of code.

Re: How can I execute php code directly rather than from page?

Posted: Mon Dec 14, 2009 10:54 am
by AbraCadaver
Yes, if you put that code in index.php that is exactly what it will do. Try it.

Re: How can I execute php code directly rather than from page?

Posted: Mon Dec 14, 2009 11:03 am
by Mythos44
I don't have access to that file. rather than pull up the page and fill it out I am just wanting to type that into the address and have it do what I want. I can't change the code. i just want to execute the code with my values directly.

Re: How can I execute php code directly rather than from page?

Posted: Mon Dec 14, 2009 1:59 pm
by AbraCadaver
Mythos44 wrote:I don't have access to that file. rather than pull up the page and fill it out I am just wanting to type that into the address and have it do what I want. I can't change the code. i just want to execute the code with my values directly.

No can do.

Re: How can I execute php code directly rather than from page?

Posted: Mon Dec 14, 2009 4:28 pm
by Apollo
Is something like this what you need?

http://devsite.co.cc/temp/post.php?post ... hing=12345

This will directly call http://www.example.com/whatever.php with the specified parameters as POST vars (i.e. as if you entered them in a form).