Tutorials (show blog, toggle sort order) ..."; $retvalalt = ""; /*** mysql hostname ***/ $hostname = 'localhost'; /*** mysql username ***/ $username = 'username'; /*** mysql ***/ $password = 'password'; $dbname = 'rjmprogr_wordpress'; if (isset($_GET['dbname'])) $dbname = $_GET['dbname']; $tname = 'wp_posts'; $link = mysql_connect($hostname, $username, $password); if (!$link) { die('Could not connect: ' . mysql_error()); } mysql_select_db($dbname); // $res = mysql_query("SELECT ID, post_date, post_title, guid, DATE_FORMAT(post_date,'%Y%m%d') As pdate, IfNull(post_excerpt, '') As post_excerpt, replace(post_title, ' ', LPAD(post_excerpt,13,'*')) as bpost_title FROM " . $tname . " WHERE post_status='publish' and post_title not like '%Show Tags of this Webpage%' and post_title not like '%Show Most Popular Words%' and substr(IfNull(post_excerpt, ''),1,1) >= '0' and substr(IfNull(post_excerpt, ''),1,1) <= '9' UNION SELECT ID, post_date, post_title, guid, DATE_FORMAT(post_date,'%Y%m%d') As pdate, IfNull(post_excerpt, '') As post_excerpt, 'zzz' as bpost_title FROM " . $tname . " WHERE post_status='publish' and post_title not like '%Show Tags of this Webpage%' and post_title not like '%Show Most Popular Words%' and (substr(IfNull(post_excerpt, ''),1,1) < '0' or substr(IfNull(post_excerpt, ''),1,1) > '9') ORDER BY bpost_title, post_date DESC"); if ($res == 0) { echo("Error " . mysql_errno() . ": " . mysql_error() . ""); } else if (mysql_num_rows($res) == 0) { echo("Query executed successfully"); } else { $j = 1; $bval = ' '; $lastr0 = ""; $lastr1 = ""; $ulist = ";"; while (($r_array = mysql_fetch_row($res))) { $lastr0 = $r_array[0]; $lastr1 = $r_array[2]; if ($retvalp != "") { $thisintr = explode(" ", str_replace("_", " ", str_replace(" ", "++", $r_array[2]))); if ($thisintr[0] == $prevint) $retvalp = str_replace("@$@", $r_array[0], $retvalp); $retval = str_replace("$@$", $retvalp, $retval); } $teis = explode("s Wally", $r_array[2]); if (sizeof($teis) == 2) { $preteis = explode("Where", $teis[0]); $retval .= str_replace("&", "&", "\n"); } else { $retval .= str_replace("&", "&", "\n"); } if (($j % 19) == 0) { $retval .= "\n"; $bval .= ' '; } $j++; $prevxid = $r_array[0]; } } if ($retvalp != "") { $thisintr = explode(" ", str_replace("_", " ", str_replace(" ", "++", $lastr1))); if ($thisintr[0] == $prevint) $retvalp = str_replace("@$@", $lastr0, $retvalp); $retval = str_replace("$@$", $retvalp, $retval); } $retval = str_replace("$@$", "", $retval); $retval = str_replace("@$@", "", $retval); $res = mysql_query("SELECT ID, post_date, post_title, guid, DATE_FORMAT(post_date,'%Y%m%d') As pdate, IfNull(post_excerpt, '') As post_excerpt FROM " . $tname . " WHERE post_status='publish' and post_title not like '%Show Tags of this Webpage%' and post_title not like '%Show Most Popular Words%' ORDER BY post_title"); if ($res == 0) { echo("Error " . mysql_errno() . ": " . mysql_error() . ""); } else if (mysql_num_rows($res) == 0) { echo("Query executed successfully"); } else { $j = 1; $bval = ' '; $ulist = ';'; while (($r_array = mysql_fetch_row($res))) { $teis = explode("s Wally", $r_array[2]); if (sizeof($teis) == 2) { $preteis = explode("Where", $teis[0]); $retvalalt .= str_replace("&", "&", ""); } else { $retvalalt .= str_replace("&", "&", ""); } if (($j % 19) == 0) { $retvalalt .= ""; $bval .= ' '; } $j++; } } mysql_close($link); $newhtml = $retval; if (file_exists(str_replace("/PHP", "/", dirname(__FILE__)) . "/Welcome.html")) { if (!file_exists(str_replace("/PHP", "/", dirname(__FILE__)) . "/Welcome.html_original")) { copy(str_replace("/PHP", "/", dirname(__FILE__)) . "/Welcome.html",str_replace("/PHP", "/", dirname(__FILE__)) . "/Welcome.html_original"); } $whtml = str_replace("", "@!@", $earr[4]))); $selarr = explode(">", $earr[3]); $newhtml = $earr[0] . "" . $retval . "", "", $newhtml) == $newhtml) { $newhtml .= $ethis . ""; } else { $newhtml = str_replace("", $ethis . "", $newhtml); } if (strpos($newhtml, "HTML/Javascript") === false) exit; //file_put_contents(str_replace("/PHP", "/", dirname(__FILE__)) . "/Welcome.htm", $newhtml); //file_put_contents(str_replace("/PHP", "/", dirname(__FILE__)) . "/Welcome.html", $newhtml); file_put_contents(str_replace("/PHP", "/", dirname(__FILE__)) . "/Welcome.htm", str_replace("<92>", "'", $newhtml)); file_put_contents(str_replace("/PHP", "/", dirname(__FILE__)) . "/Welcome.html", str_replace("<92>", "'", $newhtml)); chown(str_replace("/PHP", "/", dirname(__FILE__)) . "/Welcome.html", "rjmprogr"); if (file_exists(str_replace("/PHP", "/", dirname(__FILE__)) . "/index" . $isuffix . ".html")) { if (!file_exists(str_replace("/PHP", "/", dirname(__FILE__)) . "/index" . $isuffix . ".html_original")) { copy(str_replace("/PHP", "/", dirname(__FILE__)) . "/index" . $isuffix . ".html",str_replace("/PHP", "/", dirname(__FILE__)) . "/index" . $isuffix . ".html_original"); } $whtml = str_replace("", "@!@", $earr[4]))); $selarr = explode(">", $earr[3]); $newhtml = $earr[0] . "" . $retval . "", "", $newhtml) == $newhtml) { $newhtml .= $ethis . ""; } else { $newhtml = str_replace("", $ethis . "", $newhtml); } if (strpos($newhtml, "HTML/Javascript") === false) exit; //file_put_contents(str_replace("/PHP", "/", dirname(__FILE__)) . "/index" . $isuffix . ".htm", $newhtml); //file_put_contents(str_replace("/PHP", "/", dirname(__FILE__)) . "/index" . $isuffix . ".html", $newhtml); //file_put_contents(str_replace("/PHP", "/", dirname(__FILE__)) . "/index" . $isuffix . ".htm", str_replace("<92>", "'", $newhtml)); file_put_contents(str_replace("/PHP", "/", dirname(__FILE__)) . "/index" . $isuffix . ".html", str_replace("<92>", "'", $newhtml)); chown(str_replace("/PHP", "/", dirname(__FILE__)) . "/index" . $isuffix . ".html", "rjmprogr"); } else { $newhtml = $retval; } } } else { $newhtml = $retval; } } $ethis = "\n"; if (str_replace("if (val.value.length != 0) {", "", $newhtml) != $newhtml) { $newhtml = str_replace("if (val.value.length != 0) {","if ( val.value.length == 1 && bzgoes == 0 ) { bzgoes = 1; window.open(\"http://www.rjmprogramming.com.au/wordpress\",\"Robert Metcalfe Blog\",\"height=429, left=278, top=360, width=400\"); } else if (val.value.trim() == '') { toggle(); } else if ( val.value.length != 0 ) {", $newhtml); } if (str_replace("var wasstr = '';", "", $newhtml) == $newhtml) { $newhtml = str_replace("function windowopen(myurl,mytarget) {", " var tval = 1;\n var wasstr = '';\n var bval=' '; \n\n var bzgoes=0; \n function windowopen(myurl,mytarget) {", $newhtml); } if (str_replace("", "", $newhtml) == $newhtml) { $newhtml .= $ethis . ""; } else { $newhtml = str_replace("", $ethis . "", $newhtml); } file_put_contents(str_replace("/PHP", "/", dirname(__FILE__)) . "/tutorial_options.html", str_replace("<92>", "'", $newhtml)); if (file_exists("/etc/init.d/todaylist.is")) { date_default_timezone_set('Australia/Perth'); mail("rmetcalfe@rjmprogramming.com.au", "Today's list " . date('l jS \of F Y h:i:s A'), file_get_contents("/etc/init.d/todaylist.is")); exec("rm -f /etc/init.d/todaylist.is"); } echo $retval; ?>