Jump to content

Fwrite function


BoltZ

Recommended Posts

Well yea remember i kept giving you those errors? it didn't show the page if i had one of those errors. Here are some questions for you.

 

1. does it matter if i do ../connect.php in the file?

2. do i have to have connect.phpp in the same directory?

 

take a look at my code and see if i did something wrong

 

<?php
/**
* BBoardX 1.0 BETA
* Copyright &#169; 2008 BBoardX, All Rights Reserved
*
* Website: http://www.bboardx.com
* License: http://www.bboardx.com/license
*
*/

$myFile = "../connect.php";
$fh = fopen($myFile, 'w') or die("can't open file");

$stringData = "<?php
%%db = mysql_connect({$_POST['req_db_host']},{$_POST['username']},{$_POST['password']}) or die('Could not connect');
%%admin_email={$_POST['admin_email']};
%%admin_password={$_POST['admin_password']};
if(!%%db)
die('no db');
if(!mysql_select_db({$_POST['database']},%%db))
die('No database selected.');
if(get_magic_quotes_gpc())
{
%%_GET = array_map('stripslashes', %%_GET);
%%_POST = array_map('stripslashes', %%_POST);
%%_COOKIE=array_map('stripslashes', %%_COOKIE);
}
%%_GET = array_map('mysql_real_escape_string', %%_GET);
%%_POST = array_map('mysql_real_escape_string', %%_POST);
%%_COOKIE = array_map('mysql_real_escape_string', %%_COOKIE);
?>";
$stringData = str_replace("%%","$",$stringData);
fwrite($fh, $stringData);
fclose($fh);


Header ('Location runsql.php');
?>

$myFile = "../connect.php"; means you want to write the file one level above current directory. It should work as long as you (or to be exact a php script) have writing permissions for this... bet even if you didn't then you should get an error...

 

I've no idea...

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.