the following script is supposed to write a file and make a dir for a corrosponding
forum the only problem is it keeps coming out as
1:bbs
1:bbs2
1:bbs21
instead of
1:bbs
2:bbs2
3:bbs21
any ideas?
<?php
if(!file_exists("./forum/"))
{
mkdir("./forum/", 0777);
}
if($_POST['dir'] == "")
{
?>
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
<input type="text" name="dir" id="dir" />
<input type="submit" />
</form>
<?php
} else {
if(!file_exists("./forum/".$_POST['dir']."/"))
{
mkdir("./forum/".$_POST['dir']."/", 0777);
echo "forum made";
}
else
{
echo "forum already there";
}
$forums = file("./forum/forums.xm");
for($f=0;$f<count($forums);$f++)
{
$forums[$f] = explode(":",$forums[$f]);
$forums[$f] = $forums[$f][0];
settype($forums[$f],"integer");
}
natsort($forums);
$forums = $forums[count($forums)-1];
$forums = explode(":","",$forums);
$forums = $forums[0];
settype($forums,"integer");
$forums++;
if($fs=fopen("./forum/forums.xm","a"))
{
fwrite($fs,$forums.":".$_POST['dir']."\n");
fclose($fs);
}
}
?>
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php