예제 #1
0
 function process()
 {
     if ($this->validate()) {
         //add details to session
         session_write("analysis_name", $this->data['txtName']);
         session_write("analysis_email", $this->data['txtEmail']);
         //redirect
         redirect(WWW_SERVER . '/ratestart.php');
     } else {
         $this->bind();
         $this->render();
     }
 }
예제 #2
0
 function bind()
 {
     $this->page_title = "Add a leaflet";
     $upload_key = session_read("upload_key");
     if (!isset($upload_key) || $upload_key == '') {
         $upload_key = md5(uniqid(rand(), true));
         session_delete("upload_key");
         session_write("upload_key", $upload_key);
         error_log("bind:upload_key set to:" . $upload_key);
     }
     $this->upload_key = $upload_key;
     $this->image_que_items = $this->get_images_from_que();
     $this->assign('image_que_items', $this->image_que_items);
 }
 function process()
 {
     if ($this->validate()) {
         //save IDs to session
         session_write("image_ids", $this->image_ids);
         //redirect with callback provided
         if ($this->viewstate['callback']) {
             redirect("addinfo.php?callback=" . urlencode($this->viewstate['callback']));
         } else {
             redirect("addinfo.php");
         }
     } else {
         $this->bind();
         $this->render();
     }
 }
예제 #4
0
function check_user_cookie($user_cookie)
{
    $connection = connect();
    $ps = $connection->prepare("select  u_id, u_uID, u_email, u_pwd, u_f_name, u_l_name, u_b_day, u_gender, u_userName, u_about \n                                from auto_login as a\n                                left join users as u\n                                on u.u_id = a.a_u_id \n                                where a_u_hash = ? limit 1");
    $ps->bind_param("s", $user_cookie);
    //string
    $ps->execute();
    $ps->bind_result($u_id, $uuid, $email, $password, $firstName, $lastName, $date, $gender, $username, $about);
    $ps->fetch();
    if (!$u_id) {
        return NULL;
    }
    if ($gender == 1) {
        $gender = 'male';
    } else {
        $gender = 'female';
    }
    //Custom date Formating d/m/Y function from helpers.php
    $date = dateFormat($date);
    $userSession = new stdClass();
    $userSession->u_id = $u_id;
    $userSession->uuid = $uuid;
    $userSession->email = $email;
    $userSession->firstName = $firstName;
    $userSession->lastName = $lastName;
    $userSession->date = $date;
    $userSession->gender = $gender;
    $userSession->username = $username;
    $userSession->about = $about;
    //Add userData to Session helpers.php
    session_write($userSession);
    $ps->close();
    $connection->close();
    //Update User Cookie on client side and DB every time after cookie checking
    //update_user_cookies($u_id, $username, $email);
    return TRUE;
}
    }
    @mysqli_free_result($result);
}
$data = '';
if (empty($_SESSION)) {
    //if there isn't a session, start one
    startSession();
    //get feed data
    $request = 'https://news.google.com/news?cf=all&hl=en&pz=1&ned=us&q=' . $query . '&output=rss';
    $data = file_get_contents($request);
    //create Feed object
    $today = date("Y-m-d H:i:s");
    $myFeed = new Feed($id, $today, $data);
    $xml = simplexml_load_string($myFeed->Data);
    //create session with Feed data
    session_write($myFeed->ID, $myFeed->Data);
} else {
    //if session already set
    //get session data and load it it $xml variable
    $data = session_read($id);
    $xml = simplexml_load_string($data);
}
//output feed data
echo '<div class="panel panel-primary"><div class="panel-heading">';
echo '<h3 class="panel-title">' . $xml->channel->title . '</h3></div>';
echo '<div class="panel-body">' . $subCatDescp . '</div></div>';
foreach ($xml->channel->item as $story) {
    echo '<div class="panel panel-primary"><div class="panel-heading">';
    echo '<h3 class="panel-title"><a href="' . $story->link . '">' . $story->title . '</a></h3></div>';
    echo '<div class="panel-body">' . $story->description . '</div></div>';
}
 private function save_application()
 {
     session_write('application', $this->application);
 }
예제 #7
0
function log_in($email, $user_password, $remember_me)
{
    $connection = connect();
    $ps = $connection->prepare("select u_id, u_uID, u_email, u_pwd, u_f_name, u_l_name, u_b_day, u_gender, u_userName, u_about, u_image from users WHERE u_email=? LIMIT 1");
    $ps->bind_param("s", $email);
    //string
    $ps->execute();
    $ps->bind_result($u_id, $uuid, $email, $password, $firstName, $lastName, $date, $gender, $username, $about, $user_image);
    $ps->fetch();
    //if Email wrong return "email" to front End
    if (!$email) {
        return 0;
    }
    //If Password wrong return "password" to front End
    if (!password_verify($user_password, $password)) {
        return 0;
    }
    if ($gender == 1) {
        $gender = 'male';
    } else {
        $gender = 'female';
    }
    //Custom date Formating d/m/Y function from helpers.php
    $date = dateFormat($date);
    $userSession = new stdClass();
    $userSession->u_id = $u_id;
    $userSession->uuid = $uuid;
    $userSession->email = $email;
    $userSession->firstName = $firstName;
    $userSession->lastName = $lastName;
    $userSession->date = $date;
    $userSession->gender = $gender;
    $userSession->username = $username;
    $userSession->about = $about;
    //Add userData to Session helpers.php
    session_write($userSession);
    //Some bug with write to session througt stdClass
    $_SESSION['user_image'] = $user_image;
    $ps->close();
    $connection->close();
    //If User checked 'Remember me' -> Set Cookies
    if ($remember_me == 'true') {
        update_user_cookies($u_id, $username, $email);
    }
    return TRUE;
}
예제 #8
0
 public function save()
 {
     session_write('application', $this);
 }