Forum Moderators: coopster
I'm trying to write this code so it's no dependant on register_globals being "on". I know to do this you have to make use of the PHP globals. I'm a bit stuck on these ones:
[codes]
$SelectPlanet = $_GET['cp'];
$RestorePlanet = $_GET['re'];
$file = end(explode('/',$arr[1]['file']));
$line = $arr[1]['line'];
$debug->add("<tr><th>Query $numqueries: </th><th>$query</th><th>$file($line)</th><th>$table</th><th>$fetch</th></tr>");
[/codes]
How do I make the above lines globals? i.e for example the first line, would it be something like "$SelectPlanet = ['cp]" ?
I appreciate any help or advice. Many thanks.
ini_set ("display_errors", "1");
error_reporting(E_ALL);
This showed up what line the error was on in each file, and i've fixed most of them except the above, I can't figure them out. So I guess those errors are nothing to do with register globabls. The erros i'm getting are the following:
By the way, I don't know what some errors are repeating themselves.
Undefined index: cp in SetSelectedPlanet.php on line 14
Notice: Undefined index: re in SetSelectedPlanet.php on line 15
Notice: Undefined offset: 1 in mysql.php on line 22
Notice: Undefined offset: 1 in mysql.php on line 23
Notice: Undefined offset: 1 in mysql.php on line 22
Notice: Undefined offset: 1 in mysql.php on line 23
Notice: Undefined offset: 1 in mysql.php on line 22
Notice: Undefined offset: 1 mysql.php on line 23
Notice: Undefined offset: 1 mysql.php on line 22
Notice: Undefined offset: 1 mysql.php on line 23
Any help appreciated, thanks!
Now, how would I chance this line so that it's not dependant on register_globals being on?:
$gebruik=htmlspecialchars(addslashes($_POST['gebruik']));
I'm getting confused with all the brackets and stuff. Thanks!
If $_POST['gebruik'] is undefined, then that means it's not on the form, that is, there's no form element with name="gebruik" - check the HTML form. Could it have been coming from the $_GET via the form's action attribute? (<form action="page.php?gebruik=7">)
if(isset($_POST['gebruik']))
$gebruik = htmlspecialchars(addslashes($_POST['gebruik']));
... this will eliminate your undefined index errors.