| Autor | Zpráva | ||
|---|---|---|---|
| johnl Profil |
#1 · Zasláno: 16. 7. 2009, 12:23:36 · Upravil/a: johnl
Dobrý den, nevíte kde mám chybu v tomto kódu?
<?php
session_start();
?>
<?php
if($_SESSION['login']!=""){
echo'
<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" >
<title>Administrace</title>
<link href="css/admin.css" rel="stylesheet" type="text/css" media="screen" >
<script type="text/javascript" src="../jscripts/tiny_mce/tiny_mce.js"></script>
<script type="text/javascript">
// O2k7 skin (silver)
tinyMCE.init({
// General options
mode : "exact",
elements : "elm4",
theme : "advanced",
skin : "o2k7",
skin_variant : "black",
plugins : "safari,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,inlinepopups",
// Theme options
theme_advanced_buttons1 : "save,newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,styleselect,formatselect,fontselect,fontsizeselect",
theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,|,insertdate,inserttime,preview,|,forecolor,backcolor",
theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,media,advhr,|,print,|,ltr,rtl,|,fullscreen",
theme_advanced_buttons4 : "insertlayer,moveforward,movebackward,absolute,|,styleprops,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template,pagebreak",
theme_advanced_toolbar_location : "top",
theme_advanced_toolbar_align : "left",
theme_advanced_statusbar_location : "bottom",
theme_advanced_resizing : true,
// Example content CSS (should be your site CSS)
content_css : "css/content.css",
// Drop lists for link/image/media/template dialogs
template_external_list_url : "lists/template_list.js",
external_link_list_url : "lists/link_list.js",
external_image_list_url : "lists/image_list.js",
media_external_list_url : "lists/media_list.js",
// Replace values for the template plugin
template_replace_values : {
username : "Some User",
staffid : "991234"
}
});
</script>
</head>
<body>
<div id="telo">
<div id="hlavicka">
<a href="admin.php" class="logo"></a>
<div id="menu">
<ul>
<li><a href="admin.php">Index</a></li>
<li><a href="st.php">Upravení stránky</a></li>
<li><a href="registrace.php">Přidání uživatele</a></li>
<li><a href="tem.php">Nastavení</a></li>
</ul>
<p style="float:right;"><a href="logout.php">Odhlásit</a></p>
</div>
<div id="obsah">
<?php
if($_GET[edit] && file_exists($_GET[edit]))
{
$file = $_GET[edit];
$soubor = fopen($file, "a+");
if($_POST[akce] == "Editovat" && $_GET[edit])
{
$_POST[msg] = stripslashes($_POST[msg]);
$soubor = fopen($file, "w");
fwrite($soubor, $_POST[msg]);
fclose($soubor);
$zpr = "<p>EDITOVÁNO!</p>";
}
$handle = fopen($file, "r");
$contents = fread($handle, filesize($file));
$contents = stripslashes($contents);
fclose($handle);
<form method="post">
<textarea id="elm4" name="msg" rows="15" cols="80" style="width: 80%" wrap="off">'.htmlspecialchars($contents).'</textarea><br>
<input type="submit" name="akce" value="Editovat">
<input type="reset" value="Obnovit">
</form>
';
}
?>
</div>
<div id="paticka">
<p>Copyright © 2009 <b><a href="http://john-design.tk">John</a></b> verze: 0.7.1 - Všechna práva vyhrazena</p>
</div>
</div>
</body>
</html>
';}
else {
echo'<p><center><h1>Nepovolený přístup</h1></center></p><br>';}
?>
Pro editaci by měl být dotyčný přihlášení když se nepřihlásí vypíše mu to: <p><center><h1>Nepovolený přístup</h1></center></p><br> Chybou je že se mi vypíše jak obsah pro přihlášené tak obsah pro nepřihlášené. Edit: Objevil jsem druhou chybu ;-) Nevím kde mám chybu, asi někde v echo, protože se mi vypíše jen:
</div>
<div id="paticka">
<p>Copyright © 2009 <b><a href="http://john-design.tk">John</a></b> verze: 0.7.1 - Všechna práva vyhrazena</p>
</div>
</div>
</body>
</html>
';}
else {
echo'<p><center><h1>Nepovolený přístup</h1></center></p><br>';}
?> |
||
| Mastodont Profil |
#2 · Zasláno: 16. 7. 2009, 12:54:25
if($_GET[edit] && file_exists($_GET[edit])) Doplň si všude v kódu uvozovky a zkus to znovu. if($_GET["edit"] && file_exists($_GET["edit"])) |
||
| johnl Profil |
#3 · Zasláno: 16. 7. 2009, 13:35:15
Doplnil jsem uvozovky, a oddělil php skript od textarea a jde to ;-)
|
||
|
Časová prodleva: 17 let
|
|||
0