Example #1
0
File: register.php Project: rjha/sc
 $fhandler->addRule('email', 'Email', array('required' => 1, 'maxlength' => 64));
 $fhandler->addRule('password', 'Password', array('required' => 1, 'maxlength' => 32));
 //check security token
 $fhandler->checkToken("token", $gWeb->find("form.token", true));
 $fvalues = $fhandler->getValues();
 if (!empty($fvalues["adrisya_number"])) {
     $message = "unexpected error with form submission!";
     $fhandler->addError($message);
     $error = "Possible spam bot submission from IP :: " . $_SERVER["REMOTE_ADDR"];
     Logger::getInstance()->info($error);
 }
 if ($fhandler->hasErrors()) {
     throw new UIException($fhandler->getErrors());
 }
 //create a new login + user
 $loginDao = new \com\indigloo\sc\dao\Login();
 $loginDao->create($fvalues['first_name'], $fvalues['last_name'], $fvalues['email'], $fvalues['password']);
 //canonical email - all lower case
 $email = strtolower(trim($fvalues['email']));
 $password = trim($fvalues['password']);
 $loginId = NULL;
 try {
     $loginId = \com\indigloo\auth\User::login('sc_user', $email, $password);
 } catch (\Exception $ex) {
     $code = $ex->getCode();
     switch ($code) {
         case 401:
             $message = "Wrong login or password. Please try again!";
             throw new UIException(array($message));
             break;
         default:
Example #2
0
File: plot.php Project: rjha/sc
<?php

header('Content-type: application/json');
include 'sc-app.inc';
include APP_WEB_DIR . '/inc/header.inc';
$loginDao = new \com\indigloo\sc\dao\Login();
$rows = $loginDao->getAggregate();
$size = sizeof($rows);
// @see https://groups.google.com/forum/?fromgroups=#!topic/jqplot-users/fKQvDFqIMO4
// @imp jqplot should get integer values
// and not the "string" representation of integers!
$y = array();
for ($index = 0; $index < $size; $index++) {
    $y[$index] = intval($rows[$index]["count"]);
}
$series = array();
$series[0] = $y;
$data = json_encode($series);
echo $data;