-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.php
More file actions
executable file
·70 lines (69 loc) · 1.77 KB
/
test.php
File metadata and controls
executable file
·70 lines (69 loc) · 1.77 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
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>php02</title>
</head>
<body>
<p>
<?php
include 'lib.php';
// Set up a cookie
// if (isset($_COOKIE['user'])){
// echo "hello, ".$_COOKIE['user']."<br />";
// setcookie("user", $_COOKIE['user'] + 1);
// // $_COOKIE['user'] += 1;
// echo $_COOKIE['user']."<br />";
// }
// else {
// setcookie("user", "0", time()+100);
// echo "Set cookie"."<br />";
// }
// setcookie("user", "", time() - 10);
//
// Pass and receive parameters.
// file.php?id=xxx&a=xxx
// echo "get parameter ".$_GET["id"]." ".$_GET["a"];
// echo "<br />";
// if ($_GET["a"] == ""){
// echo "get null a";
// }
// else {
// echo "get a ".$_GET["a"];
// }
//
// Mysql
$mysqli = connect2mysql();
/* INSERT INTO .. SELECT */
// mysqli_query($conn, "select title, abstract from contests;");
// printf("%s\n", mysqli_info($conn));
$res = $mysqli->query("select contest_id, abstract, title from contests;");
for($row_no = 0; $row_no < $res->num_rows; $row_no++){
$res->data_seek($row_no);
$row = $res->fetch_assoc();
echo $row["contest_id"]." ".$row["title"]." ".$row["abstract"]."<br />";
}
$res = $mysqli->query("select contest_id, abstract, title from contests where contest_id = 1000;");
if(!$res){
echo "None res <br />";
}
else {
echo "Res is not none <br />";
}
$nickname = $mysqli->query("select nickname from users where user_id = 1");
$nickname = $nickname->fetch_assoc();
echo $nickname["nickname"]." <br />";
$mysqli->close();
// mysqli_close($con);
echo "string"+"t";
if(3 % 2 == 1){
echo "string";
}
// define("contest_", value)
echo CONTEST_RESULT_TABLE_PREFIX;
echo "end of line<br />";
// echo CONTEST_RESULT_TABLE_PREFIX;
var_dump(defined('CONTEST_RESULT_TABLE_PREFIX'));
?></p>
</body>
</html>