Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
52 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,10 @@ | |||
<html> | |||
<head> | |||
<title></title> | |||
</head> | |||
<body> | |||
<?php | |||
echo htmlspecialchars('<script>alert(1);</script>'); | |||
?> | |||
</body> | |||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,24 @@ | |||
<?php | |||
$conn = mysqli_connect("localhost", "root", 111111); | |||
mysqli_select_db($conn, "opentutorials"); | |||
$name = mysqli_real_escape_string($conn, $_GET['name']); | |||
$password = mysqli_real_escape_string($conn, $_GET['password']); | |||
$sql = "SELECT * FROM user WHERE name='".$name."' AND password='".$password."'"; | |||
echo $sql; | |||
$result = mysqli_query($conn, $sql); | |||
?> | |||
<!DOCTYPE html> | |||
<html> | |||
<head> | |||
<meta charset="utf-8"> | |||
</head> | |||
<body> | |||
<?php | |||
if($result->num_rows == "0"){ | |||
echo "뉘신지?"; | |||
} else { | |||
echo "안녕하세요. 주인님"; | |||
} | |||
?> | |||
</body> | |||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -1,17 +1,22 @@ | |||
<?php | <?php | ||
$conn = mysqli_connect("localhost", "root", 111111); | $conn = mysqli_connect("localhost", "root", 111111); | ||
mysqli_select_db($conn, "opentutorials"); | mysqli_select_db($conn, "opentutorials"); | ||
$sql = "SELECT * FROM user WHERE name='".$_POST['author']."'"; |
|
||
$title = mysqli_real_escape_string($conn, $_POST['title']); | |||
$author = mysqli_real_escape_string($conn, $_POST['author']); | |||
$description = mysqli_real_escape_string($conn, $_POST['description']); | |||
|
|||
$sql = "SELECT * FROM user WHERE name='".$author."'"; | |||
$result = mysqli_query($conn, $sql); | $result = mysqli_query($conn, $sql); | ||
if($result->num_rows == 0){ | if($result->num_rows == 0){ | ||
$sql = "INSERT INTO user (name, password) VALUES('".$_POST['author']."', '111111')"; | $sql = "INSERT INTO user (name, password) VALUES('".$author."', '111111')"; | ||
mysqli_query($conn, $sql); | mysqli_query($conn, $sql); | ||
$user_id = mysqli_insert_id($conn); | $user_id = mysqli_insert_id($conn); | ||
} else { | } else { | ||
$row = mysqli_fetch_assoc($result); | $row = mysqli_fetch_assoc($result); | ||
$user_id = $row['id']; | $user_id = $row['id']; | ||
} | } | ||
$sql = "INSERT INTO topic (title,description,author,created) VALUES('".$_POST['title']."', '".$_POST['description']."', '".$user_id."', now())"; | $sql = "INSERT INTO topic (title,description,author,created) VALUES('".$title."', '".$description."', '".$user_id."', now())"; | ||
$result = mysqli_query($conn, $sql); | $result = mysqli_query($conn, $sql); | ||
header('Location: http://localhost/index.php'); | header('Location: http://localhost/index.php'); | ||
?> | ?> |