/** * Constructor: Opens the connection to the database * * @param boolean $connect (Optional) Auto-connect when object is created * @param string $database (Optional) Database name * @param string $server (Optional) Host address * @param string $username (Optional) User name * @param string $password (Optional) Password * @param string $charset (Optional) Character set */ public function __construct($connect = true, $database = null, $server = null, $username = null, $password = null, $charset = null) { $this->db_dbname = $database == null ? MCfg::get('database') : $database; $this->db_host = $server == null ? MCfg::get('host') : $server; $this->db_user = $username == null ? MCfg::get('user') : $username; $this->db_pass = $password == null ? MCfg::get('pass') : $password; if ($charset != null) { $this->db_charset = 'utf8'; } if (strlen($this->db_host) > 0 && strlen($this->db_user) > 0) { if ($connect) { $this->Open(); } } }
public static function cryptage($chaine, $sens) { //$sens cryptage=1 décryptage=0 $key = MCfg::get('secret'); $string = $chaine; // note the spaces if ($string != '') { if ($sens == 1) { $encrypted = base64_encode(mcrypt_encrypt(MCRYPT_RIJNDAEL_256, md5($key), $string, MCRYPT_MODE_CBC, md5(md5($key)))); return $encrypted; } else { $decrypted = rtrim(mcrypt_decrypt(MCRYPT_RIJNDAEL_256, md5($key), base64_decode($string), MCRYPT_MODE_CBC, md5(md5($key))), ""); return $decrypted; } } return false; }
<?php session_start(); ob_start(); @(include_once MPATH_INCLUDES . 'auto_loader.php'); $autoloadManager = new AutoloadManager(); $autoloadManager->setSaveFile(MPATH_INCLUDES . 'autoload.php'); $autoloadManager->addFolder(MPATH_INCLUDES); $autoloadManager->addFolder(MPATH_LIBRARIES); $autoloadManager->addFolder(MPATH_MODULES); $autoloadManager->register(); // --------------------------------------------------- // Configuration Database // --------------------------------------------------- $db_host = MCfg::get('host'); // server name $db_user = MCfg::get('user'); // user name $db_pass = MCfg::get('pass'); // password $db_dbname = MCfg::get('database'); $db = new MySQL(true, $db_dbname, $db_host, $db_user, $db_pass);
private function check_ctc() { $ctc = MCfg::get('ctc') == null ? 3 : MCfg::get('ctc'); if ($this->user_info['ctc'] >= $ctc) { $this->error = false; $this->log .= '</br>Vous avez dépasseé le nombre de tentatives de connexion'; } }
<!DOCTYPE html> <html lang="fr"> <head> <meta charset="utf-8" /> <title><?php echo SYS_TITRE . ' | ' . MCfg::get('sys_desc') . ' | ' . CLIENT_TITRE; ?> (Page de Connexion)</title> <meta name="description" content="User login page" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <?php if (Mreq::tg('noscript') == "0" && Mreq::tg('_tsk') != 'errorjs') { $error_link = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'] . '?_tsk=errorjs&noscript=1'; ?> <noscript> <meta http-equiv="refresh" content="0;url=<?php echo $error_link; ?> "/> </noscript> <?php } ?> <?php require_once 'css.php'; ?>
/** * Initialse setting with new value of framework */ private function init_setup() { $this->Host = MCfg::get('mail_server'); $this->Username = MCfg::get('mail_user'); $this->Password = MCfg::get('mail_pass'); $this->SMTPAuth = MCfg::get('mail_auth'); $this->Port = MCfg::get('mail_port'); $this->From = MCfg::get('admin_mail'); $this->FromName = MCfg::get('sys_titre') . ' ' . MCfg::get('admin_name'); }
<h1> <img src="img/logo.png" width="149" height="40" /> <span class="white">MRN-ERP</span> </h1> <h4 class="blue"><?php echo MCfg::get('titre'); ?> </h4> </div> </div> <div class="space-6"></div> <div class="row-fluid"> <div class="position-relative"> <div id="login-box" class="login-box visible widget-box no-border"> <div class="widget-body"> <div class="widget-main"> <h4 class="header blue lighter bigger"> <i class="fa fa-lock green"></i> Réinitialisation du Mot de Passe </h4> <div class="space-6"></div> <form novalidate="novalidate" id="recovery" action="#" method="post" /> <fieldset> <input name="verif" type="hidden" value="1" /> <input name="token" type="hidden" value="<?php
* Creates an example PDF TEST document using TCPDF * @package com.tecnick.tcpdf * @abstract TCPDF - Example: Default Header and Footer * @author Nicola Asuni * @since 2008-03-04 */ // create new PDF document $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false); // set document information $pdf->SetCreator(MCfg::get('sys_titre')); $pdf->SetAuthor(session::get('username')); $pdf->SetTitle($title); $pdf->SetSubject(MCfg::get('client_titre')); $pdf->SetKeywords(MCfg::get('client_titre')); // set default header data $pdf->SetHeaderData(MCfg::get('logo'), 30, $title, 'Généré le :' . date('d-m-Y H:i:s') . ' Par: ' . session::get('username'), array(0, 64, 255), array(0, 64, 128)); $pdf->setFooterData(array(0, 64, 0), array(0, 64, 128)); // set header and footer fonts $pdf->setHeaderFont(array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); $pdf->setFooterFont(array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); // set default monospaced font $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED); // set margins $pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); $pdf->SetHeaderMargin(PDF_MARGIN_HEADER); $pdf->SetFooterMargin(PDF_MARGIN_FOOTER); // set auto page breaks $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); // set image scale factor $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); // Set font
/** * [creat_task_files description] * @param [string regex] $modul_name [description] * @param [string regex] $task_name [description] * @return [bol] [description] */ private function creat_task_files($modul_name, $task_name) { $modul_path = MPATH_MODULES . $modul_name; //exit("2#".$modul_path); if ($modul_name == null) { $this->error = false; $this->log .= '</br>Unable get modul name'; return false; } $file_c = $modul_path . '/controller/' . $task_name . '_c.php'; $file_m = $modul_path . '/model/' . $task_name . '_m.php'; $file_v = $modul_path . '/view/' . $task_name . '_v.php'; $content = '<?php ' . PHP_EOL . '//' . MCfg::get('sys_titre') . PHP_EOL . '// Modul: ' . $modul_name . ' => '; if (!file_put_contents($file_c, $content . 'Controller', FILE_APPEND | LOCK_EX)) { $this->error = false; $this->log .= '</br>Unable Creat Controller'; return false; } if (!file_put_contents($file_m, $content . 'Model', FILE_APPEND | LOCK_EX)) { $this->error = false; $this->log .= '</br>Unable Creat Model'; return false; } if (!file_put_contents($file_v, $content . 'View', FILE_APPEND | LOCK_EX)) { $this->error = false; $this->log .= '</br>Unable Creat View'; return false; } return true; }
<?php if (MReq::tp('check') == 1) { $array = array('host' => MReq::tp('host'), 'pass' => MReq::tp('passwords'), 'database' => MReq::tp('db'), 'user' => MReq::tp('compte')); $test = MCfg::setarray($array); $db_host = MReq::tp('host'); // server name $db_user = MReq::tp('compte'); // user name $db_pass = MReq::tp('passwords'); // password $db_dbname = MReq::tp('db'); $db = new MySQL(true, $db_dbname, $db_host, $db_user, $db_pass); $values["nom"] = MySQL::SQLValue(MReq::tp('username')); $values["mail"] = MySQL::SQLValue(MReq::tp('email')); $values["pass"] = MySQL::SQLValue(md5(MReq::tp('password'))); $values["servic"] = MySQL::SQLValue('1'); $values["fnom"] = MySQL::SQLValue(MReq::tp('firstname')); $values["lnom"] = MySQL::SQLValue(MReq::tp('lastname')); $values["tel"] = MySQL::SQLValue(012222222); $values["active"] = MySQL::SQLValue(1); $values["defapp"] = MySQL::SQLValue(3); $values["agence"] = MySQL::SQLValue(2); $values["signature"] = MySQL::SQLValue(""); // Execute the insert $result = $db->InsertRow("users_sys", $values); if (!$result) { $db->Kill($db->Error()); } exit('5# dakchi daz mziane'); //model::load('user','user');