-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcreatepage_2.php
52 lines (51 loc) · 1.09 KB
/
createpage_2.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
44
45
46
47
48
49
50
51
52
<?php
session_start();
if(!($_SESSION['logged_in'])){
session_unset();
session_destroy();
header('Location: login.php');
}
if(!empty($_REQUEST['name'])){
$name=$_REQUEST['name'];
}
if(!empty($_REQUEST['url'])){
$url=$_REQUEST['url'];
}
if(!empty($_REQUEST['title'])){
$title=$_REQUEST['title'];
}
if(!empty($_REQUEST['descrip'])){
$desp=$_REQUEST['descrip'];
}
else
$desp="NULL";
if(!empty($_REQUEST['keyword'])){
$keyword=$_REQUEST['keyword'];
}
if(!empty($_REQUEST['content'])){
$content=$_REQUEST['content'];
}
$htmlcontent="<?php include'navbar.php' ?>
<html>
<head>
<title>$title</title>
<meta name='Description' content=$desp>
<meta name='Keywords' content=$keyword>
</head>
<body>
<h1>$name</h1>
<p> $content </p>
</body>
</html>";
try{
$fp=fopen($url,"w");
fwrite($fp,$htmlcontent);
fclose($fp);
echo "FILE CREATED";
echo "<a href='adminhome.php'>Back Home</a>";
}
//catch exception
catch(Exception $e) {
echo 'Message: ' .$e->getMessage();
}
?>