473,398 Members | 2,427 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

Accessing functions through a URL?

Is it possible to access a function in a php document through a URL?

For instance: http://www.somesiteorother.com/test.php?a_function

And then have something like this in test.php:

<?php

function a_function() {echo "Hello!";}

?>
Or is this definitely not possible? I'm assuming it would definitely be
impossible for security reasons... which is what I'm hoping.
P.
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.514 / Virus Database: 312 - Release Date: 28/08/2003
Jul 16 '05 #1
5 2305
The Plankmeister <plankmeister_NO_@_SPAM_hotmail.com> wrote:
Is it possible to access a function in a php document through a URL?

For instance: http://www.somesiteorother.com/test.php?a_function

And then have something like this in test.php:

<?php
function a_function() {echo "Hello!";}
?>

Or is this definitely not possible? I'm assuming it would definitely be
impossible for security reasons... which is what I'm hoping.


Hi,

It's definitely not possible.

HTH;
JOn
Jul 16 '05 #2
Hi,

Sure it's possible. You can analyse the url. See if there are strings after
the ?. Next you need to check if that string is a function. If it is....
run it. So if you can program a little bit, it is possible...

Kind regards,

Dirk

Jon Kraft wrote:
The Plankmeister <plankmeister_NO_@_SPAM_hotmail.com> wrote:
Is it possible to access a function in a php document through a URL?

For instance: http://www.somesiteorother.com/test.php?a_function

And then have something like this in test.php:

<?php
function a_function() {echo "Hello!";}
?>

Or is this definitely not possible? I'm assuming it would definitely be
impossible for security reasons... which is what I'm hoping.


Hi,

It's definitely not possible.

HTH;
JOn


--
BOFH Excuse #380:

Operators killed when huge stack of backup tapes fell over.

Jul 16 '05 #3
Dirk Engels <d.******@student.utwente.nl> wrote:
Jon Kraft wrote:
The Plankmeister <plankmeister_NO_@_SPAM_hotmail.com> wrote:
Is it possible to access a function in a php document through a URL?

For instance: http://www.somesiteorother.com/test.php?a_function

And then have something like this in test.php:

<?php
function a_function() {echo "Hello!";}
?>

Or is this definitely not possible? I'm assuming it would definitely be
impossible for security reasons... which is what I'm hoping.


It's definitely not possible.


Sure it's possible. You can analyse the url. See if there are strings
after the ?. Next you need to check if that string is a function. If it
is.... run it. So if you can program a little bit, it is possible...


Hi Dirk,

I didn't say it wouldn't be possible for a script to call the function after
analysing the requested url - I merely confirmed that it is absolutely
impossible to call a function through a URL.

http://www.somesiteorother.com/test.php?a_function will never invoke the
function a_function().

JOn
Jul 16 '05 #4
Hi,

Not directly... but there is always a way to do something you want to do...
the sky is the limit :-)

dirk

Jon Kraft wrote:
Dirk Engels <d.******@student.utwente.nl> wrote:
Jon Kraft wrote:
The Plankmeister <plankmeister_NO_@_SPAM_hotmail.com> wrote:

Is it possible to access a function in a php document through a URL?

For instance: http://www.somesiteorother.com/test.php?a_function

And then have something like this in test.php:

<?php
function a_function() {echo "Hello!";}
?>

Or is this definitely not possible? I'm assuming it would definitely be
impossible for security reasons... which is what I'm hoping.

It's definitely not possible.


Sure it's possible. You can analyse the url. See if there are strings
after the ?. Next you need to check if that string is a function. If it
is.... run it. So if you can program a little bit, it is possible...


Hi Dirk,

I didn't say it wouldn't be possible for a script to call the function
after analysing the requested url - I merely confirmed that it is
absolutely impossible to call a function through a URL.

http://www.somesiteorother.com/test.php?a_function will never invoke the
function a_function().

JOn


--
BOFH Excuse #220:

Someone thought The Big Red Button was a light switch.

Jul 16 '05 #5
Dirk Engels wrote:
Hi,

Not directly... but there is always a way to do something you want to do...
the sky is the limit :-)

dirk


Indeed, it is ;-)) And sometimes its really simple too. I will show you.
>Is it possible to access a function in a php document through a URL?
>
>For instance: http://www.somesiteorother.com/test.php?a_function
>
>And then have something like this in test.php:
>
><?php
>function a_function() {echo "Hello!";}
$_GET["function"]();
?>


But, you would have to access it through:

http://www.somesiteorother.com/test....ion=a_function

The trick used here is that you can use any variable as a variable or function name. Similarly you can use $$variable.

Michiel.

Jul 16 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: keepyourstupidspam | last post by:
Hello, I have a class X with a member function setConfigValues(). I want to access this member function in another class Y. Y is not inherited from X. A member function of class X called run()...
6
by: harry | last post by:
Hi ppl I have a question about memory layout of a class. Consider the code below: class Base1 { virtual void f() { cout << "Base1::f" << endl; } virtual void g() { cout << "Base1::g" <<...
2
by: Stu | last post by:
Hi, I am migrating a large app to .Net 2 and am having problems with accessing hidden fields using javascript. As I am using masterpages the control names are prefixed with the control...
12
by: Steve Blinkhorn | last post by:
Does anyone know of a way of accessing and modifying variables declared static within a function from outside that function? Please no homilies on why it's bad practice: the context is very...
6
by: Ant | last post by:
I have the following code which works fine for running some tests defined within a module: def a_test(): print "Test A" def b_test(): print "Test B" if __name__ == "__main__":
1
by: DelphiLover | last post by:
Hi. I'm reading and reading, testing and testing, trying to figure out how to do things, how to do things according to best practises and how to do things in the best object oriented way. ...
4
by: Joseph Paterson | last post by:
Hi all, I'm having some trouble with the following code (simplified to show the problem) class Counter { protected: int m_counter; }
9
by: fgh.vbn.rty | last post by:
Say I have a base class B and four derived classes d1, d2, d3, d4. I have three functions fx, fy, fz such that: fx should only be called by d1, d2 fy should only be called by d2, d3 fz should...
6
by: Bhawna | last post by:
I am into c++ code maintenance for last 3-4 years but recently I am put into design phase of a new project. Being a small comapany I dont have enough guidance from seniors. Currently I am into a...
16
by: s0suk3 | last post by:
This code #include <stdio.h> int main(void) { int hello = {'h', 'e', 'l', 'l', 'o'}; char *p = (void *) hello; for (size_t i = 0; i < sizeof(hello); ++i) {
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.