BoltZ Posted November 1, 2008 Author Share Posted November 1, 2008 What the..it still doesn't show any content in my connect.php script.... Link to comment https://forums.phpfreaks.com/topic/130988-fwrite-function/page/2/#findComment-680121 Share on other sites More sharing options...
Mchl Posted November 1, 2008 Share Posted November 1, 2008 You have error reporting enabled I suppose? Just making sure... Link to comment https://forums.phpfreaks.com/topic/130988-fwrite-function/page/2/#findComment-680126 Share on other sites More sharing options...
BoltZ Posted November 1, 2008 Author Share Posted November 1, 2008 Uhh well I have a file error_log. Does that mean its enabled? Link to comment https://forums.phpfreaks.com/topic/130988-fwrite-function/page/2/#findComment-680131 Share on other sites More sharing options...
Mchl Posted November 1, 2008 Share Posted November 1, 2008 Well... do you get an error when you forget a ; at the end of a line? Link to comment https://forums.phpfreaks.com/topic/130988-fwrite-function/page/2/#findComment-680134 Share on other sites More sharing options...
BoltZ Posted November 1, 2008 Author Share Posted November 1, 2008 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 © 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'); ?> Link to comment https://forums.phpfreaks.com/topic/130988-fwrite-function/page/2/#findComment-680136 Share on other sites More sharing options...
Mchl Posted November 1, 2008 Share Posted November 1, 2008 $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... Link to comment https://forums.phpfreaks.com/topic/130988-fwrite-function/page/2/#findComment-680138 Share on other sites More sharing options...
BoltZ Posted November 1, 2008 Author Share Posted November 1, 2008 Wow it still doesn't work, i had an idea that maybe the file had permissions too bad, but then when i set them to 755 or 777 whatever the highest setting is it still didnt work Link to comment https://forums.phpfreaks.com/topic/130988-fwrite-function/page/2/#findComment-680152 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.