php script from a browser

mike_ledis's Avatar, Join Date: Aug 2010
Light Poster
Hello! Suppose that a php script exists in a server and i have access as a client.that script has 4 args first and second are char args third and forth are int args. If i want to run that script from my browser what syntax i have to use?
0
shabbir's Avatar, Join Date: Jul 2004
Go4Expert Founder
PHP scripts are run directly using the browser URLs
0
pein87's Avatar
Ambitious contributor
You need to know the url variables. If you know that you can then add values to them. Example url

Code:
http://www.mysite.coom/index.php?uid=0000001&sid=1
after the php you need a question mark or ? . This can also be done with a html page to or pretty much any script file.Then the url variable follow by an equal sign or = . This says make this url GET variable have the value after the equal sign. If there is more then one url variable you need to add an and sign or &. You can also use & but most servers have it as & . The above url has two variables that will be sent to the script via GET. POST types aren't sent so they can be seen via the url. You'd need packet filtering for that. However most use REQUEST in php so it doesn't need to filter request types. Also php doesn't use strong type, they are more or less validating the data being passed as int and string because php does not support types unless your type casting.

the variables would be retrieved like so

PHP Code:
$user $_GET['uid'];
$session $_GET['sid']; 
or

PHP Code:
$user$_REQUEST['uid'];
$session $_REQUEST['sid']; 
lots of sites dont validate their GET data and sql injections happen.
0
mike_ledis's Avatar, Join Date: Aug 2010
Light Poster
Pein87 first of all thank you! Could you explain me more about post method? If my script uses a post method how can i change the variables. I tried to make a post form in my pc,that uses the full url of the script that i want as an action. But every time, the browser is trying to find the url in the root directory that i placed my script.//ex C:/Users/mikeb/Desktop/
0
lionaneesh's Avatar, Join Date: Mar 2010
Invasive contributor
Quote:
Originally Posted by mike_ledis View Post
Pein87 first of all thank you! Could you explain me more about post method? If my script uses a post method how can i change the variables. I tried to make a post form in my pc,that uses the full url of the script that i want as an action. But every time, the browser is trying to find the url in the root directory that i placed my script.//ex C:/Users/mikeb/Desktop/
For post Requests you have to make a HTTP request to the server page...
Another way of doing it is to simply make a simple form like :-

You can do this by using Firebug a great addon for mozilla

Code: html
<form action="page_where_you_want_to_post" method="POST">
<input name="argument1" type="text"/>
<input name="argument2" type="text"/>
<input name="argument3" type="text"/>
</form>