Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
- <html xmlns="http://www.w3.org/1999/xhtml">
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
- <title>Untitled Document</title>
- </head>
- <body>
- <?php
- $metaDescription = $_POST["metaDescription"];
- $metaKeywords = $_POST["metaKeywords"];
- $listingKeywords = $_POST["listingKeywords"];
- $galleryImages = $_POST["galleryImages"];
- $businessName = $_POST["businessName"];
- $businessPhone = $_POST["businessPhone"];
- $listingThumbnail = $_POST["businessthumbURL"];
- $facebookURL = $_POST["facebookURL"];
- $metaKeywords = array_map('trim', explode(',', $metaKeywords));
- $keyword_list = array_map('trim', explode(',', $listingKeywords));
- $gallery_list = array_map('trim', explode(',', $galleryImages));
- $businessName = preg_replace("![^a-z0-9]+!i", "-", $businessName);
- $businessPhone = preg_replace('/\D+/', '', $businessPhone);
- $i = 1;
- $metaKeywordsList = implode(',', $metaKeywords);
- // gallery logic below
- //foreach ($gallery_list as $key=>$value) {
- // echo $value;
- //}
- $lower = false;
- //FIRST FIND AND REPLACE ALL SINGLE QUOTES WITH \' IN STRING
- $string = '
- ' . $businessName . '
- *
- <meta name="description" content="'. $metaDescription .'" />
- <meta name="keywords" content="' . $metaKeywordsList . '" />
- <meta name="author" content="http://www.towntarget.com" />
- <meta name="coverage" content="United States">
- <meta name="classification" content="http://www.towntarget.com">
- <meta name="revisit-after" content="weekly" />
- <meta http-equiv="expires" content="Tue, 31 Dec 2013 00:00:01 PST" />
- <meta name="distribution" content="global" />
- <meta name="robots" content="all" />
- <meta http-equiv="content-language" content="en" />
- <meta http-equiv="window-target" content="_self" />
- *
- ' . $businessName . '-' . $businessPhone . '
- *
- Content 3
- *
- Content 4 Placeholder';
- $substr = explode('%',$string);
- $pages = array();
- foreach ($substr as $str)
- {
- array_push($pages,$str);
- }
- $contents = array();
- $i = 0;
- foreach ($pages as $page)
- {
- $contents[$i] = explode("*",$page);
- $i++;
- }
- foreach ($contents as $content)
- {
- foreach ($keyword_list as $key=>$value)
- {
- $keyword = strtolower($value);
- //REMOVE COMMAS
- $keyword = str_replace(',','',$keyword);
- //ADD HYPHENS
- $keyword = str_replace(' ','-',$keyword);
- for ($i=0; $i<count($content); $i++)
- {
- $content[$i] = trim($content[$i]);
- //RE-REPLACE SINGLE QUOTES TO ESCAPED VERSIONS FOR INCLUSION IN HTML DOC (PHP ARRAY)
- $content[$i] = str_replace("'", "\'",$content[$i]);
- }
- $file = strtolower(str_replace(' ','-',$content[2]));
- $file .= '-' . $keyword;
- $filename = $file . '.php';
- $handle = fopen($filename,'w');
- $data = '
- <?php
- $content[0] = \'' . $content[0] . '\';
- $content[1] = \'' . $content[1] . '\';
- $content[2] = \'' . $content[2] . '\';
- $content[3] = \'' . $content[3] . '\';
- $content[4] = \'' . $content[4] . '\';
- $file = str_replace(" ","-","' . $content[0] . '");
- ?>';
- //UN-REPLACE ESCAPED SINGLE QUOTES FOR PRINTING TO SCREEN
- for ($i=0; $i<count($content); $i++)
- {
- $content[$i] = str_replace("\'", "'",$content[$i]);
- }
- $businessName = $_POST["businessName"];
- $data .= '<?php require("includes/header.php"); ?>';
- $data .= '<?php echo $i; ?>';
- $data .= '<?php require("includes/footer.php"); ?>';
- fwrite($handle,$data);
- fclose($handle);
- $handle2 = fopen('generated.txt','a');
- $data2 = 'http://www.towntarget.com/' . $filename . "\n";
- fwrite($handle2,$data2);
- fclose($handle2);
- }
- }
- ?>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement