Witam!
Męczę się od jakiegoś czasu z formularzem dodawania oferty wraz z kilkoma zdjęciami. Szlag mnie trafia, bo nie mogę sobie poradzić z fotką.
Czy móglbym prosić o pomoc?
Jestem w stanie zapłacić za przeróbkę, ale jakąś ludzką kwotę :)
Bardzo proszę o pomoc. Ewentualny kontakt mailowy to kjwojtowicz (malpa) tlen.pl
Część po wypełnieniu formularza.
if (isset($_POST['submit_photo'])) {
require_once INCLUDES."photo_functions_include.php";
$error = "";
$submit_info['photo_title'] = stripinput($_POST['photo_title']);
$submit_info['photo_description'] = stripinput($_POST['photo_description']);
$submit_info['album_id'] = isNum($_POST['album_id']) ? $_POST['album_id'] : "0";
$miasto = stripinput($_POST['miasto']);
$nazwa_obiektu = stripinput($_POST['nazwa_obiektu']);
$ulica = stripinput($_POST['ulica']);
$nr_domu = stripinput($_POST['nr_domu']);
$kod_pocztowy = stripinput($_POST['kod_pocztowy']);
$cena_min = stripinput($_POST['cena_min']);
$cena_max = stripinput($_POST['cena_max']);
$telefon1 = stripinput($_POST['telefon1']);
$telefon2 = stripinput($_POST['telefon2']);
$www = stripinput($_POST['www']);
$email = stripinput($_POST['email']);
$body = stripinput($_POST['body']); //opis
$typ_obiektu = stripinput($_POST['typ_obiektu']);
$polozenie_obiektu = stripinput($_POST['polozenie_obiektu']);
$zdjecie1 = stripinput($_POST['zdjecie1']);
$zdjecie2 = stripinput($_POST['zdjecie2']);
$zdjecie3 = stripinput($_POST['zdjecie3']);
$zdjecie4 = stripinput($_POST['zdjecie4']);
$zdjecie5 = stripinput($_POST['zdjecie5']);
if (is_uploaded_file($_FILES['zdjecie1']['tmp_name1'])) {
$photo_types = array(".gif",".jpg",".jpeg",".png");
$photo_pic = $_FILES['zdjecie1'];
$photo_name = strtolower(substr($photo_pic['name'], 0, strrpos($photo_pic['name'], ".")));
$photo_ext = strtolower(strrchr($photo_pic['name'],"."));
$photo_dest = "images/oferty/".$userdata['user_name'];
if (!preg_match("/^[-0-9A-Z_\[\]]+$/i", $photo_name)) {
$error = 1;
} elseif ($photo_pic['size'] > $settings['photo_max_b']){
$error = 2;
} elseif (!in_array($photo_ext, $photo_types)) {
$error = 3;
} else {
$photo_file = image_exists($photo_dest, $photo_name.$photo_ext);
move_uploaded_file($photo_pic['tmp_name1'], $photo_dest.$photo_file);
chmod($photo_dest.$photo_file, 0644);
$imagefile = @getimagesize($photo_dest.$photo_file);
if (!verify_image($photo_dest.$photo_file)) {
$error = 3;
unlink($photo_dest.$photo_file);
} elseif ($imagefile[0] > $settings['photo_max_w'] || $imagefile[1] > $settings['photo_max_h']) {
$error = 4;
unlink($photo_dest.$photo_file);
} else {
$submit_info['photo_file'] = $photo_file;
}
}
opentable($locale['570']);
if (!$error) {
//tu powinno pojsc polecenie dodawania do mojej tabeli //
$result = dbquery("INSERT INTO ".$db_prefix."submissions (submit_type, submit_user, submit_datestamp, submit_criteria) VALUES ('p', '".$userdata['user_id']."', '".time()."', '".serialize($submit_info)."')");
echo "<center><br>Zdjęcie 1 zostało zapisane.";
} else {
echo "<center><br>\n".$locale['600']."<br><br>\n";
if ($error == 1) { echo $locale['601']; }
elseif ($error == 2) { echo sprintf($locale['602'], $settings['photo_max_b']); }
elseif ($error == 3) { echo $locale['603']; }
elseif ($error == 4) { echo sprintf($locale['604'], $settings['photo_max_w'], $settings['photo_max_h']); }
echo "<br><br>\n</center>\n";
}
closetable();
}
oraz formularz
<form name='submit_form' method='post' enctype='multipart/form-data' onSubmit='return validatePhoto(this);'>
<table align='center' cellpadding='0' cellspacing='0'>
<tr>
<td class='tbl'>Miasto:</td>
<td class='tbl'>
<select name='miasto' class='textbox' style='width:250px;'>
$listamiast</select>
</td>
</tr>
<tr>
<td valign='top' class='tbl'>Nazwa obiektu:</td>
<td class='tbl'>
<input type='text' name='nazwa_obiektu' maxlength='100' class='textbox' style='width:250px;'></td>
</tr>
<tr>
<td valign='top' class='tbl'>Ulica:</td>
<td class='tbl'>
<input type='text' name='ulica' maxlength='100' class='textbox' style='width:250px;'></td>
</tr>
<tr>
<td valign='top' class='tbl'>Nr domu:</td>
<td class='tbl'>
<input type='text' name='nr_domu' maxlength='10' class='textbox' style='width:40px;'></td>
</tr>
<tr>
<td valign='top' class='tbl'>Kod pocztowy:</td>
<td class='tbl'>
<input type='text' name='kod_pocztowy' maxlength='10' class='textbox' style='width:40px;'></td>
</tr>
<tr>
<td valign='top' class='tbl'>Cena min:</td>
<td class='tbl'>
<input type='text' name='cena_min' maxlength='10' class='textbox' style='width:40px;'></td>
</tr>
<tr>
<td valign='top' class='tbl'>Cena max:</td>
<td class='tbl'>
<input type='text' name='cena_max' maxlength='10' class='textbox' style='width:40px;'></td>
</tr>
<tr>
<td valign='top' class='tbl' width='140'>Telefon kontaktowy (1):</td>
<td class='tbl'>
<input type='text' name='telefon1' maxlength='100' class='textbox' style='width:250px;'></td>
</tr>
<tr>
<td valign='top' class='tbl'>Telefon kontaktowy (2):</td>
<td class='tbl'>
<input type='text' name='telefon2' maxlength='100' class='textbox' style='width:250px;'></td>
</tr>
<tr>
<td valign='top' class='tbl'>Strona www - http://</td>
<td class='tbl'>
<input type='text' name='www' value='www.' maxlength='100' class='textbox' style='width:250px;'></td>
</tr>
<tr>
<td valign='top' class='tbl'>Adres email:</td>
<td class='tbl'>
<input type='text' name='email' maxlength='100' class='textbox' style='width:250px;'></td>
</tr>
<tr>
<td valign='top' width='100' class='tbl'>Opis:</td>
<td width='80%' class='tbl'>
<textarea name='body' cols='90' rows='10' class='textbox'>$body</textarea></td>
<!--
<tr>\n<td class='tbl'></td>\n<td class='tbl'>
<input type='button' value='b' class='button' style='font-weight:bold;width:25px' onClick=\"addText('body', '<b>', '</b>');\">
<input type='button' value='i' class='button' style='font-style:italic;width:25px' onClick=\"addText('body', '<i>', '</i>');\">
<input type='button' value='u' class='button' style='text-decoration:underline;width:25px' onClick=\"addText('body', '<u>', '</u>');\">
<input type='button' value='link' class='button' style='width:35px' onClick=\"addText('body', '<a href=\'', '\' target=\'_blank\'>Link</a>');\">
<input type='button' value='img' class='button' style='width:35px' onClick=\"addText('body', '<img src=\'".str_replace("../","",IMAGES_N)."', '\' style=\'margin:5px\' align=\'left\'>');\">
<input type='button' value='center' class='button' style='width:45px' onClick=\"addText('body', '<center>', '</center>');\">
<input type='button' value='small' class='button' style='width:40px' onClick=\"addText('body', '<span class=\'small\'>', '</span>');\">
<input type='button' value='small2' class='button' style='width:45px' onClick=\"addText('body', '<span class=\'small2\'>', '</span>');\">
<input type='button' value='alt' class='button' style='width:25px' onClick=\"addText('body', '<span class=\'alt\'>', '</span>');\"><br>
<select name='setcolor' class='textbox' style='margin-top:5px' onChange=\"addText('body', '<span style=\'color:' + this.options[this.selectedIndex].value + '\'>', '</span>');this.selectedIndex=0;\">
<option value=''>-- wybierz kolor --</option>
<option value='maroon' style='color:maroon'>Maroon</option>
<option value='red' style='color:red'>Red</option>
<option value='orange' style='color:orange'>Orange</option>
<option value='brown' style='color:brown'>Brown</option>
<option value='yellow' style='color:yellow'>Yellow</option>
<option value='green' style='color:green'>Green</option>
<option value='lime' style='color:lime'>Lime</option>
<option value='olive' style='color:olive'>Olive</option>
<option value='cyan' style='color:cyan'>Cyan</option>
<option value='blue' style='color:blue'>Blue</option>
<option value='navy' style='color:navy'>Navy Blue</option>
<option value='purple' style='color:purple'>Purple</option>
<option value='violet' style='color:violet'>Violet</option>
<option value='black' style='color:black'>Black</option>
<option value='gray' style='color:gray'>Gray</option>
<option value='silver' style='color:silver'>Silver</option>
<option value='white' style='color:white'>White</option>
</select>
</td>
</tr>
-->
</tr>
<tr>
<td valign='top' class='tbl'>Typ obiektu:</td>
<td class='tbl'>
<select name='typ_obiektu' class='textbox' style='width:250px;'>
$listatypow</select>
</td>
</tr>
<tr>
<td valign='top' class='tbl'>Położenie obiektu:</td>
<td class='tbl'>
<select class='textbox' name='polozenie_obiektu' style='width:250px;'>
<option value='1'>w górach</option>
<option value='2'>nad morzem</option>
<option value='3'>w lesie</option>
</select>
</td>
</tr>
<TR>
<td valign='top' class='tbl' colspan='2'>
<span class='small2'>".sprintf($locale['624'], parsebytesize($settings['photo_max_b']), $settings['photo_max_w'], $settings['photo_max_h'])."</span></td>
</td>
</tr>
<tr>
<td valign='top' class='tbl'>Zdjęcie 1:</td>
<td class='tbl'>
<input type='file' name='zdjecie1' class='textbox' style='width:250px;'><br>
</td>
</tr>
<tr>
<td valign='top' class='tbl'>Zdjęcie 2:</td>
<td class='tbl'>
<input type='file' name='zdjecie2' class='textbox' style='width:250px;'><br>
</td>
</tr>
<tr>
<td valign='top' class='tbl'>Zdjęcie 3:</td>
<td class='tbl'>
<input type='file' name='zdjecie3' class='textbox' style='width:250px;'><br>
</td>
</tr>
<tr>
<td valign='top' class='tbl'>Zdjęcie 4:</td>
<td class='tbl'>
<input type='file' name='zdjecie4' class='textbox' style='width:250px;'><br>
</td>
</tr>
<tr>
<td valign='top' class='tbl'>Zdjęcie 5:</td>
<td class='tbl'>
<input type='file' name='zdjecie5' class='textbox' style='width:250px;'><br>
</td>
</tr>
<tr>
<td align='center' colspan='2' class='tbl'><br>
<input type='submit' name='submit_photo' value='".$locale['626']."' class='button'>
</td>
</tr>
</table>
</form>\n";
closetable();
Edytowane przez Kirgo dnia 21.11.2007 10:20:31
|