To facilitate the operation of some modifications as Judger call set up after HUSTOJ

The operations here include:

  1. Find initial MySQL database user name and password;
  2. The csrf to a fixed value;
  3. User submitted adjacent to cancel the same time interval of 10 seconds limit.

It reads as follows:


Use the following command to download and install the hustoj to local:

wget https://github.com/zhblue/hustoj/raw/master/trunk/install/install-ubuntu18.04.sh
sudo bash install-ubuntu18.04.sh

It takes a while.
After installing the first user name adminpassword admin123registered user.
And then view the /home/judge/etc/judge.conffiles can be found that there are some data:

...
OJ_USER_NAME=debian-sys-maint
OJ_PASSWORD=zRqrwJIMreGPLD4N
OJ_DB_NAME=jol
...

Where OJ_USER_NAME, OJ_PASSWORD, OJ_DB_NAMEcorresponding to your MySQL database user name, password, and database.

For each issue, such as the number 1000of problems, his data is stored in /home/judge/data/1000/the directory of.

Modify csrf.php

`` The original file looks like this:

<?php
  require_once("include/db_info.inc.php");
  require_once("include/my_func.inc.php");
  $token = getToken();
  if(!isset($_SESSION[$OJ_NAME.'_'.'csrf_keys'])){
    $_SESSION[$OJ_NAME.'_'.'csrf_keys']=array();
  }
  array_push($_SESSION[$OJ_NAME.'_'.'csrf_keys'],$token);
  while(count($_SESSION[$OJ_NAME.'_'.'csrf_keys'])>10) 
    array_shift($_SESSION[$OJ_NAME.'_'.'csrf_keys']);
  
?><input type="hidden" name="csrf" value="<?php echo $token?>" class="<?php echo in_array($token,$_SESSION[$OJ_NAME.'_'.'csrf_keys'])?>">

Direct modified to:

<?php
?><input type="hidden" name="csrf" value="aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" class="<?php echo in_array($token,$_SESSION[$OJ_NAME.'_'.'csrf_keys'])?>">

Then every time we lose csrf values are 32 aon it: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.

The default boot does not start nginx, so to enter the following command to start the nginx server at the command line:

sudo nginx

If the default submit Taiwan frequently, it will complain: "You should not submit more than twice in 10 seconds"
So we have to remove this restriction, the solution is to modify the src/web/submit.phpfile, which will be snippet:

if (count($res)==1){
    
        $view_errors="You should not submit more than twice in 10 seconds.....<br>";
        require("template/".$OJ_TEMPLATE."/error.php");
        exit(0);
    
}

Comment out, that becomes:

// if (count($res)==1){
    
//      $view_errors="You should not submit more than twice in 10 seconds.....<br>";
//      require("template/".$OJ_TEMPLATE."/error.php");
//      exit(0);
    
// }

Guess you like

Origin www.cnblogs.com/zifeiy/p/11006529.html