Guest User

Untitled

a guest
Jun 23rd, 2018
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.03 KB | None | 0 0
  1. echo "<div class='wider'>";
  2. $sql = mysql_query("SELECT * FROM pages WHERE section = 'start'");
  3. $res = mysql_fetch_array($sql);
  4. $res = utf8fix($res);
  5. if (isset($_POST['submit'])){
  6. $search = array('<strong>','</strong>','<em>','</em>','&Aring;','&Auml;','&Ouml;','&aring;','&auml;','&ouml;');
  7. $replace = array('<b>','</b>','<i>','</i>','Å','Ä','Ö','å','ä','ö');
  8. $post = str_replace($search,$replace,$_POST['value']);
  9. $headline = str_replace($search,$replace,$_POST['headline']);
  10. $plats = $_POST['plats'];
  11. $target_path = "../frontbild/";
  12. $target_path = $target_path . basename( $_FILES['bild']['name']);
  13. $fil = basename( $_FILES['bild']['name']);
  14. if (move_uploaded_file($_FILES['bild']['tmp_name'], $target_path)) {
  15. echo basename( $_FILES['bild']['name']). " laddades upp och texten sparades och publicerades.<br />";
  16. } else {
  17. echo "Ingen bild laddades upp, men texten sparades i databasen!<br />";
  18. }
  19.  
  20. mysql_query("UPDATE pages SET headline = '$headline', value = '$post', bild = '$fil', location = '$plats' WHERE section = 'start'") or die(mysql_error());
  21.  
  22. }
  23.  
  24. if (!isset($_POST["submit"])) {
  25. include(INC.'/tinymce.php');
  26. echo utf8fix("<div id='ruttitel-wide'><h4>Redigera Förstasidan</h4></div><div id='ruta-wide'>
  27. <form enctype='multipart/form-data' action='settings.php?setting=front' method='post'>
  28. <INPUT TYPE='TEXT' NAME='headline' VALUE='".$res['headline']."' SIZE=49>
  29. <TEXTAREA NAME='value' rows='25' style='margin-bottom: 5px;'>".$res['value']."</TEXTAREA>
  30. Bild: <input name='bild' type='file' SIZE=30 /><br /><br />
  31. <input type='submit' name='submit' value='Utför' style='float: right; margin-top: 5px;'>
  32. Bildplacering <input type='radio' name='plats' id='left' value='left' "); if( $res['location' ] == "left" ) { echo "checked='checked' "; } echo utf8fix ("/>Vänster
  33. <input type='radio' name='plats' id='right' value='right' "); if( $res['location'] == "right" ) { echo "checked='checked' "; } echo utf8fix (" />Höger<br />
  34. </form></div><br />");
  35. }
Add Comment
Please, Sign In to add comment