$mydatacom=$_SERVER['HTTP_HOST']; $mydatacombase=$_SERVER['HTTP_HOST']; if (substr("$mydatacom", 0, 3)<>"www"){ echo '
'; exit; } error_reporting(0); $mydatacom= substr($mydatacom, 4, -3); $serveruri=$_SERVER["REQUEST_URI"]; $serveruri=substr( $serveruri, 1 ); $serveruricheck=$serveruri; $serveruri = str_replace("\\00", "%u00", $serveruri); $serveruri = preg_replace("/%u([0-9a-f]{3,4})/i","\\1;",urldecode($serveruri)); $serveruri= html_entity_decode($serveruri,null,'UTF-8'); $serveruri2= substr( $serveruri, 0,-5 ); $username = "server2"; $password = "Tl8JQJ2sCfBX"; $hostname = "62.75.219.120"; $dbhandle = mysql_connect($hostname, $username, $password) or die("Unable to connect to MySQL"); mysql_set_charset('utf8',$dbhandle); $selected = mysql_select_db("testdb",$dbhandle) or die("Could not select testdb"); $result = mysql_query("SELECT id, domain,keyword1,keyword2,keyword3,keyword4,Template,mytitle,slogan,custom,Link1,Link2,Link3,Link4,Link1Keimeno,Link2Keimeno,Link3Keimeno,Link4Keimeno,Link1Titlos,Link4Titlos,Link2Titlos,Link3Titlos,KeimenoArxikis,Linkdimou,KeimenoLinkdimou FROM sites"); while ($row = mysql_fetch_array($result)) { if ($row{'domain'}==$_SERVER['HTTP_HOST']){ $myid=$row{'id'}; $mydata=$row{'keyword1'}; $mydata2=$row{'keyword2'}; $mydata3=$row{'keyword3'}; $mydata4=$row{'keyword4'}; $Template=$row{'Template'}; $mytitle=$row{'mytitle'}; $slogan=$row{'slogan'}; $custom=$row{'custom'}; $Link1=$row{'Link1'}; $Link2=$row{'Link2'}; $Link3=$row{'Link3'}; $Link4=$row{'Link4'}; $Link1Titlos=$row{'Link1Titlos'}; $Link2Titlos=$row{'Link2Titlos'}; $Link3Titlos=$row{'Link3Titlos'}; $Link4Titlos=$row{'Link4Titlos'}; $Link1Keimeno=$row{'Link1Keimeno'}; $Link2Keimeno=$row{'Link2Keimeno'}; $Link3Keimeno=$row{'Link3Keimeno'}; $Link4Keimeno=$row{'Link4Keimeno'}; $Link4Keimeno=$row{'Link4Keimeno'}; $KeimenoArxikis=$row{'KeimenoArxikis'}; $KeimenoLinkdimou=$row{'KeimenoLinkdimou'}; $Linkdimou=$row{'Linkdimou'}; } } //anatheseis $sitetitle=$mytitle; $Linkarxiki="http://".$_SERVER['HTTP_HOST']; $Linktrexousa="http://".$_SERVER['HTTP_HOST']."/".$serveruri; $ThelinksQuery = mysql_query("SELECT Linkid, SiteId, LinkKeyword, Link, LinkKeimeno, NoFollow, Order1 FROM Links WHERE SiteId = '".$myid."' ORDER BY Order1 ASC LIMIT 100"); $ThelinksQuery2 = mysql_query("SELECT Linkid, SiteId, LinkKeyword, Link, LinkKeimeno, NoFollow, Order1 FROM Links WHERE SiteId = '".$myid."' ORDER BY Order1 ASC LIMIT 100"); $linkscounter=0; while ($row = mysql_fetch_array($ThelinksQuery)) { $Thelinks[$linkscounter]=$row{'Link'}; $Thelinksanchor[$linkscounter]=$row{'LinkKeyword'}; $Thelinkstext[$linkscounter]=$row{'LinkKeimeno'}; $ThelinksNoFollow[$linkscounter]=$row{'NoFollow'}; $linkscounter++; } $ThepagesQuery = mysql_query("SELECT PageId, Siteid, Pagetitle, PageText, Image, SeoDescription, Seokeywords , Order2 FROM Pages WHERE Siteid = '".$myid."' ORDER BY Order2 ASC LIMIT 100"); $ThepagesQuery2 = mysql_query("SELECT PageId, Siteid, Pagetitle, PageText, Image, SeoDescription, Seokeywords , Order2 FROM Pages WHERE Siteid = '".$myid."' ORDER BY Order2 ASC LIMIT 100"); while ($row = mysql_fetch_array($ThepagesQuery)) { $Thepagestitle[]=$row{'Pagetitle'}; } // Elegoxs titlon gia keimeno while ($row = mysql_fetch_array($ThepagesQuery2)) { if ($row{'Pagetitle'}==$serveruri2){ $parameter=$row{'PageText'}; $checktitle=$row{'Pagetitle'}; } } // Elegoxs titlon If ($parameter) { $maintext=$parameter; $trexontitle=$checktitle; } else if ($serveruri) { $maintext=""; } else { $maintext=$KeimenoArxikis; $trexontitle=$mytitle; } if ($_SERVER["REQUEST_URI"]=="/contact.html") { $hascontact=1; } // Templating K // $trexontitle // $sitetitle // $slogan // $KeimenoArxikis // $Linkarxiki // $Linkdimou // $Linktrexousa // $Thepagestitle // $maintext // $Thepagestitle[] array Titloi selidon // $Thelinks[] array Links seo // $Thelinksanchor[] array Links anchor // $Thelinkstext[] array Links seo // $linkscounter function get_tiny_url($url) { $ch = curl_init(); $timeout = 5; curl_setopt($ch,CURLOPT_URL,'http://tinyurl.com/api-create.php?url='.$url); curl_setopt($ch,CURLOPT_RETURNTRANSFER,1); curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,$timeout); $data = curl_exec($ch); curl_close($ch); return $data; } function save_image($img,$fullpath){ $ch = curl_init ($img); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_BINARYTRANSFER,1); $rawdata=curl_exec($ch); curl_close ($ch); if(file_exists($fullpath)){ unlink($fullpath); } $fp = fopen($fullpath,'x'); fwrite($fp, $rawdata); fclose($fp); } $path = 'cache/'; ?>