Exemple #1
1
function login($data)
{
    //global $tpl;
    $objResponse = new xajaxResponse();
    include 'settings/tables.php';
    /* Crypt Password with MD5 Method */
    $pw_crypted = MD5(mysql_real_escape_string($data['password']));
    //encrypt password with MD5
    $email = mysql_real_escape_string($data['email']);
    /******************************************/
    /* Create Object :: EXIST */
    $logon = new CheckExist();
    /******************************************/
    /* Check :: EXIST */
    $logon->tableE = $tbl_users;
    $logon->conditionE = " UserEmail = '" . $email . "' && UserPass = '******' && activation_code = '' ";
    $CheckData = $logon->exist();
    /******************************************/
    /* Change Status :: Login successful or failed */
    if ($CheckData == 1) {
        $logon->email = $email;
        $logon->pw = $pw_crypted;
        $logon->tbl_users = $tbl_users;
        //setcookie
        if (isset($data['autologon'])) {
            $logon->cookie_duration = 1;
        } else {
            $logon->cookie_duration = 0;
        }
        $logon->cookieset('ly');
        $objResponse->Script("document.getElementById('submit_login').onclick()");
        $objResponse->redirect(ROOT_DIR);
        //return true;
    } else {
        $logon->email = '';
        $logon->pw = '';
        //$logon->cookieset('l');
        $objResponse->assign("p_logon_failure", "style.display", 'block');
        $objResponse->assign("p_logon_failure", "innerHTML", "Login information could not be verified.<br> Please try it again.");
        //TODO move string to language file
        //$tpl->display("logon/login.tpl");
        //return false;
    }
    unset($logon);
    /******************************************/
    return $objResponse;
}
Exemple #2
0
    $blog->update();
    /******************************************/
    /* Delete :: Object UPDATE */
    unset($blog);
    /******************************************/
    /* UPDATE :: RSS Feed */
    include 'update_rss_blog.php';
    /******************************************/
    /* Load :: Updated Main Content */
    $GetPage = new SelectEntrys();
    $GetPage->cols = 'date';
    $GetPage->table = $tbl_blog;
    $GetPage->condition = " id = '{$_POST['id']}' ";
    $Tdate = $GetPage->row();
    unset($GetPage);
    $GetPage = new CheckExist();
    $GetPage->tableE = $tbl_blog;
    $GetPage->conditionE = "date > '{$Tdate}' AND deleted = '0' ";
    $newer_entries = $GetPage->exist();
    unset($GetPage);
    $page = $newer_entries / $set[0]['perpage_blog'];
    $page = floor($page);
    $page++;
    header("Location:" . ROOT_DIR . "blog/" . $_POST['id'] . "/");
    /******************************************/
} else {
    if (isset($preview)) {
        include "modules/blog/output.php";
        include 'modules/blog/preview.php';
        $tpl->assign('array', $array);
        $tpl->display("formular/form_main.tpl");
Exemple #3
0
<?php

if ($_GET['module'] != 'flash') {
    $ay_cats_active = explode(",", $user_data['flash_categories_visible']);
    $flash_cats = new CheckExist();
    $flash_cats->tableE = $tbl_flash_categories;
    $n_flash_cats = $flash_cats->exist();
    for ($i = 1; $i <= $n_flash_cats; $i++) {
        if (in_array($i, $ay_cats_active)) {
            $tpl->assign('flash_cat_' . $i, "checked='checked'");
        } else {
            $tpl->assign('flash_cat_' . $i, "");
        }
    }
}
if ($user_data['flash_categories_visible'] != "" || $_GET['module'] == 'flash') {
    $cats = $user_data['flash_categories_visible'];
    $flashes = new SelectEntrys();
    $flashes->cols = 'ID, section, category, type, question, likes, dislikes, opt1, opt2, opt3, opt4, opt5, opt6, opt7, opt8, opt9, opt10, opt1_votes, opt2_votes, opt3_votes, opt4_votes, opt5_votes, opt6_votes, opt7_votes, opt8_votes, opt9_votes, opt10_votes';
    $flashes->table = $tbl_flashes;
    if ($_GET['module'] == 'flash') {
        $flashes->condition = "category = {$cid}";
    } else {
        $flashes->condition = "category IN ({$cats})";
    }
    $flashes->order = 'CreateDate DESC';
    $flashes->limit = $per_page_flashes;
    $flashes->multiSelect = '1';
    $ay_flashes = $flashes->row();
    if ($ay_flashes == "") {
        $ay_flashes = array();
<?php

require_once 'dbCon.php';
require_once '../settings/dbCon.php';
include "../settings/tables.php";
include "exist.php";
if ($_GET['s'] == "check_email") {
    $email = trim(stripslashes(mysql_real_escape_string($_GET['email'])));
    $email_exist = new CheckExist();
    $email_exist->tableE = $tbl_users;
    $email_exist->conditionE = "UserEmail = '{$email}' ";
    $obj_return = $email_exist->exist();
    echo $obj_return;
}
Exemple #5
0
 /******************************************/
 /* Clear thumbs directory */
 $thumbs->directory = $dir_thumbs;
 $thumbs->listfolder('clear');
 rmdir("gallery/{$folder}/thumbs");
 /******************************************/
 /* Delete entry */
 $gallery->table = $tbl_gallery;
 $gallery->condition = " id = '{$_POST['gid']}' ";
 $gallery->delete();
 /******************************************/
 /* Delete :: Object INSERT */
 unset($gallery);
 /******************************************/
 /* Get total rows */
 $gallery = new CheckExist();
 $gallery->tableE = $tbl_gallery;
 $gallery->conditionE = "";
 $TotalRows = $gallery->exist();
 unset($gallery);
 /******************************************/
 /* Load :: Updated Main Content */
 if (!isset($_GET['page'])) {
     $page_current = '1';
 } else {
     $page_current = $_GET['page'];
 }
 $max_pages = ceil($TotalRows / $set[0]["perpage_gallery"]);
 if ($max_pages > 1 && $page_current <= $max_pages) {
     $page_url = 'gallery/page/' . $page_current . '/';
 } else {
     $single_array[] = $array_blog_comments[$b]['bid'];
     $array_comments[$b]['bid'] = $array_blog_comments[$b]['bid'];
     $array_comments[$b]['comment_numbers'] = $array_blog_comments[$b]['COUNT(id)'];
     $array_comments[$b]['comment_time'] = convert_date_comments($array_blog_comments[$b]['MAXtime']);
     $array_comments[$b]['comment_time'] = substr($array_comments[$b]['comment_time'], 0, strlen($array_comments[$b]['comment_time']) - 8);
 }
 $string_bids = implode(",", $single_array);
 $b_title = new SelectEntrys();
 $b_title->cols = 'id, title_DE, title_EN, date';
 $b_title->table = $tbl_blog;
 $b_title->condition = "id IN ({$string_bids})";
 $b_title->multiSelect = '1';
 $array_b_titles = $b_title->row();
 for ($b = 0; $b < count($array_b_titles); $b++) {
     $date = $array_b_titles[$b]['date'];
     $get_page = new CheckExist();
     $get_page->tableE = $tbl_blog;
     $get_page->conditionE = " date > '{$date}' ";
     $_page = $get_page->exist();
     unset($get_page);
     $bid = $array_b_titles[$b]['id'];
     $final_page = floor($_page / $set[0]['perpage_blog']) + 1;
     $array_b[$bid]['title_DE'] = $array_b_titles[$b]['title_DE'];
     $array_b[$bid]['title_EN'] = $array_b_titles[$b]['title_EN'];
     $array_b[$bid]['link'] = 'blog/' . $final_page . '/' . $bid . '/#c' . $bid;
 }
 for ($b = 0; $b < count($array_comments); $b++) {
     $bid = $array_comments[$b]['bid'];
     $array_comments[$b]['title_DE'] = $array_b[$bid]['title_DE'];
     $array_comments[$b]['title_EN'] = $array_b[$bid]['title_DE'];
     $array_comments[$b]['link'] = $array_b[$bid]['link'];
Exemple #7
0
<?php

/* Crypt Password with MD5 Method */
$pw_crypted = MD5($_POST['UserPass']);
/******************************************/
/* Create Object :: EXIST */
$logon = new CheckExist();
/******************************************/
/* Check :: EXIST */
$logon->tableE = $tbl_users;
$logon->conditionE = " UserEmail = '" . $_POST['UserEmail'] . "' && UserPass = '******' && activation_code = '' ";
$CheckData = $logon->exist();
/******************************************/
/* Change Status :: Login successful or failed */
if ($CheckData == 1) {
    $logon->email = $_POST['UserEmail'];
    $logon->pw = $pw_crypted;
    $logon->tbl_users = $tbl_users;
    if (isset($_POST['autologon'])) {
        $logon->cookie_duration = 1;
    } else {
        $logon->cookie_duration = 0;
    }
    $logon->cookieset('l');
    header("Location:" . ROOT_DIR);
} else {
    $logon->email = '';
    $logon->pw = '';
    //$logon->cookieset('l');
    $tpl->assign('logon_failure', true);
    //$tpl->display("logon/login.tpl");
Exemple #8
0
function update_visiter_stats($tbl_visiter, $tbl_settings, $timestamp, $del_old_visiters, $time_new_visiter)
{
    require_once 'lib/select.php';
    require_once 'lib/modify.php';
    require_once 'lib/exist.php';
    $delimiter = $timestamp - $del_old_visiters * 60;
    // delete entries older than 2 weeks 60*60*24*14
    $visiter = new ModifyEntry();
    $visiter->table = $tbl_visiter;
    $visiter->condition = " UNIX_TIMESTAMP(date) < {$delimiter} ";
    $visiter->delete();
    unset($visiter);
    $delimiter = $timestamp - $time_new_visiter * 60;
    $visiter = new CheckExist();
    $visiter->tableE = $tbl_visiter;
    $visiter->conditionE = " IP = '" . $_SERVER['REMOTE_ADDR'] . "' AND UNIX_TIMESTAMP(date) >= {$delimiter} ";
    $visiter_exist = $visiter->exist();
    unset($visiter);
    if ($visiter_exist == 0) {
        //$country = file_get_contents('http://api.hostip.info/country.php?ip='.$_SERVER['REMOTE_ADDR']);
        $date = date("Y-m-d H:i:s", $timestamp);
        $visiter = new ModifyEntry();
        $visiter->table = $tbl_visiter;
        $visiter->cols = 'IP, date, browser, country, referer';
        $visiter->values = " '" . $_SERVER['REMOTE_ADDR'] . "', '{$date}', '" . $_SERVER['HTTP_USER_AGENT'] . "', 'unknown',  '" . $_SERVER['HTTP_REFERER'] . "' ";
        $visiter->insert();
        $visiter->table = $tbl_settings;
        $visiter->changes = " visiters_total = visiters_total+1 ";
        $visiter->condition = " id = '1' ";
        $visiter->update();
        unset($visiter);
    }
    return false;
}
Exemple #9
0
<?php

/* Crypt Password with MD5 Method */
$pw_crypted = MD5($_POST[password]);
/******************************************/
/* Create Object :: EXIST */
require_once './lib/exist.php';
$hits = new CheckExist();
/******************************************/
/* Check :: EXIST */
$hits->tableE = $tbl_users;
$hits->conditionE = " UserName = '******'username']}' && UserPass = '******' ";
$CheckData = $hits->exist();
/******************************************/
/* Change Status :: Login successful or failed */
if ($CheckData == 1) {
    $hits->user = $_POST[username];
    $hits->pw = $pw_crypted;
    $hits->tbl_users = $tbl_users;
    $hits->cookieset();
    header("Location:" . ROOT_DIR . "admin/");
} else {
    $hits->user = '';
    $hits->pw = '';
    $hits->cookieset();
    $tpl->assign('failure', true);
    $tpl->display("logon/login.tpl");
}
unset($hits);
/******************************************/
Exemple #10
0
         if (empty($_POST[name])) {
             $_POST[name] = $name_guest;
         }
         $_POST["comment"] = strip_tags($_POST["comment"]);
         $blog->table = $tbl_blog_comments;
         $blog->cols = 'bid, name, comment, lang, ip';
         $blog->values = " '{$_POST['bid']}', '{$_POST['name']}', '{$_POST['comment']}', '{$lang_active}', '{$_SERVER['REMOTE_ADDR']}' ";
         $blog->insert();
         /******************************************/
         /* Prevent Spam :: Save IP and set cookie */
         if ($set[0]["time_ban"] > 0) {
             $blog->table = $tbl_blog_spamban;
             $blog->cols = 'ip, bid';
             $blog->values = " '{$_SERVER['REMOTE_ADDR']}', '{$_POST['bid']}' ";
             $blog->insert();
             $spam = new CheckExist();
             $c_name = "ip_" . $_POST[bid];
             $c_content = $_SERVER['REMOTE_ADDR'];
             $c_time = time() + 60 * $set[0]["time_ban"];
             $spam->cookieIP($c_name, $c_content, $c_time, '/');
             unset($spam);
         }
         /******************************************/
         /* Load :: Updated Main Content */
         header("Location:" . ROOT_DIR . $page_url);
         /******************************************/
     }
 } else {
     /* Delete :: Old blocked IPs */
     $blog = new ModifyEntry();
     $blog->table = $tbl_blog_spamban;
Exemple #11
0
<?php

/* Create Object :: EXIST */
$logon = new CheckExist();
/******************************************/
/* Logout :: Delete Cookie */
$logon->email = '';
$logon->pw = '';
$logon->cookieset('l');
//$tpl->display("logon/login.tpl");
//$memcache->delete('user_data_'.$user_data['ID']);
unset($logon);
session_destroy();
header("Location:" . ROOT_DIR);
/******************************************/
Exemple #12
0
 /*
 		 if (!isset($bd_scale_dates[0])) { 
    
 	         $bd_check = new CheckExist();
 	         $bd_check->tableE = $tbl_users;
 	         $validity_check->conditionE = "UserToken = '".$_GET['t']."' && activation_code = '".$_GET['c']."' ";
 	         $validity = $validity_check->exist();
 		 
 		 }
 */
 //require_once('././lib/functions/convert_date.php');
 //Load Data that is displayed on landing page (diary, etc.)
 $diary_show_random = true;
 include "././lib/functions/fetch_diary.php";
 $tpl->assign('ay_diary', $ay_diary);
 $diary_entry_tdy = new CheckExist();
 $diary_entry_tdy->tableE = $tbl_diary;
 $diary_entry_tdy->conditionE = " userID = '" . $user_data['ID'] . "' AND DATE_FORMAT(date,'%Y-%m-%d') = CURDATE()";
 $dy_entry_tdy = $diary_entry_tdy->exist();
 if ($dy_entry_tdy == 1) {
     $tpl->assign('entry_today', 1);
 } else {
     $tpl->assign('entry_today', 0);
 }
 //define selected state for filter options
 $c_month = date("m", $timestamp);
 $c_year = date("Y", $timestamp);
 $tpl->assign('c_month', $c_month);
 $tpl->assign('c_year', $c_year);
 $goals_show_landing = true;
 include "././lib/functions/fetch_goals.php";
Exemple #13
0
function save($site, $FormValues)
{
    global $memcache;
    global $tpl;
    global $duration;
    global $_COOKIE;
    include 'settings/tables.php';
    $objResponse = new xajaxResponse();
    if (!isset($_COOKIE["l"])) {
        $objResponse->redirect(ROOT_DIR);
        return $objResponse;
    }
    $l["token"] = substr($_COOKIE["l"], 3, -35);
    $mem_key1 = "user_data_" . $l["token"];
    $user_data = $memcache->get($mem_key1);
    $mem_key2 = "trigger_f_" . $l["token"];
    $trigger_f = $memcache->get($mem_key2);
    include 'modules/logon/get_userdata.php';
    $mem_key3 = "ay_flashes_voted_" . $l["token"];
    $mem_key4 = "ay_flashes_rated_" . $l["token"];
    $ay_flashes_voted = $memcache->get($mem_key3);
    $ay_flashes_rated = $memcache->get($mem_key4);
    $ay_flash_cats = $memcache->get('ay_flash_cats');
    include 'modules/flash/flashfeed_add.php';
    $mysqldate = date('Y-m-d H:i:s', time());
    if ($site == 'sections_public') {
        if (isset($FormValues['sections_public'])) {
            $sections_public = implode(',', $FormValues['sections_public']);
        } else {
            $sections_public = '';
        }
        $upd_data = new ModifyEntry();
        $upd_data->table = $tbl_users;
        $upd_data->condition = " ID = '" . $user_data['ID'] . "' ";
        $upd_data->changes = " sections_public = '{$sections_public}' ";
        $upd_data->update();
        unset($upd_data);
        $user_data['sections_public'] = $sections_public;
        $mem_key1 = "user_data_" . $l["token"];
        $memcache->replace($mem_key1, $user_data, false);
        if (isset($FormValues['sections_public'])) {
            for ($i = 1; $i <= 5; $i++) {
                if (in_array($i, $FormValues['sections_public'])) {
                    $tpl->assign('f_sharing_' . $i, "checked='checked'");
                } else {
                    $tpl->assign('f_sharing_' . $i, "");
                }
            }
        } else {
            for ($i = 1; $i <= 5; $i++) {
                $tpl->assign('f_sharing_' . $i, "");
            }
        }
    } else {
        if ($site == 'flash_cat') {
            if (isset($FormValues['flash_cats'])) {
                $flash_cats = implode(',', $FormValues['flash_cats']);
            } else {
                $flash_cats = '';
            }
            $upd_data = new ModifyEntry();
            $upd_data->table = $tbl_users;
            $upd_data->condition = " ID = '" . $user_data['ID'] . "' ";
            $upd_data->changes = " flash_categories_visible = '{$flash_cats}' ";
            $upd_data->update();
            unset($upd_data);
            $user_data['flash_categories_visible'] = $flash_cats;
            $mem_key1 = "user_data_" . $l["token"];
            $memcache->replace($mem_key1, $user_data, false);
            $flash_cats_n = new CheckExist();
            $flash_cats_n->tableE = $tbl_flash_categories;
            $n_flash_cats = $flash_cats_n->exist();
            if (isset($FormValues['flash_cats'])) {
                for ($i = 1; $i <= $n_flash_cats; $i++) {
                    if (in_array($i, $FormValues['flash_cats'])) {
                        $tpl->assign('flash_cat_' . $i, "checked='checked'");
                    } else {
                        $tpl->assign('flash_cat_' . $i, "");
                    }
                }
            } else {
                for ($i = 1; $i <= $n_flash_cats; $i++) {
                    $tpl->assign('flash_cat_' . $i, "");
                }
            }
            /*redundant*/
            if ($flash_cats != "") {
                $flashes = new SelectEntrys();
                $flashes->cols = 'ID, section, category, type, question, likes, dislikes, opt1, opt2, opt3, opt4, opt5, opt6, opt7, opt8, opt9, opt10, opt1_votes, opt2_votes, opt3_votes, opt4_votes, opt5_votes, opt6_votes, opt7_votes, opt8_votes, opt9_votes, opt10_votes';
                $flashes->table = $tbl_flashes;
                $flashes->condition = 'category IN (' . $flash_cats . ')';
                $flashes->order = 'CreateDate DESC';
                $flashes->limit = 10;
                $flashes->multiSelect = '1';
                $ay_flashes = $flashes->row();
                if ($ay_flashes == "") {
                    $ay_flashes = array();
                }
            } else {
                $ay_flashes = array();
            }
            /***/
            $tpl->assign('ay_flashes', $ay_flashes);
            $tpl->assign('section', "category");
            $tpl->assign('ay_flash_categories', $memcache->get('ay_flash_cats'));
            $mem_key3 = "ay_flashes_voted_" . $l["token"];
            $mem_key4 = "ay_flashes_rated_" . $l["token"];
            $tpl->assign('ay_flashes_voted', $memcache->get($mem_key3));
            $tpl->assign('ay_flashes_rated', $memcache->get($mem_key4));
            $html = $tpl->fetch("modules/flash/flash_cats.tpl");
            $html2 = $tpl->fetch("modules/flash/flashfeed.tpl");
            $objResponse->assign("flash_cats", "innerHTML", $html);
            $objResponse->assign("flashfeed", "innerHTML", $html2);
        } else {
            if ($site == 'flash') {
                $id = $FormValues['flashID'];
                $type = $FormValues['flash_type'];
                $flash_opt_str = 'flash_opt_' . $id;
                $flash_res = new ModifyEntry();
                $str = '';
                foreach ($FormValues['opt'] as $opt) {
                    if ($str == '') {
                        $str = "opt" . $opt . "_votes=opt" . $opt . "_votes+1";
                    } else {
                        $str = $str . ", opt" . $opt . "_votes=opt" . $opt . "_votes+1";
                    }
                    $flash_res->table = $tbl_flash_results;
                    $flash_res->cols = 'userID, flashID, opt, time';
                    $flash_res->values = " '" . $user_data['ID'] . "', '{$id}', '{$opt}', '{$mysqldate}'";
                    $flash_res->insert();
                }
                unset($flash_res);
                $upd_data = new ModifyEntry();
                $upd_data->table = $tbl_flashes;
                $upd_data->condition = " ID = '{$id}' ";
                $upd_data->changes = " {$str}, total_votes = total_votes +1 ";
                $upd_data->update();
                unset($upd_data);
                $flash_result = new SelectEntrys();
                $flash_result->cols = 'opt1, opt2, opt3, opt4, opt5, opt6, opt7, opt8, opt9, opt10, opt1_votes, opt2_votes, opt3_votes, opt4_votes, opt5_votes, opt6_votes, opt7_votes, opt8_votes, opt9_votes, opt10_votes';
                $flash_result->table = $tbl_flashes;
                $flash_result->condition = " ID = '{$id}' ";
                $flash_result->multiSelect = 1;
                $ay_flash_result = $flash_result->row();
                unset($flash_result);
                foreach ($ay_flash_result as $key => $value) {
                    $arr = $value;
                }
                $ay_flashes_voted[] = $id;
                sort($ay_flashes_voted);
                $mem_key3 = "ay_flashes_voted_" . $l["token"];
                $memcache->replace($mem_key3, $ay_flashes_voted, false);
                $tpl->assign("section", "category");
                $tpl->assign("i", $arr);
                $html = $tpl->fetch("modules/flash/flash_result.tpl");
                $objResponse->assign($flash_opt_str, "innerHTML", $html);
            } else {
                if ($site == 'friends') {
                    //$str_restricted = explode(",", $user_data['fb_friends_restricted']);
                    $FormValues = intval(substr($FormValues, 3));
                    //settype($FormValues, "string");
                    foreach ($user_data['fb_friends'] as $key => $value) {
                        if ($value["friendID"] == "{$FormValues}") {
                            if ($value["restricted"] == 1) {
                                $restri = 0;
                            }
                            if ($value["restricted"] == 0) {
                                $restri = 1;
                            }
                            $user_data['fb_friends'][$key]["restricted"] = $restri;
                        }
                    }
                    $upd_data = new ModifyEntry();
                    $upd_data->table = $tbl_friends;
                    $upd_data->condition = " userID = '" . $user_data['ID'] . "' AND friendID = '{$FormValues}' ";
                    $upd_data->changes = " restricted = '{$restri}' ";
                    $upd_data->update();
                    $mem_key1 = "user_data_" . $l["token"];
                    $memcache->replace($mem_key1, $user_data, false);
                } else {
                    if ($site == 'favorite') {
                        $already_fav = new CheckExist();
                        $already_fav->tableE = $tbl_favorites;
                        $already_fav->conditionE = " userID = '" . $user_data['ID'] . "' AND flashID = '{$FormValues}' ";
                        $already_fav = $already_fav->exist();
                        if ($already_fav == 0) {
                            $ins_data = new ModifyEntry();
                            $ins_data->table = $tbl_favorites;
                            $ins_data->cols = 'userID, flashID';
                            $ins_data->values = " '" . $user_data['ID'] . "', '{$FormValues}' ";
                            $ins_data->insert();
                            unset($ins_data);
                        }
                        $p_favorited_id = 'p_favorited_' . $FormValues;
                        $objResponse->assign($p_favorited_id, "innerHTML", "Favorite saved successfully");
                    }
                }
            }
        }
    }
    return $objResponse;
}
Exemple #14
0
    if (isset($submitC)) {
        $toggleS_style = '';
        $toggleS_img = 'collapse';
        $toggleS_title = $toggle_collapseC;
    }
    $counter++;
    if (isset($save_pages)) {
        $tpl->assign("array_p", $save_pages);
        $lastpage = end($save_pages);
        $tpl->assign("pagesT", $lastpage['page']);
        $tpl->assign("title_pagenavi", $blog_navi);
    }
    $tpl->assign("page", $page);
    /* Spam Ban still active? */
    $c_name = "ip_" . $id;
    $spamban_D = new CheckExist();
    $spamban_D->tableE = $tbl_blog_spamban;
    $spamban_D->conditionE = "bid = '{$id}' AND ip = '{$_SERVER['REMOTE_ADDR']}' ";
    $spamban = $spamban_D->exist();
    if (isset($_COOKIE[$c_name])) {
        $spamban = 1;
    }
    /**************************/
}
// end :: module != 'admin'
if (!isset($preview)) {
    //date format: 0000-00-00 00:00:00
    $c_year = substr($b_timestamp, 0, 4);
    $c_month = substr($b_timestamp, 5, 2);
    $c_day = substr($b_timestamp, 8, 2);
    $c_hour = substr($b_timestamp, 11, 2);
Exemple #15
0
/******************************************/
/* Administrator Login Status */
if ($_COOKIE["userdata"]) {
    /* Call Method :: Explode the Cookie */
    $str = explode("|", $_COOKIE["userdata"]);
    /******************************************/
    /* Maybe user is locked? */
    $status = new SelectEntrys();
    $status->userid = $str[1];
    $status->cols = 'status';
    $Mystatus = $status->getUserData();
    unset($status);
    /******************************************/
    if ($Mystatus == 1) {
        /* Admin or Superadmin status? */
        $admin = new SelectEntrys();
        $admin->userid = $str[1];
        $admin->cols = 'admin';
        $Myadmin = $admin->getUserData();
        unset($admin);
        /******************************************/
        /* Compare Cookie data with database */
        require_once './lib/exist.php';
        $logon = new CheckExist();
        $logon->tableE = $tbl_users;
        $logon->conditionE = " UserID = '{$str['1']}' && UserPass = '******'2']}' ";
        $logon_true = $logon->exist();
        /******************************************/
    }
}
/******************************************/
Exemple #16
0
    } else {
        if ($Myadmin != "1") {
            $links_c->condition = "visibility = '1' ";
        }
    }
}
$links_c->multiSelect = '1';
$array_c = $links_c->row();
unset($links_c);
$tpl->assign('array_c_names', $array_c_names);
$tpl->assign('array_c', $array_c);
$tpl->assign("form_nopreview", "1");
/**************************/
/* Check if links are available in the selected category  */
if ($_GET['cid'] > 0) {
    $links = new CheckExist();
    $links->tableE = $tbl_links;
    if ($Myadmin == "1") {
        $links->conditionE = " cid = '{$_GET['cid']}' ";
    } else {
        $links->conditionE = " cid = '{$_GET['cid']}' AND visibility = '1' ";
    }
    $links_total = $links->exist();
    unset($links);
}
/**************************/
/* Load :: Link section  */
$links = new SelectEntrys();
$links->cols = ' id, cid, link, description, description_EN, position, visibility ';
$links->table = $tbl_links;
$links->order = "cid, position";
Exemple #17
0
<?php

/* Create Object :: EXIST */
$hits = new CheckExist();
/******************************************/
/* Logout :: Delete Cookie */
$hits->user = '';
$hits->pw = '';
$hits->cookieset();
$tpl->display("logon/login.tpl");
header("Location:" . ROOT_DIR . "admin/");
unset($hits);
/******************************************/
Exemple #18
0
     $cats = $f_cats->row();
     //same for sections_public if needed
     foreach ($cats as $key => $value) {
         $arr[] = $value['ID'];
     }
     $str_cats = implode(",", $arr);
     $upd_data = new ModifyEntry();
     $upd_data->table = $tbl_users;
     $upd_data->condition = " UserToken = '" . $_POST['t'] . "' ";
     $upd_data->changes = " nationality = '" . $_POST['nationality'] . "', residence = '" . $_POST['residence'] . "', gender = '" . $_POST['gender'] . "', birthday = '{$birthday}', flash_categories_visible = '{$str_cats}', activation_code = '' ";
     $upd_data->update();
     unset($upd_data);
     header("Location:" . ROOT_DIR . "register/activation.html?t=" . $_POST['t'] . "&e=success");
 } else {
     if (isset($_GET['c']) && isset($_GET['t'])) {
         $validity_check = new CheckExist();
         $validity_check->tableE = $tbl_users;
         $validity_check->conditionE = "UserToken = '" . $_GET['t'] . "' && activation_code = '" . $_GET['c'] . "' ";
         $validity = $validity_check->exist();
         $tpl->assign('validity', $validity);
         if ($validity == 1) {
             /* Prepare country list for registration */
             $countries = new SelectEntrys();
             $countries->cols = 'ID, ' . $lang_active;
             $countries->table = $tbl_countries;
             $countries->order = $lang_active;
             $countries->multiSelect = '1';
             $ay_countries = $countries->row();
             unset($countries);
             $ay_born = array();
             $year_born_i = '1950';
Exemple #19
0
function registerUser($data, $action)
{
    global $db;
    global $debug_mode;
    $objResponse = new xajaxResponse();
    include 'settings/tables.php';
    $reg_failure = "";
    $email = trim(stripslashes(mysqli_real_escape_string($db, $data['email'])));
    $firstname = trim(stripslashes(mysqli_real_escape_string($db, $data['firstname'])));
    if ($action == 'register') {
        $password = trim(stripslashes(mysqli_real_escape_string($db, md5($data['password']))));
        $password2 = trim(stripslashes(mysqli_real_escape_string($db, md5($data['password2']))));
        $beta_code = trim(stripslashes(mysqli_real_escape_string($db, md5($data['betacode']))));
        //generate activation code
        $act_code = md5(uniqid(rand()));
        $token = time() . uniqid();
        //check if email is already registered
        $checkemail = new CheckExist();
        $checkemail->tableE = $tbl_users;
        $checkemail->conditionE = " UserEmail = '" . $email . "'  ";
        $CheckData = $checkemail->exist();
        //error handling and validation
        if (!preg_match('/^([a-zA-Z0-9])+([\\.a-zA-Z0-9_-])*@([a-zA-Z0-9_-])+(\\.[a-zA-Z0-9_-]+)+/', $email)) {
            $reg_failure = "Email not valid.";
        } elseif (strlen($email) < 5) {
            $reg_failure = "Email not valid.";
        } elseif ($CheckData > 0) {
            $reg_failure = "Email already taken.";
        } elseif ($password != $password2) {
            $reg_failure = "Passwords do not match. Please correct your information and try it again.";
        } elseif (strlen($data['password']) < 5 || strlen($data['password2']) < 5) {
            $reg_failure = "Password is too short. Please correct your information and try it again.";
        } elseif (strlen($firstname) < 3) {
            $reg_failure = "Firstname is too short. Please correct your information and try it again.";
        } elseif ($beta_code != 'X2DH38u3z') {
            $reg_failure = "Beta Access Code not valid. Please correct your information and try it again.";
        }
        //registration validation successful
        if ($reg_failure == "") {
            //create new user in database
            $user_register = new ModifyEntry();
            $user_register->table = $tbl_users;
            $user_register->cols = 'UserToken, UserEmail, UserPass, firstname, activation_code, language';
            $user_register->values = " '{$token}', '{$email}', '{$password}', '{$firstname}', '{$act_code}', 'EN' ";
            $user_register->insert();
            if ($user_register->errno() == 0) {
                //send email confirmation with activation link to user
                $Header = "MIME-Version: 1.0\n";
                $Header .= "Content-type: text/plain; charset=utf-8\n";
                $Header .= "From: noreply@happify.com";
                //$from    = "From: admin@wiwistud.de";
                //activation.html?c=bebf08f7af79422ced07be79c2f2f5c0&t=13140575844e52ed70736d2
                $act_link = ROOT_DIR . "logon/activation.html?c=" . $act_code . "&t=" . $token;
                $subject = "Activation link happify.com";
                $message = "Activation link: " . $act_link;
                if ($debug_mode != "OFF") {
                    require "../phpmailer/class.phpmailer.php";
                    $mail = new PHPMailer();
                    $mail->IsSMTP();
                    // send via SMTP
                    //IsSMTP(); // send via SMTP
                    $mail->SMTPSecure = "ssl";
                    // sets the prefix to the servier
                    $mail->Host = "smtp.gmail.com";
                    // sets GMAIL as the SMTP server
                    $mail->Port = 465;
                    $mail->SMTPDebug = 0;
                    $mail->SMTPAuth = true;
                    // turn on SMTP authentication
                    $mail->Username = "******";
                    // SMTP username
                    $mail->Password = "******";
                    // SMTP password
                    $webmaster_email = "*****@*****.**";
                    //Reply to this email ID
                    //$email="*****@*****.**"; // Recipients email ID
                    //$name=$firstname; // Recipient's name
                    //$mail->From = $webmaster_email;
                    //$mail->FromName = "Happify";
                    $mail->SetFrom($webmaster_email, "Happify");
                    $mail->AddAddress($email, $firstname);
                    //$mail->AddReplyTo($webmaster_email,"Webmaster");
                    //$mail->WordWrap = 50; // set word wrap
                    //$mail->AddAttachment("/var/tmp/file.tar.gz"); // attachment
                    //$mail->AddAttachment("/tmp/image.jpg", "new.jpg"); // attachment
                    //$mail->IsHTML(true); // send as HTML
                    $mail->Subject = $subject;
                    $mail->Body = $message;
                    //HTML Body
                    $mail->AltBody = $message;
                    //Text Body
                    $mail->Send();
                } else {
                    mail($email, $subject, $message, $Header);
                }
                $objResponse->assign("form_reg", "style.display", 'none');
                $objResponse->assign("reg_success", "style.display", 'block');
                unset($user_register);
            } else {
                $objResponse->assign("p_reg_failure", "style.display", 'block');
                $objResponse->assign("p_reg_failure", "innerHTML", "Registration not successful. Please try again.");
                // TODO move string to language file
            }
        } else {
            $objResponse->assign("p_reg_failure", "style.display", 'block');
            $objResponse->assign("p_reg_failure", "innerHTML", $reg_failure);
        }
    } else {
        if ($action == 'notify') {
            //check if email is already registered
            $checkemail = new CheckExist();
            $checkemail->tableE = $tbl_notify;
            $checkemail->conditionE = " UserEmail = '" . $email . "'  ";
            $CheckData = $checkemail->exist();
            //TODO why does it not work on server
            if (!preg_match('/^([a-zA-Z0-9])+([\\.a-zA-Z0-9_-])*@([a-zA-Z0-9_-])+(\\.[a-zA-Z0-9_-]+)+/', $email)) {
                $reg_failure = "Email not valid.";
            }
            // TODO move string to language file
            if ($CheckData > 0) {
                $reg_failure = "Email already registered.";
            }
            // TODO move string to language file
            //registration validation successful
            if ($reg_failure == "") {
                //$firstname = $data['firstname'];
                //create new user in database
                $user_register = new ModifyEntry();
                $user_register->table = $tbl_notify;
                $user_register->cols = 'UserEmail';
                $user_register->values = " '" . $email . "' ";
                $user_register->insert();
                if ($user_register->errno() == 0) {
                    //send email confirmation with activation link to user
                    $Header = "MIME-Version: 1.0\n";
                    $Header .= "Content-type: text/plain; charset=utf-8\n";
                    $Header .= "From: noreply@myhappifier.info";
                    $subject = "myhappifier.info Launch";
                    $message = "Hi! \r\n\n  \nThank you for your registration. We will inform you as soon as Happify launches!\r\n\r\n\n              \n              \nUntil then: stay happy!";
                    if ($debug_mode != "OFF") {
                        require "../phpmailer/class.phpmailer.php";
                        $mail = new PHPMailer();
                        $mail->IsSMTP();
                        // send via SMTP
                        //IsSMTP(); // send via SMTP
                        $mail->SMTPSecure = "ssl";
                        // sets the prefix to the server
                        $mail->Host = "smtp.gmail.com";
                        // sets GMAIL as the SMTP server
                        $mail->Port = 465;
                        $mail->SMTPDebug = 0;
                        $mail->SMTPAuth = true;
                        // turn on SMTP authentication
                        $mail->Username = "******";
                        // SMTP username
                        $mail->Password = "******";
                        // SMTP password
                        $webmaster_email = "*****@*****.**";
                        //Reply to this email ID
                        //$email="*****@*****.**"; // Recipients email ID
                        //$name=$firstname; // Recipient's name
                        //$mail->From = $webmaster_email;
                        //$mail->FromName = "Happify";
                        $mail->SetFrom($webmaster_email, "Happify");
                        $mail->AddAddress($email, $firstname);
                        //$mail->AddReplyTo($webmaster_email,"Webmaster");
                        //$mail->WordWrap = 50; // set word wrap
                        //$mail->AddAttachment("/var/tmp/file.tar.gz"); // attachment
                        //$mail->AddAttachment("/tmp/image.jpg", "new.jpg"); // attachment
                        //$mail->IsHTML(true); // send as HTML
                        $mail->Subject = $subject;
                        $mail->Body = $message;
                        //HTML Body
                        $mail->AltBody = $message;
                        //Text Body
                        $mail->Send();
                        //mail does not work
                    } else {
                        mail($email, $subject, $message, $Header);
                    }
                    $objResponse->assign("form_reg", "style.display", 'none');
                    $objResponse->assign("reg_success", "style.display", 'block');
                    unset($user_register);
                } else {
                    $objResponse->assign("p_reg_failure", "style.display", 'block');
                    $objResponse->assign("p_reg_failure", "innerHTML", "Registration not successful. Please try again.");
                    // TODO move string to language file
                }
            } else {
                $objResponse->assign("p_reg_failure", "style.display", 'block');
                $objResponse->assign("p_reg_failure", "innerHTML", $reg_failure);
            }
        }
    }
    return $objResponse;
}