public function get_exchange_rates()
 {
     //		\Cache::forget('money_exchange_rates');
     if (\Cache::has('money_exchange_rates')) {
         $data = \Cache::get('money_exchange_rates');
     } elseif (is_connected("openexchangerates.org")) {
         $api_key = "bbc128aa6f3645d78b098f0eef3dd533";
         $json = file_get_contents("http://openexchangerates.org/api/latest.json?app_id={$api_key}");
         $json = json_decode($json, true);
         $data['rates'] = $json['rates'];
         $data['base'] = $json['base'];
         // $data['json_rates'] = json_encode($json['rates']);
         \Cache::add('money_exchange_rates', $data, 360);
         \Cache::add('money_exchange_rates_default', $data, 50000);
     } else {
         $data = \Cache::get('money_exchange_rates_default');
     }
     $currency_list = \Lst::common('currency1');
     $arr["site_name"] = "Ahmed-Badawy.com";
     $arr["base"] = $data['base'];
     foreach ($currency_list as $key => $val) {
         $n = ['short' => $key, "name" => $val, "value" => $data['rates'][$key]];
         $arr['rates'][$key] = $n;
     }
     return $arr;
 }
예제 #2
0
function printNews($side)
{
    $pos = zp_filter_slot('admin_overview', 'comment_form_print10Most') !== false;
    if ($pos && $side == 'left' || !$pos && $side == 'right') {
        if ($connected = is_connected()) {
            require_once dirname(__FILE__) . '/zenphoto_news/rsslib.php';
        }
        ?>
		<div class="box" id="overview-news">
		<h2 class="h2_bordered"><?php 
        echo gettext("News from Zenphoto.org");
        ?>
</h2>
		<?php 
        if ($connected) {
            echo RSS_Display("http://www.zenphoto.org/index.php?rss-news&withimages", 5);
        } else {
            ?>
			<ul>
				<li><?php 
            echo gettext('A connection to <em>Zenphoto.org</em> could not be established.');
            ?>
				</li>
			</ul>
			<?php 
        }
        ?>
		</div>
		<?php 
    }
    return $side;
}
예제 #3
0
파일: Home.php 프로젝트: sbrodin/12parfait
 public function index()
 {
     $data = array();
     $data['title'] = $this->lang->line('home');
     $this->load->model('message_model');
     if (!is_connected()) {
         $language = $this->config->item('language');
     } else {
         $language = $this->session->userdata['user']->language;
     }
     $data['home_message'] = $this->message_model->get_message('home-message');
     if ($data['home_message'] !== '') {
         $data['home_message'] = $data['home_message'][0]->{$language . '_content'};
     }
     $data['home_message'] = html_entity_decode($data['home_message']);
     $data['yesterday_matches'] = matches_of_day(date('d/m/Y', time() - 60 * 60 * 24));
     $data['today_matches'] = matches_of_day();
     $data['tomorrow_matches'] = matches_of_day(date('d/m/Y', time() + 60 * 60 * 24));
     if (!$data['yesterday_matches'] && !$data['today_matches'] && !$data['tomorrow_matches']) {
         $data['last_matches'] = last_matches();
         $data['next_matches'] = next_matches();
     }
     $this->load->view('templates/header', $data);
     $this->load->view('templates/nav', $data);
     $this->load->view('index', $data);
     $this->load->view('templates/footer', $data);
 }
