<?php # lang require_once "../src/pfci18n.class.php"; require_once "inc.conf.php"; pfcI18N::Init($lang, "admin"); # htaccess class require_once 'htaccess.class.php'; $ht = new htaccess(); # Activate Authentification if (!empty($_GET['active'])) { if ($_GET['active'] == 1 && $ht->getNumberOfUsers() > 0) { $ht->printHtaccess(); } elseif ($_GET['active'] == 1 && $ht->getNumberOfUsers() == 0) { $msg = _pfc("At least one user must be declare to activate authentication."); header('Location: ' . $_SERVER['PHP_SELF'] . '?msg=' . rawurlencode($msg)); exit; } elseif ($_GET['active'] == 2 && file_exists($ht->get_file_Htaccess())) { $ht->delHtaccess(); } } # Delete a user if (!empty($_GET['del']) && !empty($_GET['username'])) { if ($ht->getNumberOfUsers() == 1) { $msg = _pfc("It is not possible to delete the last user."); header('Location: ' . $_SERVER['PHP_SELF'] . '?msg=' . rawurlencode($msg)); exit; } else { $username = $_GET['username']; $ht->delUser($username); $groups = $ht->getGroupOfUser($username);
if (file_exists("../backup/" . $dirname . "/" . $_GET['file'] . ".txt")) { @unlink("../backup/" . $dirname . "/" . $_GET['file'] . ".txt"); } } else { $msg = "Un problème est survenu lors de la tentative de suppression du fichier <b>" . $_GET['file'] . "</b>.<br />\n\t\t\t\t\tIl s'agit peut-être un problème de droits sur le répertoire backup.<br />\n"; } } } } // Protection du répertoire backup if (isset($action) and $action == 'protect') { check_token(); include_once "../lib/class.htaccess.php"; // Instance of the htaccess class // $ht = & new htaccess(TRUE); $ht = new htaccess(TRUE); $user = array(); // Get the logins from the password file $user = $ht->get_htpasswd(); // Add an Administrator if (empty($_POST['pwd1_backup']) || empty($_POST['pwd2_backup'])) { $msg = "Problème : les deux mots de passe ne sont pas identiques ou sont vides."; $error = 1; } elseif ($_POST['pwd1_backup'] != $_POST['pwd2_backup']) { $msg = "Problème : les deux mots de passe ne sont pas identiques."; $error = 1; } elseif (empty($_POST['login_backup'])) { $msg = "Problème : l'identifiant est vide."; $error = 1; } else { $_login = my_strtolower(unslashes($_POST['login_backup']));
$cs_ID = $siteInfo['cs_ID']; $cs_company_id = $siteInfo['cs_company_id']; $affiliation = "`td_site_ID` = '{$cs_ID}'"; if ($allow_any_site) { $affiliation = "`userId` = '{$cs_company_id}'"; } $trans_table = "`cs_transactiondetails`"; if ($testmode) { $trans_table = "`cs_test_transactiondetails`"; } $sql = "SELECT * FROM {$trans_table} WHERE {$affiliation} AND `td_recur_processed` = 0 and status='A' AND `td_recur_next_date`>=CURDATE()"; $result = mysql_query($sql, $cnn_cs) or dieLog(mysql_errno() . ": " . mysql_error() . "<br>Cannot execute query"); $num = mysql_num_rows($result); //if($num<1) die("UNF"); $accessDir = "/home/etel/public_html/access/" . $siteInfo['cs_reference_ID'] . "/"; $ht = new htaccess(); // Setting up path of password file // Setting up path of password file @mkdir($accessDir); chdir($accessDir); $ht->setFPasswd($accessDir . "htpasswd"); //$ht->setFHtaccess($accessDir.".htaccess"); // Setting authenification type // If you don't set, the default type will be "Basic" $ht->setAuthType("Basic"); // Setting authenification area name // If you don't set, the default name will be "Internal Area" $ht->setAuthName("Members Area"); while ($accountInfo = mysql_fetch_assoc($result)) { // Adding user $ht->addUser($accountInfo['td_username'], $accountInfo['td_password'], "");
public function getHTAccess($settings) { $htaccess = new htaccess(); $htaccess->setFPasswd($settings['mi_folder_user_fullpath']); $htaccess->setFHtaccess($settings['mi_folder_fullpath']); if (!empty($settings['mi_name'])) { $htaccess->setAuthName($settings['mi_name']); } return $htaccess; }