[+] EDITØR MODE [+]
htdocs
>
public
>
www
>
admin_prog_edit2.php
Edit File: admin_prog_edit2.php
<?php define('DB_SERVER', 'hostingmysql323.register.it'); define('DB_USERNAME', 'gregorio'); define('DB_PASSWORD', 'fontana2015'); define('DB_DATABASE', 'fontanaarchitetti'); $db = mysqli_connect(DB_SERVER,DB_USERNAME,DB_PASSWORD,DB_DATABASE); session_start(); $user_check=$_SESSION['login_user']; $ses_sql=mysqli_query($db,"select username from members where username='$user_check' "); $row=mysqli_fetch_array($ses_sql,MYSQLI_ASSOC); $login_session=$row['username']; if(!isset($login_session)) { header("Location: admin.php"); } ?> <?php $host="hostingmysql323.register.it"; // Host name $username="gregorio"; // Mysql username $password="fontana2015"; // Mysql password $db_name="fontanaarchitetti"; // Database name // Connect to server and select database. mysql_connect("$host", "$username", "$password")or die("cannot connect"); mysql_select_db("$db_name")or die("cannot select DB"); $catz = $_GET["cat"]; if($_GET["cat"] === "1") { $categoriaT = "prog"; }elseif($_GET["cat"] === "2") { $categoriaT = "conc"; } $result = mysql_query('SELECT * FROM '.$categoriaT.' ORDER BY data DESC'); ?> <html> <head> <!-- ------------------------------------------------META------------------------------------------------ --> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv="cache-control" content="max-age=0"> <meta http-equiv="cache-control" content="no-cache"> <meta http-equiv="expires" content="0"> <meta http-equiv="expires" content="Tue, 01 Jan 1980 1:00:00 GMT"> <meta http-equiv="pragma" content="no-cache"> <meta charset="UTF-8"> <title>Fontana Architetti - Amministrazione</title> <link rel="stylesheet" href="css/style.css" media="screen" type="text/css" /> </head> <body> <a href="admin_index.php"> <div id="header"> <h1> Fontana Architetti - Amministrazione</h1> </div> </a> <div id="sottoheader"> <div class="back"><a href="admin_index.php?p=1"><img src="img/admin/back.jpg"></a></div> <div class="tit"> <h1> Modifica progetti</h1> </div> </div> <div id="blocco"> <form name="form1" method="post" action=""> <?php $currentDate = false; echo'<table> <tr> <th>Nome</th> <th>Elimina</th> <th>Modifica</th> </tr>'; while($rows=mysql_fetch_array($result)){ echo' <tr> <td>'.$rows["data"].' - '.$rows["titolo_IT"].'</td> <td><input name="checkbox[]" type="checkbox" id="checkbox[]" value="'. $rows['id'].'"></td>'; echo'<td><input name="radio[]" type="radio" id="radio[]" value="'. $rows['id'].'"></td>'; echo'</tr>'; } echo'<tr> <td></td> <td><input name="delete" type="submit" id="delete" value="Elimina progetto"></td> <td><input name="edit" type="submit" id="edit" value="Modifica progetto"></td> </form>'; // Check if delete button active, start this; if (isset($_POST['delete'])) { $checkbox = $_POST['checkbox']; $count = count($checkbox); $tabar = array('', 'prog', 'conc'); for($i = 0; $i < $count; $i++) { $id = (int) $checkbox[$i]; // Parse your value to integer if ($id > 0) { // and check if it's bigger then 0 mysql_query("DELETE FROM ".$tabar[$catz]." WHERE id = $id"); } } // if successful redirect to if($result){ echo "<meta http-equiv=\"refresh\" content=\"0;URL=admin_prog_edit.php?cat=$catz\">"; } } if (isset($_POST['edit'])) { $radio = $_POST['radio']; $count = count($radio); for($i = 0; $i < $count; $i++) { $id = (int) $radio[$i]; // Parse your value to integer if ($id > 0) { // and check if it's bigger then 0 //echo 'id='.$id.' count='.$count; // header("location: admin_staffedit.php"); echo "<meta http-equiv=\"refresh\" content=\"0;URL=admin_progedit.php?id=$id&cat=$catz\">"; } } } ?> </div> <?php mysql_close(); ?> </body> </html>
Method:
fopen()
file_put_contents()
stream_context_create()
Simpan
Rename:
Rename