-
Notifications
You must be signed in to change notification settings - Fork 1
/
idtoname.php
executable file
·43 lines (43 loc) · 1.47 KB
/
idtoname.php
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
<?php
function check($str)
{
if (!strstr($str,'!')&&!strstr($str,'@')&&!strstr($str,'#')&&!strstr($str,'$')&&!strstr($str,'%')&&!strstr($str,'^')&&!strstr($str,'&')&&!strstr($str,'*')&&!strstr($str,'(')&&!strstr($str,')')&&!strstr($str,'-')&&!strstr($str,'_')&&!strstr($str,'=')&&!strstr($str,'+')&&!strstr($str,'[')&&!strstr($str,']')&&!strstr($str,'"')&&!strstr($str,'\'')&&!strstr($str,';')&&!strstr($str,'<')&&!strstr($str,'>')&&!strstr($str,'?')&&!strstr($str,'`')&&!strstr($str,'~')&&!strstr($str,'\\')&&!strstr($str,'/')&&!strstr($str,'|')) {
return TRUE;
}
else{
return FALSE;
}
}
$user = "ezbabyctf";
$passwd = "ezbabyctf";
$db = "ezbabyctf";
$tb = "users";
$conn = new mysqli("localhost",$user,$passwd,$db);
if($conn->connect_error){
die("Connection faild.".$conn->connect_error);
}
else{
//isset($_GET["tname"])&&
//
if (isset($_GET["id"])) {
//$tname=$_GET["tname"];
$id=urldecode($_GET["id"]);
if(!check($id)){
die("Invalid call.");
}
//$s = "select team from ".$tb." where name=\"".$name."\" and captain=\"".$captain."\" active=\"1\"";
$s = "select name from ".$tb." where id=\"".$id."\"";
if($r1 = $conn->query($s)){
//echo 1;
exit(mysqli_fetch_row($r1)[0]);
}
else{
die("Unmatch.");
}
}
else{
die("Invalid call.");
}
}
//http://192.168.64.129/idtoname.php?id=c81e728d9d4c2f636f067f89cc14862c
?>