예제 #4
0
파일: pics.php 프로젝트: ItsJimi/42
function pics($post, $connect)
{
    if ($post['bool'] === "false") {
        $sql = "SELECT * FROM pics ORDER BY id DESC LIMIT " . intval($post['nbr']) . ", 2";
        $result = $connect->query($sql);
        $fetch1['data'] = $result->fetchAll(PDO::FETCH_ASSOC);
        foreach ($fetch1['data'] as $key => $value) {
            $sql = "SELECT COUNT(*) AS 'count' FROM likes WHERE pic='" . $value['id'] . "'";
            $result = $connect->query($sql);
            $fetch2 = $result->fetch(PDO::FETCH_ASSOC);
            $fetch1['data'][$key]['likes'] = $fetch2['count'];
            if (is_connected()) {
                $sql = "SELECT * FROM likes WHERE pic='" . intval($value['id']) . "' AND user='******'user']) . "'";
                $result = $connect->query($sql);
                if ($result->fetch()) {
                    $fetch1['data'][$key]['islike'] = 1;
                } else {
                    $fetch1['data'][$key]['islike'] = 0;
                }
            }
            $sql = "SELECT user, comment FROM comments WHERE pic='" . $value['id'] . "' ORDER BY id ASC";
            $result = $connect->query($sql);
            $fetch3 = $result->fetchAll(PDO::FETCH_ASSOC);
            $fetch1['data'][$key]['comments'] = $fetch3;
        }
        $fetch1['end'] = true;
        $res = json_encode($fetch1);
        return $res;
    } else {
        $sql = "SELECT * FROM pics WHERE id='" . intval($post['nbr']) . "'";
        $result = $connect->query($sql);
        if ($result->rowCount() > 0) {
            $fetch1 = $result->fetch(PDO::FETCH_ASSOC);
            $sql = "SELECT COUNT(*) AS 'count' FROM likes WHERE pic='" . intval($fetch1['id']) . "'";
            $result = $connect->query($sql);
            $fetch2 = $result->fetch(PDO::FETCH_ASSOC);
            $fetch1['likes'] = $fetch2['count'];
            if (is_connected()) {
                $sql = "SELECT * FROM likes WHERE pic='" . intval($fetch1['id']) . "' AND user='******'user']) . "'";
                $result = $connect->query($sql);
                if ($result->fetch()) {
                    $fetch1['islike'] = 1;
                } else {
                    $fetch1['islike'] = 0;
                }
            }
            $sql = "SELECT user, comment FROM comments WHERE pic='" . intval($fetch1['id']) . "' ORDER BY id ASC";
            $result = $connect->query($sql);
            $fetch3 = $result->fetchAll(PDO::FETCH_ASSOC);
            $fetch1['comments'] = $fetch3;
            $fetch1['end'] = true;
            $res = json_encode($fetch1);
            return $res;
        } else {
            $res['end'] = false;
            $res['info'] = "Cette photo n'existe pas.";
            return json_encode($res);
        }
    }
}
예제 #5
0
 public function __construct()
 {
     parent::__construct();
     if (!is_connected()) {
         $this->lang->load('12parfait', $this->config->item('language'));
     } else {
         $this->lang->load('12parfait', $this->session->userdata['user']->language);
     }
 }
 public function __construct()
 {
     $this->load->helper('memberspace/connection');
     if (!is_connected()) {
         die(translate('Vous ne pouvez pas accéder à vos fichiers si vous n\'êtes pas connecté.'));
     }
     parent::__construct();
     $this->load->library('layout/layout');
     $this->load->helper('memberspace/authorization');
     $this->load->helper('images/image');
     $this->load->database();
 }
예제 #7
0
 public function __construct()
 {
     parent::__construct();
     // Authentification de l'utilisateur
     if (!is_connected()) {
         // Redirige l'utilisateur vers la page de connexion s'il n'est pas authentifié
         $this->lang->load('12parfait', $this->config->item('language'));
         redirect(site_url(), 'location');
     } else {
         $this->lang->load('12parfait', $this->session->userdata['user']->language);
     }
     // on n'active le profiler qu'en dev
     if (ENVIRONMENT === 'development') {
         // $this->output->enable_profiler(true);
     }
 }
예제 #8
0
/**
 * Searches the zenphoto.org home page for the current zenphoto download
 * locates the version number of the download and compares it to the version
 * we are running.
 *
 * @return string If there is a more current version on the WEB, returns its version number otherwise returns FALSE
 * @since 1.1.3
 */
function checkForUpdate()
{
    $webVersion = false;
    if (is_connected() && class_exists('DOMDocument')) {
        require_once dirname(__FILE__) . '/zenphoto_news/rsslib.php';
        $recents = RSS_Retrieve("http://www.zenphoto.org/index.php?rss=news&category=changelog");
        if ($recents) {
            array_shift($recents);
            $article = array_shift($recents);
            //	most recent changelog article
            $v = trim(str_replace('zenphoto-', '', basename($article['link'])));
            $c = explode('-', ZENPHOTO_VERSION);
            $c = array_shift($c);
            if ($v && version_compare($c, $v, "<")) {
                $webVersion = $v;
            }
        }
    }
    return $webVersion;
}
예제 #9
0
 function mailInfo()
 {
     if (is_connected()) {
         $CI = get_instance();
         // You may need to load the model if it hasn't been pre-loaded
         $CI->load->model('account/mailbox_model');
         // Call a function of the model
         //$CI->mailbox->do_something();
         $mailbox_settings = $CI->mailbox_model->get();
         if (!empty($mailbox_settings)) {
             $address = "{" . $mailbox_settings->mail_server . "}" . $mailbox_settings->mailbox;
             $email = $mailbox_settings->email;
             $password = $mailbox_settings->password;
             if ($inbox = imap_open($address, $email, $password, OP_READONLY)) {
                 // Get general mailbox information.
                 $info = imap_status($inbox, $address, SA_ALL);
                 $mailInfo = array('unread' => $info->unseen, 'recent' => $info->recent, 'total' => $info->messages);
                 return $mailInfo;
             }
         }
     }
 }
