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
How can I execute php code directly rather than from page?
Moderator: General Moderators
- AbraCadaver
- DevNet Master
- Posts: 2572
- Joined: Mon Feb 24, 2003 10:12 am
- Location: The Republic of Texas
- Contact:
Re: How can I execute php code directly rather than from page?
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 >" />mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.
Re: How can I execute php code directly rather than from page?
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.
Somthing like this
"http://www.massivemob.com/index.php?typ ... =375273754"
That would execute that portion of code.
- AbraCadaver
- DevNet Master
- Posts: 2572
- Joined: Mon Feb 24, 2003 10:12 am
- Location: The Republic of Texas
- Contact:
Re: How can I execute php code directly rather than from page?
Yes, if you put that code in index.php that is exactly what it will do. Try it.
mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.
Re: How can I execute php code directly rather than from page?
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.
- AbraCadaver
- DevNet Master
- Posts: 2572
- Joined: Mon Feb 24, 2003 10:12 am
- Location: The Republic of Texas
- Contact:
Re: How can I execute php code directly rather than from page?
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.
mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.
Re: How can I execute php code directly rather than from page?
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).
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).