Skip to content

Latest commit

 

History

History
41 lines (37 loc) · 788 Bytes

challenge-29.md

File metadata and controls

41 lines (37 loc) · 788 Bytes

Challenge

<?php
 include('config.php');
 session_start();

 if($_SESSION['time'] && time() - $_SESSION['time'] > 60){
    session_destroy();
    die('timeout');
 } else {
    $_SESSION['time'] = time();
 }

 echo rand();
 if(isset($_GET['go'])){
    $_SESSION['rand'] = array();
    $i = 5;
    $d = '';
    while($i--){
        $r = (string)rand();
        $_SESSION['rand'][] = $r;
        $d .= $r;
    }
    echo md5($d);
 }else if(isset($_GET['check'])){
    if($_GET['ckeck'] === $_SESSION['rand']){
        echo $flag;
    } else {
        echo 'die';
        session_destroy();
    }
 } else {
    show_source(__FILE__);
 }
?>

Solution

Refference