-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprofile.php
More file actions
147 lines (128 loc) · 3.9 KB
/
profile.php
File metadata and controls
147 lines (128 loc) · 3.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
<?php
if (!isset($_SESSION)) {
session_start();
}
require "../../config.php";
require "../../navbar.php";
ini_set('display_errors', 0);
error_reporting(E_ERROR | E_WARNING | E_PARSE);
$nr_pb = count(scandir("sol"))-2;
require "../../func.php";
?>
<!DOCTYPE HTML>
<html>
<head>
<link rel="stylesheet" href="<?=$root2?>/style.css">
<style>
span {
display:flex;
}
span div {
margin: 3px;
padding: 3px;
}
#pt1 {
width: 30vw;
}
input {
position: relative;
bottom: 7px;
}
@media only screen and (max-device-width: 800px) {
#pt1 {
width: 100%;
}
}
</style>
</head>
<body>
<!--Incepem afisarea-->
<span>
<div id="pt1">
<center>
<div id="box">
<div id="box_text">
<?php
require "../../identicon.php";
echo get_identicon(basename(realpath('.')));
?>
</div>
</div>
</center>
<div id="box" style="width:100%;">
<center>
<h2><?=basename(realpath('.'))?></h2>
<?php
# Afisam bio-ul profilului
if (basename(realpath('.')) == $_SESSION["nume"]) {
echo "<form method=\"post\">
<input type=\"text\" name=\"bio\" placeholder=\"".file_get_contents("bio.txt")."\"></input>
<input type=\"submit\" hidden />
</form>";
if (!empty($_POST["bio"])) {
@file_put_contents("bio.txt", $_POST["bio"]);
}
} else {
echo "<i>".file_get_contents("bio.txt")."</i>";
}
?>
</center>
</div>
<br />
<div id="box" style="width:100%;height:100%;">
<b>Solutii trimise: <?=$nr_pb?></b>
<hr />
<b>Data crearii contului: <?=date("F d, Y @H:i:s.",filemtime('.'))?></b>
<hr />
<b>Grad: <?=dp_rank($nr_pb)?></b>
<hr />
</div>
</div>
<div id="box" style="width:65vw;">
<b>Solutii</b>
<div id="box_text" style="height:85%";>
<?php
$sol = array_splice(scandir("sol"), 2);
$s_total = count($sol);
$g = 0;
# Sortam solutiile in functie de data lor de incarcare utilizand o func. lambda
usort($sol, function
($x,$y)
{
return filemtime("sol/$y")-filemtime("sol/$x");
});
# Incepem cu cele mai noi solutii
array_reverse($sol);
# Afisam solutiile
foreach($sol as $solutie) {
++$g;
# Locatia solutiei
$path_solutie = readlink("sol/$solutie");
# Titlul problemei
$titlu_problema = basename(dirname($path_solutie, 2));
# Solutia (client-path)
$fisr_solutie = "$root2/x/y/z/$path_solutie";
# Solutia (server-path)
$fis2_solutie = "$root/comp/$titlu_problema/sol/".basename($path_solutie);
#################################
# AFISAM DATA SI ORA REZOLVARII #
#################################
echo date("F d, Y @H:i:s", filemtime($fis2_solutie)).' ';
###########################
# AFISAM TITLUL PROBLEMEI #
###########################
echo "<b>Problema $titlu_problema: </b>";
############################
# AFISAM SOLUTIA PROBLEMEI #
############################
echo "<a href=\"$fisr_solutie\">".basename($path_solutie)."</a>";
if ($g < $s_total)
echo "<hr />";
}
?>
</div>
</div>
</div>
</span>
</body>
</html>