-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathhome.php
executable file
·134 lines (103 loc) · 3.28 KB
/
home.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
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
<?php
session_start();
require("auth.php");
include("config/conf.inc");
?>
<!Doctype html>
<html>
<head>
<link rel="stylesheet" href="css/bootstrap.css" type="text/css" />
</head>
<body>
<div class="container">
<div class="row">
<a href="logout.php" class="pull-right">Logout!</a>
<div class="col-lg-5">
<form class="form-horizontal" method="POST" action="controller/InsertNews.php" enctype="multipart/form-data">
<fieldset>
<!-- Form Name -->
<legend>Publish News</legend>
<!-- Text input-->
<div class="form-group">
<label class="col-md-4 control-label" for="textinput">Title</label>
<div class="col-md-6">
<input id="textinput" name="title" type="text" placeholder="placeholder" class="form-control input-md">
</div>
</div>
<!-- Text input-->
<div class="form-group">
<label class="col-md-4 control-label" for="textinput">Author</label>
<div class="col-md-6">
<input id="textinput" name="author" type="text" placeholder="placeholder" class="form-control input-md">
</div>
</div>
<!-- Text input-->
<div class="form-group">
<label class="col-md-4 control-label" for="textinput">Tags</label>
<div class="col-md-6">
<input id="textinput" name="tags" type="text" placeholder="placeholder" class="form-control input-md">
</div>
</div>
<div class="form-group">
<label class="col-md-4 control-label" for="filebutton">Ulopad Photo</label>
<div class="col-md-4">
<input id="filebutton" name="photo" class="input-file" type="file">
</div>
</div>
<!-- Select Basic -->
<div class="form-group">
<label class="col-md-4 control-label" for="selectbasic">Select Category</label>
<div class="col-md-6">
<select id="selectbasic" name="cat" class="form-control">
<option value="Science">Science</option>
<option value="Technology">Technology</option>
<option value="Sports">Sports</option>
<option value="Politics">Politics</option>
</select>
</div>
</div>
<!-- Textarea -->
<div class="form-group">
<label class="col-md-4 control-label" for="textarea">Body</label>
<div class="col-md-6">
<textarea class="form-control" id="textarea" name="body">Details....</textarea>
</div>
</div>
<!-- Button -->
<div class="form-group">
<label class="col-md-4 control-label" for="singlebutton">Publish News</label>
<div class="col-md-4">
<button id="singlebutton" name="subbtn" class="btn btn-primary">Upload News</button>
</div>
</div>
</fieldset>
</form>
</div>
<div class="col-lg-7">
<h3>Published News So far.</h3>
<?php
$sql=mysql_query("SELECT * FROM news");
if($sql){
$i=1;
echo "<table class='table table-bordered'>";
echo "<tr><th>S/N</th><th>News Title</th><th colspan=2>Action</th></tr>";
while($row=mysql_fetch_array($sql)){
echo "<tr>";
echo "<td>" . $i . "</td><td>".$row['title']."</td><td><a href='update.php?id=$row[id]'>Update News</a></td>";
?>
<td><a href='removeNews.php?id=<?php echo $row[id]; ?>' onclick="return confirm('Do you really want to remove this news?')">Remove News</a></td>
</tr>
<?php
$i++;
}
echo "</table>";
}
else{
echo "<p class='alert alert-info'> You have no Database!</p>";
}
?>
</div>
</div>
</div>
</body>
</html>