Ohw ik heb de file al gevonden het was een gewoon script.
vaag dat de database zich in de ftp bevind?
maar ik moet het heel raar invullen,
hier een voorbeeld
#Scooter#Yamaha Aerox#11000#uit 2007 niks mis mee motorisch goed#scooter.JPG
Scooter=Catagorie
Yamaha Aerox=Merk
11000=Prijs
uit 2007 niks mis mee motorisch goed=Info
scooter.JPG=plaatje
dus ik kan niets toevoegen dan moet ik het al handmatig doen.
hier mijn admin script.
op regel 24 word dus mijn database weergeven die in de ftp zit voorderest moet ik alles handmatig toevoegen
<?
$readcookie = $_COOKIE['user'];
if($readcookie!="mijnww"){echo "error 467. verkeerde login! <a href='login.php'>Inloggen</a>";exit;}
//echo $_COOKIE['user'];
?>
<style>
td{font-size:11px;font-family:verdana}
input,select{font-size:11px;font-family:verdana}
</style>
<table border='0' width=700 align='center' cellpadding='2' cellspacing='2' bgcolor='#EEEEEE'><tr><td>
<B>Webshop Admin</B> <BR><BR>
| <A HREF="admin.php?action=showall"><B>Alle producten weergeven</B></A>
| <A HREF="admin.php?action=addnew"><B>Nieuw product toevoegen</B></A>
| <A HREF="login.php?action=logout"><B>Uitloggen</B></A>
</td></tr></table>
<BR><BR>
<?
if($_GET['action']=="showall"){
$tim = file("prodtable.db");
$sizecat = count($tim);
////////////////////////////////////
for($i=0;$i<$sizecat;$i++){
$deti = explode("#",$tim[$i]);
echo "<table border='0' width=700 align='center' cellpadding='2' cellspacing='2'><tr><td bgcolor='#EEEEEE' width=200><B>Naam:</B> $deti[2] / <B>Prijs:</B> $deti[3]$<BR> <a href='prodshow.php?id=$i' target='_new'><b> Meer informatie... </b></a> </td><td bgcolor='#EEEEEE'> <A HREF='admin.php?id=$i&action=editprod'>Aanpassen</A> </td><td bgcolor='#EEEEEE'> <A HREF='admin.php?id=$i&action=delete'>Verwijderen</A> </td></tr></table>";
echo "<META HTTP-EQUIV=Refresh CONTENT='10; URL=admin.php?action=showall'>";
}
}
?>
<?
if($_GET['action']=="delete"){
$fp = fopen("prodtable2.db","w");
$line = '';
fwrite($fp,$line);
$tim = file("prodtable.db");
$sizecat = count($tim);
$id = $_GET['id'];
for($i=0;$i<$sizecat;$i++){
$tim[$id]="";
$fp = fopen("prodtable2.db","a");
$line = $tim[$i];
fwrite($fp,$line);
}
$file = 'prodtable2.db';
$newfile = 'prodtable.db';
if (!copy($file, $newfile)) {
echo "Kopieren van deze file is mislukt: $file...\n";
}
}
?>
<?
if($_GET['action']=="addnew"){
echo "<CENTER><form action='admin.php' method='post' enctype='multipart/form-data'>";
echo "<select name=cat><option value='cars' selected> - Selecteen een categorie -";
$file=file("cat.php");
$sz = sizeof($file);
for($i=0;$i<$sz;$i++){
echo "<option value='$file[$i]'> $file[$i]";
}
echo "</select><BR>";
echo "<input type=text name=prodname size=30 value='name'><BR>";
echo "<input type=text name=price size=30 value='price'><BR>";
echo "<input type=text name=descr size=30 value='about...'><BR>";
echo "<input type=file name=logo size=20><BR>";
echo "<input type=submit name=submit value='add product'><BR>";
echo "<input type=hidden name=action value=insert><BR>";
echo "</form></CENTER>";
}
?>
<?
if($_POST['action']=="insert"){
if ($_FILES['logo']['name'] != "") {
$imageInfo = getimagesize($_FILES['logo']['tmp_name']);
$width = $imageInfo[0];
$height = $imageInfo[1];
if($height > 310 || $width > 410){echo "<script> alert('Afbeelding is te groot! Probeer deze te verkleinen!') </script>";exit;}
$newimg1 = date("YmdHis").".jpg";
if(stristr($_SERVER['OS'],"win")){$path = "prodimg/";}
elseif(stristr($_SERVER['OS'],"linux")){$path = str_replace("admin.php","",$_SERVER['SCRIPT_FILENAME']) . "prodimg/";}
else {$path = "prodimg/";}
move_uploaded_file ( $_FILES['logo']['tmp_name'], $path . $newimg1 );}
else{$newimg1="pc.gif"; }
$fp = fopen("prodtable.db","a");
$line = "#". $_POST['cat'] ."#". $_POST['prodname'] ."#". $_POST['price'] ."#". $_POST['descr'] ."#". $newimg1 . "\r\n";
fwrite($fp,$line);
}
?>
<?
if($_GET['action']=="editprod"){
echo "<CENTER><form action='admin.php' method='get'>";
$filex=file("prodtable.db");
$szx = sizeof($file);
$id = $_GET['id'];
$detim = explode("#",$filex[$id]);
echo "<input type=text name=cat size=30 readonly value='$detim[1]'><BR>";
echo "<input type=text name=prodname size=30 value='$detim[2]'><BR>";
echo "<input type=text name=price size=30 value='$detim[3]'><BR>";
echo "<input type=text name=descr size=30 value='$detim[4]'><BR>";
echo "<input type=text name=logo size=20 readonly value='$detim[5]'><BR>";
echo "<input type=submit name=submit value='change product info now'><BR>";
echo "<input type=hidden name=action value=editprodnow><BR>";
echo "<input type=hidden name=id value=$id><BR>";
echo "</form></CENTER>";
}
?>
<?
if($_GET['action']=="editprodnow"){
$cat = $_GET['cat'];
$prodname = $_GET['prodname'];
$price = $_GET['price'];
$descr = $_GET['descr'];
$logo = $_GET['logo'];
$file = 'prodtable.db';
$newfile = 'prodtable2.db';
copy($file, $newfile);
$fp = fopen("prodtable.db","w");
$line = '';
fwrite($fp,$line);
$tim = file("prodtable2.db");
$sizecat = count($tim);
$id = $_GET['id'];
for($i=0;$i<$sizecat;$i++){
if($i==$id){$tim[$i]="#$cat#$prodname#$price#$descr#$logo \r\n";}
$fp2 = fopen("prodtable.db","a");
$line2 = $tim[$i];
fwrite($fp2,$line2);
}
}
?>
Toon Meer