Author Topic: [MOD] for Bypassing The SAFE MODE  (Read 151597 times)

0 Members and 1 Guest are viewing this topic.

Offline camo93

  • Newbie
  • *
  • Posts: 24
    • View Profile
    • http://central-galerie.com
[MOD] for Bypassing The SAFE MODE
« 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
« Last Edit: June 19, 2008, 08:18:20 AM by Nicky »

Offline Clow Read

  • Newbie
  • *
  • Posts: 21
    • View Profile
    • http://vectorcandy.com
[MOD] for Bypassing The SAFE MODE
« Reply #1 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 ^_~

Offline camo93

  • Newbie
  • *
  • Posts: 24
    • View Profile
    • http://central-galerie.com
[MOD] for Bypassing The SAFE MODE
« Reply #2 on: February 06, 2003, 12:01:49 PM »
Thank you :wink:  
Safe Mode is a big problem with all script.

Offline heocon

  • Pre-Newbie
  • Posts: 1
    • View Profile
help me!!!!!!!!!!!!!!!!!!!!!
« Reply #3 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!

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Administrator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
[MOD] for Bypassing The SAFE MODE
« Reply #4 on: February 09, 2003, 03:18:56 PM »
Probalbly your host doesnt support FTP either... 8O
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline camo93

  • Newbie
  • *
  • Posts: 24
    • View Profile
    • http://central-galerie.com
[MOD] for Bypassing The SAFE MODE
« Reply #5 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.

Offline joecks

  • Newbie
  • *
  • Posts: 11
    • View Profile
    • http://www.familie-bruil.com
Re: help me!!!!!!!!!!!!!!!!!!!!!
« Reply #6 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 ?

Offline kummy

  • Newbie
  • *
  • Posts: 11
    • View Profile
[MOD] for Bypassing The SAFE MODE
« Reply #7 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?

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Administrator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: help me!!!!!!!!!!!!!!!!!!!!!
« Reply #8 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.
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline camo93

  • Newbie
  • *
  • Posts: 24
    • View Profile
    • http://central-galerie.com
[MOD] for Bypassing The SAFE MODE
« Reply #9 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?

Offline kummy

  • Newbie
  • *
  • Posts: 11
    • View Profile
[MOD] for Bypassing The SAFE MODE
« Reply #10 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!

Offline camo93

  • Newbie
  • *
  • Posts: 24
    • View Profile
    • http://central-galerie.com
[MOD] for Bypassing The SAFE MODE
« Reply #11 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!

Offline kummy

  • Newbie
  • *
  • Posts: 11
    • View Profile
[MOD] for Bypassing The SAFE MODE
« Reply #12 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...

Offline camo93

  • Newbie
  • *
  • Posts: 24
    • View Profile
    • http://central-galerie.com
[MOD] for Bypassing The SAFE MODE
« Reply #13 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.

Offline joecks

  • Newbie
  • *
  • Posts: 11
    • View Profile
    • http://www.familie-bruil.com
[MOD] for Bypassing The SAFE MODE
« Reply #14 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