4images Forum & Community

4images Modifications / Modifikationen => Mods & Plugins (Releases & Support) => Topic started by: camo93 on February 04, 2003, 08:48:43 PM

Title: [MOD] for Bypassing The SAFE MODE
Post by: camo93 on February 04, 2003, 08:48:43 PM
To manage 4images with SAFE MODE !
Finish remove/create directory by FTP and CHMOD 777 !

Requirements :
- FTP account
- PHP SAFE MODE actived

DO NOT MODIFY THE FILES IF YOU DON'T HAVE ANY PROBLEM WITH SAFE MODE !
BE SURE TO BACKUP : /admin/categories.php and /global.php

Step 1
Note : be sure to change all blue lines if not the hack don't work !
Open /admin/categories.php and Find :

Code: [Select]
function create_cat_folder($path, $mode) {
  if (@is_dir($path)) {
    @chmod($path, $mode);
    return true;
  }
  else {
    $oldumask = umask(0);
    $result = mkdir($path, $mode);
    umask($oldumask);
    if (!@is_dir($path) || !$result) {
      $result = mkdir($path, 0755);
      @chmod($path, $mode);
    }
    return $result;
  }
}

Replace by

Code: [Select]
function create_cat_folder($path, $mode) {

//initialisation de la connection FTP
$ftp_server='195.90.85.74'; // your FTP IP Serveur
$conn_id = ftp_connect($ftp_server);

// login et mot de passe
$user="camo"; // your login name
$passwd="whyNot"; // your password
$login_result = ftp_login($conn_id, $user, $passwd);

// Vérification de la connection
if ((!$conn_id) || (!$login_result)) {
echo "Mauvaise connexion FTP";
echo "Essaye de se connecter a $ftp_server for user $ftp_user_name";
die;
} else {

//ici, la connection est bien effectuée, alors on appelle la fonction qui crée le répertoire
$result = ftp_mkdir($conn_id,$path);
}

//Fermeture de la connection ftp
ftp_close($conn_id);
}

Step 2
Note : be sure to change all blue lines if not the hack don't work !
Find :

Code: [Select]
function remove_cat_folder($path) {
  $ok = 1;
  if (@is_dir($path)) {
    $handle = opendir($path);
    while ($file = @readdir($handle)) {
      if ($file != "." && $file != "..") {
        $ok = (!remove_cat_folder($path."/".$file)) ? 0 : $ok;
      }
    }
    closedir($handle);
    $ok = (!rmdir($path)) ? 0 : $ok;
  }
  else {
    $ok = (!unlink($path)) ? 0 : $ok;
  }
  return $ok;
}

Replace by

Code: [Select]
function remove_cat_folder($path) {

//initialisation de la connection FTP
$ftp_server='195.90.85.74'; // your FTP IP Serveur
$conn_id = ftp_connect($ftp_server);

// login et mot de passe
$user="camo"; // your login name
$passwd="whyNot"; // your password
$login_result = ftp_login($conn_id, $user, $passwd);

// Vérification de la connection
if ((!$conn_id) || (!$login_result)) {
echo "Mauvaise connexion FTP";
echo "Essaye de se connecter a $ftp_server for user $ftp_user_name";
die;
} else {

//ici, la connection est bien effectuée, alors on appelle la fonction qui crée le répertoire
$result = ftp_rmdir($conn_id,$path);
}

//Fermeture de la connection ftp
ftp_close($conn_id);

}

Step 3
Open /global.php and Find :

Code: [Select]
$msg = "";
$clickstream = "";
define('MEDIA_PATH', ROOT_PATH.MEDIA_DIR);
define('THUMB_PATH', ROOT_PATH.THUMB_DIR);
define('MEDIA_TEMP_PATH', ROOT_PATH.MEDIA_TEMP_DIR);
define('THUMB_TEMP_PATH', ROOT_PATH.THUMB_TEMP_DIR);
define('TEMPLATE_PATH', ROOT_PATH.TEMPLATE_DIR."/".$config['template_dir']);
define('ICON_PATH', ROOT_PATH.TEMPLATE_DIR."/".$config['template_dir']."/icons");

Replace by

Code: [Select]
$msg = "";
$clickstream = "";
define('MEDIA_PATH_FTP', "/4images/data/media");
define('THUMB_PATH_FTP', "/4images/data/thumbnails");
define('MEDIA_PATH', ROOT_PATH.MEDIA_DIR);
define('THUMB_PATH', ROOT_PATH.THUMB_DIR);
define('MEDIA_TEMP_PATH', ROOT_PATH.MEDIA_TEMP_DIR);
define('THUMB_TEMP_PATH', ROOT_PATH.THUMB_TEMP_DIR);
define('TEMPLATE_PATH', ROOT_PATH.TEMPLATE_DIR."/".$config['template_dir']);
define('ICON_PATH', ROOT_PATH.TEMPLATE_DIR."/".$config['template_dir']."/icons");

Now! make as if safe mode had never existed !
Camo

[edit=Nicky]
Code: [Select]
[color] and
Code: [Select]
[/color] removed from codes. original post attached as chmod.txt
Title: [MOD] for Bypassing The SAFE MODE
Post by: Clow Read on February 06, 2003, 01:23:15 AM
interesting ^^
this mod is really useful for ppl who are working under safe mode

thnx for the mod ^_~
Title: [MOD] for Bypassing The SAFE MODE
Post by: camo93 on February 06, 2003, 12:01:49 PM
Thank you :wink:  
Safe Mode is a big problem with all script.
Title: help me!!!!!!!!!!!!!!!!!!!!!
Post by: heocon on February 09, 2003, 11:51:40 AM
Quote
Fatal error: Call to undefined function: ftp_connect() in /home/vhosts/a2class.net/httpdocs/products/admin/categories.php on line 75

please help me!
Title: [MOD] for Bypassing The SAFE MODE
Post by: V@no on February 09, 2003, 03:18:56 PM
Probalbly your host doesnt support FTP either... 8O
Title: [MOD] for Bypassing The SAFE MODE
Post by: camo93 on February 12, 2003, 11:49:05 AM
Quote from: V@no
Probalbly your host doesnt support FTP either... 8O


Yes, require a FTP account.
Title: Re: help me!!!!!!!!!!!!!!!!!!!!!
Post by: joecks on February 17, 2003, 03:06:37 PM
Quote from: heocon
Quote
Fatal error: Call to undefined function: ftp_connect() in /home/vhosts/a2class.net/httpdocs/products/admin/categories.php on line 75

please help me!


I have the same problem and i do have ftp access, what else can i do wrong ?
Title: [MOD] for Bypassing The SAFE MODE
Post by: kummy on February 17, 2003, 03:32:24 PM
well...i think it's work...but a i get this message:

Warning: ftp_connect() [function.ftp-connect]: php_hostconnect: connect failed in /home/kummy72/public_html/iluh/4images/admin/categories.php on line 101

Warning: ftp_login() expects parameter 1 to be resource, boolean given in /home/kummy72/public_html/iluh/4images/admin/categories.php on line 106
Mauvaise connexion FTPEssaye de se connecter a 195.90.85.74 for user

my question is, how can i know my FTP IP server?
Title: Re: help me!!!!!!!!!!!!!!!!!!!!!
Post by: V@no on February 17, 2003, 05:49:43 PM
Quote from: joecks


I have the same problem and i do have ftp access, what else can i do wrong ?

The fact that u have FTP access, doesnt mean, that PHP has ftp access.
Title: [MOD] for Bypassing The SAFE MODE
Post by: camo93 on February 17, 2003, 07:40:09 PM
The message say : the ip server is not good

Quote
Mauvaise connexion FTPEssaye de se connecter a 195.90.85.74 for user


Ping your.domaine.name
and copy the IP adresse in the config.

Quote from: kummy
well...i think it's work...but a i get this message:

Warning: ftp_connect() [function.ftp-connect]: php_hostconnect: connect failed in /home/kummy72/public_html/iluh/4images/admin/categories.php on line 101

Warning: ftp_login() expects parameter 1 to be resource, boolean given in /home/kummy72/public_html/iluh/4images/admin/categories.php on line 106
Mauvaise connexion FTPEssaye de se connecter a 195.90.85.74 for user

my question is, how can i know my FTP IP server?
Title: [MOD] for Bypassing The SAFE MODE
Post by: kummy on February 17, 2003, 07:54:03 PM
okay...
then i get another message:

Warning: move_uploaded_file(./../data/media/3/nengah_new_pic.jpg) [function.move-uploaded-file]: failed to create stream: No such file or directory in /home/kummy72/public_html/iluh/4images/includes/upload.php on line 114

Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move '/tmp/phpgoa5X1' to './../data/media/3/nengah_new_pic.jpg' in /home/kummy72/public_html/iluh/4images/includes/upload.php on line 114

Error uploading image file: nengah new pic.jpg
nengah_new_pic.jpg: Copy error. Please check the directory permissions.

No database entry!
Title: [MOD] for Bypassing The SAFE MODE
Post by: camo93 on February 17, 2003, 08:00:22 PM
Yes, because if your adress ip is not good, the process don't create the directory. And the script continue and say : No such file or directory.

IP : the FTP serveur
Name : your login (very important for chown directory and permission)

Quote from: kummy
okay...
then i get another message:

Warning: move_uploaded_file(./../data/media/3/nengah_new_pic.jpg) [function.move-uploaded-file]: failed to create stream: No such file or directory in /home/kummy72/public_html/iluh/4images/includes/upload.php on line 114

Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move '/tmp/phpgoa5X1' to './../data/media/3/nengah_new_pic.jpg' in /home/kummy72/public_html/iluh/4images/includes/upload.php on line 114

Error uploading image file: nengah new pic.jpg
nengah_new_pic.jpg: Copy error. Please check the directory permissions.

No database entry!
Title: [MOD] for Bypassing The SAFE MODE
Post by: kummy on February 17, 2003, 11:04:22 PM
Quote from: camo93
Yes, because if your adress ip is not good, the process don't create the directory. And the script continue and say : No such file or directory.

IP : the FTP serveur
Name : your login (very important for chown directory and permission)


mm...okay..i'll try to find the IP now... :) btw, can i use ftp://ftp.kummy...bla..bla.. ? :roll:

camo, when i use FTP to connet to my ftp server, the status will be show like this:
STATUS:>   Connecting to ftp.kummy.indietown.com
STATUS:>   Connecting to ftp.kummy.indietown.com (ip = 66.246.37.217)
STATUS:>   Socket connected. Waiting for welcome message...

is the IP server of my ftp 66.246.37.217 ?? i've put it in $ftp_server=, but the error message still there...i can't upload any pics...
Title: [MOD] for Bypassing The SAFE MODE
Post by: camo93 on February 18, 2003, 10:56:43 AM
Quote
camo, when i use FTP to connet to my ftp server, the status will be show like this:
STATUS:>   Connecting to ftp.kummy.indietown.com
STATUS:>   Connecting to ftp.kummy.indietown.com (ip = 66.246.37.217)
STATUS:>   Socket connected. Waiting for welcome message...

is the IP server of my ftp 66.246.37.217 ?? i've put it in $ftp_server=, but the error message still there...i can't upload any pics...

argh !
I do not understand why. The Address IP is good and there is an error.
Can be a problem with the version of PHP.
I seek what it does not go...but it is possible that the PHP of your provider does not give the right has ftp access.
Title: [MOD] for Bypassing The SAFE MODE
Post by: joecks on February 18, 2003, 03:29:50 PM
I have it done (with help from another topic in the forum)

just let 4images make the directory (category).

After that remove the directory (it will be a number) created in data/media and data/thumbnails with your ftp client.

make the same directory again with your ftp client, chmod 777, upload your files to data/media/"number" (you can also upload your own thumbs to data/thumbnails"number" , i make them with irfanview).

go to the adminpanel of 4images and check for new images.

Thats all,

Greetings,

Carlo
Title: [MOD] for Bypassing The SAFE MODE
Post by: kummy on February 18, 2003, 04:52:38 PM
my God...it's really work... :lol:  8)
camo, i still use the real categories.php (none edited)..and it's work  :D

btw, will i always do these steps everytime i want to upload my photoz? i think everytime i add a category, right?

Quote from: joecks
I have it done (with help from another topic in the forum)

just let 4images make the directory (category).

After that remove the directory (it will be a number) created in data/media and data/thumbnails with your ftp client.

make the same directory again with your ftp client, chmod 777, upload your files to data/media/"number" (you can also upload your own thumbs to data/thumbnails"number" , i make them with irfanview).

go to the adminpanel of 4images and check for new images.

Thats all,

Greetings,

Carlo
Title: [MOD] for Bypassing The SAFE MODE
Post by: joecks on February 18, 2003, 07:35:35 PM
Yes, you only have to do the trick when ever you create a new category...

Grtx,

Joecks
Title: [MOD] for Bypassing The SAFE MODE
Post by: camo93 on February 19, 2003, 09:42:16 AM
Quote
btw, will i always do these steps everytime i want to upload my photoz? i think everytime i add a category, right?

Yes ! and this is why my solution is the best. The solution which joecks gives is known in another topic and is not the object here.
I have tested just one time this solution because it's irritatting !.

For hundreds of directory's it is very irritating to make del/create, del/create and many much more...and finished by 777.
My website show many photographers and it's impossible to del/add many directory and chown 777 :-) lol

Now with my code, 4images is the same one that before without the SAFE Mode disturbing it.

Regards,
Camo
Title: Re: help me!!!!!!!!!!!!!!!!!!!!!
Post by: joecks on February 20, 2003, 07:59:51 PM
When i check my php server info it says,

ftp
FTP support  enabled  

and still get this error message.

Grtx,

Joecks

Quote from: V@no
Quote from: joecks


I have the same problem and i do have ftp access, what else can i do wrong ?

The fact that u have FTP access, doesnt mean, that PHP has ftp access.
Title: Re: help me!!!!!!!!!!!!!!!!!!!!!
Post by: camo93 on February 20, 2003, 08:13:05 PM
Quote from: joecks
When i check my php server info it says,

ftp
FTP support  enabled  

and still get this error message.

Grtx,

Joecks

Quote from: V@no
Quote from: joecks


I have the same problem and i do have ftp access, what else can i do wrong ?

The fact that u have FTP access, doesnt mean, that PHP has ftp access.


