Erstmal danke für eure Antworten.
Ich versuche nochmal etwas konkreter zu erklären, wozu ich dieses Script brauche. Ich versuche grad eine Admin Erweiterung für die Gallerie 4Images zu schreiben. Die Datenbank Verbindung wird automatisch über das Script hergestellt und deßhalb, hab ich hier nur die Kernzeilen, bei denen ich nicht weiterkomme, gepostet. Ich habe leider auf meinem Php Webspace nur 50 Mb Speicherplatz und deßhalb möchte ich die Bilder auf meinem anderen Webspace (ohne Php und MySQL) auslagern. Ich will die Bilder nun schnell und einfach verlinken können, dass hab ich mir so gedacht:
PHP-Code:
<?php
////////////// Startseite ///////////////
if ($action == ""){
echo "<form method=\"post\" action=\"addimages.php?action=add\">
<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\" width=\"100%\">
<tr>
<td class=\"tableborder\">
<table cellpadding=\"3\" cellspacing=\"1\" border=\"0\" width=\"100%\">
<tr class=\"tableheader\">
<td>[b]<span class=\"tableheader\">Add images</span>[/b]</td>
</tr>
<tr class=\"tablerow\">
<td>Name</td>
<td colspan=\"3\"><input type=\"text\" size=\"70\" name=\"name\"></td>
</tr>
<tr class=\"tablerow\">
<td>Images URL </td>
<td><input type=\"text\" size=\"70\" name=\"url\"></td>
<td>Counter: <input type=\"text\" size=\"5\" name=\"from\"> to <input type=\"text\" size=\"5\" name=\"to\"</td>
<td>
<input type=\"radio\" name=\"extension\" value=\".jpg\" checked=\"checked\"> .jpg
<input type=\"radio\" name=\"extension\" value=\".gif\"> .gif
</td>
</tr>
<tr class=\"tablerow\">
<td>Thumbnails URL</td>
<td><input type=\"text\" size=\"70\" name=\"tn_url\"></td>
<td>Counter: <input type=\"text\" size=\"5\" name=\"tn_from\"> to <input type=\"text\" size=\"5\" name=\"tn_to\"</td>
<td>
<input type=\"radio\" name=\"tn_extension\" value=\".jpg\" checked=\"checked\"> .jpg
<input type=\"radio\" name=\"tn_extension\" value=\".gif\"> .gif
</td>
<tr class=\"tablerow\">
<td>Category ID</td>
<td colspan=\"3\"><input type=\"text\" size=\"70\" name=\"category\"></td>
</tr>
<tr class=\"tablerow\">
<td>User ID</td>
<td colspan=\"3\"><input type=\"text\" size=\"70\" name=\"user\"></td>
</tr>
</tr>
<tr class=\"tablefooter\">
<td colspan=\"2\" align=\"center\"> <input type=\"submit\" value=\" Submit \" class=\"button\"> <input type=\"reset\" value=\" Reset \" class=\"button\"><input type=\"hidden\" name=\"ok\" value=\"ok\"></td>
</tr>
</table>
</tr>
</td>
</table>
</form>";
}
////////////// Add ///////////////
if ($action == "add"){
if(isset($ok)){
$name = $_POST['name'];
$url = $_POST['url'];
$from = $_POST['from'];
$to = $_POST['to'];
$extension = $_POST['extension'];
$tn_from = $_POST['tn_from'];
$tn_to = $_POST['tn_to'];
$tn_extension = $_POST['tn_extension'];
$category = $_POST['category'];
$user = $_POST['user'];
while ($from <= $to) {
$image_media_file = $url.$from.$extension;
$image_thumb_file = $tn_url.$from.$tn_extension;
$sql = "INSERT INTO ".IMAGES_TABLE." SET image_name='$name', image_media_file='$image_media_file', image_thumb_file='$image_thumb_file', cat_id='$category', user_id='$user'";
}
if(@mysql_query($sql)) {
echo "Images added
";
echo "<a href=\"addimages.php\">Back</a>";
}
else {
echo "Error";
}
}else{
echo "Error";
}
}
?>
Das Problem es funktioniert nur zum Teil, wenn ich in der Eingabemaske nun z.B von 1 bis 15 eingebe, dann wird nur das 15te Bild hinzugefügt.