[+] EDITØR MODE [+]
htdocs
>
web
>
gallery_editor.php
Edit File: gallery_editor.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 include_once 'common.php'; $host="hostingmysql323.register.it"; // Host name $username="gregorio"; // Mysql username $password="fontana2015"; // Mysql password $db_name="fontanaarchitetti"; // Database name $tbl_name="gallery"; // Table name // Connect to server and select databse. mysql_connect("$host", "$username", "$password")or die("cannot connect"); mysql_select_db("$db_name")or die("cannot select DB"); $subf = $_GET['subf']; $id_gal = $_GET['id_gal']; $sql='SELECT * FROM gallery WHERE cat = "'.$subf.'" AND id_gal = "'.$id_gal.'" ORDER BY posiz ASC'; $result=mysql_query($sql); $count=mysql_num_rows($result); $numimg = ($count+1); ?> <!DOCTYPE HTML> <html> <head> <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 http-equiv="Content-Type" content="text/html;charset=ISO-8859-1"> <title>Fontana Architetti - Amministrazione</title> <!-- The main CSS file --> <link href="css/gallery_style.css" rel="stylesheet" /> <link href="/css/style.css" rel="stylesheet" /> </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"><img src="img/admin/back.jpg"></a></div> <div class="tit"> <h1>Editor gallery</h1> </div> </div> <div id="blocco"> <table> <form name="img_form" action="/PHP_script/gallery_editor_up.php" method="post"> <?php $i = 0; if ( $count > 0 ){ while($row=mysql_fetch_array($result)){ $imgpos = $row['posiz']; $imgtip = $row['tipo']; echo ' <tr> <td rowspan="3">'; if ($imgtip == "3"){ echo '<iframe width="150px" src="https://www.youtube.com/embed/'.$row['path'].'" frameborder="0"></iframe>'; } else { echo '<img src="/upload/'.$_GET['subf'].'/'.$_GET['id_gal'].'/'.$row['path'].'" width="150px">'; }; echo ' </td> <td> <input type="hidden" name="id['.$i.']" value="'.$row['id'].'"> <p><b>'.$row['path'].'</b></p> </td> </tr> <tr> <td> <label for="tipo">Tipologia immagine: </label>'; if ($imgtip == "1"){ echo '<input type="radio" name="tipo['.$i.']" value="1" checked>Disegno <input type="radio" name="tipo['.$i.']" value="2">Fotografia <input type="radio" name="tipo['.$i.']" value="4">Testo'; } elseif ($imgtip == "2") { echo '<input type="radio" name="tipo['.$i.']" value="1">Disegno <input type="radio" name="tipo['.$i.']" value="2" checked>Fotografia <input type="radio" name="tipo['.$i.']" value="4">Testo'; } elseif ($imgtip == "3") { echo '<input type="hidden" name="tipo['.$i.']" value="3">Video youtube'; } elseif ($imgtip == "4") { echo '<input type="radio" name="tipo['.$i.']" value="1">Disegno <input type="radio" name="tipo['.$i.']" value="2" >Fotografia <input type="radio" name="tipo['.$i.']" value="4" checked>Testo'; } ; echo' </td> </tr> <tr> <td> <label for="posiz">Ordine: </label> <select name="posiz['.$i.']" id="'.$row['id'].'">'; for($k = 1; $k < $numimg; $k++) { if ($k == $imgpos){ echo '<option value="'.$k.'" selected>'.$k.'</option>'; } else { echo '<option value="'.$k.'">'.$k.'</option>'; }; } echo '</select> </td> </tr>'; $i++; } echo' </table> <input name="submit" type="submit" id="submit" value="Aggiorna"> </form>'; } else { echo '<p class="centro">Nessuna immagine presente in questa galleria</p>'; }; ?> </div> </body> </html> <?php mysql_close(); ?>
Method:
fopen()
file_put_contents()
stream_context_create()
Simpan
Rename:
Rename