示例#1
0
    default:
    $chartType = get_input('chartType');
    $chartType = (!empty($chartType)) ? $chartType : "pie";
    $sql = "SELECT id, host, facility, priority, tag, program, msg, counter, fo, lo, notes, (SELECT value from cache where name='msg_sum') as count FROM ".$_SESSION['TBL_MAIN']." $where GROUP BY $groupby ORDER BY count LIMIT $limit";
    $title = new title( date("D M d Y") );
    $ctype = new pie();
    $result = perform_query($sql, $dbLink, $_SERVER['PHP_SELF']);
    if(num_rows($result) >= 1) {
        while ($line = fetch_array($result)) {
            $hosts[] = $line['host'];
            $pievalues[] = new pie_value(intval($line['count']),  $line['host']);
        }
    }
    // Generate random pie colors
    for($i = 0; $i<=count($pievalues) ; $i++) {
        $colors[] = '#'.random_hex_color(); // 09B826
    }

    $ctype->set_alpha(0.5);
    $ctype->add_animation( new pie_fade() );
    $ctype->add_animation( new pie_bounce(5) );
    // $ctype->start_angle( 270 )
    $ctype->start_angle( 0 );
	$ctype->set_tooltip( "#label#<br>#val# of #total#<br>#percent# of top $limit hosts" );
	$ctype->radius(80);
	$ctype->set_colours( $colors );
	$ctype->set_values( $pievalues );
	$chart = new open_flash_chart();
	// $chart->set_title( $title );
	$chart->add_element( $ctype );
	echo $chart->toPrettyString();
示例#2
0
 public function register_validation($password)
 {
     // Set parameters
     $email = '*****@*****.**';
     $username = $this->input->post('username');
     // Email Validation
     $this->load->helper('email');
     if (!valid_email($email)) {
         $this->form_validation->set_message('register_validation', 'This is not a working email address');
         return false;
     } else {
         // Attempt new user register
         $facebook_id = 0;
         $ip = $_SERVER['REMOTE_ADDR'];
         $ip_frequency_register = 1;
         $user_id = $this->user_model->register($username, $password, $email, $facebook_id, $ip, $ip_frequency_register);
         // Fail
         if ($user_id === 'ip_fail') {
             // $this->form_validation->set_message('register_validation', 'This IP has already registered in the last ' . $ip_frequency_register . ' hours');
             // return false;
         } else {
             if (!$user_id) {
                 $this->form_validation->set_message('register_validation', 'Username already exists');
                 return false;
                 // Success
             } else {
                 // Set variables
                 $worlds = $this->user_model->get_all_worlds();
                 $active_army = 20;
                 // Create account for each world
                 foreach ($worlds as $world) {
                     // Random color for each account
                     $color = random_hex_color();
                     $account_id = $this->user_model->create_player_account($user_id, $world['id'], $active_army, $color);
                 }
                 // Login
                 $sess_array = array();
                 $sess_array = array('id' => $user_id, 'username' => $username, 'active_army' => $active_army);
                 $this->session->set_userdata('logged_in', $sess_array);
                 return true;
             }
         }
     }
 }