note 86698 added to function.fwrite
| From: | vamsi4mail at gmail dot com | Date: | Thu, 30 Oct 2008 12:09:27 +0000 |
| Subject: | note 86698 added to function.fwrite | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-145965@lists.php.net to get a copy of this message | ||
// 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..
----
Server IP: 203.199.69.133
Probable Submitter: 122.252.226.215
----
Manual Page -- http://www.php.net/manual/en/function.fwrite.php
Edit -- https://master.php.net/note/edit/86698
Del: integrated -- https://master.php.net/note/delete/86698/integrated
Del: useless -- https://master.php.net/note/delete/86698/useless
Del: bad code -- https://master.php.net/note/delete/86698/bad+code
Del: spam -- https://master.php.net/note/delete/86698/spam
Del: non-english -- https://master.php.net/note/delete/86698/non-english
Del: in docs -- https://master.php.net/note/delete/86698/in+docs
Del: other reasons-- https://master.php.net/note/delete/86698
Reject -- https://master.php.net/note/reject/86698
Search -- https://master.php.net/manage/user-notes.php