Page 2 of 3
Posted: Sat Feb 21, 2004 12:42 pm
by markl999
Here's the full test i did anyway
Code: Select all
<?php
$n = 'one';
$a = 'two';
$l = 'three';
$fm= 'four';
$ach = 'five';
$pc = 'six';
$le = 'seven';
$r = 'eight';
$q = 'nine';
$pw = 'ten';
$results = "<?php
\$name = "$n";
\$age = "$a";
\$location = "$l";
\$fmap = "$fm";
\$achievements = "$ach";
\$pastclan = "$pc";
\$lexp = "$le";
\$resolution = "$r";
\$quote = "$q";
\$p = "$pw";
?>";
$fp = fopen('code.php', 'w');
fputs($fp, $results);
fclose($fp);
?>
Posted: Sat Feb 21, 2004 12:46 pm
by defx
what kind of file are you writing it too mark? because im writing it to a php file and it doesnt show up when i open it up in ultraedit :O
Posted: Sat Feb 21, 2004 12:47 pm
by markl999
Just writing it to a file called code.php
Posted: Sat Feb 21, 2004 12:51 pm
by Illusionist
Ok mark the first time i tried it without escaping the ; it didn't work... but for some reason it does now.. ig uess soemthing else was wrong with my code! eheh
Posted: Sat Feb 21, 2004 12:51 pm
by defx
this is weird, i open up the page, "write" it, then open the file its supposed to write to, and nothing is there
Posted: Sat Feb 21, 2004 12:54 pm
by markl999
I notice you are doing
Code: Select all
$fp = fopen("$file", "w");
fwrite($fp, $results);
Try doing this :
Code: Select all
echo "Writing to $file<br />";
$fp = fopen($file, "w");
fwrite($fp, $results);
fclose($fp);
See if the echo looks ok.
Posted: Sat Feb 21, 2004 12:56 pm
by defx
nope, still doesnt work ;O -- could i be doing something wrong as far as defining the file goes, since it isnt in the function?
Posted: Sat Feb 21, 2004 12:58 pm
by markl999
What did the echo output? 'Writing to ...... '?
If you put error_reporting(E_ALL); right after <?php then it will throw up undefined vars like $file
Posted: Sat Feb 21, 2004 1:00 pm
by Illusionist
i think i found your problem:
Code: Select all
} elseif ($p == "edit" && $user == "defx") {
$file = "defx.php";
} elseif ($p == "submit") {
submit();
}
If your just trying to test the submit, then you'll never define the file...
Posted: Sat Feb 21, 2004 1:01 pm
by defx
no i am full out using the page. i am going to page.php?p=edit&user=defx and it still doesnt work :O
Posted: Sat Feb 21, 2004 1:02 pm
by Illusionist
thats ebcause your never calling submit() then.... Just going to page.php?p=edit&user=defx will just define $file... it will never run submit()
Posted: Sat Feb 21, 2004 1:03 pm
by defx
see im wondering if its because i only go to ?p=submit when it submits
Posted: Sat Feb 21, 2004 1:04 pm
by defx
well like what im doing is going to page.php?p=edit&user=defx there the form code shows up, im putting in info and hitting submit, which is linked to ?p=submit
Posted: Sat Feb 21, 2004 1:05 pm
by markl999
Do you have register_globals On? If not it won't work, you'll need to use $_GET['p'] where you have $p, and $_GET['user'] where you have $user etc..
Posted: Sat Feb 21, 2004 1:05 pm
by Illusionist
i know waht you can do though... add a hidden input field in your big echo that echo's out he HTML, and give it a name of file and assign it's value to $file.
<input type=\"hidden\" name=\"file\" value=\"$file\">