Permalink
Browse files

Add some little shit at user_panel and experiment

  • Loading branch information...
LTommy committed Dec 7, 2017
1 parent 8c3c543 commit 827aa5056e852376578aa69b98cd3444993c8b6e
Showing with 26 additions and 13 deletions.
  1. BIN server/src/a.out
  2. +14 −3 server/src/experiment.cpp
  3. +6 −7 server/src/experiment.h
  4. +5 −2 server/src/user_panel.cpp
  5. +1 −1 server/src/user_panel.h
View
Binary file not shown.
View
@@ -1,24 +1,35 @@
#include "experiment.h"
#include "redis.h"
#include <iostream>
#include <string>
#include <vector>
using namespace std;
Experiment::Experiment(string exp_kind, int id, Redis &redis){
Experiment::Experiment(string exp_kind, int exp_id, Redis &redis){
this->exp_kind = exp_kind;
this->exp_id = exp_id;
this->update_all(redis);
}
int Experiment::update_all(Redis &redis)
{
string key;
if (this->exp_id >= 10)
key = this->exp_kind + ":0" + to_string(this->exp_id);
else
key = this->exp_kind + ":00" + to_string(this->exp_id);
this->exp_name = redis.hget(key, "exp_name");
this->exp_detail = redis.hget(key, "exp_detail");
this->exp_score = atoi(redis.hget(key, "exp_score").c_str());
this->exp_hints = redis.hget(key, "exp_score");
this->exp_flag = redis.hget(key, "exp_flag");
// this->exp_all_count = redis.hget("");
}
int main()
{
Redis redis;
cout << redis.hget("test:008", "name");
string temp("003");
cout << atoi(temp.c_str());
Experiment pwn1("pwn", 0, redis);
pwn1.update_all(redis);
}
View
@@ -1,25 +1,24 @@
#ifndef EXPERIMENT_H
#define EXPERIMENT_H
#include "redis.h"
#include "../include/server.h"
class Experiment
{
public:
public:
Experiment(std::string exp_kind, int exp_id, Redis &redis);
std::string exp_name;
int exp_id;
int exp_score;
std::string detail;
std::string hints;
std::string exp_detail;
std::string exp_hints;
int top3[3];
int update_all(Redis &redis);
int exp_all_count;
std::string exp_kind;
int total_count;
private:
std::string exploit_sample;
std::string flag;
std::string exp_flag;
};
#endif //EXPERIMENT_H
@@ -1,5 +1,4 @@
#include "user_panel.h"
#include "redis.h"
#include <iostream>
#include <vector>
using namespace std;
@@ -8,9 +7,13 @@ User::User(const char*username){
}
int User::list_all_exp(Redis redis){
}
int Admin::insert_exp_from_input(Redis &redis){
}
int main(){
User user;
}
View
@@ -15,7 +15,7 @@ class User{
class Admin:User{
public:
int new_exp();
int insert_exp_from_input(Redis &redis);
int new_user();
};

0 comments on commit 827aa50

Please sign in to comment.