Jeg har haft et par tråde her på forumet den seneste tid og er virkelig taknemmelig for den hjælp jeg har fået! Tusinde tak til jer der står bag det her forum!
Nå, men jeg har følgene fejl:
http://www.againstyourrecords.dk/sarasg/site/admin/temp1/files/Germans3Er det noget replace string eller hvordan?
På forhånd tak.
Mvh Bjarke
Her er scriptet:
<?php
if($_POST['formSubmit'] == "Submit")
{
$varTitel = $_POST['formTitel'];
$varHead = $_POST['formHead'];
$varText = $_POST['formText'];
$varText = str_replace("\n", "<br/>", $varText);
while (file_exists($file)) {
echo("Titlen du prøver at oprette findes allerede");
}
$f = fopen( "files/" . $varTitel, "w");
fwrite($f, "
<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'>
<html xmlns='http://www.w3.org/1999/xhtml'>
<head>
<meta http-equiv='Content-Type' content='text/html; charset=UTF-8' />
<title>" . $varHead . "</title>
<link rel='stylesheet' type='text/css' href='../../../style.css'/>
</head><html><body>
<div id='wrapper'>
<div id='upper'>
<ul>
<li><a href='index.php'><strong class='logo'>SARA GLAHN</strong></a></li>
</ul>
</div>
<div id='menu'>
<ul class='menu'>
<li>
<a href='works_menu.php' class='show_black'><strong><img src='../../../img/arrow.png' width='12' height='12' />WORKS</strong></a>
</li>
<li>
<?php
// Variabel der definere folder
$path = '../files/';
// opendir funktion (folder) = $dir_handle variabel. Hvis folderen ikke findes skriv 'Unab...
$dir_handle = @opendir($path) or die('Unable to open $path');
// while løkke der tjekker filer fra $dir_handel
while ($file = readdir($dir_handle))
{
if($file!='.' && $file!='..')
echo '
<li>
<a href='$file' class='dynamic_menu'><p>$file</p></a>
</li>
';
}
// lukker
closedir($dir_handle);
?>
</li>
<li>
<a href='../../../cv.php'><strong>CV</strong></a>
</li>
<li>
<a href='../../../contact.php'><strong>CONTACT</strong></a>
</li>
</ul>
</div>
<div id='content'>
<p><h3>" . $varHead . "</h3></p>
<p>" . $varText . "</p></body></html>
</div>
");
fclose($f);
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<link rel="stylesheet" type="text/css" href="style.css"/>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Works 1</title>
</head>
<body>
<h1 style="margin-left:50px; margin-top:30px; margin-bottom:10px;">Sara Glahn</h1>
<p style="padding-left:50px; padding-top:3px; padding-bottom:3px; border-bottom:solid 1px black; border-top:solid 1px black; background-color:#ccc; font-size:11px;">Skabeloner : <a href="myform1.php" class="admin_top_menu">Kun tekst</a> - <a href="myform2.php" class="admin_top_menu">Foto & tekst</a> - <a href="myform3.php" class="admin_top_menu">Video & tekst</a> <a href="../../index.php" style="margin-left:20px;" class="admin_top_menu">Forside</a> <a href="#" class="admin_top_menu" style="margin-left:20px;"> Login</a> / <a href="#" class="admin_top_menu"> Logout</a></p>
<div id="admin_form">
<form action="myform1.php" method="post">
<p>
Titel/menu:<br>
<input type="text" name="formTitel" maxlength="50" class="tekst_head" value="<?=$varHead;?>" />
</p>
<p>
Overskrift/menu punkt:<br>
<input type="text" name="formHead" maxlength="50" class="tekst_head" value="<?=$varHead;?>" />
</p>
<p>
Tekst:<br>
<textarea name="formText" class="tekst" value="<?=$varText;?>" /></textarea>
</p>
<input type="submit" name="formSubmit" value="Submit" />
<input type="button" value="Clear" onClick="history.go(0)"><br><br>
</form>
</div>
<div id="dynamic_menu">
<?php
// slet fil
if(isset($_GET['file'])){
unlink($_GET['file']);
}
// Variabel der definere folder
$path = "files/";
// opendir funktion (folder) = $dir_handle variabel. Hvis folderen ikke findes skriv "Unab...
$dir_handle = @opendir($path) or die("Unable to open $path");
echo "<span style='font-family: Verdana, Helvetica, sans-serif; font-size:10px; padding-bottom:10px;'>
Her er dine sider:</span><br/><br/>
<ul>";
// while løkke der tjekker filer fra $dir_handel
while ($file = readdir($dir_handle))
{
if($file!="." && $file!="..")
echo "
<li>
<a href='files/$file' class='dynamic_menu' target='_blank'><p>$file</a><a href='myform1.php?file=files/$file' style='font-size:12px; margin-left:15px;'>(slet)</a></p>
</li>
";
}
// lukker
closedir($dir_handle);
?>
</ul>
</div>
</body>
</html>