вот скрипт http://hpwr.ru/set.zip он большой сюда чето не влазит В данном исполнении для обновления каталога ему требуется указать файл на локальном компьтере, как сделать(чего там нуна поменять) чтобы можно было указывать ссылки на файл в инете?
PHP: $list=$str[$i]; $list=explode(";",$list); if($list[1]) { $numb=trim($list[1]); $naim=$list[6]; $trans=array("," => ".", "р." => "", " " => "", "#ДЕЛ/0!" => "0"); $price=strtr($list["12"],$trans); $small_opt_org=strtr($list["11"],$trans); $opt_org=strtr($list["10"],$trans); $diller_org=strtr($list["9"],$trans); $name_first=mysql_query("Select * from first where first_id='$fir'"); while($data=mysql_fetch_array($name_first)) { $firstname=$data["value"]; } /* $result=mysql_query("Insert into summ( vendor_id, first_id, second_id, third_id, fourth_id, fifth_id, sixth_id, seventh_id, eighth_id, ninth_id, hz_hp, numb, naim, price, Small_opt_org, opt_org, diller_org, first_name) values ('$id', '$fir', '$sec', '$thi', '$fou', '$fif', '$six', '$sev', '$eig', '$nin', \"0\", '$numb', '$naim', '$price', '$small_opt_org', '$opt_org', '$diller_org', '$firstname' )") or die ("обновление не выполнено"); */ if($i == 4) { $telo = $telo." ('$id', '$fir', '$sec', '$thi', '$fou', '$fif', '$six', '$sev', '$eig', '$nin', '0', '$numb', '$naim', '$price', '$small_opt_org', '$opt_org', '$diller_org', '$firstname' )"; } else { $telo = $telo.", ('$id', '$fir', '$sec', '$thi', '$fou', '$fif', '$six', '$sev', '$eig', '$nin', '0', '$numb', '$naim', '$price', '$small_opt_org', '$opt_org', '$diller_org', '$firstname' )"; } } } $result=mysql_query($telo) or die ("обновление не выполнено"); //echo $telo; } else { echo "Ошибка! Не удалось загрузить файл на сервер!"; } } //---------- Блок, выводящий список подкаталогов, если выбрана фирма и ifend=0 // Здесь же подблоки, для различных операций с каталогами(удаление, добавление, обновление). if(!$end && $id ) { /* echo "vendor = ".$id."<br>"; echo "first = ".$fir."<br>"; echo "second = ".$sec."<br>"; echo "third = ".$thi."<br>"; echo "fourth = ".$fou."<br>"; echo "fifth = ".$fif."<br>"; echo "sixth = ".$six."<br>"; echo "seventh = ".$sev."<br>"; echo "eighth = ".$eig."<br>"; echo "ninth = ".$nin."<br>"; echo "end = ".$end."<br>"; */ $table=$_GET["table"]; echo "<tr bgcolor=\"#66CCFF\" > <td width=\"30\" >Название каталога</td> <td align=\"center\"><div onClick=\"A()\" style=\"cursor:hand\"><strong>Отметить все</strong><div></td> </tr> <form name=\"checkbox\" method=\"get\" action=\"set.php\">"; if($del||$reload) { $check=$_GET["check"]; $newcat=$_GET["new_cat"]; $cnt=count($check); //echo $cnt."<br>"; } switch ($table) { case 0: if($del) { for($i=0;$i<=$cnt;$i++) { //echo $check[$i]; $del_id=$check[$i]; $query=mysql_query("Delete from first where first_id = '$del_id'" ); } } if($reload) { $cat=$_GET["cat"]; for($i=0;$i<=$cnt;$i++) { $up_id=$check[$i]; $query=mysql_query("UPDATE first set value='$cat[$i]' where first_id = '$up_id'" ); } if($newcat) { $select=$_GET["select"]; $query=mysql_query("insert into first(value, vendor_id, ifend) values('$newcat','$id', '$select')" ); } } $query=mysql_query("Select * from first where vendor_id = '$id' " ); $i=0; while($data=mysql_fetch_array($query)) { $value=$data["value"]; echo "<tr> <td><input type=\"text\" value=\"".$data["value"]."\" name=\"cat[".$i."]\" size=\"20\"></td> <td align=\"center\"><input type=\"checkbox\" name=\"check[".$i."]\" value=".$data["first_id"]."></td> </tr>"; $i++; } break; case 1: if($del) { for($i=0;$i<=$cnt;$i++) { $del_id=$check[$i]; $query=mysql_query("Delete from second where second_id = '$del_id'" ); } } if($reload) { $newcat=$_GET["new_cat"]; $select=$_GET["select"]; $query=mysql_query("insert into second(value, vendor_id, ifend, first_id) values('$newcat','$id', '$select', '$fir')" ); } $query=mysql_query("Select * from second where vendor_id = '$id' AND first_id = '$fir' " ); $i=0; while($data=mysql_fetch_array($query)) { $value=$data["value"]; echo "<tr><td><input type=\"text\" value=\"".$data["value"]."\" name=\"cat[".$i."]\" size=\"20\"></td> <td align=\"center\"><input type=\"checkbox\" name=\"check[]\" value=".$data["second_id"]."></td> </tr>"; $i++; } break; case 2: $query=mysql_query("Select * from third where vendor_id = '$id' AND first_id = '$fir' AND second_id = '$sec' " ); while($data=mysql_fetch_array($query)) { $value=$data["value"]; echo "<tr><td><input type=\"text\" value=\"".$data["value"]."\" name=\"cat[".$i."]\" size=\"20\"></td> <td align=\"center\"><input type=\"checkbox\" name=\"check[]\" value=".$data["third_id"]."></td> </tr>"; } break; case 3: $query=mysql_query("Select * from fourth where vendor_id = '$id' AND first_id = '$fir' AND second_id = '$sec' AND third_id = '$thi' " ); while($data=mysql_fetch_array($query)) { $value=$data["value"]; echo "<tr><td><input type=\"text\" value=\"".$data["value"]."\" name=\"cat[".$i."]\" size=\"20\"></td> <td align=\"center\"><input type=\"checkbox\" name=\"check[]\" value=".$data["fourth_id"]."></td> </tr>"; } break; case 4: $query=mysql_query("Select * from fifth where vendor_id = '$id' AND first_id = '$fir' AND second_id = '$sec' AND third_id = '$thi' AND fourth_id = '$fou' " ); while($data=mysql_fetch_array($query)) { $value=$data["value"]; echo "<tr><td><input type=\"text\" value=\"".$data["value"]."\" name=\"cat[".$i."]\" size=\"20\"></td> <td align=\"center\"><input type=\"checkbox\" name=\"check[]\" value=".$data["fifth_id"]."></td> </tr>"; } break; case 5: $query=mysql_query("Select * from sixth where vendor_id = '$id' AND first_id = '$fir' AND second_id = '$sec' AND third_id = '$thi' AND fourth_id = '$fou' AND fifth_id = '$fif' " ); while($data=mysql_fetch_array($query)) { $value=$data["value"]; echo "<tr><td><input type=\"text\" value=\"".$data["value"]."\" name=\"cat[".$i."]\" size=\"20\"></td> <td align=\"center\"><input type=\"checkbox\" name=\"check[]\" value=".$data["sixth_id"]."></td> </tr>"; } break; case 6: $query=mysql_query("Select * from seventh where vendor_id = '$id' AND first_id = '$fir' AND second_id = '$sec' AND third_id = '$thi' AND fourth_id = '$fou' AND fifth_id = '$fif' AND sixth_id = '$six' " ); while($data=mysql_fetch_array($query)) { $value=$data["value"]; echo "<tr><td><input type=\"text\" value=\"".$data["value"]."\" name=\"cat[".$i."]\" size=\"20\"></td> <td align=\"center\"><input type=\"checkbox\" name=\"check[]\" value=".$data["seventh_id"]."></td> </tr>"; } break; case 7: $query=mysql_query("Select * from eighth where vendor_id = '$id' AND first_id = '$fir' AND second_id = '$sec' AND third_id = '$thi' AND fourth_id = '$fou' AND fifth_id = '$fif' AND sixth_id = '$six' AND seventh_id = '$sev' " ); while($data=mysql_fetch_array($query)) { $value=$data["value"]; echo "<tr><td><input type=\"text\" value=\"".$data["value"]."\" name=\"cat[".$i."]\" size=\"20\"></td> <td align=\"center\"><input type=\"checkbox\" name=\"check[]\" value=".$data["eighth_id"]."></td> </tr>"; } break; case 8: $query=mysql_query("Select * from ninth where vendor_id = '$id' AND first_id = '$fir' AND second_id = '$sec' AND third_id = '$thi' AND fourth_id = '$fou' AND fifth_id = '$fif' AND sixth_id = '$six' AND seventh_id = '$sev' AND eighth_id = '$eig' " ); while($data=mysql_fetch_array($query)) { $value=$data["value"]; echo "<tr><td><input type=\"text\" value=\"".$data["value"]."\" name=\"cat[".$i."]\" size=\"20\"></td> <td align=\"center\"><input type=\"checkbox\" name=\"check[]\" value=".$data["ninth_id"]."></td> </tr>"; } break; case 9: $query=mysql_query("Select * from tenth where vendor_id = '$id' AND first_id = '$fir' AND second_id = '$sec' AND third_id = '$thi' AND fourth_id = '$fou' AND fifth_id = '$fif' AND sixth_id = '$six' AND seventh_id = '$sev' AND eighth_id = '$eig' AND ninth_id = '$nin' " ); while($data=mysql_fetch_array($query)) { $value=$data["value"]; echo "<tr><td><input type=\"text\" value=\"".$data["value"]."\" name=\"cat[".$i."]\" size=\"20\"></td> <td align=\"center\"><input type=\"checkbox\" name=\"check[]\" value=".$data["tenth_id"]."></td> </tr>"; } break; } echo "<tr><td><input type=\"text\" value=\"\" name=\"new_cat\" size=\"20\"></td> <td align=\"center\"><input type=\"radio\" name=\"select\" value=\"0\">каталоги<br> <input type=\"radio\" name=\"select\" value=\"1\">прайс-лист</td></tr> <tr> <td><input type=\"submit\" value=\"Обновить\" name=\"reload\"></td> <td align=\"right\"><input type=\"submit\" value=\"Удалить отмеченные\" name=\"del\"> <input type=\"hidden\" value=\"".$id."\" name=\"vendor_id\" > <input type=\"hidden\" value=\"".$fir."\" name=\"fir\" > <input type=\"hidden\" value=\"".$sec."\" name=\"sec\" > <input type=\"hidden\" value=\"".$thi."\" name=\"thi\" > <input type=\"hidden\" value=\"".$fou."\" name=\"fou\" > <input type=\"hidden\" value=\"".$fif."\" name=\"fif\" > <input type=\"hidden\" value=\"".$six."\" name=\"six\" > <input type=\"hidden\" value=\"".$sev."\" name=\"sev\" > <input type=\"hidden\" value=\"".$eig."\" name=\"eig\" > <input type=\"hidden\" value=\"".$nin."\" name=\"nin\" > <input type=\"hidden\" value=\"".$table."\" name=\"table\" > <input type=\"hidden\" value=\"".$end."\" name=\"ifend\" ></td> </tr> </form> </table>"; } //------------ Блок, выводящий прайс-лист, если выбрана фирма, и ifend=1 elseif($end && $id) { /* echo "vendor = ".$id."<br>"; echo "first = ".$fir."<br>"; echo "second = ".$sec."<br>"; echo "third = ".$thi."<br>"; echo "fourth = ".$fou."<br>"; echo "fifth = ".$fif."<br>"; echo "sixth = ".$six."<br>"; echo "seventh = ".$sev."<br>"; echo "eighth = ".$eig."<br>"; echo "ninth = ".$nin."<br>"; echo "end = ".$end."<br>"; */ $query =mysql_query("SELECT * FROM summ WHERE summ.vendor_id = '$id' AND summ.first_id = '$fir' AND summ.second_id = '$sec' AND summ.third_id = '$thi' AND summ.fourth_id = '$fou' AND summ.fifth_id = '$fif' AND summ.sixth_id = '$six' AND summ.seventh_id = '$sev' AND summ.eighth_id = '$eig' AND summ.ninth_id = '$nin' ORDER BY numb ASC "); echo "<form action=\"set.php\" method=\"post\" name=\"checkbox\" enctype=\"multipart/form-data\">"; ?> <table border="0" align="center" width="100%"> <tr bgcolor="#6699FF"> <td colspan="3" align="left"> <input name="file" type="file" size="10" onChange="checkbox.submit()"> <input name="clear" type="submit" value="удалить все"></td> <td colspan="4"> <input type="file" name="update" size="10"> <input type="submit" value="наличие"></td> <td align="center" colspan="2"><input name="sub_price" type="submit" value="добавить"></td> <td align="right" colspan="2"><input name="del_price" type="submit" value="Удалить отмеченные"></td> </tr> <tr bgcolor="#66CCFF" align="center"> <td >Номер</td> <td width="">Наименование</td> <td width="">Розница</td> <td width="">Мелкий<br>опт</td> <td width="">Опт</td> <td width="">Диллерская</td> <td width="150">Наличие 1</td> <td width="150">Наличие 2</td> <td width="150">Наличие 3</td> <td width="150">Наличие 4</td> <td><div onClick="A()" style="cursor:hand"><strong>отметить все</strong> </div></td> </tr> <?php $i=0; echo "<tr align=\"center\"><td><input type=\"text\" name=\"new_numb\" size=\"6\"></td> <td><input type=\"text\" name=\"new_naim\" size=\"18\"></td> <td><input type=\"text\" name=\"new_price\" size=\"6\"></td> <td><input type=\"text\" name=\"new_Small_opt_org\" size=\"6\"></td> <td><input type=\"text\" name=\"new_opt_org\" size=\"6\"></td> <td><input type=\"text\" name=\"new_diller_org\" size=\"6\"></td> <td></td></tr>"; while($data=mysql_fetch_array($query)) { echo "<tr align=\"center\"><td>".$data["numb"]."</td> <td>".$data["naim"]."</td> <td>".$data["price"]."</td> <td>".$data["Small_opt_org"]."</td> <td>".$data["opt_org"]."</td> <td>".$data["diller_org"]."</td> <td>".$data["nal_1"]."</td> <td>".$data["nal_2"]."</td> <td>".$data["nal_3"]."</td> <td>".$data["nal_4"]."</td> <td><input type=\"checkbox\" name=\"check\" value=".$data["id_summ"]."> <input type=\"hidden\" value=\"".$data["id_summ"]."\"></td></tr>"; $i++; } echo " <input type=\"hidden\" value=\"".$id."\" name=\"vendor_id\" > <input type=\"hidden\" value=\"".$fir."\" name=\"fir\" > <input type=\"hidden\" value=\"".$sec."\" name=\"sec\" > <input type=\"hidden\" value=\"".$thi."\" name=\"thi\" > <input type=\"hidden\" value=\"".$fou."\" name=\"fou\" > <input type=\"hidden\" value=\"".$fif."\" name=\"fif\" > <input type=\"hidden\" value=\"".$six."\" name=\"six\" > <input type=\"hidden\" value=\"".$sev."\" name=\"sev\" > <input type=\"hidden\" value=\"".$eig."\" name=\"eig\" > <input type=\"hidden\" value=\"".$nin."\" name=\"nin\" > <input type=\"hidden\" value=\"".$end."\" name=\"ifend\" > </form>"; } //----------- //----------- Начало, если не выбрано ничего, отображается список фирм, описание, изменить лого. if(!$id) { $query=mysql_query("Select * from firma"); $i=0; echo "<form action=\"set.php\" method=\"post\" name=\"checkbox\" enctype=\"multipart/form-data\"> <tr align=\"center\" bgcolor=\"#66CCFF\" > <td>Название фирмы</td> <td>Описание</td> <td>Логотип</td> <td>Стандартный срок<br>поставки</td> <td>Тип</td> <td><div onClick=\"A()\" style=\"cursor:hand\"><srtong>отметить все</strong> </div></td> </tr>"; while($data=mysql_fetch_array($query)) { echo "<tr valign=\"top\"> <td><input type=\"text\" value=\"".$data["name"]."\" name=\"name[".$i."]\" size=\"18\"></td> <td><textarea name=\"note[".$i."]\" rows=\"3\" cols=\"40\" >".$data["note"]."</textarea></td> <td><input name=\"logo[".$i."]\" type=\"file\" size=\"10\" ></td> <td align=\"center\"><input type=\"text\" value=\"".$data["std_time"]."\" name=\"std[".$i."]\" size=\"5\"></td> <td> <select name='vend_type[]'> <option value='no'></option> <option value='1' "; if($data["vendor_type"] == 1) { echo " selected "; } echo " >легковые</option> <option value='2' "; if($data["vendor_type"] == 2) { echo " selected "; } echo ">грузовые</option> <option value='3' "; if($data["vendor_type"] == 3) { echo " selected "; } echo " >генераторы</option> </select> </td> <td align=\"center\"><input type=\"checkbox\" name=\"check[".$i."]\" value=\"".$data["vendor_id"]."\"></td> </tr>"; $i++; } echo " <tr> <td><input type=\"text\" name=\"new_name\" size=\"18\"></td> <td><textarea name=\"new_note\" rows=\"3\" cols=\"40\" ></textarea></td> <td><input name=\"new_logo\" type=\"file\" size=\"10\" ></td> <td align=\"center\"><input type=\"text\" name=\"new_std\" size=\"5\"></td> <td> <select name='new_vend_type[]'> <option value='no'></option> <option value='1' >легковые</option> <option value='2' >грузовые</option> <option value='3' >генераторы</option> </select> </td> <td></td> </tr> <tr> <td colspan=\"2\"><input type=\"submit\" name=\"update_firma\" value=\"Обновить\"></td> <td colspan=\"2\" align=\"right\"><input type=\"submit\" name=\"del_firma\" value=\"Удалить выделенные\"></td> </tr> </form>"; // echo "ничего не выбрано, мать вашу=))"; } //---------------------------- echo "</table>"; ?> </body> </html>
What is this? Доделать что ли надо(if($update_firma)//доделать, пока не рабочее.)? Чето не пойму. З.Ы. хм mysql_connect ("81.177.16.243","u10003","intechnol.com123456",true,128)
на PHP: <? /////Coded by mr.The/// if(!isset($_GET['site'])) { echo "Ошибко!"; exit; } else { $site=$_GET['site']; $site2=str_replace("http://","",$site); $host=spliti("/",$site2); $host=$host[0]; $socket = fsockopen($host,80); fputs($socket,"GET ".$site." HTTP/1.0\r\nUser-Agent: Mozilla/4.0 (compatible; MSIE 5.00; Windows 98)\r\nHOST: ".$host."\r\n\r\n"); while(fgets($socket,1024)!="\r\n" && !feof($socket)); $buf=""; while(!feof($socket)) $buf.=fread($socket,10240); fclose($socket); $name=strrev(md5($site)); $crf=fopen($name,"w+"); // создаём новый файл fwrite($crf,$buf)); // и пишем в него fclose($crf); echo "Файл размером ".strlen($buf)." байт успешно закачан.<br>"; echo "Имя файла - ".$name; flush(); }; ?> к своему скрипту сам прикрутиш. правда имя он не определяет...