0

I have one code , when execute this code i let do other thing , for example :

<?php

if ($ending=="ok")
{
    $insert_end="ok";
}  

if ($insert_end=="ok")
{
    print "ok";
}

?>

But if i go the url and put for example :

http://www.domain.com/index.php?insert_end=ok

Execute the code and i don´t want this be possible because if some people know this can execute the code , it´s possible no let execute the code when put in url

Thank´s Regards

4
  • Also where is this? Your view, your controller? Commented Jun 7, 2014 at 19:13
  • Yes the controller if all ok put $insert_end="ok"; but if i put the same in the url execute all , also , by this my question if it´s possible no let this inside url , thank´s Commented Jun 7, 2014 at 19:19
  • Don't do $insert_end = $_GET['insert_end'] if you don't want the user to be able to set it. Commented Jun 7, 2014 at 19:22
  • I never use GET , you can see in the example Commented Jun 7, 2014 at 19:38

2 Answers 2

2

Disable register_globals in your php.ini file. It should not be used for exactly this reason.

Sign up to request clarification or add additional context in comments.

2 Comments

It's also worth noting that an upgrade is advisable, register_globals was removed in 5.4.
I have disable register globals and when y send by url this , always execute in the internal code
0

From what I could understand, try this:

if ($insert_end=="ok" && !array_key_exists('insert_end', $_GET))
{
    print "ok";
}

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.