コード例 #1
0
ファイル: GWF_ChatOnline.php プロジェクト: sinfocol/gwf3
 public static function setSessOffline(Module_Chat $module)
 {
     $sessid = GWF_Session::getSessID();
     $table = new self(false);
     if (false === ($row = $table->getRow($sessid))) {
         # Unknown row
         return true;
     }
     return $row->saveVar('chaton_timeleft', time());
 }
コード例 #2
0
ファイル: GWF_ShoppingCart.php プロジェクト: sinfocol/gwf3
 public static function getCart()
 {
     $sessid = GWF_Session::getSessID();
     if (false !== ($cart = self::table(__CLASS__)->selectFirst("orderc_sessid='{$sessid}'"))) {
         return $cart;
     } else {
         $cart = new self(array('orderc_uid' => GWF_Session::getUserID(), 'orderc_sessid' => $sessid));
         if (false === $cart->insert()) {
             return false;
         }
         return $cart;
     }
 }
コード例 #3
0
ファイル: WC_CryptoChall.php プロジェクト: sinfocol/gwf3
 public static function generateSolution($random, $letters_only = false, $lowercase = false, $length = 12)
 {
     if (false === ($user = GWF_Session::getUser())) {
         $username = GWF_Session::getSessID();
     } else {
         $username = $user->getVar('user_name');
     }
     $md5 = strtoupper(md5($random . $random . $username . $random . $random));
     if ($letters_only === true) {
         $md5 = str_replace(self::$SEARCH, self::$REPLACE, $md5);
     }
     if ($lowercase === true) {
         $md5 = strtolower($md5);
     }
     return substr($md5, 2, $length);
 }
コード例 #4
0
ファイル: index.php プロジェクト: sinfocol/gwf3
function lsb_gen_image($solution)
{
    if (false === ($image = imagecreatefrompng(LSB_IMAGE_PATH))) {
        return GWF_WEB_ROOT . 'error/Can_not_create_img';
    }
    if (false === imageistruecolor($image)) {
        return GWF_WEB_ROOT . 'error/Image_not_true_color';
    }
    lsb_write_string($image, 0, $solution);
    //	lsb_write_string($image, 1, $solution);
    //	lsb_write_string($image, 2, $solution);
    $sessid = GWF_Session::getSessID();
    $out_path = "challenge/training/stegano/LSB/temp/{$sessid}.png";
    // 	$out_path = 'dbimg/lsb/'.$sessid.'.png';
    imagepng($image, $out_path);
    imagedestroy($image);
    return $out_path;
}
コード例 #5
0
ファイル: GWF_ForumVisitors.php プロジェクト: sinfocol/gwf3
 public static function setWatching(GWF_ForumThread $thread, $cut)
 {
     $tid = $thread->getID();
     # Insert current spectator
     //		GDO::table(__CLASS__);
     $row = new self(array('fowa_sess' => GWF_Session::getSessID(), 'fowa_time' => time(), 'fowa_tid' => $tid));
     if (false === $row->replace()) {
         return false;
     }
     # Delete old
     $cut = time() - $cut;
     if (false === $row->deleteWhere("fowa_time<{$cut}")) {
         return false;
     }
     # Set new amount
     if (false === $thread->saveVar('thread_watchers', $row->countRows("fowa_tid={$tid}"))) {
         return false;
     }
     return true;
 }
コード例 #6
0
ファイル: Form.php プロジェクト: sinfocol/gwf3
 private function onLoggedIn(GWF_User $user, $isAjax)
 {
     $last_url = GWF_Session::getLastURL();
     if (false === GWF_Session::onLogin($user, isset($_POST['bind_ip']))) {
         return GWF_HTML::err('ERR_GENERAL', array(__FILE__, __LINE__));
     }
     require_once GWF_CORE_PATH . 'module/Login/GWF_LoginHistory.php';
     GWF_LoginHistory::insertEvent($user->getID());
     # save last login time
     $user->saveVar('user_lastlogin', time());
     if ($this->module->cfgCleanupAlways()) {
         GWF_LoginFailure::cleanupUser($user->getID());
     }
     if ($isAjax) {
         return sprintf('1:%s', GWF_Session::getSessID());
     } else {
         GWF_Session::set('GWF_LOGIN_BACK', $last_url);
         if (false !== ($lang = $user->getLanguage())) {
             GWF_Language::setCurrentLanguage($lang);
         }
         if (0 < ($fails = GWF_LoginFailure::getFailCount($user, $this->module->cfgTryExceed()))) {
             GWF_Session::set('GWF_LOGIN_FAILS', $fails);
         }
         GWF_Website::redirect(GWF_WEB_ROOT . 'welcome');
     }
 }
コード例 #7
0
ファイル: index.php プロジェクト: sinfocol/gwf3
<?php

chdir('../../');
define('GWF_PAGE_TITLE', 'Snake');
define('CHEAT_SNAKE_SCORE', 300000);
require_once 'challenge/html_head.php';
if (false === ($chall = WC_Challenge::getByTitle(GWF_PAGE_TITLE))) {
    $chall = WC_Challenge::dummyChallenge(GWF_PAGE_TITLE, 4, 'challenge/snake/index.php', false);
}
$chall->showHeader();
htmlTitleBox($chall->lang('title'), $chall->lang('info', array(CHEAT_SNAKE_SCORE, 'CGI_Highscore.php', 'http://snake.gizmore.org', 'http://snake.gizmore.org/CGI_Highscore.php')));
echo '<div class="box box_c">' . PHP_EOL;
echo '<applet code="SnakeApplet.class" archive="snake.jar?v=1.06" width="500" height="400"><param name="sessid" value="' . GWF_HTML::display(GWF_Session::getSessID()) . '" ></param></applet>' . PHP_EOL;
echo '</div>' . PHP_EOL;
echo $chall->copyrightFooter();
require_once 'challenge/html_foot.php';
コード例 #8
0
ファイル: attachment.php プロジェクト: sinfocol/gwf3
<?php

chdir('../../../../');
require_once 'protected/config.php';
require_once '../gwf3.class.php';
$gwf = new GWF3(getcwd(), array('website_init' => true, 'autoload_modules' => true, 'load_module' => false, 'get_user' => true, 'do_logging' => true, 'blocking' => true, 'no_session' => false, 'store_last_url' => true, 'ignore_user_abort' => true));
//GWF_Session::start();
//GWF_Language::init();
//GWF_HTML::init();
$wechall = GWF_Module::loadModuleDB('WeChall');
require_once GWF_CORE_PATH . 'module/WeChall/WC_CryptoChall.php';
$jpg_path = 'challenge/training/stegano/attachment/the.jpg';
$jpg_file = file_get_contents($jpg_path);
$solution = WC_CryptoChall::generateSolution('YouLikeAttachmentEh', true, false);
$zip_path = GWF_PATH . 'extra/temp/steganoattach/' . GWF_Session::getSessID() . '.zip';
$zip = new GWF_ZipArchive();
if (false === $zip->open($zip_path, GWF_ZipArchive::CREATE)) {
    die('zip error 1');
}
if (false === $zip->addFromString('solution.txt', $solution)) {
    die('zip error 2');
}
if (false === $zip->close()) {
    die('zip error 3');
}
$jpg_file .= file_get_contents($zip_path);
unlink($zip_path);
header('Content-Type: image/jpeg');
echo $jpg_file;
die;