SHOW:
|
|
- or go back to the newest paste.
| 1 | <?php | |
| 2 | session_start(); | |
| 3 | include 'database.php'; | |
| 4 | ||
| 5 | - | if(!empty($_POST)){
|
| 5 | + | //if(!empty($_POST)){
|
| 6 | - | |
| 6 | + | if(isset($_POST['username'])){
|
| 7 | $username = $_POST['username']; | |
| 8 | $password = $_POST['password']; | |
| 9 | ||
| 10 | $sql = "select * from user where username='".$username."' and password='".$password."'"; | |
| 11 | #echo $sql."<br />"; | |
| 12 | $query = mysql_query($sql) or die (mysql_error()); | |
| 13 | ||
| 14 | // pengecekan query valid atau tidak | |
| 15 | if($query){
| |
| 16 | $row = mysql_num_rows($query); | |
| 17 | ||
| 18 | // jika $row > 0 atau username dan password ditemukan | |
| 19 | if($row > 0){
| |
| 20 | $_SESSION['isLoggedIn']=1; | |
| 21 | $_SESSION['username']=$username; | |
| 22 | header('Location: memberarea.php');
| |
| 23 | }else{
| |
| 24 | echo "username atau password salah"; | |
| 25 | } | |
| 26 | } | |
| 27 | } | |
| 28 | ?> | |
| 29 | ||
| 30 | ||
| 31 | <html> | |
| 32 | ||
| 33 | ||
| 34 | <head> | |
| 35 | ||
| 36 | <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous"> | |
| 37 | ||
| 38 | <!-- Optional theme --> | |
| 39 | <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap-theme.min.css" integrity="sha384-fLW2N01lMqjakBkx3l/M9EahuwpSfeNvV63J5ezn3uZzapT0u7EYsXMjQV+0En5r" crossorigin="anonymous"> | |
| 40 | ||
| 41 | <!-- Latest compiled and minified JavaScript --> | |
| 42 | <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js" integrity="sha384-0mSbJDEHialfmuBBQP6A4Qrprq5OVfW37PRR3j5ELqxss1yVqOtnepnHVP9aJ7xS" crossorigin="anonymous"></script> | |
| 43 | </head> | |
| 44 | ||
| 45 | <body> | |
| 46 | ||
| 47 | ||
| 48 | <nav class="navbar navbar-default"> | |
| 49 | <div class="container-fluid"> | |
| 50 | <!-- Brand and toggle get grouped for better mobile display --> | |
| 51 | <div class="navbar-header"> | |
| 52 | <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false"> | |
| 53 | <span class="sr-only">Toggle navigation</span> | |
| 54 | <span class="icon-bar"></span> | |
| 55 | <span class="icon-bar"></span> | |
| 56 | <span class="icon-bar"></span> | |
| 57 | </button> | |
| 58 | <a class="navbar-brand" href="#">Home</a> | |
| 59 | </div> | |
| 60 | ||
| 61 | <!-- Collect the nav links, forms, and other content for toggling --> | |
| 62 | <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1"> | |
| 63 | <ul class="nav navbar-nav"> | |
| 64 | ||
| 65 | <li><a href="#">About</a></li> | |
| 66 | <li class="dropdown"> | |
| 67 | <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Fiture <span class="caret"></span></a> | |
| 68 | <ul class="dropdown-menu"> | |
| 69 | <li><a href="#">Action</a></li> | |
| 70 | <li><a href="#">Another action</a></li> | |
| 71 | <li><a href="#">Something else here</a></li> | |
| 72 | <li role="separator" class="divider"></li> | |
| 73 | <li><a href="#">Separated link</a></li> | |
| 74 | <li role="separator" class="divider"></li> | |
| 75 | <li><a href="#">One more separated link</a></li> | |
| 76 | </ul> | |
| 77 | </li> | |
| 78 | </ul> | |
| 79 | <form class="navbar-form navbar-left" role="search"> | |
| 80 | <div class="form-group"> | |
| 81 | <input type="text" class="form-control" placeholder="Search"> | |
| 82 | </div> | |
| 83 | <button type="submit" class="btn btn-default">Submit</button> | |
| 84 | </form> | |
| 85 | <ul class="nav navbar-nav navbar-right"> | |
| 86 | <li><a href="#">Register</a></li> | |
| 87 | <li class="dropdown"> | |
| 88 | <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Account <span class="caret"></span></a> | |
| 89 | <ul class="dropdown-menu"> | |
| 90 | <li><a href="#">Action</a></li> | |
| 91 | <li><a href="#">Another action</a></li> | |
| 92 | <li><a href="#">Something else here</a></li> | |
| 93 | <li role="separator" class="divider"></li> | |
| 94 | <li><a href="#">Separated link</a></li> | |
| 95 | </ul> | |
| 96 | </li> | |
| 97 | </ul> | |
| 98 | </div><!-- /.navbar-collapse --> | |
| 99 | </div><!-- /.container-fluid --> | |
| 100 | </nav> | |
| 101 | ||
| 102 | ||
| 103 | ||
| 104 | <!--BAGIAN NAV ATAS--> | |
| 105 | ||
| 106 | ||
| 107 | <div class="container"> | |
| 108 | <div class="row"> | |
| 109 | ||
| 110 | <div class="col-md-8"> <!--KIRI--> | |
| 111 | <div class="panel panel-default"> | |
| 112 | <div class="panel-heading">Post Wlahar</div> | |
| 113 | <div class="panel-body"> | |
| 114 | <?php | |
| 115 | - | $post = $_GET["post"]; |
| 115 | + | //$post = isset($_GET["post"]; |
| 116 | - | if (!$post) {
|
| 116 | + | //if (!$post) {
|
| 117 | if(isset($_GET['post'])){
| |
| 118 | $ambil_data = mysql_query("select * from berita order by id_berita desc limit 0,5");
| |
| 119 | while($hasil_data = mysql_fetch_array($ambil_data)){
| |
| 120 | ?> | |
| 121 | <div class="row-fluid"> | |
| 122 | <div class="span4"> | |
| 123 | <img data-src="holder.js/300x200" alt="300x200" src="<?=$hasil_data['gambar'];?>" style="width: 300px; height: 200px;"> | |
| 124 | </div> | |
| 125 | <div class="span8"> | |
| 126 | <h2><?=$hasil_data['judul'];?></h2> | |
| 127 | <p style="text-align:justify;"><?=substr($hasil_data['isi'],0,500);?></p> | |
| 128 | <p> | |
| 129 | <a href="index.php?post=<?=$hasil_data['id_berita'];?>" class="btn btn-primary">Baca Selengkapnya</a> | |
| 130 | <a href="#" class="btn btn-inverse">Diposkan pada <?=$hasil_data['tanggal'];?></a> | |
| 131 | </p> | |
| 132 | </div> | |
| 133 | </div> | |
| 134 | <hr> | |
| 135 | <?php | |
| 136 | } } | |
| 137 | else | |
| 138 | {
| |
| 139 | ||
| 140 | $ambil_data = mysql_query("select * from berita where id_berita='$post'");
| |
| 141 | $hasil_data = mysql_fetch_array($ambil_data); | |
| 142 | ?> | |
| 143 | <div class="paragraphs"> | |
| 144 | <div class="row"> | |
| 145 | <div class="span12 well"> | |
| 146 | <img class="img-polaroid" src="<?=$hasil_data['gambar'];?>" style="width:250px; height: 200px; float:left; margin-right:10px;"/> | |
| 147 | <div class="content-heading"><h3><?=$hasil_data['judul'];?></h3></div> | |
| 148 | <p><a href="#" class="btn btn-inverse">Diposkan pada <?=$hasil_data['tanggal'];?></a> </p> | |
| 149 | <p style="text-align:justify;"><?=$hasil_data['isi'];?></p> | |
| 150 | <div style="clear:both;"></div> | |
| 151 | </div> | |
| 152 | </div> | |
| 153 | </div> | |
| 154 | ||
| 155 | ||
| 156 | <?php | |
| 157 | $ambil_recent = mysql_query("select id_berita,judul,tanggal from berita order by rand() limit 20");
| |
| 158 | ?> | |
| 159 | <div class="well sidebar-nav"> | |
| 160 | <ul class="nav nav-list"> | |
| 161 | ||
| 162 | ||
| 163 | <li class="nav-header">Baca Juga</li> | |
| 164 | <ul type="square"> | |
| 165 | <?php | |
| 166 | while($hasil_recent= mysql_fetch_array($ambil_recent)){
| |
| 167 | echo "<li><a href='index.php?link=lihatDetailBerita.php&id=$hasil_recent[id_berita]'>".$hasil_recent['judul']."</a></li>"; | |
| 168 | } | |
| 169 | ?> | |
| 170 | </ul> | |
| 171 | </ul> | |
| 172 | </div> | |
| 173 | ||
| 174 | <?php | |
| 175 | } | |
| 176 | ?> | |
| 177 | </div> | |
| 178 | </div> | |
| 179 | ||
| 180 | ||
| 181 | ||
| 182 | ||
| 183 | </div> | |
| 184 | <div class="col-md-4"> <!--KANAN--> | |
| 185 | ||
| 186 | <div class="panel panel-primary"> | |
| 187 | <div class="panel-heading">Member Area</div> | |
| 188 | <div class="panel-body"> | |
| 189 | ||
| 190 | ||
| 191 | ||
| 192 | <!--LOGIN--> | |
| 193 | ||
| 194 | <form action="" method="post"> | |
| 195 | <div class="form-group"> | |
| 196 | <label for="exampleInputEmail1">Username</label> | |
| 197 | <input type="text" name="username" class="form-control" id="exampleInputEmail1" placeholder="Email"> | |
| 198 | </div> | |
| 199 | <div class="form-group"> | |
| 200 | <label for="exampleInputPassword1">Password</label> | |
| 201 | <input type="password" name="password" class="form-control" id="exampleInputPassword1" placeholder="Password"> | |
| 202 | </div> | |
| 203 | ||
| 204 | ||
| 205 | <button type="submit" class="btn btn-default">LOGIN</button> | |
| 206 | </form> | |
| 207 | ||
| 208 | <!--LOGIN--> | |
| 209 | </div> | |
| 210 | </div> | |
| 211 | ||
| 212 | ||
| 213 | ||
| 214 | ||
| 215 | </div> | |
| 216 | </div> | |
| 217 | </div> | |
| 218 | </div> | |
| 219 | ||
| 220 | <!--KONTEN--> | |
| 221 | ||
| 222 | ||
| 223 | ||
| 224 | <hr> | |
| 225 | <footer class="footer"> | |
| 226 | <div class="container"> | |
| 227 | ||
| 228 | <center> <p class="text-muted"> Wlahar - 2016 </p> </center> | |
| 229 | </div> | |
| 230 | </footer> | |
| 231 | ||
| 232 | </body> |