note 86698 rejected from function.fwrite by thiago

From: Date: Thu, 30 Oct 2008 12:23:21 +0000
Subject: note 86698 rejected from function.fwrite by thiago
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-145966@lists.php.net to get a copy of this message
Note Submitter: vamsi4mail at gmail dot com ---- // hiii mkdir ("./$userid/", 0755, true); $myFile = "./$userid/index.php"; $fh = fopen($myFile, 'w') or die("can't open file"); $filename = "./$userid/index.php"; $somecontent = " <?php $con = mysql_connect('localhost','root',''); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("signup", $con); $result = mysql_query("SELECT * FROM user_signup where userid='$userid'"); while($row = mysql_fetch_array($result)) { echo $row['email'] . " " . $row['name']; echo "<br />"; } mysql_close($con); ?> "; // Let's make sure the file exists and is writable first. //if (is_writable($filename)) { // In our example we're opening $filename in append mode. // The file pointer is at the bottom of the file hence // that's where $somecontent will go when we fwrite() it. if (!$handle = fopen($filename, 'a')) { echo "Cannot open file ($filename)"; exit; } // Write $somecontent to our opened file. if (fwrite($handle, $somecontent) === FALSE) { echo "Cannot write to file ($filename)"; exit; } echo "Success"; fclose($handle); //hiii -------- creating file with php code is not possible to do like above Please help me..

« previous php.notes (#145966) next »