function createcsv($number, $fp) { if ($number == null) { createfirst($fp); fwrite($fp, createurl($fp)); fclose($fp); $str = mb_convert_encoding("测试成功", "GBK", "UTF-8"); echo $str; } if (is_numeric("{$number}")) { createfirst($fp); for ($i = $number / 2; $i < $number; $i++) { fwrite($fp, createurl($fp)); } fclose($fp); echo mb_convert_encoding("生成成功", "GBK", "UTF-8"); } }
// make foo the current db $db_selected = mysql_select_db('moveon', $link); if (!$db_selected) { die('Can\'t use foo : ' . mysql_error()); } $pageN = $_GET['pg']; $newPage = $pageN + 1; $epg = $_GET['epg']; //echo $csql = "SELECT city.slug AS CITY, county.slug as COUNTY FROM `city` ,`county` WHERE county.id = city.county_id and `city.id` = '$pageN'"; $csql = "SELECT city.county_id AS county_id ,city.id as id,city.city_name as cityname,city.postal_code as postalcode , county.slug as ctname FROM `city` ,`county` WHERE county.id = city.county_id and city.id='{$pageN}'"; $cresult = mysql_query($csql); $crow = mysql_fetch_array($cresult); // echo $crow['cityname']; if ($crow['cityname']) { // print_r($crow); $slug = createurl($crow['cityname']); $county = $crow['ctname']; $cityid = $crow['id']; echo $url = "https://www.townscountiespostcodes.co.uk/postcodes-in-england/" . $county . "/" . $slug . "/"; echo '<div id="dcontent">'; echo $content = file_get_contents($url); echo '</div>'; // printf("ID: %s Name: %s", $row[0], $row[1]); ?> <div id="result"> </div> <script type="text/javascript"> $(document).ready(function()
if (!$db_selected) { die('Can\'t use foo : ' . mysql_error()); } $datastring = explode('//', $_POST['title']); //print_r($datastring); $county_id = $_POST['county']; $title = mysql_real_escape_string($datastring[2]); if ($title != '') { $csql = "SELECT ID FROM `city` WHERE county_id ={$county_id} and `city_name` = '{$title}' "; $cresult = mysql_query($csql); $crow = mysql_fetch_array($cresult); if ($crow['ID']) { $city_id = $crow['ID']; echo "already exust <br />"; } else { $slug = createurl($title); echo $catesql = "INSERT INTO `city` (county_id,city_name )\r\n VALUES\r\n ('{$county_id}','{$title}' )"; $cresult2 = mysql_query($catesql); $city_id = mysql_insert_id(); echo "new created " . $city_id . "<br />"; } } function createurl($url) { $url = rtrim($url, '-'); $url = str_replace("(", "-", trim($url)); $url = str_replace(")", "", trim($url)); $url = str_replace(",", "", trim($url)); $url = str_replace(".", "", trim($url)); $url = str_replace(" ", "-", trim($url)); $url = str_replace("'", "", trim($url));
$_SESSION['yocto'] = $provided_id; header('Location: index.php'); } } else { if (!empty($provided_url) && empty($provided_id)) { $idcount_file = fopen("idcount.txt", "r") or die("Unable to open file!"); $countid = fgets($idcount_file); $dirname = $countid . rand(66, 6666); function needit() { return $dirname; } if (!mkdir("{$dirname}")) { echo 'Failed this time!!!'; } else { createurl($dirname, $provided_url); $_SESSION['yocto'] = $dirname; header('Location: index.php'); } fclose($idcount_file); $countid++; $idcount_file_update = fopen("idcount.txt", "w") or die("Unable to open file!"); fwrite($idcount_file_update, $countid); fclose($idcount_file_update); } else { echo 'Sorry Dear, Your URL is already smaller than yocto :p'; } } } ?> <form action="index.php" method="GET">
// make foo the current db $db_selected = mysql_select_db('moveon', $link); if (!$db_selected) { die('Can\'t use foo : ' . mysql_error()); } $pageN = $_GET['pg']; $newPage = $pageN + 1; $samplepagesQ = "SELECT * FROM `sampleservices` WHERE `id` = " . $pageN; $samplepages = mysql_query($samplepagesQ); $samplepagesR = mysql_fetch_array($samplepages); if ($samplepagesR['county_name']) { $Location = $samplepagesR['county_name']; $title = str_replace("{LOCATION}", $Location, $samplepagesR['title']); $title = str_replace("_", " ", $title); $service_slug = createurl(str_replace("{LOCATION}", '', $samplepagesR['service_name'])); $county_slug = createurl($Location); $meta_title = str_replace("{LOCATION}", $Location, $samplepagesR['meta_title']); $meta_keywords = str_replace("{LOCATION}", $Location, $samplepagesR['meta_keywords']); $meta_description = str_replace("{LOCATION}", $Location, $samplepagesR['meta_description']); $short_description = str_replace("{LOCATION}", $Location, $samplepagesR['short_description']); $description = str_replace("{LOCATION}", $Location, $samplepagesR['description']); $status = $samplepagesR['status']; $county = $Location; $service_name = $samplepagesR['service_name']; $banner_text = str_replace("{LOCATION}", $Location, $samplepagesR['banner_text']); $banner_sub_text = str_replace("{LOCATION}", $Location, $samplepagesR['banner_sub_text']); $title = str_replace("'", "’", $title); $meta_title = str_replace("'", "’", $meta_title); $meta_keywords = str_replace("'", "’", $meta_keywords); $meta_description = str_replace("'", "’", $meta_description); $short_description = str_replace("'", "’", $short_description);
$result = mysql_query($csql); //$crow = mysql_fetch_array($cresult); //print_r($crow); //die; $i = 0; while ($row = mysql_fetch_assoc($result)) { $i++; echo '<br />' . $i . '<br />'; $Location = $row['CITY']; $city = $row['CITY']; $county = $row['COUNTY']; //$Location = $samplepagesR['city_name']; $title = str_replace("{LOCATION}", $Location, $samplepagesR['title']); $service_slug = createurl(str_replace("{LOCATION}", '', $samplepagesR['service_name'])); $county_slug = createurl($county); $city_slug = createurl($city); $meta_title = str_replace("{LOCATION}", $Location, $samplepagesR['meta_title']); $meta_keywords = str_replace("{LOCATION}", $Location, $samplepagesR['meta_keywords']); $meta_description = str_replace("{LOCATION}", $Location, $samplepagesR['meta_description']); $short_description = str_replace("{LOCATION}", $Location, $samplepagesR['short_description']); $description = str_replace("{LOCATION}", $Location, $samplepagesR['description']); $service_name = $samplepagesR['service_name']; $banner_text = str_replace("{LOCATION}", $Location, $samplepagesR['banner_text']); $banner_sub_text = str_replace("{LOCATION}", $Location, $samplepagesR['banner_sub_text']); $catagory = $samplepagesR['catagory']; $banner_img = $samplepagesR['banner_img']; $title = str_replace("'", "’", $title); $title = str_replace("_", " ", $title); $meta_title = str_replace("'", "’", $meta_title); $meta_keywords = str_replace("'", "’", $meta_keywords); $meta_description = str_replace("'", "’", $meta_description);