예제 #10
0
function restore($pdo)
{
    if (isset($_GET['type'], $_GET['file']) && !empty($_GET['type']) && !empty($_GET['file'])) {
        $type = $_GET['type'];
        $file = trim($_GET['file']);
        $internet = false;
        if ($type == 'cloud') {
            if (is_connected()) {
                $internet = true;
                $drop_sql = dropboxDBfiles();
                if (in_array($file, $drop_sql)) {
                    if (dropboxRestore($file)) {
                        import_to_db('dbbackup' . DS . 'dropbox' . DS . $file);
                    }
                }
            }
        } else {
            if ($type == 'local') {
                if (file_exists('dbbackup' . DS . $file)) {
                    import_to_db('dbbackup' . DS . $file);
                }
            }
        }
    }
    redirect(BASE_PATH . '/backup/?token=' . $_SESSION['token'], 1);
}
예제 #11
0
<?php

$button_text = gettext("Check for update");
$button_action = WEBPATH . '/' . ZENFOLDER . '/admin.php?action=check_for_update';
$button_icon = 'images/accept.png';
$button_title = gettext("Queries the Zenphoto web site for the latest version and compares that with the one that is running.");
$button_alt = gettext('Check for update');
$button_hidden = '<input type="hidden" name="action" value="check_for_update" />';
$button_rights = ADMIN_RIGHTS;
$button_enable = is_connected();
예제 #12
0
//make sure this is set to what you want vlans to start with, e.g. vlan3309
if (!isset($_POST) || $_POST != '') {
    ?>
<html>
<body style="background-color: e0e7f7";>
<form action="fast_config.php" method="POST"/>
<table border="0">
<tr><td style="border-left: dashed 1px; border-top: dashed 1px;">VLAN:</td><td style="border-right: dashed 1px; border-top: dashed 1px;"><input type="text" name="vlan"/></td></tr>
<tr><td style="border-left: dashed 1px; border-bottom: dashed 1px;">Interface: </td><td style="border-right: dashed 1px; border-bottom: dashed 1px;"><input type="text" name="interface"/></td></tr>
<tr><td>Subnet:</td><td><input type="text" name="subnet"/></td><td><input value="Apply" type="submit"/></td>
</table>
<?php 
}
if (isset($_POST['subnet']) && $_POST['subnet'] != '') {
    do {
        is_connected();
    } while (is_connected() != '1');
    if ($_POST['vlan'] != '') {
        make_vlan($_POST['vlan'], $_POST['interface']);
    }
    set_addr($_POST['subnet'], $_POST['vlan']);
}
function is_connected()
{
    $connected = @fsockopen("192.168.88.1", "80");
    //website and port
    if ($connected) {
        $is_conn = true;
        //action when connected
        fclose($connected);
    } else {
예제 #13
0
function second_connected()
{
    for ($i = 5; $i > 0; $i--) {
        if (is_connected(1) != '1') {
            if ($i == 1) {
                logthis('no more mikrotiks. killing myself. ');
                sleep(4);
            } else {
                logthis('dying in : ' . ($i - 1) . ' cycles');
            }
        } else {
            return 1;
        }
    }
    header('Location: ' . $GLOBALS['finished_location'] . '');
    exit;
}
예제 #14
0
function sendMailAutomatically()
{
    $currentDate = date("Y/m/d");
    $dueDate = date('Y-m-d', strtotime($currentDate . ' + 1 days'));
    $conn = mysqli_connect('localhost', 'root', 'phenol69', 'LibraryNotifier');
    // Check connection
    if ($conn->connect_error) {
        die("Connection failed: " . $conn->connect_error);
    }
    $sql = "select *from book where DueDate='" . $dueDate . "'";
    $result = $conn->query($sql);
    if ($result->num_rows > 0) {
        $sId = array();
        $bName = array();
        while ($row = $result->fetch_assoc()) {
            $sId[] = $row["StudentId"];
            $bName[] = $row['BookName'];
        }
        $mailNumber = count($sId);
        foreach ($sId as $value) {
            $queryStudent = "select *from student WHERE Rollno = '" . $value . "'";
            $result1 = $conn->query($queryStudent);
            while ($row1 = $result1->fetch_assoc()) {
                $emailId[] = $row1["Email"];
            }
        }
        //
        require_once '../CommonPage/initializer.php';
        $connection = is_connected();
        if ($connection == true) {
            require_once '../control/phpMailer/class.phpmailer.php';
            require_once "../control/phpMailer/class.smtp.php";
            require '../control/phpMailer/PHPMailerAutoload.php';
            $mailer = new PHPMailer();
            $mailer->IsSMTP();
            $mailer->SMTPSecure = 'tls';
            $mailer->Host = 'smtp.gmail.com';
            $mailer->Port = 587;
            $mailer->Username = '******';
            $mailer->Password = '******';
            $mailer->SMTPAuth = true;
            $mailer->From = '*****@*****.**';
            $mailer->FromName = 'Library';
            $mailer->Subject = 'Book Due Date Tomorrow';
            for ($i = 0; $i < $mailNumber; $i++) {
                $studentMail = $emailId[$i];
                $bookName = $bName[$i];
                $mailer->Body = 'Hello You have to return ' . $bookName . " Tomorrow";
                $mailer->ClearAddresses();
                $mailer->AddAddress($studentMail);
                $mailCount = 1;
                if ($mailer->Send()) {
                    $sql = "UPDATE mailservice SET EmailCount = {$mailCount} WHERE id = 1";
                    $conn->query($sql);
                    $mailCount++;
                }
            }
        } else {
            redirect_to('admin.php');
        }
    } else {
    }
}
예제 #15
0
                $base = substr($clone, strlen($base));
                $link = $base . '/' . ZENFOLDER . '/admin.php';
                $source = '<a href="' . $link . '">' . $clone . '</a>';
            } else {
                $source = $clone;
            }
            $source = '<br />&nbsp;&nbsp;&nbsp;' . sprintf(gettext('source: %s'), $source);
        }
        $graphics_lib = zp_graphicsLibInfo();
        ?>
								<li>
									<?php 
        printf(gettext('Zenphoto version <strong>%1$s [%2$s] (%3$s)</strong>'), ZENPHOTO_VERSION, '<a title="' . ZENPHOTO_FULL_RELEASE . '">' . ZENPHOTO_RELEASE . '</a>', $official);
        echo $source;
        if (extensionEnabled('check_for_update') && TEST_RELEASE) {
            if (is_connected() && class_exists('DOMDocument')) {
                require_once SERVERPATH . '/' . ZENFOLDER . '/' . PLUGIN_FOLDER . '/zenphoto_news/rsslib.php';
                $recents = RSS_Retrieve("http://www.zenphoto.org/index.php?rss=news&category=changelog");
                if ($recents) {
                    array_shift($recents);
                    $article = array_shift($recents);
                    //	most recent changelog article
                    $v = trim(str_replace('zenphoto-', '', basename($article['link'])));
                    $c = explode('-', ZENPHOTO_VERSION);
                    $c = array_shift($c);
                    if ($v && version_compare($c, $v, '>')) {
                        ?>
													<p class="notebox">
														<a href="http://www.zenphoto.org/news/zenphoto-<?php 
                        echo $c;
                        ?>
예제 #16
0
function printNews()
{
    ?>
	<div class="box overview-utility">
		<h2 class="h2_bordered"><?php 
    echo gettext("News from Zenphoto.org");
    ?>
</h2>
		<?php 
    if (is_connected()) {
        require_once dirname(__FILE__) . '/zenphoto_news/rsslib.php';
        require_once SERVERPATH . '/' . ZENFOLDER . '/template-functions.php';
        $recents = RSS_Retrieve("http://www.zenphoto.org/index.php?rss=news&withimages");
        if ($recents) {
            $opened = false;
            $recents = array_slice($recents, 1, 5);
            $shorten = getOption('zenphoto_news_length');
            foreach ($recents as $article) {
                $type = $article["type"];
                if ($type == 0) {
                    if ($opened) {
                        ?>
						</ul>
						<?php 
                        $opened = false;
                    }
                    ?>
					<b />
					<?php 
                } else {
                    if (!$opened) {
                        ?>
						<ul>
							<?php 
                        $opened = true;
                    }
                }
                $title = $article["title"];
                $date = zpFormattedDate(DATE_FORMAT, strtotime($article["pubDate"]));
                $link = $article["link"];
                if ($shorten) {
                    $description = shortenContent($article["description"], $shorten, '...');
                } else {
                    $description = false;
                }
                ?>
					<li><a href="<?php 
                echo $link;
                ?>
"><strong><?php 
                echo $title;
                ?>
</strong> (<?php 
                echo $date;
                ?>
)</a>
						<?php 
                if ($description != false) {
                    ?>
							<br />
							<?php 
                    echo $description;
                }
                ?>
					</li>
					<?php 
                if ($type == 0) {
                    ?>
						<br />
						<?php 
                }
            }
            if ($opened) {
                ?>
				</ul>
				<?php 
            }
        } else {
            ?>
			<ul>
				<li><?php 
            printf(gettext('Failed to retrieve link <em>%s</em>'), 'http://www.zenphoto.org/index.php?rss=news&withimages');
            ?>
</li>
			</ul>
			<?php 
        }
    } else {
        ?>
		<ul>
			<li><?php 
        echo gettext('A connection to <em>Zenphoto.org</em> could not be established.');
        ?>
			</li>
		</ul>
		<?php 
    }
    ?>
	</div>
	<?php 
}
예제 #17
0
*/
/* --- CONSTRUCT SESSION --- */
session_start();
/* --- CKEDITOR SESSION --- */
$_SESSION['KCFINDER'] = array();
$_SESSION['KCFINDER']['disabled'] = false;
/* --- SESSION DUAL LANGUAGE --- */
if (!isset($_SESSION['lang'])) {
    $_SESSION['lang'] = "en";
}
/* --- CALL FUNCTIONS --- */
$info = get_info();
$general = get_general();
$global_user = get_customer_global($_SESSION['user_id']);
$notif = get_notification_global();
$internet = is_connected();
/*
* ----------------------------------------------------------------------
* CUSTOM FUNCTION
* ----------------------------------------------------------------------
*/
/* --- SHORTEN FUNCTIONS DATABASE --- */
function db($sql)
{
    $conn = connDB();
    $query = mysql_query($sql, $conn);
    $row = array();
    while ($result = mysql_fetch_array($query)) {
        array_push($row, $result);
    }
    return $row;
예제 #18
0
<?php

include '../CommonPage/initializer.php';
$connection = is_connected();
if ($connection == true) {
    require_once 'phpMailer/class.phpmailer.php';
    require_once "phpMailer/class.smtp.php";
    require 'phpMailer/PHPMailerAutoload.php';
    $mailer = new PHPMailer();
    $mailer->IsSMTP();
    $mailer->SMTPSecure = 'tls';
    $mailer->Host = 'smtp.gmail.com';
    $mailer->Port = 587;
    $mailer->Username = '******';
    $mailer->Password = '******';
    $mailer->SMTPAuth = true;
    $mailer->From = '*****@*****.**';
    $mailer->FromName = 'Library';
    $mailer->Subject = 'Book Due Date Tomorrow';
    $totalMail = $_POST['mailNumber'];
    for ($i = 0; $i < $totalMail; $i++) {
        $studentMail = $_POST['emailId_' . $i];
        $bookName = $_POST['bookName_' . $i];
        $mailer->Body = 'You have to return ' . $bookName . " Tomorrow. Please return book before 7 PM.";
        $mailer->ClearAddresses();
        $mailer->AddAddress($studentMail);
        if ($mailer->Send()) {
            $_SESSION["mailSent"] = true;
        } else {
            $_SESSION["mailSent"] = false;
            redirect_to('admin.php');
예제 #19
0
require_once 'includes/allreputation.php';
require_once 'includes/alllocales.php';
$query = $_GET["profile"];
require_once 'includes/allprofiles.php';
require_once 'configs/tplconfig.php';
$smarty->config_load($conf_file, 'profile');
$profile['user'] = userinfo($query);
$profile['inventory'] = citems($query);
$profile['profession'] = userprofs($query);
$profile['achievements'] = $cDB->selectCell('SELECT COUNT(*) FROM character_achievement WHERE guid=?', $query);
$profile['guild']['guid'] = $cDB->selectCell('SELECT guildid FROM guild_member WHERE guid=?', $profile['user']['guid']);
$profile['guild']['name'] = $cDB->selectCell('SELECT name FROM guild WHERE guildid=?', $profile['guild']['guid']);
$url = "http://wowhead.com";
if ($viewer == 1) {
    $profile['is_connected'] = is_connected();
} else {
    $profile['is_connected'] = false;
}
$profile['qcomp'] = $cDB->selectCell('SELECT COUNT(*) FROM character_queststatus WHERE guid=? and status IN(0,1,3)', $query);
$profile['aquests'] = $DB->selectCell('SELECT COUNT(Id)
		FROM quest_template
		WHERE
			Title NOT IN ("","----","?????")
			AND Title NOT LIKE "<DEPRECATED>%"
			AND Title NOT LIKE "<NYI>%"
			AND Title NOT LIKE "<nyi>%"
			AND Title NOT LIKE "<TEST>%"
			AND Title NOT LIKE "<TXT>%"
			AND Title NOT LIKE "<UNUSED%"
			');
예제 #20
0
 public function modifier_sous_categorie($id = null)
 {
     // On vérifie qu'il s'agit bien d'un admin :
     if (is_connected() && $_SESSION['niveau'] == 1) {
         $this->load->helper('form');
         $this->load->library('form_validation');
         // On fixe les règles concernant l'ajout d'une recette :
         //$this->form_validation->set_rules('categorie_mere', '"Nom de la catégorie mère"', 'trim|required|encode_php_tags');
         $this->form_validation->set_rules('categorie_fille', '"Nom de la sous-catégorie"', 'trim|required|encode_php_tags');
         if ($this->form_validation->run()) {
             // On récupère l'id de la catégorie mère :
             $this->load->model('CategorieManager');
             $categorieManager = new CategorieManager();
             $data = array('nom_categorie' => $this->input->post('categorie_fille'));
             // On met à jour les données :
             $this->db->where('id_categorie', $this->input->post('id_categorie'));
             $this->db->update('categorie', $data);
             redirect('administration/administrer_sous_categories');
         } else {
             $this->load->model('CategorieManager');
             $categorieManager = new CategorieManager();
             $sous_categorie = $categorieManager->get_categorie_mere($id);
             $data = array();
             $data['sous_categorie'] = $sous_categorie;
             $data['id'] = $id;
             $data['menu_categories'] = $this->menu_categories;
             $this->layout->view('modifier_sous_categorie', $data);
         }
     } else {
         redirect('accueil');
     }
 }
예제 #21
0
/**
 * Searches the zenphoto.org home page for the current zenphoto download
 * locates the version number of the download and compares it to the version
 * we are running.
 *
 * @return string If there is a more current version on the WEB, returns its version number otherwise returns FALSE
 * @since 1.1.3
 */
function checkForUpdate()
{
    global $_zp_WEB_Version;
    if (isset($_zp_WEB_Version)) {
        return $_zp_WEB_Version;
    }
    if (!is_connected()) {
        return 'X';
    }
    $c = ZENPHOTO_VERSION;
    $v = @file_get_contents('http://www.zenphoto.org/files/LATESTVERSION');
    if (empty($v)) {
        $_zp_WEB_Version = 'X';
    } else {
        if ($i = strpos($v, 'RC')) {
            $v_candidate = intval(substr($v, $i + 2));
        } else {
            $v_candidate = 9999;
        }
        if ($i = strpos($c, 'RC')) {
            $c_candidate = intval(substr($c, $i + 2));
        } else {
            $c_candidate = 9999;
        }
        $pot = array(1000000000, 10000000, 100000, 1);
        $wv = explode('.', $v);
        $wvd = 0;
        foreach ($wv as $i => $d) {
            $wvd = $wvd + $d * $pot[$i];
        }
        $cv = explode('.', $c);
        $cvd = 0;
        foreach ($cv as $i => $d) {
            $cvd = $cvd + $d * $pot[$i];
        }
        if ($wvd > $cvd || $wvd == $cvd && $c_candidate < $v_candidate) {
            $_zp_WEB_Version = $v;
        } else {
            $_zp_WEB_Version = '';
        }
    }
    return $_zp_WEB_Version;
}
예제 #22
0
파일: save.php 프로젝트: ItsJimi/42
<?php

require_once "include.php";
if (is_connected()) {
    $request = save($_POST['pic'], $_POST['filter'], $connect);
} else {
    $request = 0;
}
echo $request;
예제 #23
0
파일: signin.php 프로젝트: ItsJimi/42
<?php

require_once "include.php";
if (!is_connected()) {
    $request = signin($_POST, $connect);
} else {
    $request = 0;
}
echo $request;
예제 #24
0
 public function inscription()
 {
     if (is_connected()) {
         redirect('accueil');
     } else {
         $this->load->helper('form');
         $this->load->library('form_validation');
         // On fixe les règles concernant le formulaire d'inscription :
         $this->form_validation->set_rules('nom', '"Nom de l\'utilisateur"', 'trim|required|alpha_dash|encode_php_tags');
         $this->form_validation->set_rules('prenom', '"Prénom de l\'utilisateur"', 'trim|required|alpha_dash|encode_php_tags');
         $this->form_validation->set_rules('login', '"Login de l\'utilisateur"', 'trim|required|alpha_dash|encode_php_tags');
         $this->form_validation->set_rules('email', '"Email de l\'utilisateur"', 'trim|required|valid_email|encode_php_tags');
         $this->form_validation->set_rules('mdp', '"Mot de passe de l\'utilisateur"', 'trim|required|alpha_dash|encode_php_tags');
         $this->form_validation->set_rules('mdp2', '"Mot de passe de vérification"', 'trim|required|alpha_dash|encode_php_tags|matches[mdp]');
         if ($this->form_validation->run()) {
             //	Le formulaire est valide
             // On vérifie que l'adresse mail n'est pas déjà utilisée :
             $mail = $this->input->post('email');
             $mail = htmlspecialchars($mail);
             $resultat = $this->db->query("SELECT * FROM utilisateur WHERE email = ?", array($mail));
             $rows = $resultat->num_rows();
             if ($rows > 0) {
                 $data = array();
                 $data['erreur'] = "Cette adresse email est déjà utilisée...";
                 $data['menu_categories'] = $this->menu_categories;
                 $this->layout->view('inscription', $data);
             } else {
                 // On vérifie désormais que le pseudo n'est pas déjà utilisé :
                 $pseudo = $this->input->post('login');
                 $resultat2 = $this->db->query("SELECT * FROM utilisateur WHERE login = ?", array($pseudo));
                 $rows2 = $resultat2->num_rows();
                 if ($rows2 > 0) {
                     $data2 = array();
                     $data2['erreur_login'] = "******";
                     $data2['menu_categories'] = $this->menu_categories;
                     $this->layout->view('inscription', $data2);
                 } else {
                     // Ici on instancie les variables de session et on enregistre l'utilisateur en base de données :
                     // On charge les éléments nécessaires :
                     $this->load->library('utilisateur');
                     $this->load->model('utilisateurManager');
                     // On récupère les données envoyées par le formulaire d'inscription afin d'instancier un objet Utilisateur :
                     $utilisateur = new Utilisateur();
                     $utilisateur->setNom($this->input->post('nom'));
                     $utilisateur->setPrenom($this->input->post('prenom'));
                     $utilisateur->setLogin($this->input->post('login'));
                     $utilisateur->setEmail($this->input->post('email'));
                     $utilisateur->setPassword($this->input->post('mdp'));
                     $utilisateur->setNiveau('2');
                     // On ajoute l'utilisateur en bdd via le manager :
                     $this->utilisateurManager->ajouter_utilisateur($utilisateur);
                     // On instancie les variables de session :
                     $this->session->set_userdata('login', $utilisateur->login());
                     $this->session->set_userdata('niveau', $utilisateur->niveau());
                     // On redirige l'utilisateur vers la page d'accueil :
                     redirect('accueil');
                 }
             }
         } else {
             //	Le formulaire est invalide ou vide
             $data = array();
             $data['menu_categories'] = $this->menu_categories;
             $this->layout->view('inscription', $data);
         }
     }
 }