Arghhhhhhhhhhhhhh !!!
I'm sorry, i don't understand ...
snifff ;(((
Title: Re: help me!!!!!!!!!!!!!!!!!!!!!
Post by: joecks on February 21, 2003, 06:40:58 PM
I mean that i get the same error...

When i check php info it says that ftp is supported..

Grtx,

Joecks

Quote from: heocon
Quote
Fatal error: Call to undefined function: ftp_connect() in /home/vhosts/a2class.net/httpdocs/products/admin/categories.php on line 75

please help me!
Title: [MOD] for Bypassing The SAFE MODE
Post by: rah on February 25, 2003, 03:29:40 AM
I am totally lost! I followed the instructions on how to deal with this safe mode thing, and still did not rectify it:
http://www.bazodeecentral.com/bcgallery/index.php

I firstly went into (/admin/catergories.php) made the changes and then into (/global.php) to make the necessary changes as well. But nothing happened. Any suggestions on where I went wrong???

More info: both files were in chmod 644 before I started working on them... I chmod them to 777 while working on them, then chmod it back to 644 when I was completed. Could that be my problem?
Title: hi
Post by: Kamui on March 14, 2003, 02:26:36 PM
i do need this so much. plz help me out. when adding categories it shows this message
Warning: ftp_mkdir() [function.ftp-mkdir]: ./../data/media/10: No such file or directory in /home/saiyaz/public_html/animesessions/admin/categories.php on line 90

Warning: ftp_mkdir() [function.ftp-mkdir]: ./../data/thumbnails/10: No such file or directory in /home/saiyaz/public_html/animesessions/admin/categories.php on line 90
Categories successfull added

the categories were added to the database but not to the ftp. how to solve this ?
Title: CORRECTION : FOR ALL THIS IS MY CONFIG FILE
Post by: camo93 on March 14, 2003, 05:01:22 PM
Hi,

Sorry for the problems.
This is my categories.php file.
Please backup your original.

Change the IP, password and login in this code.
Tell me more.

Regards

Code: [Select]
<?php
/**************************************************************************
 *                                                                        *
 *    4images - A Web Based Image Gallery Management System               *
 *    ----------------------------------------------------------------    *
 *                                                                        *
 *             File&#58; categories.php                                       *
 *        Copyright&#58; &#40;C&#41; 2002 Jan Sorgalla                                *
 *            Email&#58; jan@4homepages.de                                    *
 *              Web&#58; http&#58;//www.4homepages.de                             *
 *    Scriptversion&#58; 1.7                                                  *
 *                                                                        *
 *    Never released without support from&#58; Nicky &#40;http&#58;//www.nicky.net&#41;   *
 *                                                                        *
 **************************************************************************
 *                                                                        *
 *    Dieses Script ist KEINE Freeware. Bitte lesen Sie die Lizenz-       *
 *    bedingungen &#40;Lizenz.txt&#41; für weitere Informationen.                 *
 *    ---------------------------------------------------------------     *
 *    This script is NOT freeware! Please read the Copyright Notice       *
 *    &#40;Licence.txt&#41; for further information.                              *
 *                                                                        *
 *************************************************************************/

define&#40;'IN_CP', 1&#41;;
define&#40;'ROOT_PATH', './../'&#41;;
require&#40;'admin_global.php'&#41;;

include&#40;ROOT_PATH.'includes/search_utils.php'&#41;;

if &#40;$action == ""&#41; &#123;
  
$action "modifycats";
&
#125;

$access_field_array = array&#40;
  
"auth_viewcat" => AUTH_ALL,
  
"auth_viewimage" => AUTH_ALL,
  
"auth_download" => AUTH_USER,
  
"auth_upload" => AUTH_USER,
  
"auth_directupload" => AUTH_ADMIN,
  
"auth_vote" => AUTH_ALL,
  
"auth_sendpostcard" => AUTH_ALL,
  
"auth_readcomment" => AUTH_ALL,
  
"auth_postcomment" => AUTH_USER
&#41;;

$access_array = array&#40;
  
AUTH_ALL => $lang['all'&#93;,
  
AUTH_USER => $lang['userlevel_registered'&#93;,
  
AUTH_ACL => $lang['private'&#93;,
  
AUTH_ADMIN => $lang['userlevel_admin'&#93;
&#41;;

function show_access_select&#40;$title = "", $type, $status&#41; &#123;
  
global $access_array$HTTP_POST_VARS;
  if &
#40;isset&#40;$HTTP_POST_VARS[$type&#93;&#41;&#41; &#123;
    
$status $HTTP_POST_VARS[$type&#93;;
  
&#125;
  
echo "<tr class=\"".get_row_bg&#40;&#41;."\" valign=\"top\">\n<td><p class=\"rowtitle\">".$title."</p></td>\n";
  
echo "<td>\n<select name=\"".$type."\">\n";
  foreach &
#40;$access_array as $key => $val&#41; &#123;
    
echo "<option value=\"".$key."\"";
    if &
#40;$status == $key&#41; &#123;
      
echo " selected=\"selected\"";
    &
#125;
    
echo ">".$val."</option>\n";
  &
#125;
  
echo "</select>\n</td>\n</tr>\n";
&
#125;

//****************************************
function create_cat_folder&#40;$path, $mode&#41; &#123;

//initialisation de la connection FTP 
$ftp_server='IP of provider here'// IP 
$conn_id ftp_connect&#40;$ftp_server&#41;; 

// login et mot de passe 
$user="FTP login here"
$passwd="password here"// password 
$login_result ftp_login&#40;$conn_id, $user, $passwd&#41;; 

// Vérification de la connection 
if &#40;&#40;!$conn_id&#41; || &#40;!$login_result&#41;&#41; &#123; 
echo "Mauvaise connexion FTP"
echo 
"Essaye de se connecter a $ftp_server for user $ftp_user_name"
die; 
&
#125; else &#123; 

//ici, la connection est bien effectuée, alors on appelle la fonction qui crée le répertoire
$result ftp_mkdir&#40;$conn_id,$path&#41;;
&#125; 

//Fermeture de la connection ftp 
ftp_close&#40;$conn_id&#41;; 
&#125;

//******************************************
function remove_cat_folder&#40;$path&#41; &#123;

//initialisation de la connection FTP 
$ftp_server='IP of provider here'// IP 
$conn_id ftp_connect&#40;$ftp_server&#41;; 

// login et mot de passe
$user="FTP login here"
$passwd="password here"// password 
$login_result ftp_login&#40;$conn_id, $user, $passwd&#41;; 

// Vérification de la connection 
if &#40;&#40;!$conn_id&#41; || &#40;!$login_result&#41;&#41; &#123; 
echo "Mauvaise connexion FTP"
echo 
"Essaye de se connecter a $ftp_server for user $ftp_user_name"
die; 
&
#125; else &#123; 

//ici, la connection est bien effectuée, alors on appelle la fonction qui crée le répertoire
$result ftp_rmdir&#40;$conn_id,$path&#41;;
&#125; 

//Fermeture de la connection ftp 
ftp_close&#40;$conn_id&#41;; 

&#125;
//----------------------------------------------------------------------------

function remove_subcategories&#40;$cid = 0, $depth = 1&#41; &#123;
  
global $site_db$error_log$lang$category_cache;

  if &
#40;!isset&#40;$category_cache[$cid&#93;&#41;&#41; &#123;
    
return false;
  &
#125;
  
foreach &#40;$category_cache[$cid&#93; as $key => $cats&#41; &#123;
    
echo "<table border=\"0\" cellpadding=\"2\" cellspacing=\"0\"><tr><td>\n";
    if &
#40;$depth > 1&#41; &#123;
      
echo str_repeat&#40;"&nbsp;&nbsp;&nbsp;&nbsp;", $depth - 1&#41;."\n";
    
&#125;
    
echo "</td><td>\n";

    
$sql "DELETE FROM ".GROUP_ACCESS_TABLE.
            WHERE cat_id = "
.$cats['cat_id'&#93;;
    
$site_db->query&#40;$sql&#41;;

    
$sql "DELETE FROM ".CATEGORIES_TABLE.
            WHERE cat_id = "
.$cats['cat_id'&#93;;

    
if &#40;$site_db->query&#40;$sql&#41;&#41; &#123;
      
echo $lang['cat_delete_success'&#93;." <b>".$cats['cat_name'&#93;."</b> &#40;ID&#58; ".$cats['cat_id'&#93;."&#41;<br />\n";
    
&#125;
    
else &#123;
      
$error_log[&#93; = $lang['cat_delete_error'&#93;." <b>".$cats['cat_name'&#93;."</b> &#40;ID&#58; ".$cats['cat_id'&#93;."&#41;";
    
&#125;

    
$sql "SELECT image_id 
            FROM "
.IMAGES_TABLE.
            WHERE cat_id = "
.$cats['cat_id'&#93;;
    
$img_result $site_db->query&#40;$sql&#41;;

    
$image_ids_sql 0;
    while &
#40;$image_row = $site_db->fetch_array&#40;$img_result&#41;&#41; &#123;
      
$image_ids_sql .= &#40;&#40;$image_ids_sql != ""&#41; ? ", " &#58; ""&#41;.$image_row['image_id'&#93;;
    
&#125;

    
$sql "DELETE FROM ".IMAGES_TABLE.
            WHERE image_id IN &#40;
$image_ids_sql&#41;";
    if &
#40;$site_db->query&#40;$sql&#41;&#41; &#123;
      
echo "-&raquo ".$lang['image_delete_success'&#93;."<br />\n";
    
&#125;
    
else &#123;
      
$error_log[&#93; = $lang['image_delete_error'&#93;." &#40;".$cats['cat_name'&#93;.", ID&#58; ".$cats['cat_id'&#93;."&#41;";
    
&#125;

    
if &#40;!empty&#40;$cats['cat_id'&#93;&#41;&#41; &#123;
      
if &#40;remove_cat_folder&#40;MEDIA_PATH_FTP."/".$cats['cat_id'&#93;&#41;&#41; &#123;
        
echo "-&raquo ".$lang['file_delete_success'&#93;."<br />\n";
      
&#125;
      
else &#123;
        
$error_log[&#93; = $lang['file_delete_error'&#93;." &#40;".$cats['cat_name'&#93;.", ID&#58; ".$cats['cat_id'&#93;."&#41;";
      
&#125;
      
if &#40;remove_cat_folder&#40;THUMB_PATH_FTP."/".$cats['cat_id'&#93;&#41;&#41; &#123;
        
echo "-&raquo ".$lang['thumb_delete_success'&#93;."<br />\n";
      
&#125;
      
else &#123;
        
$error_log[&#93; = $lang['thumb_delete_error'&#93;." &#40;".$cats['cat_name'&#93;.", ID&#58; ".$cats['cat_id'&#93;."&#41;";
      
&#125;
    
&#125;

    
$sql "DELETE FROM ".COMMENTS_TABLE.
            WHERE image_id IN &#40;
$image_ids_sql&#41;";
    if &
#40;$site_db->query&#40;$sql&#41;&#41; &#123;
      
echo "-&raquo ".$lang['comments_delete_success'&#93;."<br />\n";
    
&#125;
    
else &#123;
      
$error_log[&#93; = $lang['comments_delete_error'&#93;." &#40;".$cats['cat_name'&#93;.", ID&#58; ".$cats['cat_id'&#93;."&#41;";
    
&#125;

    
remove_searchwords&#40;$image_ids_sql&#41;;

    
echo "<br /></td></tr></table>\n";
    
remove_subcategories&#40;$cats['cat_id'&#93;, $depth + 1&#41;;
  
&#125;
  
unset&#40;$category_cache[$cid&#93;&#41;;
  
return true;
&
#125;

function show_category_rows&#40;$cid = 0, $depth = 1&#41; &#123;
  
global $site_db$site_sess$lang$category_cache;

  if &
#40;!isset&#40;$category_cache[$cid&#93;&#41;&#41; &#123;
    
return false;
  &
#125;
  
foreach &#40;$category_cache[$cid&#93; as $key => $cats&#41; &#123;
    
$class "tablerow2";
    if &
#40;$cats['cat_parent_id'&#93; == 0&#41; &#123;
      
$class "tablerow";
    &
#125;
    
echo "<tr class=\"$class\">\n<td>\n";
    if &
#40;$depth > 1&#41; &#123;
      
echo str_repeat&#40;"&nbsp;&nbsp;&nbsp;&nbsp;", $depth - 1&#41;."<img src=\"images/folder_path.gif\" alt=\"\">\n";
    
&#125;

//    echo "<img src=\"".ROOT_PATH."admin/images/folder.gif\" alt=\"\"><b><a href=\"".$site_sess-//>url&#40;ROOT_PATH."categories.php?cat_id=".$cats['cat_id'&#93;&#41;."\" //target=\"_blank\">".$cats['cat_name'&#93;."</a>\n</b>&nbsp;&nbsp;&nbsp;&nbsp;";

echo "<img src=\"".ROOT_PATH."admin/images/folder.gif\" alt=\"\">&nbsp;<b>".$cats['cat_id'&#93;."</b>&nbsp;<b><a href=\"".$site_sess->url&#40;ROOT_PATH."categories.php?cat_id=".$cats['cat_id'&#93;&#41;."\" target=\"_blank\">".$cats['cat_name'&#93;."</a>\n</b>&nbsp;&nbsp;&nbsp;&nbsp;"; 

    
    
    
show_text_link&#40;$lang['edit'&#93;, "categories.php?action=editcat&cat_id=".$cats['cat_id'&#93;&#41;;
    
show_text_link&#40;$lang['delete'&#93;, "categories.php?action=removecat&cat_id=".$cats['cat_id'&#93;&#41;;
    
show_text_link&#40;$lang['add_subcategory'&#93;, "categories.php?action=addcat&cat_parent_id=".$cats['cat_id'&#93;&#41;;
    
echo "\n</td>\n<td align=\"center\">";
    echo 
"<a href=\"".$site_sess->url&#40;"categories.php?action=ordercat&move=up&cat_id=".$cats['cat_id'&#93;&#41;."\"><img src=\"images/arrow_up.gif\" border=\"0\"></a>\n";
    
echo "<a href=\"".$site_sess->url&#40;"categories.php?action=ordercat&move=down&cat_id=".$cats['cat_id'&#93;&#41;."\"><img src=\"images/arrow_down.gif\" border=\"0\"></a>\n";
    
echo "</td>\n</tr>\n";
    
show_category_rows&#40;$cats['cat_id'&#93;, $depth + 1&#41;;
  
&#125;
  
unset&#40;$category_cache[$cid&#93;&#41;;
&#125;

function update_cat_order&#40;$parent_id = 0&#41; &#123;
  
global $site_db;
  
$sql "SELECT cat_id 
          FROM "
.CATEGORIES_TABLE.
          WHERE cat_parent_id = 
$parent_id 
          ORDER BY cat_order ASC"
;
  
$result $site_db->query&#40;$sql&#41;;
  
$i 10;
  while &
#40;$row = $site_db->fetch_array&#40;$result&#41;&#41; &#123;
    
$sql "UPDATE ".CATEGORIES_TABLE.
            SET cat_order = 
$i 
            WHERE cat_id = "
.$row['cat_id'&#93;;
    
$site_db->query&#40;$sql&#41;;
    
$i += 10;
  &
#125;
&#125;

function get_cat_order_dropdown&#40;$parent_id = 0&#41; &#123;
  
global $cat_cache$cat_parent_cache$lang$HTTP_POST_VARS;
  
$category_list "\n<select name=\"cat_order\" class=\"categoryselect\">\n";
  
$category_list .= "<option value=\"0\"";
  if &
#40;isset&#40;$HTTP_POST_VARS['cat_order'&#93;&#41; && $HTTP_POST_VARS['cat_order'&#93; == 0&#41; &#123;
    
$category_list .= " selected=\"selected\"";
  &
#125;
  
$category_list .= ">".$lang['at_end'&#93;."</option>\n";
  
$category_list .= "<option value=\"5\"";
  if &
#40;isset&#40;$HTTP_POST_VARS['cat_order'&#93;&#41; && $HTTP_POST_VARS['cat_order'&#93; == 5&#41; &#123;
    
$category_list .= " selected=\"selected\"";
  &
#125;
  
$category_list .= ">".$lang['at_beginning'&#93;."</option>\n";
  
foreach &#40;$cat_parent_cache[$parent_id&#93; as $key => $val&#41; &#123;
    
$category_list .= "<option value=\"".&#40;$cat_cache[$val&#93;['cat_order'&#93; + 5&#41;."\"";
    
if &#40;isset&#40;$HTTP_POST_VARS['cat_order'&#93;&#41; && $HTTP_POST_VARS['cat_order'&#93; == &#40;$cat_cache[$val&#93;['cat_order'&#93; + 5&#41;&#41; &#123;
      
$category_list .= " selected=\"selected\"";
    &
#125;
    
$category_list .= ">".$lang['after'&#93;." ".$cat_cache[$val&#93;['cat_name'&#93;."</option>\n";
  
&#125;
  
$category_list .= "</select>\n";
  return 
$category_list;
&
#125;

show_admin_header&#40;&#41;;

if &#40;$action == "ordercat"&#41; &#123;
  
$cat_id = &#40;isset&#40;$HTTP_POST_VARS['cat_id'&#93;&#41;&#41; ? intval&#40;$HTTP_POST_VARS['cat_id'&#93;&#41; &#58; intval&#40;$HTTP_GET_VARS['cat_id'&#93;&#41;;
  
$move = &#40;isset&#40;$HTTP_POST_VARS['move'&#93;&#41;&#41; ? trim&#40;$HTTP_POST_VARS['move'&#93;&#41; &#58; trim&#40;$HTTP_GET_VARS['move'&#93;&#41;;

  
$number = &#40;$move == "up"&#41; ? -15 &#58; 15;

  
$sql "UPDATE ".CATEGORIES_TABLE.
          SET cat_order = cat_order + 
$number 
          WHERE cat_id = 
$cat_id";
  
$site_db->query&#40;$sql&#41;;

  
update_cat_order&#40;$cat_cache[$cat_id&#93;['cat_parent_id'&#93;&#41;;
  
$action "modifycats";
&
#125;

if &#40;$action == "deletecat"&#41; &#123;
  
$error_log = array&#40;&#41;;
  
show_table_header&#40;$lang['main_category'&#93;, 1&#41;;
  
$cat_id = &#40;isset&#40;$HTTP_POST_VARS['cat_id'&#93;&#41;&#41; ? intval&#40;$HTTP_POST_VARS['cat_id'&#93;&#41; &#58; intval&#40;$HTTP_GET_VARS['cat_id'&#93;&#41;;

  
$sql "SELECT cat_id, cat_name, cat_parent_id 
          FROM "
.CATEGORIES_TABLE.
          ORDER BY cat_order, cat_name ASC"
;
  
$result $site_db->query&#40;$sql&#41;;
  
$category_cache = array&#40;&#41;;
  
while &#40;$row = $site_db->fetch_array&#40;$result&#41;&#41; &#123;
    
$category_cache[$row['cat_parent_id'&#93;&#93;[$row['cat_id'&#93;&#93; = $row;
  
&#125;

  
echo "<tr><td class=\"tablerow\">\n";
  echo 
"<table border=\"0\" cellpadding=\"2\" cellspacing=0><tr><td>&nbsp;</td><td>\n";

  
$sql "DELETE FROM ".GROUP_ACCESS_TABLE.
          WHERE cat_id = "
.$cat_id;
  
$site_db->query&#40;$sql&#41;;

  
$sql "DELETE FROM ".CATEGORIES_TABLE.
          WHERE cat_id = "
.$cat_id;

  if &
#40;$site_db->query&#40;$sql&#41;&#41; &#123;
    
echo $lang['cat_delete_success'&#93;." <b>".$cat_cache[$cat_id&#93;['cat_name'&#93;."</b> &#40;ID&#58; ".$cat_id."&#41;<br />\n";
  
&#125;
  
else &#123;
    
$error_log[&#93; = $lang['cat_delete_error'&#93;." <b>".$cat_cache[$cat_id&#93;['cat_name'&#93;."</b> &#40;ID&#58; ".$cat_id."&#41;";
  
&#125;

  
$sql "SELECT image_id 
          FROM "
.IMAGES_TABLE.
          WHERE cat_id = "
.$cat_id;
  
$img_result $site_db->query&#40;$sql&#41;;

  
$image_ids_sql 0;
  while &
#40;$image_row = $site_db->fetch_array&#40;$img_result&#41;&#41; &#123;
    
$image_ids_sql .= &#40;&#40;$image_ids_sql != ""&#41; ? ", " &#58; ""&#41;.$image_row['image_id'&#93;;
  
&#125;

  
$sql "DELETE FROM ".IMAGES_TABLE.
          WHERE image_id IN &#40;
$image_ids_sql&#41;";
  if &
#40;$site_db->query&#40;$sql&#41;&#41; &#123;
    
echo "-&raquo ".$lang['image_delete_success'&#93;."<br />\n";
  
&#125;
  
else &#123;
    
$error_log[&#93; = $lang['image_delete_error'&#93;." &#40;".$cat_cache[$cat_id&#93;['cat_name'&#93;.", ID&#58; ".$cat_id."&#41;";
  
&#125;

  
if &#40;!empty&#40;$cat_id&#41;&#41; &#123;
    
if &#40;remove_cat_folder&#40;MEDIA_PATH_FTP."/".$cat_id&#41;&#41; &#123;
      
echo "-&raquo ".$lang['file_delete_success'&#93;."<br />\n";
    
&#125;
    
else &#123;
      
$error_log[&#93; = $lang['file_delete_error'&#93;." &#40;".$cat_cache[$cat_id&#93;['cat_name'&#93;.", ID&#58; ".$cat_id."&#41;";
    
&#125;
    
if &#40;remove_cat_folder&#40;THUMB_PATH_FTP."/".$cat_id&#41;&#41; &#123;
      
echo "-&raquo ".$lang['thumb_delete_success'&#93;."<br />\n";
    
&#125;
    
else &#123;
      
$error_log[&#93; = $lang['thumb_delete_error'&#93;." &#40;".$cat_cache[$cat_id&#93;['cat_name'&#93;.", ID&#58; ".$cat_id."&#41;";
    
&#125;
  
&#125;

  
$sql "DELETE FROM ".COMMENTS_TABLE.
          WHERE image_id IN &#40;
$image_ids_sql&#41;";
  if &
#40;$site_db->query&#40;$sql&#41;&#41; &#123;
    
echo "-&raquo ".$lang['comments_delete_success'&#93;."<br />\n";
  
&#125;
  
else &#123;
    
$error_log[&#93; = $lang['comments_delete_error'&#93;." &#40;".$cat_cache[$cat_id&#93;['cat_name'&#93;.", ID&#58; ".$cat_id."&#41;";
  
&#125;

  
remove_searchwords&#40;$image_ids_sql&#41;;

  
echo "<br /></td></tr></table>\n";
  echo 
"</td></tr>\n";
  
show_table_separator&#40;$lang['sub_categories'&#93;, 1&#41;;
  
echo "<tr><td class=\"tablerow\">\n";
  if &
#40;!remove_subcategories&#40;$cat_id&#41;&#41; &#123;
    
echo $lang['no_subcategories'&#93;;
  
&#125;
  
echo "</td></tr>\n";
  
show_table_footer&#40;&#41;;
  
if &#40;!empty&#40;$error_log&#41;&#41; &#123;
    
show_table_header&#40;"Error Log&#58;", 1&#41;;
    
echo "<tr><td class=\"tablerow\">\n";
    echo 
"<table border=\"0\" cellpadding=\"\"2 cellspacing=\"0\"><tr><td>&nbsp;</td><td>\n";
    echo 
"<b>".$lang['error_log_desc'&#93;."</b>\n<ul>\n";
    
foreach &#40;$error_log as $key => $val&#41; &#123;
      
printf &#40;"<li>%s</li>\n", $val&#41;;
    
&#125;
    
echo "</ul>\n</td></tr></table>\n";
    echo 
"</td></tr>\n";
    
show_table_footer&#40;&#41;;
  
&#125;
  
echo "<p>";
  
show_text_link&#40;$lang['back_overview'&#93;,"categories.php?action=modifycats"&#41;;
&#125;

if &#40;$action == "removecat"&#41; &#123;
  
$cat_id = &#40;isset&#40;$HTTP_POST_VARS['cat_id'&#93;&#41;&#41; ? intval&#40;$HTTP_POST_VARS['cat_id'&#93;&#41; &#58; intval&#40;$HTTP_GET_VARS['cat_id'&#93;&#41;;

  
show_form_header&#40;"categories.php", "deletecat"&#41;;
  
show_hidden_input&#40;"cat_id", $cat_id&#41;;
  
show_table_header&#40;$lang['delete'&#93;."&#58; ".$cat_cache[$cat_id&#93;['cat_name'&#93;, 2&#41;;
  
show_description_row&#40;$lang['delete_cat_confirm'&#93;&#41;;
  
show_form_footer&#40;$lang['yes'&#93;, "", 2, $lang['no'&#93;&#41;;
&#125;

if &#40;$action == "savecat"&#41; &#123;
  
$error = array&#40;&#41;;
  
$cat_name un_htmlspecialchars&#40;trim&#40;$HTTP_POST_VARS['cat_name'&#93;&#41;&#41;;
  
$cat_description un_htmlspecialchars&#40;trim&#40;$HTTP_POST_VARS['cat_description'&#93;&#41;&#41;;
  
$cat_parent_id intval&#40;$HTTP_POST_VARS['cat_parent_id'&#93;&#41;;
  
$cat_order = &#40;isset&#40;$HTTP_POST_VARS['cat_order'&#93;&#41;&#41; ? intval&#40;$HTTP_POST_VARS['cat_order'&#93;&#41; &#58; 0;

  
$auth_viewcat $HTTP_POST_VARS['auth_viewcat'&#93;;
  
$auth_viewimage $HTTP_POST_VARS['auth_viewimage'&#93;;
  
$auth_download $HTTP_POST_VARS['auth_download'&#93;;
  
$auth_upload $HTTP_POST_VARS['auth_upload'&#93;;
  
$auth_directupload $HTTP_POST_VARS['auth_directupload'&#93;;
  
$auth_vote $HTTP_POST_VARS['auth_vote'&#93;;
  
$auth_sendpostcard $HTTP_POST_VARS['auth_sendpostcard'&#93;;
  
$auth_readcomment $HTTP_POST_VARS['auth_readcomment'&#93;;
  
$auth_postcomment $HTTP_POST_VARS['auth_postcomment'&#93;;

  
if &#40;$cat_name == ""&#41; &#123;
    
$error['cat_name'&#93; = 1;
  
&#125;

  
if &#40;empty&#40;$error&#41;&#41; &#123;
    
if &#40;!$cat_order&#41; &#123;
      
$sql "SELECT cat_order 
              FROM "
.CATEGORIES_TABLE.
              WHERE cat_parent_id = 
$cat_parent_id 
              ORDER BY cat_order DESC
              LIMIT 1"
;
      
$catorder $site_db->query_firstrow&#40;$sql&#41;;
      
$cat_order $catorder['cat_order'&#93; + 10;
      
$do_updat_cat_order 0;
    &
#125;
    
else &#123;
      
$do_updat_cat_order 1;
    &
#125;

    
$sql "INSERT INTO ".CATEGORIES_TABLE.
            &#40;cat_name, cat_description, cat_parent_id, cat_order, auth_viewcat, auth_viewimage, auth_download, auth_upload, auth_directupload, auth_vote, auth_sendpostcard, auth_readcomment, auth_postcomment&#41; 
            VALUES 
            &#40;'
$cat_name', '$cat_description', $cat_parent_id$cat_order$auth_viewcat$auth_viewimage$auth_download$auth_upload$auth_directupload$auth_vote$auth_sendpostcard$auth_readcomment$auth_postcomment&#41;";
    
$result $site_db->query&#40;$sql&#41;;
    
$cat_id $site_db->get_insert_id&#40;&#41;;

    
if &#40;$result && $cat_id&#41; &#123;
      
if &#40;$do_updat_cat_order&#41; &#123;
        
update_cat_order&#40;$cat_parent_id&#41;;
      
&#125;
      
$msg $lang['cat_add_success'&#93;;
      
create_cat_folder&#40;MEDIA_PATH_FTP."/".$cat_id, CHMOD_DIRS&#41;;
      
create_cat_folder&#40;THUMB_PATH_FTP."/".$cat_id, CHMOD_DIRS&#41;;
    
&#125;
    
else &#123;
      
$msg $lang['cat_add_error'&#93;;
    
&#125;
    
$action "modifycats";
  &
#125;
  
else &#123;
    
$msg sprintf&#40;"<span class=\"marktext\">%s</span>", $lang['lostfield_error'&#93;&#41;;
    
$action "addcat";
  &
#125;
&#125;

if &#40;$action == "addcat"&#41; &#123;
  
if &#40;$msg != ""&#41; &#123;
    
printf&#40;"<b>%s</b>\n", $msg&#41;;
  
&#125;

  
show_form_header&#40;"categories.php", "savecat"&#41;;
  
show_table_header&#40;$lang['nav_categories_add'&#93;, 2&#41;;
  
show_input_row&#40;$lang['field_category_name'&#93;, "cat_name", "", $textinput_size&#41;;
  
show_textarea_row&#40;$lang['field_description_ext'&#93;, "cat_description", "", $textarea_size&#41;;
  
$cat_parent_id = &#40;isset&#40;$HTTP_GET_VARS['cat_parent_id'&#93;&#41;&#41; ? $HTTP_GET_VARS['cat_parent_id'&#93; &#58; 0;
  
show_cat_select_row&#40;$lang['field_parent'&#93;, $cat_parent_id, 1&#41;;

  //show_custom_row&#40;$lang['cat_order'&#93;, get_cat_order_dropdown&#40;$cat_parent_id&#41;&#41;;

  
$permission_headline $lang['permissions'&#93;;
  
if &#40;$cat_parent_id != 0&#41; &#123;
    
$new_access_field_array = array&#40;&#41;;

    
$sql "SELECT cat_name, auth_viewcat, auth_viewimage, auth_download, auth_upload, auth_directupload, auth_vote, auth_sendpostcard, auth_readcomment, auth_postcomment 
            FROM "
.CATEGORIES_TABLE.
            WHERE cat_id = 
$cat_parent_id";
    
$row $site_db->query_firstrow&#40;$sql&#41;;

    
foreach &#40;$access_field_array as $key => $val&#41; &#123;
      
$new_access_field_array[$key&#93; = $row[$key&#93;;
    
&#125;
    
unset&#40;$access_field_array&#41;;
    
$access_field_array $new_access_field_array;
    
$permission_headline .= "<span class=\"smalltext\"><br>".$lang['permissions_inherited'&#93;." &#40;".$row['cat_name'&#93;."&#41;</span>";
  
&#125;

  
show_table_separator&#40;$permission_headline, 2&#41;;
  
foreach &#40;$access_field_array as $key => $val&#41; &#123;
    
show_access_select&#40;$lang[$key&#93;, $key, $val&#41;;
  
&#125;

  
show_form_footer&#40;$lang['add'&#93;, $lang['reset'&#93;, 2&#41;;
&#125;

if &#40;$action == "updatecat"&#41; &#123;
  
$error = array&#40;&#41;;
  
$cat_id = &#40;isset&#40;$HTTP_POST_VARS['cat_id'&#93;&#41;&#41; ? intval&#40;$HTTP_POST_VARS['cat_id'&#93;&#41; &#58; intval&#40;$HTTP_GET_VARS['cat_id'&#93;&#41;;

  
$cat_parent_id intval&#40;$HTTP_POST_VARS['cat_parent_id'&#93;&#41;;
  
$cat_name un_htmlspecialchars&#40;trim&#40;$HTTP_POST_VARS['cat_name'&#93;&#41;&#41;;
  
$cat_description un_htmlspecialchars&#40;trim&#40;$HTTP_POST_VARS['cat_description'&#93;&#41;&#41;;
  
$cat_hits intval&#40;trim&#40;$HTTP_POST_VARS['cat_hits'&#93;&#41;&#41;;

  
$auth_viewcat $HTTP_POST_VARS['auth_viewcat'&#93;;
  
$auth_viewimage $HTTP_POST_VARS['auth_viewimage'&#93;;
  
$auth_download $HTTP_POST_VARS['auth_download'&#93;;
  
$auth_upload $HTTP_POST_VARS['auth_upload'&#93;;
  
$auth_directupload $HTTP_POST_VARS['auth_directupload'&#93;;
  
$auth_vote $HTTP_POST_VARS['auth_vote'&#93;;
  
$auth_sendpostcard $HTTP_POST_VARS['auth_sendpostcard'&#93;;
  
$auth_readcomment $HTTP_POST_VARS['auth_readcomment'&#93;;
  
$auth_postcomment $HTTP_POST_VARS['auth_postcomment'&#93;;

  
if &#40;$cat_parent_id == $cat_id&#41; &#123;
    
$msg .= sprintf&#40;"<span class=\"marktext\">%s</span><br />", $lang['parent_cat_error'&#93;&#41;;
    
$error['cat_parent_id'&#93; = 1;
  
&#125;
  
if &#40;$cat_name == ""&#41; &#123;
    
$error['cat_name'&#93; = 1;
  
&#125;

  
if &#40;empty&#40;$error&#41;&#41; &#123;
    
$sql "UPDATE ".CATEGORIES_TABLE.
            SET cat_name = '
$cat_name', cat_description = '$cat_description', cat_parent_id = $cat_parent_id, cat_hits = $cat_hits, auth_viewcat = $auth_viewcat, auth_viewimage = $auth_viewimage, auth_download = $auth_download, auth_upload = $auth_upload, auth_directupload = $auth_directupload, auth_vote = $auth_vote, auth_sendpostcard = $auth_sendpostcard, auth_readcomment = $auth_readcomment, auth_postcomment = $auth_postcomment 
            WHERE cat_id = 
$cat_id";
    
$result $site_db->query&#40;$sql&#41;;

    
$msg = &#40;$result&#41; ? $lang['cat_edit_success'&#93; &#58; $lang['cat_edit_error'&#93;;
    
$action "modifycats";
  &
#125;
  
else &#123;
    
$msg .= sprintf&#40;"<span class=\"marktext\">%s</span>", $lang['lostfield_error'&#93;&#41;;
    
$action "editcat";
  &
#125;
&#125;

if &#40;$action == "editcat"&#41; &#123;
  
if &#40;$msg != ""&#41; &#123;
    
printf&#40;"<b>%s</b>\n", $msg&#41;;
  
&#125;
  
$cat_id = &#40;isset&#40;$HTTP_POST_VARS['cat_id'&#93;&#41;&#41; ? intval&#40;$HTTP_POST_VARS['cat_id'&#93;&#41; &#58; intval&#40;$HTTP_GET_VARS['cat_id'&#93;&#41;;

  
$sql "SELECT cat_name, cat_description, cat_parent_id, cat_hits, auth_viewcat, auth_viewimage, auth_download, auth_upload, auth_directupload, auth_vote, auth_sendpostcard, auth_readcomment, auth_postcomment 
          FROM "
.CATEGORIES_TABLE.
          WHERE cat_id = 
$cat_id";
  
$result $site_db->query_firstrow&#40;$sql&#41;;

  
show_form_header&#40;"categories.php", "updatecat"&#41;;
  
show_hidden_input&#40;"cat_id", $cat_id&#41;;
  
show_table_header&#40;$lang['nav_categories_edit'&#93;, 2&#41;;
  
show_input_row&#40;$lang['field_category_name'&#93;, "cat_name", $result['cat_name'&#93;, $textinput_size&#41;;
  
show_textarea_row&#40;$lang['field_description_ext'&#93;, "cat_description", $result['cat_description'&#93;, $textarea_size&#41;;
  
show_cat_select_row&#40;$lang['field_parent'&#93;, $result['cat_parent_id'&#93;, 1&#41;;
  
show_input_row&#40;$lang['field_hits'&#93;, "cat_hits", $result['cat_hits'&#93;, 5&#41;;

  
show_table_separator&#40;$lang['permissions'&#93;, 2&#41;;
  
foreach &#40;$access_field_array as $key => $val&#41; &#123;
    
show_access_select&#40;$lang[$key&#93;, $key, $result[$key&#93;&#41;;
  
&#125;

  
show_form_footer&#40;$lang['save_changes'&#93;, $lang['reset'&#93;, 2, $lang['back'&#93;&#41;;
&#125;

if &#40;$action == "modifycats"&#41; &#123;
  
if &#40;$msg != ""&#41; &#123;
    
printf&#40;"<b>%s</b>\n<p>", $msg&#41;;
  
&#125;

  
$sql "SELECT cat_id, cat_name, cat_description, cat_parent_id, cat_hits, cat_order, auth_viewcat, auth_viewimage, auth_download, auth_upload, auth_directupload, auth_vote, auth_sendpostcard, auth_readcomment, auth_postcomment 
          FROM "
.CATEGORIES_TABLE.
          ORDER BY cat_order, cat_name ASC"
;
  
$result $site_db->query&#40;$sql&#41;;

  
$category_cache = array&#40;&#41;;
  
while &#40;$row = $site_db->fetch_array&#40;$result&#41;&#41; &#123;
    
$category_cache[$row['cat_parent_id'&#93;&#93;[$row['cat_id'&#93;&#93; = $row;
  
&#125;

  
echo "<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\" width=\"100%\" align=\"center\"><tr><td class=\"tableborder\">\n<table cellpadding=\"3\" cellspacing=\"1\" border=\"0\" width=\"100%\">\n";
  echo 
"<tr class=\"tableseparator\">\n";
  echo 
"<td class=\"tableseparator\">".$lang['nav_categories_edit'&#93;."</td>\n<td class=\"tableseparator\" align=\"center\">".$lang['cat_order'&#93;."</td>\n</tr>\n";
  
if &#40;sizeof&#40;$category_cache&#41; == 0&#41; &#123;
    
echo "<tr class=\"".get_row_bg&#40;&#41;."\">\n<td colspan=\"2\">".$lang['no_categories'&#93;."</td></tr>";
  
&#125;
  
else &#123;
    
show_category_rows&#40;&#41;;
  
&#125;
  
show_table_footer&#40;&#41;;
&#125;
show_admin_footer&#40;&#41;;
?>

[/code]
Title: Re: hi
Post by: OpenGL on April 12, 2003, 12:17:11 PM
Quote from: Kamui
i do need this so much. plz help me out. when adding categories it shows this message
Warning: ftp_mkdir() [function.ftp-mkdir]: ./../data/media/10: No such file or directory in /home/saiyaz/public_html/animesessions/admin/categories.php on line 90

Warning: ftp_mkdir() [function.ftp-mkdir]: ./../data/thumbnails/10: No such file or directory in /home/saiyaz/public_html/animesessions/admin/categories.php on line 90
Categories successfull added

the categories were added to the database but not to the ftp. how to solve this ?


i did try new camo93's categories.php but nothing happened... i dont know how to resolve this problem....
Help me plz...............
Title: [MOD] for Bypassing The SAFE MODE
Post by: treblecharger on April 17, 2003, 09:35:40 PM
I installed it, and did everything you said to bypass the safe mode, but i still get this error:

Quote
Warning: file_exists() [function.file-exists]: SAFE MODE Restriction in effect. The script whose uid is 711 is not allowed to access /home/treble-c/public_html/gallery/data/media/1 owned by uid 99 in /home/treble-c/public_html/gallery/includes/upload.php on line 109

Warning: move_uploaded_file() [function.move-uploaded-file]: SAFE MODE Restriction in effect. The script whose uid is 711 is not allowed to access /home/treble-c/public_html/gallery/data/media/1 owned by uid 99 in /home/treble-c/public_html/gallery/includes/upload.php on line 114


what am i doing wrong?
Title: Ftp will not make Dir. ---Not sure if global is edited right
Post by: mjt123 on April 19, 2003, 08:21:52 PM
I see that alot are have the same Err as me. I dont know what to do i did the edit to categories.php in the admin folder also the edit to the global.php but i did not have one in the admin folder so i fig that the global in the 4image/ was the right one IS THAT RIGHT ?

also im not sure what i need to put in the global edit

                                        Here
define('MEDIA_PATH_FTP', "/4images/data/media");
                                        Here
define('THUMB_PATH_FTP', "/4images/data/thumbnails");

This is what i did

define('MEDIA_PATH_FTP', "/home.com/httpdocs/4images/data/media");

define('THUMB_PATH_FTP', "/home.com/httpsdoc/4images/data/thumbnails");


Now i can make categorie in the Database but will not put in ftp.

If i tri to upload a image here the Err.

Warning: Unable to create './../data/media/1/scan.JPG': No such file or directory in /home/httpd/vhosts/home.com/httpdocs/4images/includes/upload.php on line 114

Warning: Unable to move '/tmp/phpTgPw8Q' to './../data/media/1/scan.JPG' in /home/httpd/vhosts/home.com/httpdocs/4images/includes/upload.php on line 114


If i tri to add or edit categories here the errs i get

Warning: ftp_mkdir: ./../data/media/8: No such file or directory in /home/httpd/vhosts/home.com/httpdocs/4images/admin/categories.php on line 90

Fatal error: Call to undefined function: ftp_close() in /home/httpd/vhosts/home.com/httpdocs/4images/admin/categories.php on line 94


Thanks Mike
Title: [MOD] for Bypassing The SAFE MODE
Post by: Nightfall on May 01, 2003, 04:33:22 PM
I have tried to use both the full path and only the /4images/data/media
They both didn't work The problem is as follows:

Warning: ftp_mkdir(): /home/virtual/site4/fst/var/www/html/4images/data/media/25: No such file or directory in /home/virtual/site4/fst/var/www/html/4images/admin/categories.php on line 91

Warning: ftp_mkdir(): /home/virtual/site4/fst/var/www/html/4images/data/thumbnails/25: No such file or directory in /home/virtual/site4/fst/var/www/html/4images/admin/categories.php on line 91
Category added

It only adds category to database no change in ftp

Pls help thanks.
Title: [MOD] for Bypassing The SAFE MODE
Post by: Qais on May 26, 2003, 09:14:18 PM
i did all the configuration
but again
i'm getting this error
asked host to change the server mode but they said no they can't change it...



can anybody help me...

i'm getting this error

Warning: SAFE MODE Restriction in effect. The script whose uid is 504 is not allowed to access ./../data/media/7 owned by uid 48 in /home/virtual/site2/fst/var/www/html/photos/admin/checkimages.php on line 191


help?
Title: Re: Ftp will not make Dir. ---Not sure if global is edited right
Post by: ib41 on June 01, 2003, 05:45:42 AM
Quote from: mjt123
I see that alot are have the same Err as me. I dont know what to do i did the edit to categories.php in the admin folder also the edit to the global.php but i did not have one in the admin folder so i fig that the global in the 4image/ was the right one IS THAT RIGHT ?

also im not sure what i need to put in the global edit

                                        Here
define('MEDIA_PATH_FTP', "/4images/data/media");
                                        Here
define('THUMB_PATH_FTP', "/4images/data/thumbnails");

This is what i did

define('MEDIA_PATH_FTP', "/home.com/httpdocs/4images/data/media");

define('THUMB_PATH_FTP', "/home.com/httpsdoc/4images/data/thumbnails");


Now i can make categorie in the Database but will not put in ftp.

If i tri to upload a image here the Err.

Warning: Unable to create './../data/media/1/scan.JPG': No such file or directory in /home/httpd/vhosts/home.com/httpdocs/4images/includes/upload.php on line 114

Warning: Unable to move '/tmp/phpTgPw8Q' to './../data/media/1/scan.JPG' in /home/httpd/vhosts/home.com/httpdocs/4images/includes/upload.php on line 114


If i tri to add or edit categories here the errs i get

Warning: ftp_mkdir: ./../data/media/8: No such file or directory in /home/httpd/vhosts/home.com/httpdocs/4images/admin/categories.php on line 90

Fatal error: Call to undefined function: ftp_close() in /home/httpd/vhosts/home.com/httpdocs/4images/admin/categories.php on line 94


Thanks Mike




  "/home.com/httpdocs/4images/data/media");  

you dont need the RED area, also, you should only leave the 4images in IF your folder is created  in your server as 4images

you should RENAME "4images" to the CORRECT NAME of your 4images "FOLDER".
Title: Almost complete
Post by: ib41 on June 01, 2003, 05:49:13 AM
I got the mod working on my site ( it does upload the images ) but I still get this ERROR text above the uploaded image

Code: [Select]
Warning: SAFE MODE Restriction in effect. The script whose uid is 12669 is not allowed to access /mnt/datadisk/users/webs/sitename.breezeland.com/pictures/data/thumbnails/1 owned by uid 51 in /mnt/datadisk/users/webs/sitename.breezeland.com/pictures/includes/image_utils.php on line 141

Warning: SAFE MODE Restriction in effect. The script whose uid is 12669 is not allowed to access ./data/thumbnails/1/P1172924-g.jpg owned by uid 51 in /mnt/datadisk/users/webs/sitename.breezeland.com/pictures/includes/image_utils.php on line 83


when I view the folders it doesn't show, ONLY just right after the image is uploaded


great mod BTW ;)
Title: [MOD] for Bypassing The SAFE MODE
Post by: Adagio on June 02, 2003, 04:40:38 PM
Same for me too. All works, except when I try to upload a picture. All chmod's are set to 777 ... and even with this mod, I get the message:

Warning: SAFE MODE Restriction in effect. The script whose uid is 636 is not allowed to access /home/www/web1/html/galerie/data/media/1 owned by uid 30 in /home/www/web1/html/galerie/includes/upload.php on line 114

Not funny ...
Title: [MOD] for Bypassing The SAFE MODE
Post by: DANG_BLUE on June 05, 2003, 08:52:06 AM
I'm using this MOD buts it still error:
Code: [Select]
Warning: file_exists() [function.file-exists]: SAFE MODE Restriction in effect. The script whose uid is 65941 is not allowed to access ./data/media/7 owned by uid 65768 in /customer/tnt/docs/gallery/includes/upload.php on line 109

Warning: move_uploaded_file() [function.move-uploaded-file]: SAFE MODE Restriction in effect. The script whose uid is 65941 is not allowed to access ./data/media/7 owned by uid 65768 in /customer/tnt/docs/gallery/includes/upload.php on line 114


No image uploaded in forder, no image in gallery... help!
Title: [MOD] for Bypassing The SAFE MODE
Post by: Tocsi on June 18, 2003, 03:07:43 AM
i've the same problem!
i also do the second modification on page 2 of this thread.
same error without the mod on page 2.
please help! i won't change my provider again!

Code: [Select]

Warning: SAFE MODE Restriction in effect. The script whose uid is 647 is not allowed to access /home/www/web12/html/foddoalbum/data/media/3 owned by uid 30 in /home/www/web12/html/foddoalbum/includes/upload.php on line 109

Warning: SAFE MODE Restriction in effect. The script whose uid is 647 is not allowed to access /home/www/web12/html/foddoalbum/data/media/3 owned by uid 30 in /home/www/web12/html/foddoalbum/includes/upload.php on line 114
Title: [MOD] for Bypassing The SAFE MODE
Post by: spiffykiwi on June 18, 2003, 07:42:50 PM
Quote from: Adagio
Same for me too. All works, except when I try to upload a picture. All chmod's are set to 777 ... and even with this mod, I get the message:

Warning: SAFE MODE Restriction in effect. The script whose uid is 636 is not allowed to access /home/www/web1/html/galerie/data/media/1 owned by uid 30 in /home/www/web1/html/galerie/includes/upload.php on line 114

Not funny ...


I get the same exact thing :( ... and I'm getting really frustrated over here...
Title: [MOD] for Bypassing The SAFE MODE
Post by: pepsity on June 19, 2003, 05:46:21 AM
Hey all
It works for me but I get this when I go into Add Categories

Code: [Select]
Parse error: parse error, unexpected $ in /home/username/public_html/website/gallery/admin/categories.php on line 596


pepsity
Title: [MOD] for Bypassing The SAFE MODE
Post by: mrdummy on June 20, 2003, 02:27:14 PM
Mod for bypassing safe mode works not always. UID problems occurs when i upload images to the site.

I think you must use 'FTP code mod' before you start with 4images site for first time.

I know now why UID codes are in trouble. Because script makes directories which are made by server self, thus own UID number. But uploaded images are from user / ftp method, thus another UID number.
That's not easy problem.

When i checks which commands are needed to bypass UID checks, there are some solutions:

- in apache http.conf you need for example:
Code: [Select]
<Directory /home/www/4images/data/>
php_admin_value safe_mode 0
php_admin_value open_basedir /home/www/4images/data/tmp_media/
php_admin_value open_basedir /home/www/4images/data/tmp_thumbnails/
</Directory>


But it works not very well.

Remove dirs and make same dirs again with your FTP program, then switch to chmod 777. It solves UID problem, but it takes little much work.

But now i have new command seen in PHP.
The command move_uploaded_file is possible solution for UID problem. Because it bypasses UID checks and does only move uploaded files to another dir. Useful for user uploaded files.

Is this code used into 4images site script? I see the script use copy() command for move files, but it causes UID conflicts.

Here manual for code: http://nl.php.net/manual/en/function.move-uploaded-file.php

Can you use this command or not?
Title: Re: [MOD] for Bypassing The SAFE MODE
Post by: Mogandi on April 05, 2005, 01:28:18 PM
Hi,

after getting the safe mode error message and finding the solution here, I rewrite the files as written in the first "Beitrag" ;-) Buit it doesn't work. Now i get errors when i make a new categorie.

Is there a possibility to solve this problem without ftp? I don't want my admins on my ftp account and i want them to admin all about the 4images script.
Probably the new version 1.7.1 helps?

Greetings Moggl
Title: Re: [MOD] for Bypassing The SAFE MODE
Post by: V@no on April 06, 2005, 05:15:45 AM
Is there a possibility to solve this problem without ftp?
yes, as soon as your hoster turn off safe mode - no ftp will require ;)
Title: Re: [MOD] for Bypassing The SAFE MODE
Post by: tpc010 on April 21, 2005, 12:46:25 AM
Hello,

this working in my skript.

I have search for this in forum. But nothing can be found.

I hope its usefull for other servers. :D

mfg tpc010


function create_cat_folder($path, $mode) {

//initialisation de la connection FTP
$ftp_server='serverIP'; // your FTP IP Serveur
$conn_id = ftp_connect($ftp_server);

// login et mot de passe
$user="USER"; // your login name
$passwd="XXXX"; // your password
$login_result = ftp_login($conn_id, $user, $passwd);

// Vérification de la connection
if ((!$conn_id) || (!$login_result)) {
echo "Schlechte Verbindung über FTP";
echo "Es wird versucht sich am Server: $ftp_server mit dem User: $ftp_user_name anzumelden";
die;
} else {

//ici, la connection est bien effectuée, alors on appelle la fonction qui crée le répertoire
$result = ftp_mkdir($conn_id,$path);
$chmod_cmd="CHMOD 0777 ".$path;
$chmod=ftp_site($conn_id, $chmod_cmd);

}
Title: Re: [MOD] for Bypassing The SAFE MODE
Post by: vietdragon on May 16, 2005, 02:46:15 PM
Hosting safe mode is on .

After i hacked this mod.

when i add categories  have this Warning :

Warning: ftp_mkdir(): Can't create directory: No such file or directory in /home/muzic/public_html/vnp/admin/categories.php on line 90

Warning: ftp_mkdir(): Can't create directory: No such file or directory in /home/muzic/public_html/vnp/admin/categories.php on line 90
Category added



Title: Re: [MOD] for Bypassing The SAFE MODE
Post by: Justin761985 on July 26, 2005, 01:24:39 AM
Hello,

I edit both files as required and used my FTP IP Address and all the login details and I still get the same old error message:

Warning: move_uploaded_file(./../data/media/4/Winter.jpg): failed to open stream: No such file or directory in /home/vhosts_111mb/puder-source.111mb.com/includes/upload.php on line 113

Warning: move_uploaded_file(): Unable to move '/tmp/phpYzlOt0' to './../data/media/4/Winter.jpg' in /home/vhosts_111mb/puder-source.111mb.com/includes/upload.php on line 113
Image 1
    Error uploading image file: Winter.jpg
Winter.jpg: Copy error. Please check the directory permissions.

No database entry!

What else can I do to fix that or what may I be doing wrong?

Thanks,
Justin.
Title: Re: [MOD] for Bypassing The SAFE MODE
Post by: andybxxx on August 03, 2005, 01:31:16 PM
how do I find out my ftp IP, I know the ftp path, but ddon't know how to get the IP
Title: Re: [MOD] for Bypassing The SAFE MODE
Post by: V@no on August 03, 2005, 02:06:59 PM
ask your hoster
Title: Re: [MOD] for Bypassing The SAFE MODE
Post by: baconzoo on September 25, 2005, 04:20:12 PM
I'm using this MOD buts it still error:
Code: [Select]
Warning: file_exists() [function.file-exists]: SAFE MODE Restriction in effect. The script whose uid is 65941 is not allowed to access ./data/media/7 owned by uid 65768 in /customer/tnt/docs/gallery/includes/upload.php on line 109

Warning: move_uploaded_file() [function.move-uploaded-file]: SAFE MODE Restriction in effect. The script whose uid is 65941 is not allowed to access ./data/media/7 owned by uid 65768 in /customer/tnt/docs/gallery/includes/upload.php on line 114

No image uploaded in forder, no image in gallery... help!

I also get this same error but only on images I upload in a New "Private" category.  ????  My old "Registered User" categories are fine.  So I switched the permissions to Registered just to see but still I error.  Very strange.
Title: Re: [MOD] for Bypassing The SAFE MODE
Post by: Schwede1987 on October 17, 2005, 06:10:43 PM
Code: [Select]
Warning: opendir(): SAFE MODE Restriction in effect. The script whose uid is 10003 is not allowed to access ./../data/media/2 owned by uid 30 in /home/httpd/vhosts/allesrosa.com/httpdocs/phpkit/4images/admin/checkimages.php on line 192

Warning: opendir(./../data/media/2): failed to open dir: Success in /home/httpd/vhosts/allesrosa.com/httpdocs/phpkit/4images/admin/checkimages.php on line 192

That's what i get, even after installing the Bypass. What to do? What's the error?

Thanks!
Title: Re: [MOD] for Bypassing The SAFE MODE
Post by: Nebel on October 25, 2005, 10:27:36 PM
Hi,

Blue=English
Lila=Deutsch

with some work it works :D
mit ein bisschen Arbeit klappt es. :D


Backup all files before you change them!!!
Mach eine Sicherheitskopie von den Dateien, bevor du sie Veränderst

DO NOT MODIFY THE FILES IF YOU DON'T HAVE ANY PROBLEM WITH SAFE MODE !
ÄNDERE DIE DATEIEN NICHT, WENN DU KEINE PROBLEME IM SAVE MODE HAST!


1.


Open /global.php and find :
Öffne /global.php und suche:

$msg = "";
$clickstream = "";
define('MEDIA_PATH', ROOT_PATH.MEDIA_DIR);
define('THUMB_PATH', ROOT_PATH.THUMB_DIR);
define('MEDIA_TEMP_PATH', ROOT_PATH.MEDIA_TEMP_DIR);
define('THUMB_TEMP_PATH', ROOT_PATH.THUMB_TEMP_DIR);
define('TEMPLATE_PATH', ROOT_PATH.TEMPLATE_DIR."/".$config['template_dir']);
define('ICON_PATH', ROOT_PATH.TEMPLATE_DIR."/".$config['template_dir']."/icons");

Replace by
Ersetzen mit

Quote
$msg = "";
$clickstream = "";
define('MEDIA_PATH_FTP', "/4images/data/media");
define('THUMB_PATH_FTP', "/4images/data/thumbnails");
define('MEDIA_PATH', ROOT_PATH.MEDIA_DIR);
define('THUMB_PATH', ROOT_PATH.THUMB_DIR);
define('MEDIA_TEMP_PATH', ROOT_PATH.MEDIA_TEMP_DIR);
define('THUMB_TEMP_PATH', ROOT_PATH.THUMB_TEMP_DIR);
define('TEMPLATE_PATH', ROOT_PATH.TEMPLATE_DIR."/".$config['template_dir']);
define('ICON_PATH', ROOT_PATH.TEMPLATE_DIR."/".$config['template_dir']."/icons");

4images must be the path where 4images is installed e.g. http://www.yourdomain.com/4images/
4images muss der Pfad sein, wo 4images installiert ist z.B. http://www.yourdomain.com/4images/


2.

Click Start > Run
Then type: cmd /k ping www.yourdomain.com

Repace yourdomain.com with your own. You'll see the IP-Adress of your homepage
Quote
Ping www.yourdomain.com [[/color]123.456.789.001] ....
The orange one is the IP.[/color]

Klick auf Start > Ausführen
Tippe im Eingabefeld ein: cmd /k ping www.yourdomain.com

Ersetze yourdomain.com mit deiner eigenen. Du sieshst die IP-Adresse deiner Homepage
Quote
Ping www.yourdomain.com [[/color]123.456.789.001] ....
Das Orangene ist die IP.[/color]

3.

1. Replace the /admin/categories.php with the following.  2. Be sure to change all red lines!!!
1. Ersetze die /admin/categories.php mit dem Folgenden.  2. Geh sicher, dass du alle Roten Zeilen änderst!!!
Quote
<?php
/**************************************************************************
*                                                                        *
*    4images - A Web Based Image Gallery Management System               *
*    ----------------------------------------------------------------    *
*                                                                        *
*             File: categories.php                                       *
*        Copyright: (C) 2002 Jan Sorgalla                                *
*            Email: jan@4homepages.de                                    *
*              Web: http://www.4homepages.de                             *
*    Scriptversion: 1.7                                                  *
*                                                                        *
*    Never released without support from: Nicky (http://www.nicky.net)   *
*                                                                        *
**************************************************************************
*                                                                        *
*    Dieses Script ist KEINE Freeware. Bitte lesen Sie die Lizenz-       *
*    bedingungen (Lizenz.txt) für weitere Informationen.                 *
*    ---------------------------------------------------------------     *
*    This script is NOT freeware! Please read the Copyright Notice       *
*    (Licence.txt) for further information.                              *
*                                                                        *
*************************************************************************/

define('IN_CP', 1);
define('ROOT_PATH', './../');
require('admin_global.php');

include(ROOT_PATH.'includes/search_utils.php');

if ($action == "") {;
  $action = "modifycats";
}

$access_field_array = array(
  "auth_viewcat" => AUTH_ALL,
  "auth_viewimage" => AUTH_ALL,
  "auth_download" => AUTH_USER,
  "auth_upload" => AUTH_USER,
  "auth_directupload" => AUTH_ADMIN,
  "auth_vote" => AUTH_ALL,
  "auth_sendpostcard" => AUTH_ALL,
  "auth_readcomment" => AUTH_ALL,
  "auth_postcomment" => AUTH_USER
);

$access_array = array(
  AUTH_ALL => $lang['all'],
  AUTH_USER => $lang['userlevel_registered'],
  AUTH_ACL => $lang['private'],
  AUTH_ADMIN => $lang['userlevel_admin']
);

function show_access_select($title = "", $type, $status) {;
  global $access_array, $HTTP_POST_VARS;
  if (isset($HTTP_POST_VARS[$type])) {;
    $status = $HTTP_POST_VARS[$type];
  }
  echo "<tr class=\"".get_row_bg()."\" valign=\"top\">\n<td><p class=\"rowtitle\">".$title."</p></td>\n";
  echo "<td>\n<select name=\"".$type."\">\n";
  foreach ($access_array as $key => $val) {;
    echo "<option value=\"".$key."\"";
    if ($status == $key) {;
      echo " selected=\"selected\"";
    }
    echo ">".$val."</option>\n";
  }
  echo "</select>\n</td>\n</tr>\n";
}

//****************************************
function create_cat_folder($path, $mode) {;

//initialisation de la connection FTP
$ftp_server='123.456.789.001'; // IP
$conn_id = ftp_connect($ftp_server);

// login et mot de passe
$user="username";
$passwd="password"; // password
$login_result = ftp_login($conn_id, $user, $passwd);

// Vérification de la connection
if ((!$conn_id) || (!$login_result)) {;
echo "Mauvaise connexion FTP";
echo "Essaye de se connecter a $ftp_server for user $ftp_user_name";
die;
} else {;

//ici, la connection est bien effectuée, alors on appelle la fonction qui crée le répertoire
$result = ftp_mkdir($conn_id,$path);
$chmod_cmd="CHMOD 0777 ".$path;
$chmod=ftp_site($conn_id, $chmod_cmd);
}

//Fermeture de la connection ftp
ftp_close($conn_id);
}

//******************************************
function remove_cat_folder($path) {;

//initialisation de la connection FTP
$ftp_server='123.456.789.001'; // IP
$conn_id = ftp_connect($ftp_server);

// login et mot de passe
$user="username";
$passwd="password"; // password
$login_result = ftp_login($conn_id, $user, $passwd);

// Vérification de la connection
if ((!$conn_id) || (!$login_result)) {;
echo "Mauvaise connexion FTP";
echo "Essaye de se connecter a $ftp_server for user $ftp_user_name";
die;
} else {;

//ici, la connection est bien effectuée, alors on appelle la fonction qui crée le répertoire
$result = ftp_rmdir($conn_id,$path);
}

//Fermeture de la connection ftp
ftp_close($conn_id);

}
//----------------------------------------------------------------------------

function remove_subcategories($cid = 0, $depth = 1) {;
  global $site_db, $error_log, $lang, $category_cache;

  if (!isset($category_cache[$cid])) {;
    return false;
  }
  foreach ($category_cache[$cid] as $key => $cats) {;
    echo "<table border=\"0\" cellpadding=\"2\" cellspacing=\"0\"><tr><td>\n";
    if ($depth > 1) {;
      echo str_repeat("&nbsp;&nbsp;&nbsp;&nbsp;", $depth - 1)."\n";
    }
    echo "</td><td>\n";

    $sql = "DELETE FROM ".GROUP_ACCESS_TABLE."
            WHERE cat_id = ".$cats['cat_id'];
    $site_db->query($sql);

    $sql = "DELETE FROM ".CATEGORIES_TABLE."
            WHERE cat_id = ".$cats['cat_id'];

    if ($site_db->query($sql)) {;
      echo $lang['cat_delete_success']." <b>".$cats['cat_name']."</b> (ID: ".$cats['cat_id'].")<br />\n";
    }
    else {;
      $error_log[] = $lang['cat_delete_error']." <b>".$cats['cat_name']."</b> (ID: ".$cats['cat_id'].")";
    }

    $sql = "SELECT image_id
            FROM ".IMAGES_TABLE."
            WHERE cat_id = ".$cats['cat_id'];
    $img_result = $site_db->query($sql);

    $image_ids_sql = 0;
    while ($image_row = $site_db->fetch_array($img_result)) {;
      $image_ids_sql .= (($image_ids_sql != "") ? ", " : "").$image_row['image_id'];
    }

    $sql = "DELETE FROM ".IMAGES_TABLE."
            WHERE image_id IN ($image_ids_sql)";
    if ($site_db->query($sql)) {;
      echo "-&raquo ".$lang['image_delete_success']."<br />\n";
    }
    else {;
      $error_log[] = $lang['image_delete_error']." (".$cats['cat_name'].", ID: ".$cats['cat_id'].")";
    }

    if (!empty($cats['cat_id'])) {;
      if (remove_cat_folder(MEDIA_PATH_FTP."/".$cats['cat_id'])) {;
        echo "-&raquo ".$lang['file_delete_success']."<br />\n";
      }
      else {;
        $error_log[] = $lang['file_delete_error']." (".$cats['cat_name'].", ID: ".$cats['cat_id'].")";
      }
      if (remove_cat_folder(THUMB_PATH_FTP."/".$cats['cat_id'])) {;
        echo "-&raquo ".$lang['thumb_delete_success']."<br />\n";
      }
      else {;
        $error_log[] = $lang['thumb_delete_error']." (".$cats['cat_name'].", ID: ".$cats['cat_id'].")";
      }
    }

    $sql = "DELETE FROM ".COMMENTS_TABLE."
            WHERE image_id IN ($image_ids_sql)";
    if ($site_db->query($sql)) {;
      echo "-&raquo ".$lang['comments_delete_success']."<br />\n";
    }
    else {;
      $error_log[] = $lang['comments_delete_error']." (".$cats['cat_name'].", ID: ".$cats['cat_id'].")";
    }

    remove_searchwords($image_ids_sql);

    echo "<br /></td></tr></table>\n";
    remove_subcategories($cats['cat_id'], $depth + 1);
  }
  unset($category_cache[$cid]);
  return true;
}

function show_category_rows($cid = 0, $depth = 1) {;
  global $site_db, $site_sess, $lang, $category_cache;

  if (!isset($category_cache[$cid])) {;
    return false;
  }
  foreach ($category_cache[$cid] as $key => $cats) {;
    $class = "tablerow2";
    if ($cats['cat_parent_id'] == 0) {;
      $class = "tablerow";
    }
    echo "<tr class=\"$class\">\n<td>\n";
    if ($depth > 1) {;
      echo str_repeat("&nbsp;&nbsp;&nbsp;&nbsp;", $depth - 1)."<img src=\"images/folder_path.gif\" alt=\"\">\n";
    }

//    echo "<img src=\"".ROOT_PATH."admin/images/folder.gif\" alt=\"\"><b><a href=\"".$site_sess-//>url(ROOT_PATH."categories.php?cat_id=".$cats['cat_id'])."\" //target=\"_blank\">".$cats['cat_name']."</a>\n</b>&nbsp;&nbsp;&nbsp;&nbsp;";

echo "<img src=\"".ROOT_PATH."admin/images/folder.gif\" alt=\"\">&nbsp;<b>".$cats['cat_id']."</b>&nbsp;<b><a href=\"".$site_sess->url(ROOT_PATH."categories.php?cat_id=".$cats['cat_id'])."\" target=\"_blank\">".$cats['cat_name']."</a>\n</b>&nbsp;&nbsp;&nbsp;&nbsp;";



    show_text_link($lang['edit'], "categories.php?action=editcat&cat_id=".$cats['cat_id']);
    show_text_link($lang['delete'], "categories.php?action=removecat&cat_id=".$cats['cat_id']);
    show_text_link($lang['add_subcategory'], "categories.php?action=addcat&cat_parent_id=".$cats['cat_id']);
    echo "\n</td>\n<td align=\"center\">";
    echo "<a href=\"".$site_sess->url("categories.php?action=ordercat&move=up&cat_id=".$cats['cat_id'])."\"><img src=\"images/arrow_up.gif\" border=\"0\"></a>\n";
    echo "<a href=\"".$site_sess->url("categories.php?action=ordercat&move=down&cat_id=".$cats['cat_id'])."\"><img src=\"images/arrow_down.gif\" border=\"0\"></a>\n";
    echo "</td>\n</tr>\n";
    show_category_rows($cats['cat_id'], $depth + 1);
  }
  unset($category_cache[$cid]);
}

function update_cat_order($parent_id = 0) {;
  global $site_db;
  $sql = "SELECT cat_id
          FROM ".CATEGORIES_TABLE."
          WHERE cat_parent_id = $parent_id
          ORDER BY cat_order ASC";
  $result = $site_db->query($sql);
  $i = 10;
  while ($row = $site_db->fetch_array($result)) {;
    $sql = "UPDATE ".CATEGORIES_TABLE."
            SET cat_order = $i
            WHERE cat_id = ".$row['cat_id'];
    $site_db->query($sql);
    $i += 10;
  }
}

function get_cat_order_dropdown($parent_id = 0) {;
  global $cat_cache, $cat_parent_cache, $lang, $HTTP_POST_VARS;
  $category_list = "\n<select name=\"cat_order\" class=\"categoryselect\">\n";
  $category_list .= "<option value=\"0\"";
  if (isset($HTTP_POST_VARS['cat_order']) && $HTTP_POST_VARS['cat_order'] == 0) {;
    $category_list .= " selected=\"selected\"";
  }
  $category_list .= ">".$lang['at_end']."</option>\n";
  $category_list .= "<option value=\"5\"";
  if (isset($HTTP_POST_VARS['cat_order']) && $HTTP_POST_VARS['cat_order'] == 5) {;
    $category_list .= " selected=\"selected\"";
  }
  $category_list .= ">".$lang['at_beginning']."</option>\n";
  foreach ($cat_parent_cache[$parent_id] as $key => $val) {;
    $category_list .= "<option value=\"".($cat_cache[$val]['cat_order'] + 5)."\"";
    if (isset($HTTP_POST_VARS['cat_order']) && $HTTP_POST_VARS['cat_order'] == ($cat_cache[$val]['cat_order'] + 5)) {;
      $category_list .= " selected=\"selected\"";
    }
    $category_list .= ">".$lang['after']." ".$cat_cache[$val]['cat_name']."</option>\n";
  }
  $category_list .= "</select>\n";
  return $category_list;
}

show_admin_header();

if ($action == "ordercat") {;
  $cat_id = (isset($HTTP_POST_VARS['cat_id'])) ? intval($HTTP_POST_VARS['cat_id']) : intval($HTTP_GET_VARS['cat_id']);
  $move = (isset($HTTP_POST_VARS['move'])) ? trim($HTTP_POST_VARS['move']) : trim($HTTP_GET_VARS['move']);

  $number = ($move == "up") ? -15 : 15;

  $sql = "UPDATE ".CATEGORIES_TABLE."
          SET cat_order = cat_order + $number
          WHERE cat_id = $cat_id";
  $site_db->query($sql);

  update_cat_order($cat_cache[$cat_id]['cat_parent_id']);
  $action = "modifycats";
}

if ($action == "deletecat") {;
  $error_log = array();
  show_table_header($lang['main_category'], 1);
  $cat_id = (isset($HTTP_POST_VARS['cat_id'])) ? intval($HTTP_POST_VARS['cat_id']) : intval($HTTP_GET_VARS['cat_id']);

  $sql = "SELECT cat_id, cat_name, cat_parent_id
          FROM ".CATEGORIES_TABLE."
          ORDER BY cat_order, cat_name ASC";
  $result = $site_db->query($sql);
  $category_cache = array();
  while ($row = $site_db->fetch_array($result)) {;
    $category_cache[$row['cat_parent_id']][$row['cat_id']] = $row;
  }

  echo "<tr><td class=\"tablerow\">\n";
  echo "<table border=\"0\" cellpadding=\"2\" cellspacing=0><tr><td>&nbsp;</td><td>\n";

  $sql = "DELETE FROM ".GROUP_ACCESS_TABLE."
          WHERE cat_id = ".$cat_id;
  $site_db->query($sql);

  $sql = "DELETE FROM ".CATEGORIES_TABLE."
          WHERE cat_id = ".$cat_id;

  if ($site_db->query($sql)) {;
    echo $lang['cat_delete_success']." <b>".$cat_cache[$cat_id]['cat_name']."</b> (ID: ".$cat_id.")<br />\n";
  }
  else {;
    $error_log[] = $lang['cat_delete_error']." <b>".$cat_cache[$cat_id]['cat_name']."</b> (ID: ".$cat_id.")";
  }

  $sql = "SELECT image_id
          FROM ".IMAGES_TABLE."
          WHERE cat_id = ".$cat_id;
  $img_result = $site_db->query($sql);

  $image_ids_sql = 0;
  while ($image_row = $site_db->fetch_array($img_result)) {;
    $image_ids_sql .= (($image_ids_sql != "") ? ", " : "").$image_row['image_id'];
  }

  $sql = "DELETE FROM ".IMAGES_TABLE."
          WHERE image_id IN ($image_ids_sql)";
  if ($site_db->query($sql)) {;
    echo "-&raquo ".$lang['image_delete_success']."<br />\n";
  }
  else {;
    $error_log[] = $lang['image_delete_error']." (".$cat_cache[$cat_id]['cat_name'].", ID: ".$cat_id.")";
  }

  if (!empty($cat_id)) {;
    if (remove_cat_folder(MEDIA_PATH_FTP."/".$cat_id)) {;
      echo "-&raquo ".$lang['file_delete_success']."<br />\n";
    }
    else {;
      $error_log[] = $lang['file_delete_error']." (".$cat_cache[$cat_id]['cat_name'].", ID: ".$cat_id.")";
    }
    if (remove_cat_folder(THUMB_PATH_FTP."/".$cat_id)) {;
      echo "-&raquo ".$lang['thumb_delete_success']."<br />\n";
    }
    else {;
      $error_log[] = $lang['thumb_delete_error']." (".$cat_cache[$cat_id]['cat_name'].", ID: ".$cat_id.")";
    }
  }

  $sql = "DELETE FROM ".COMMENTS_TABLE."
          WHERE image_id IN ($image_ids_sql)";
  if ($site_db->query($sql)) {;
    echo "-&raquo ".$lang['comments_delete_success']."<br />\n";
  }
  else {;
    $error_log[] = $lang['comments_delete_error']." (".$cat_cache[$cat_id]['cat_name'].", ID: ".$cat_id.")";
  }

  remove_searchwords($image_ids_sql);

  echo "<br /></td></tr></table>\n";
  echo "</td></tr>\n";
  show_table_separator($lang['sub_categories'], 1);
  echo "<tr><td class=\"tablerow\">\n";
  if (!remove_subcategories($cat_id)) {;
    echo $lang['no_subcategories'];
  }
  echo "</td></tr>\n";
  show_table_footer();
  if (!empty($error_log)) {;
    show_table_header("Error Log:", 1);
    echo "<tr><td class=\"tablerow\">\n";
    echo "<table border=\"0\" cellpadding=\"\"2 cellspacing=\"0\"><tr><td>&nbsp;</td><td>\n";
    echo "<b>".$lang['error_log_desc']."</b>\n<ul>\n";
    foreach ($error_log as $key => $val) {;
      printf ("<li>%s</li>\n", $val);
    }
    echo "</ul>\n</td></tr></table>\n";
    echo "</td></tr>\n";
    show_table_footer();
  }
  echo "<p>";
  show_text_link($lang['back_overview'],"categories.php?action=modifycats");
}

if ($action == "removecat") {;
  $cat_id = (isset($HTTP_POST_VARS['cat_id'])) ? intval($HTTP_POST_VARS['cat_id']) : intval($HTTP_GET_VARS['cat_id']);

  show_form_header("categories.php", "deletecat");
  show_hidden_input("cat_id", $cat_id);
  show_table_header($lang['delete'].": ".$cat_cache[$cat_id]['cat_name'], 2);
  show_description_row($lang['delete_cat_confirm']);
  show_form_footer($lang['yes'], "", 2, $lang['no']);
}

if ($action == "savecat") {;
  $error = array();
  $cat_name = un_htmlspecialchars(trim($HTTP_POST_VARS['cat_name']));
  $cat_description = un_htmlspecialchars(trim($HTTP_POST_VARS['cat_description']));
  $cat_parent_id = intval($HTTP_POST_VARS['cat_parent_id']);
  $cat_order = (isset($HTTP_POST_VARS['cat_order'])) ? intval($HTTP_POST_VARS['cat_order']) : 0;

  $auth_viewcat = $HTTP_POST_VARS['auth_viewcat'];
  $auth_viewimage = $HTTP_POST_VARS['auth_viewimage'];
  $auth_download = $HTTP_POST_VARS['auth_download'];
  $auth_upload = $HTTP_POST_VARS['auth_upload'];
  $auth_directupload = $HTTP_POST_VARS['auth_directupload'];
  $auth_vote = $HTTP_POST_VARS['auth_vote'];
  $auth_sendpostcard = $HTTP_POST_VARS['auth_sendpostcard'];
  $auth_readcomment = $HTTP_POST_VARS['auth_readcomment'];
  $auth_postcomment = $HTTP_POST_VARS['auth_postcomment'];

  if ($cat_name == "") {;
    $error['cat_name'] = 1;
  }

  if (empty($error)) {;
    if (!$cat_order) {;
      $sql = "SELECT cat_order
              FROM ".CATEGORIES_TABLE."
              WHERE cat_parent_id = $cat_parent_id
              ORDER BY cat_order DESC
              LIMIT 1";
      $catorder = $site_db->query_firstrow($sql);
      $cat_order = $catorder['cat_order'] + 10;
      $do_updat_cat_order = 0;
    }
    else {;
      $do_updat_cat_order = 1;
    }

    $sql = "INSERT INTO ".CATEGORIES_TABLE."
            (cat_name, cat_description, cat_parent_id, cat_order, auth_viewcat, auth_viewimage, auth_download, auth_upload, auth_directupload, auth_vote, auth_sendpostcard, auth_readcomment, auth_postcomment)
            VALUES
            ('$cat_name', '$cat_description', $cat_parent_id, $cat_order, $auth_viewcat, $auth_viewimage, $auth_download, $auth_upload, $auth_directupload, $auth_vote, $auth_sendpostcard, $auth_readcomment, $auth_postcomment)";
    $result = $site_db->query($sql);
    $cat_id = $site_db->get_insert_id();

    if ($result && $cat_id) {;
      if ($do_updat_cat_order) {;
        update_cat_order($cat_parent_id);
      }
      $msg = $lang['cat_add_success'];
      create_cat_folder(MEDIA_PATH_FTP."/".$cat_id, CHMOD_DIRS);
      create_cat_folder(THUMB_PATH_FTP."/".$cat_id, CHMOD_DIRS);
    }
    else {;
      $msg = $lang['cat_add_error'];
    }
    $action = "modifycats";
  }
  else {;
    $msg = sprintf("<span class=\"marktext\">%s</span>", $lang['lostfield_error']);
    $action = "addcat";
  }
}

if ($action == "addcat") {;
  if ($msg != "") {;
    printf("<b>%s</b>\n", $msg);
  }

  show_form_header("categories.php", "savecat");
  show_table_header($lang['nav_categories_add'], 2);
  show_input_row($lang['field_category_name'], "cat_name", "", $textinput_size);
  show_textarea_row($lang['field_description_ext'], "cat_description", "", $textarea_size);
  $cat_parent_id = (isset($HTTP_GET_VARS['cat_parent_id'])) ? $HTTP_GET_VARS['cat_parent_id'] : 0;
  show_cat_select_row($lang['field_parent'], $cat_parent_id, 1);

  //show_custom_row($lang['cat_order'], get_cat_order_dropdown($cat_parent_id));

  $permission_headline = $lang['permissions'];
  if ($cat_parent_id != 0) {;
    $new_access_field_array = array();

    $sql = "SELECT cat_name, auth_viewcat, auth_viewimage, auth_download, auth_upload, auth_directupload, auth_vote, auth_sendpostcard, auth_readcomment, auth_postcomment
            FROM ".CATEGORIES_TABLE."
            WHERE cat_id = $cat_parent_id";
    $row = $site_db->query_firstrow($sql);

    foreach ($access_field_array as $key => $val) {;
      $new_access_field_array[$key] = $row[$key];
    }
    unset($access_field_array);
    $access_field_array = $new_access_field_array;
    $permission_headline .= "<span class=\"smalltext\"><br>".$lang['permissions_inherited']." (".$row['cat_name'].")</span>";
  }

  show_table_separator($permission_headline, 2);
  foreach ($access_field_array as $key => $val) {;
    show_access_select($lang[$key], $key, $val);
  }

  show_form_footer($lang['add'], $lang['reset'], 2);
}

if ($action == "updatecat") {;
  $error = array();
  $cat_id = (isset($HTTP_POST_VARS['cat_id'])) ? intval($HTTP_POST_VARS['cat_id']) : intval($HTTP_GET_VARS['cat_id']);

  $cat_parent_id = intval($HTTP_POST_VARS['cat_parent_id']);
  $cat_name = un_htmlspecialchars(trim($HTTP_POST_VARS['cat_name']));
  $cat_description = un_htmlspecialchars(trim($HTTP_POST_VARS['cat_description']));
  $cat_hits = intval(trim($HTTP_POST_VARS['cat_hits']));

  $auth_viewcat = $HTTP_POST_VARS['auth_viewcat'];
  $auth_viewimage = $HTTP_POST_VARS['auth_viewimage'];
  $auth_download = $HTTP_POST_VARS['auth_download'];
  $auth_upload = $HTTP_POST_VARS['auth_upload'];
  $auth_directupload = $HTTP_POST_VARS['auth_directupload'];
  $auth_vote = $HTTP_POST_VARS['auth_vote'];
  $auth_sendpostcard = $HTTP_POST_VARS['auth_sendpostcard'];
  $auth_readcomment = $HTTP_POST_VARS['auth_readcomment'];
  $auth_postcomment = $HTTP_POST_VARS['auth_postcomment'];

  if ($cat_parent_id == $cat_id) {;
    $msg .= sprintf("<span class=\"marktext\">%s</span><br />", $lang['parent_cat_error']);
    $error['cat_parent_id'] = 1;
  }
  if ($cat_name == "") {;
    $error['cat_name'] = 1;
  }

  if (empty($error)) {;
    $sql = "UPDATE ".CATEGORIES_TABLE."
            SET cat_name = '$cat_name', cat_description = '$cat_description', cat_parent_id = $cat_parent_id, cat_hits = $cat_hits, auth_viewcat = $auth_viewcat, auth_viewimage = $auth_viewimage, auth_download = $auth_download, auth_upload = $auth_upload, auth_directupload = $auth_directupload, auth_vote = $auth_vote, auth_sendpostcard = $auth_sendpostcard, auth_readcomment = $auth_readcomment, auth_postcomment = $auth_postcomment
            WHERE cat_id = $cat_id";
    $result = $site_db->query($sql);

    $msg = ($result) ? $lang['cat_edit_success'] : $lang['cat_edit_error'];
    $action = "modifycats";
  }
  else {;
    $msg .= sprintf("<span class=\"marktext\">%s</span>", $lang['lostfield_error']);
    $action = "editcat";
  }
}

if ($action == "editcat") {;
  if ($msg != "") {;
    printf("<b>%s</b>\n", $msg);
  }
  $cat_id = (isset($HTTP_POST_VARS['cat_id'])) ? intval($HTTP_POST_VARS['cat_id']) : intval($HTTP_GET_VARS['cat_id']);

  $sql = "SELECT cat_name, cat_description, cat_parent_id, cat_hits, auth_viewcat, auth_viewimage, auth_download, auth_upload, auth_directupload, auth_vote, auth_sendpostcard, auth_readcomment, auth_postcomment
          FROM ".CATEGORIES_TABLE."
          WHERE cat_id = $cat_id";
  $result = $site_db->query_firstrow($sql);

  show_form_header("categories.php", "updatecat");
  show_hidden_input("cat_id", $cat_id);
  show_table_header($lang['nav_categories_edit'], 2);
  show_input_row($lang['field_category_name'], "cat_name", $result['cat_name'], $textinput_size);
  show_textarea_row($lang['field_description_ext'], "cat_description", $result['cat_description'], $textarea_size);
  show_cat_select_row($lang['field_parent'], $result['cat_parent_id'], 1);
  show_input_row($lang['field_hits'], "cat_hits", $result['cat_hits'], 5);

  show_table_separator($lang['permissions'], 2);
  foreach ($access_field_array as $key => $val) {;
    show_access_select($lang[$key], $key, $result[$key]);
  }

  show_form_footer($lang['save_changes'], $lang['reset'], 2, $lang['back']);
}

if ($action == "modifycats") {;
  if ($msg != "") {;
    printf("<b>%s</b>\n<p>", $msg);
  }

  $sql = "SELECT cat_id, cat_name, cat_description, cat_parent_id, cat_hits, cat_order, auth_viewcat, auth_viewimage, auth_download, auth_upload, auth_directupload, auth_vote, auth_sendpostcard, auth_readcomment, auth_postcomment
          FROM ".CATEGORIES_TABLE."
          ORDER BY cat_order, cat_name ASC";
  $result = $site_db->query($sql);

  $category_cache = array();
  while ($row = $site_db->fetch_array($result)) {;
    $category_cache[$row['cat_parent_id']][$row['cat_id']] = $row;
  }

  echo "<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\" width=\"100%\" align=\"center\"><tr><td class=\"tableborder\">\n<table cellpadding=\"3\" cellspacing=\"1\" border=\"0\" width=\"100%\">\n";
  echo "<tr class=\"tableseparator\">\n";
  echo "<td class=\"tableseparator\">".$lang['nav_categories_edit']."</td>\n<td class=\"tableseparator\" align=\"center\">".$lang['cat_order']."</td>\n</tr>\n";
  if (sizeof($category_cache) == 0) {;
    echo "<tr class=\"".get_row_bg()."\">\n<td colspan=\"2\">".$lang['no_categories']."</td></tr>";
  }
  else {;
    show_category_rows();
  }
  show_table_footer();
}
show_admin_footer();
?>
Did you change all red lines to your own settings and passwords?
Hast du alle roten Zeilen mit deinen eigenen Daten und Passwörtern versehen?

Hope it works for you too.
Ich hoffe, dass es bei dir auch funktioniert.

-----------------------------------------------------------------------------


If it doesn't work at all you can test this: If you have created some folders before by hand or otherwise, you have to delete them all before it works. Delete all numered folders in 4images/data/media and in 4images/data/thumbnails.
Falls es immer noch nicht klappen sollte oder wenn du kaum Ordner erstellt hast, solltest du es so versuchen: Wenn du schon vorher versucht hast per Hand Ordner zu erstellen, musst du sie erst löschen bevor es klappt. Lösche alle nummerierten Ordner in den Verzeichnissen 4images/data/media und in 4images/data/thumbnails.

-----------------------------------------------------------------------------

Regards,
Gruß,
Nebel

Title: Re: [MOD] for Bypassing The SAFE MODE
Post by: Nebel on November 12, 2005, 06:09:15 PM
Hi,

I forgott to insert the chmod command.
Code: [Select]
$chmod_cmd="CHMOD 0777 ".$path;
$chmod=ftp_site($conn_id, $chmod_cmd);

Edited Above :)
Title: Re: [MOD] for Bypassing The SAFE MODE
Post by: V@no on November 12, 2005, 06:36:52 PM
I didnt get this part:
Quote
If you have created some folders before by hand or otherwise, you have to delete them all before it works. Delete all numered folders in 4images/data/media and in 4images/data/thumbnails.
If you created folders by hand (meaning through FTP?) if so, why do you need to delete them? this mod is also using FTP, so it should be the same as if you create new folders by hand or though this mod...
or I'm missing something?
Title: Re: [MOD] for Bypassing The SAFE MODE
Post by: Nebel on November 12, 2005, 06:37:38 PM
N'abend nochmal,

hab das ganze dann auchmal auf Deutsch mit reingeschrieben 8)

Viel Spass

Gruß
Nebel
Title: Re: [MOD] for Bypassing The SAFE MODE
Post by: Nebel on November 12, 2005, 06:39:36 PM
Hi V@no,

I tried to keep the folders (right through FTP) but it didn't work. But I don't know why. When I deleted them it worked. But I tried it again before a minute and it worked also with folders created by hand. I'll change it above.

Regards
Nebel
Title: Re: [MOD] for Bypassing The SAFE MODE
Post by: michi-w. on November 18, 2005, 11:55:33 PM
Wenn ich beide Dateien änder, also die Admin categories.php und die global.php, dann geht es nicht, wenn ich aber nur die global.php veränder, dann kann ich Kategorien anliegen, ohne manuelle Anpassung.

Wie kann das sein?

Gruß
michi-w.
Title: Re: [MOD] for Bypassing The SAFE MODE
Post by: Nebel on November 20, 2005, 04:51:48 PM
Hi,

öh eigentlich kann das gar nicht sein?! Die Funktion zum erstellen der Ordner per ftp ist ja erst im categories.php.

Ging es denn vorher nicht?

Gruß
Nebel
Title: Re: [MOD] for Bypassing The SAFE MODE
Post by: michi-w. on November 20, 2005, 05:28:12 PM
Seltsamerweise ging es vorher nicht, oder mein Provider hat mit dem PHP Update etwas im Safe Mode geändert.
Title: Re: [MOD] for Bypassing The SAFE MODE
Post by: Acidgod on November 20, 2005, 05:30:52 PM
take a watch with a phpinfo file... (o:
Title: Re: [MOD] for Bypassing The SAFE MODE
Post by: michi-w. on November 20, 2005, 06:37:07 PM
Viel schlauer bin ich jetzt auch nicht! :?

Quote
enable-safe-mode
safe_mode Off
safe_mode_exec_dir no value
safe_mode_gid On
safe_mode_include_dir no value
sql.safe_mode Off
safe_mode_allowed_env_vars PHP_
safe_mode_protected_env_vars LD_LIBRARY_PATH
Title: Re: [MOD] for Bypassing The SAFE MODE
Post by: Acidgod on November 20, 2005, 10:10:46 PM
Quote
safe_mode Off 



And now? (o:
Title: Re: [MOD] for Bypassing The SAFE MODE
Post by: michi-w. on November 21, 2005, 12:19:03 AM
 :?: You are the spezialist :?
Title: Re: [MOD] for Bypassing The SAFE MODE
Post by: we_scooter on November 26, 2005, 08:29:27 PM
ok,
I installed the MOd and it rocks
As my host is turning SAFE MODE ON,
so I need to by pass SAFE MODe for  auto
thumbnailer too

any ideas?
Title: Re: [MOD] for Bypassing The SAFE MODE
Post by: rfn on December 11, 2005, 12:57:12 PM
will this work if you have safe mode off?

Rfn
Title: Re: [MOD] for Bypassing The SAFE MODE
Post by: Acidgod on December 11, 2005, 04:49:32 PM
you dont need it then...
Title: Re: [MOD] for Bypassing The SAFE MODE
Post by: rfn on December 17, 2005, 10:20:00 AM
you dont need it then...

I'll try it anyway, I need this ..
normal install works on my localhost and another host, but not on host number 2 ..
Title: Re: [MOD] for Bypassing The SAFE MODE
Post by: Swallow on December 27, 2005, 12:43:59 AM
Moin!

Habe alles so gemacht, wie Du's beschrieben hast...leider bekomme ich jedoch folgende Meldungen, wenn ich eine neue Kategorie hinzufügen möchte:
Warning: ftp_mkdir(): Create directory operation failed. in /home/www/web922/html/4images/admin/categories.php on line 90

Warning: ftp_site(): SITE CHMOD command failed. in /home/www/web922/html/4images/admin/categories.php on line 92

Warning: ftp_mkdir(): Create directory operation failed. in /home/www/web922/html/4images/admin/categories.php on line 90

Warning: ftp_site(): SITE CHMOD command failed. in /home/www/web922/html/4images/admin/categories.php on line 92
Kategorie erfolgreich hinzugefügt


...wobei die Zeilen 90 bis 92 (meiner Datei categories.php) folgendermaßen aussehen:

Zeile 90: $result = ftp_mkdir($conn_id,$path);
Zeile 91: $chmod_cmd="CHMOD 0777 ".$path;
Zeile 92:$chmod=ftp_site($conn_id, $chmod_cmd);


Sofern ich die Verzeichnisse dann "zu Fuß" erstelle klappt alles aber ansonsten klappt leider nichts...  :(

...vorab schon einmal Danke für jeden Tipp an dieser Stelle!!!

CU Swallow
Title: Re: [MOD] for Bypassing The SAFE MODE
Post by: Ty on January 16, 2006, 02:38:22 AM
I'm getting this error:

Warning: filesize(): SAFE MODE Restriction in effect. The script whose uid is 32370 is not allowed to access ./../data/media/4/0.jpg owned by uid 99 in /home/xxxxx/public_html/galeria/admin/admin_functions.php on line 599


PLEASE HELP ME!!!!! I got 3330 pictures on my gallery and I can't lose it!!!
Title: Re: [MOD] for Bypassing The SAFE MODE
Post by: narell on January 21, 2006, 04:01:02 PM
i modified both files but i still get this error:

Warning: move_uploaded_file() [function.move-uploaded-file]: SAFE MODE Restriction in effect. The script whose uid is 67554 is not allowed to access /DISK2/WWW/scifisystem.com/trinispot/4images/data/media/1 owned by uid 99 in /DISK2/WWW/scifisystem.com/trinispot/4images/includes/upload.php on line 125
 
 
can u tell me how to fix?
ohh..will the mod work even if it is in another language?
 
 
Title: Re: [MOD] for Bypassing The SAFE MODE
Post by: V@no on January 21, 2006, 06:34:59 PM
http://www.4homepages.de/forum/index.php?topic=6838.0
Title: Re: [MOD] for Bypassing The SAFE MODE
Post by: Nebel on January 22, 2006, 04:06:56 PM
Did you made the changes from Page 4 of this topic? http://www.4homepages.de/forum/index.php?topic=3958.msg49849#msg49849

In German it works too.
Title: Re: [MOD] for Bypassing The SAFE MODE
Post by: vote4 on February 22, 2006, 06:22:47 PM
Guten Abend!

Da ich leider das gleiche Problem habe mit dem SAFE MODE - schon mit dem hoster gesprochen habe -
darauf hin die Rechte kontrolliert habe (alle auf 777) -
ich jedoch nur ein hobby-admin meines Portals bin, welches nun nur mehr an diesem Problem zu scheitern droht.

Kann das jemand für mich durchsehen und evtl. korrigieren?
Ich mute mir das ernsthaft nicht zu - bzw. mache ich dann sicher noch mehr kaputt. ;-(

Mit bestem Dank
Title: Re: [MOD] for Bypassing The SAFE MODE
Post by: vote4 on February 22, 2006, 09:17:05 PM
So, ich versuchte es nun selber - aber leider ohne Erfolg.


Es zeigt nun beim Freischalten der user-uploads folgendes an:

Warning: copy(): SAFE MODE Restriction in effect. The script whose uid is 749 is not allowed to access /var/www/web51/html/data/media/9 owned by uid 33 in /var/www/web51/html/admin/admin_functions.php on line 111

Warning: copy(./../data/media/9/image.png): failed to open stream: No such file or directory in /var/www/web51/html/admin/admin_functions.php on line 111

Warning: copy(): SAFE MODE Restriction in effect. The script whose uid is 749 is not allowed to access /var/www/web51/html/data/thumbnails/9 owned by uid 33 in /var/www/web51/html/admin/admin_functions.php on line 155

Warning: copy(./../data/thumbnails/9/.png): failed to open stream: No such file or directory in /var/www/web51/html/admin/admin_functions.php on line 155
Fehler beim Hinzufügen des Bildes: TEST (image.png)


Würde mich um Unterstützung sehr freuen. ;-))

Gruss
Thomas K.
Title: Re: [MOD] for Bypassing The SAFE MODE
Post by: JoeLibya on March 14, 2006, 12:31:13 PM
Please I need urgent help! All images and thumpnails in my gallery " cannot be found" that's what I get from all the error messages when I try to click on any picture, and all thmpnails are gone, and replaced by the default thmpnails ..!!!!!!

www.ajdabiya.com/secret

How I cold fix that? I knew that my host is under the safe mode

Thank you so mch in Adavance
Title: help me
Post by: jafar on April 14, 2006, 05:02:15 PM
help me

pic not shown and error display

im done bypass safe mod but pic no t shon
Quote
Warning: filesize(): SAFE MODE Restriction in effect. The script whose uid is 32239 is not allowed to access ./../data/media/2/Tarash.jpg owned by uid 99 in /home/seghaleh/public_html/4images/admin/admin_functions.php on line 599


help
Title: Re: [MOD] for Bypassing The SAFE MODE
Post by: saggel on July 19, 2006, 11:30:45 PM
Is the problem solved on 1.7.3 ?
Title: Re: [MOD] for Bypassing The SAFE MODE
Post by: saggel on July 25, 2006, 01:42:42 AM
Anyone?  :?
Title: Re: [MOD] for Bypassing The SAFE MODE
Post by: saggel on July 31, 2006, 07:37:22 PM
I think it doesn't...
Title: Re: [MOD] for Bypassing The SAFE MODE
Post by: bina on November 23, 2006, 08:19:53 AM
Hallo,

mein Host möchte Safe Mode nicht mehr auf off stellen und habe alles versucht was dort stand, nur wird immer noch keins meiner fast 13 000 Bilder eingezeigt. Was kann ich jetzt machen ?

Überlege jetzt den Host zu wechseln, was auch nicht grade das leichte ist.

Hat jemand noch einen Tipp, wie ich die Galerie weiter nutzten kann, ohne dass ich ein der Rund 13 000 BIlder verliere ?
Title: Re: [MOD] for Bypassing The SAFE MODE
Post by: wheat on December 17, 2006, 09:20:39 AM
I'm confused.

When it says this:

"
$user="camo"; // your login name
$passwd="whyNot"; // your password "

What is the login and password for? The imagery gallery, my FTP? I don't know what to put in!! HELP!!
Title: Re: [MOD] for Bypassing The SAFE MODE
Post by: Mazinger on January 24, 2007, 02:28:09 PM
I've installed the gallery through the Cpanel... and eveything was installed successfully, the permissions were set... and the gallery worked...

when i tried to upload an image through the admin cp ... nothing was uploaded for :

Quote
Warning: move_uploaded_file(./../data/media/1/retsu.jpg) [function.move-uploaded-file]: failed to open stream: Permission denied in /home/zonearab/public_html/includes/upload.php on line 113

Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move '/tmp/phpeLdUpn' to './../data/media/1/retsu.jpg' in /home/zonearab/public_html/includes/upload.php on line 113

the safe mode was turned ON .. so I used the code in http://www.4homepages.de/forum/index.php?topic=3958.0 and changed the blue text...

... still have the problem yet ...

i deleted the folders in data/media... and created new ones (1, 2, ...) and set permission 777 ...

but still have the problem  :?

can any one help??
Title: Re: [MOD] for Bypassing The SAFE MODE
Post by: Mazinger on January 24, 2007, 02:34:18 PM
another problem, when i try to upload as a member.. not through the admin cp:
Quote
Warning: move_uploaded_file(./data/media/2/retsu.jpg) [function.move-uploaded-file]: failed to open stream: Permission denied in /home/zonearab/public_html/includes/upload.php on line 113

Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move '/tmp/phpMlRAyH' to './data/media/2/retsu.jpg' in /home/zonearab/public_html/includes/upload.php on line 113
Title: Re: [MOD] for Bypassing The SAFE MODE
Post by: Mazinger on January 24, 2007, 08:33:04 PM
I got this:

Quote
Warning: move_uploaded_file() [function.move-uploaded-file]: SAFE MODE Restriction in effect. The script whose uid is 32032 is not allowed to access /home/zonearab/public_html/gallery/data/media/1 owned by uid 99 in /home/zonearab/public_html/gallery/includes/upload.php on line 113
Title: Re: [MOD] for Bypassing The SAFE MODE
Post by: leo-magic on January 28, 2007, 11:54:16 AM
Delete the folder [number] in /data/media and [number] in /data/thumbnails and recreate these two folders and give them chmod 777.

Léo
Title: Re: [MOD] for Bypassing The SAFE MODE
Post by: maedicke on July 06, 2007, 07:38:45 PM
Backup all files before you change them!!!
Mach eine Sicherheitskopie von den Dateien, bevor du sie Veränderst

DO NOT MODIFY THE FILES IF YOU DON'T HAVE ANY PROBLEM WITH SAFE MODE !
ÄNDERE DIE DATEIEN NICHT, WENN DU KEINE PROBLEME IM SAVE MODE HAST!


1.


Hi,

Ich möchte auf meiner Webseite auch eine Image Galerie einrichten und bin daraufhin auch über 4images gestolpert.
Natürlich hat mein Webhoster Safemode = on gesetzt.
Mit diesem Patch hier geht es ganz gut zu umschiffen, allerdings ist da noch ein Problem:
Möchte ich eine Kategorie löschen, in der noch Bilder vorhanden sind, bekomme ich folgende Fehlermeldung:

Kategorie erfolgreich gelöscht test34 (ID: 22)
-» Bild erfolgreich gelöscht

Warning: ftp_rmdir() [function.ftp-rmdir]: /galerie/data/media/22: Directory not empty in /home/www/htdocs/maedicke.de/galerie/admin/categories.php on line 120
-» Kommentare erfolgreich gelöscht


Weiter unten steht dann:

   Es sind Fehler bei folgenden Aktionen aufgetreten:

    * Fehler beim Löschen der Bild-Datei (test34, ID: 22)
    * Fehler beim Löschen der Thumbnail-Datei (test34, ID: 22)


In Zeile 120 steht bei mir $result = ftp_rmdir($conn_id,$path);

Wo liegt denn der Fehler?


Title: Re: [MOD] for Bypassing The SAFE MODE
Post by: superuke on September 17, 2007, 04:54:15 PM
Ich hab auch alles so gemacht wie im Thread http://4homepages.de/forum/index.php?topic=3958.0 beschrieben. SaveMode ist auf ON. Es funzt trotzdem nicht. Bekomme immer die Fehlermeldung:

Code: [Select]
Fehler beim Upload der Bild-Datei: CIMG1709.JPG
CIMG1709.JPG: Datei konnte nicht auf den Server kopiert werden. Bitte überprüfen Sie ob die Zugriffsrechte des Zielordners richtig gesetzt sind

Daten nicht in die Datenbank geschrieben

Gibt es noch ne andere möglichkeit wo der Fehler hängen könnte?
Title: Re: [MOD] for Bypassing The SAFE MODE
Post by: bensen on October 05, 2007, 11:19:10 PM
das script funzt nicht gleiche fehler wie beim vorgänger
Title: Re: [MOD] for Bypassing The SAFE MODE
Post by: nette2 on January 12, 2009, 12:01:59 PM
I have done all as you sugested to bypas safe mode but it still won't work for me.

any other sugestions please??
Title: Re: [MOD] for Bypassing The SAFE MODE
Post by: Sebas Bonito on July 20, 2009, 02:17:39 AM
For me the same... does anybody have some news?
Title: Re: [MOD] for Bypassing The SAFE MODE
Post by: hippi on May 26, 2013, 04:33:30 PM
Sorry, what is "blue lines" in your first post?
And I dont understand last content. May you explan it for me? Thanks :D
[ Camo
[edit=Nicky]
Code:  [Select]  [Expand]  [Hide line numbers]
1[color]
and
Code:  [Select]  [Expand]  [Hide line numbers]
1[/color]
removed from codes. original post attached as chmod.txt ]

And how I can add IP in the config ?
 
Quote
Ping your.domaine.name
and copy the IP adresse in the config.
Quote

[ Quote from: kummy   [Expand]
well...i think it's work...but a i get this message:
Warning: ftp_connect() [function.ftp-connect]: php_hostconnect: connect failed in /home/kummy72/public_html/iluh/4images/admin/categories.php on line 101
Warning: ftp_login() expects parameter 1 to be resource, boolean given in /home/kummy72/public_html/iluh/4images/admin/categories.php on line 106
Mauvaise connexion FTPEssaye de se connecter a 195.90.85.74 for user
my question is, how can i know my FTP IP server?  ]