Здравейте,
правя си сайт кадето ще може да се инсталират безплатно форуми и CMS системи но в код-а явно някаде бъркам
ето код-а
ако можете да помогнете ще съм ви много благодарен
Благодаря предварително
правя си сайт кадето ще може да се инсталират безплатно форуми и CMS системи но в код-а явно някаде бъркам
ето код-а
Код:
<?
if($is_loged_in == TRUE)
{
$result = FALSE;
$full_member_db = file("data/users.php");
foreach($full_member_db as $member_db_line)
{
if(!eregi("<\?",$member_db_line))
{
$member_db = explode("|",$member_db_line);
if(strtolower($member_db[0]) == $_SESSION['joined'] && $member_db[2] == $_SESSION['user']) { $result = TRUE; break; }
}
}
if($result == TRUE)
{
if($is_user == TRUE);
if($is_moderator == TRUE);
if($is_administrator == TRUE);
}
}
else { header("location: $PHP_SELF?no_acces=1"); }
$dir = scandir('forums/');
$files = count( $dir );
for ( $i = 0; $i < $files; $i++ )
{
if ( is_dir($dir[$i]) && $dir[$i] != "." && $dir[$i] != ".." && $dir[$i] != "adult" )
if ($user == $dir[$i])
die("<center><b>Съжалявам вие имате право само на един txt Форум</b></center>");
}
class copyDir {
var $dir1;
var $dir2;
var $errtxt;
var $overwrite_files;
var $recurse;
var $copy_callback;
var $copy;
function copyDir() {
$this->overwrite_files = false;
$this->recursive = false;
$this->copy_callback = false;
$this->copy = new stdClass();
}
/**
* Set the directory to copy from
*/
function setCopyFromDir( $dir ) {
if (!is_dir($dir)) {
$this->_error('The supplied argument, '.$dir.', is not a valid directory path!');
return false;
}
$this->dir1 = $dir;
return true;
}
/**
* Set the directory to copy to
*/
function setCopyToDir( $dir ) {
if (!is_dir($dir)) {
if (!mkdir($dir)) {
$this->_error('Could not create directory, '.$dir);
return false;
}
}
$this->dir2 = $dir;
return true;
}
/**
* Set if we want to copy sub folders or not
* @param bool TRUE or FALSE
*/
function copySubFolders( $bool = true ) {
$this->recurse = $bool;
}
/**
* Set if we want to overwrite existing files or not
* @param bool TRUE or FALSE
*/
function overWriteFiles( $bool = true ) {
$this->overwrite_files = $bool;
}
/**
* Set a callback function to be executed each time a file or sub folder is copied
* @param string callback function name
*/
function setCopyCallback( $fn ) {
$this->copy_callback = $fn;
}
/**
* Create the directory copy
* @param bool Recurse through sub directories?
*/
function createCopy() {
if ( !is_dir($this->dir1) ) {
$this->_error('Directory to copy from is not a directory. Set the directory using setCopyFromDir()');
return false;
}
if ( !is_dir($this->dir2) ) {
$this->_error('Directory to copy to is not a directory. Set the directory using setCopyToDir()');
return false;
}
// all set, start copy
if ($this->_makeCopy($this->dir1, $this->dir2, $recurse)) {
return true;
}
return false;
}
function _makeCopy($dir1, $dir2) {
if ($dh = opendir($dir1)) {
$i = 0;
$dirArr = array();
while ($el = readdir($dh)) {
$path1 = $dir1.'/'.$el;
$path2 = $dir2.'/'.$el;
$this->_setCopyStatus($path1, $path2);
if (is_dir($path1) && $el != '.' && $el != '..') {
if (is_dir($path2)) {
continue;
}
if (!mkdir($path2)) {
$this->_error('Could not create new directory, '.$path2);
return false;
}
if ($this->recurse) { // copy sub directories recursively
$this->_makeCopy($path1, $path2);
}
} elseif (is_file($path1)) {
if (is_file($path2) && !$this->overwrite_files) {
$this->_error("Duplicate File Exists, when trying to copy file: $path1, to $path2.<br /> Set overWriteFiles() if you need to overwrite existing files.");
return false;
}
if (!copy($path1, $path2)) {
$this->_error('Could not copy file, '.$path1.', to '.$path2);
return false;
}
}
$i++;
}
closedir($dh);
return true;
} else {
$this->_error('Could not open the directory, '.$dir1);
}
return false;
}
function _setCopyStatus($path1, $path2) {
$this->copy->oldfile = $path1;
$this->copy->newfile = $path2;
$this->_callback();
}
function _callback() {
if ($this->copy_callback) {
call_user_func($this->copy_callback, $this->copy);
}
}
function _error($txt) {
$this->errtxt = $txt;
}
/**
* View the last error logged
*/
function viewError() {
return $this->errtxt;
}
}
/**
* Usage of the copy directory class
*/
$dir = dirname(__FILE__); // the directory this script is in
$cp = new copyDir();
// set the directory to copy
if (!$cp->setCopyFromDir( $dir.'/txtforum' )) {
echo $cp->viewError();
die;
}
// set the directory to copy to
if (!$cp->setCopyToDir( $dir."/forums/$user" )) {
echo $cp->viewError();
die;
}
$cp->copySubFolders(true); // include sub folders when copying
//$cp->overWriteFiles(true); // overwrite existing files
$cp->setCopyCallback( 'updateCopyProgress' );
if (!$cp->createCopy( true )) { // create a copy and recurse through sub folders
echo $cp->viewError();
die;
}
// this is our custom function which is called each time we are about to make a new file copy
// or create a new sub directory
function updateCopyProgress(&$copy) {
$file1 = $copy->oldfile;
$file2 = $copy->newfile;
$type = is_dir($file1) ? 'dir' : 'file';
}
?>
ако можете да помогнете ще съм ви много благодарен
Благодаря предварително