user3626084
user3626084

Reputation: 75

Php and strings inside code

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

Upvotes: 0

Views: 49

Answers (2)

Prasanth
Prasanth

Reputation: 5268

From what I could understand, try this:

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

Upvotes: 0

Niet the Dark Absol
Niet the Dark Absol

Reputation: 324820

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

Upvotes: 2

Related Questions