<?php
$GLOBALS['_875910870_']=Array(base64_decode('ZXhwbG' .'9' .'k' .'ZQ' .'=='),base64_decode('bWljcm90aW1l'),base64_decode('' .'a' .'WN' .'vbnY' .'='),base64_decode('' .'bWJfZGV0ZW' .'N0X2VuY2' .'9' .'kaW5n'),base64_decode('aWNvb' .'nY='),base64_decode('' .'c' .'3R' .'yd' .'G9sb' .'3' .'dlcg=='),base64_decode('' .'c3Ryd' .'G' .'9s' .'b3d' .'lcg=='),base64_decode('aWNvbnY='),base64_decode('b' .'WJfZ' .'GV0ZW' .'N0X2VuY2' .'9' .'ka' .'W5n'),base64_decode('aWNvbn' .'Y='),base64_decode('c3Vic3' .'Ry'),base64_decode('' .'c3V' .'ic3Ry'),base64_decode('aWNvbnY' .'='),base64_decode('aWNvbnY='),base64_decode('bW' .'JfZG' .'V' .'0ZW' .'N0' .'X2' .'VuY29kaW5n'),base64_decode('a' .'WNvb' .'nY='),base64_decode('c3Vic' .'3' .'Ry' .'X3' .'J' .'lcGxhY2' .'U='),base64_decode('c3' .'Vic3RyX3Jlc' .'GxhY2U' .'='),base64_decode('aWNv' .'b' .'nY='),base64_decode('bWJfZGV0ZWN0' .'X2VuY29ka' .'W5n'),base64_decode('c2l' .'6' .'ZW9m'),base64_decode('ZX' .'hwbG9kZQ=' .'='),base64_decode('c2' .'l6ZW9m'),base64_decode('YXJy' .'YX' .'lfY2h1bm' .'s='),base64_decode('YXJ' .'yYX' .'lfY2h1b' .'m' .'s='),base64_decode('bXRfc3Jhb' .'mQ='),base64_decode('c2l' .'6ZW9m'),base64_decode('' .'c2l6ZW9m'),base64_decode('c2l6' .'ZW9m'),base64_decode('b' .'XRfcmFuZA=='),base64_decode('c2l6Z' .'W9m'),base64_decode('bXRfc' .'3' .'Jhbm' .'Q='),base64_decode('bXRfcmFuZA=='),base64_decode('dHJpbQ=='),base64_decode('ZXh' .'wb' .'G9kZQ' .'=' .'='),base64_decode('c2' .'l6ZW9m'),base64_decode('c2l' .'6' .'ZW9m'),base64_decode('b' .'XRfc3J' .'hbmQ='),base64_decode('b' .'XRfc' .'mFuZ' .'A=' .'='),base64_decode('c2l6ZW9m'),base64_decode('YXJy' .'Y' .'XlfdW5' .'pcXV' .'l'),base64_decode('dHJpbQ=='),base64_decode('ZX' .'hwbG9k' .'ZQ=='),base64_decode('c2l6ZW' .'9' .'m'),base64_decode('' .'cmVzZXQ='),base64_decode('' .'ZWFj' .'a' .'A=='),base64_decode('c2l6' .'ZW9m'),base64_decode('b' .'XR' .'fc3JhbmQ='),base64_decode('bXRfcmFuZA' .'=='),base64_decode('ZXhwbG9k' .'ZQ=='),base64_decode('' .'dHJpbQ=='),base64_decode('dHJp' .'bQ=' .'='),base64_decode('' .'c3RyX3Jl' .'cGx' .'hY2U='),base64_decode('c' .'3Ry' .'X3' .'Jl' .'cG' .'xhY2U='),base64_decode('c3' .'RyX3' .'JlcGxhY' .'2U='),base64_decode('ZXhwbG9kZQ=='),base64_decode('' .'c2' .'l6Z' .'W' .'9m'),base64_decode('' .'b' .'XRf' .'c3J' .'hbm' .'Q='),base64_decode('bX' .'RfcmF' .'uZA' .'=='),base64_decode('Y2VpbA' .'=='),base64_decode('c2l6Z' .'W9m'),base64_decode('bX' .'Rf' .'c' .'3JhbmQ='),base64_decode('' .'bX' .'RfcmFuZA=='),base64_decode('b' .'XRfc' .'3' .'Jh' .'bmQ='),base64_decode('bX' .'RfcmFuZA=='),base64_decode('c3RyX3Jlc' .'G' .'x' .'hY2U='),base64_decode('' .'c3RyaXBf' .'dGFncw' .'=='),base64_decode('ZX' .'hwb' .'G' .'9kZQ=='),base64_decode('c3RyX3' .'JlcG' .'xh' .'Y2U='),base64_decode('' .'c' .'3RybGVu'),base64_decode('ZXhwbG9kZQ=='),base64_decode('c2l6Z' .'W' .'9m'),base64_decode('' .'c3Ry' .'X3' .'JlcG' .'xhY2U='),base64_decode('b' .'XRfc3' .'Jh' .'b' .'m' .'Q' .'='),base64_decode('bXRfcmFuZA=='),base64_decode('c3Ryc3' .'Ry'),base64_decode('ZXhwbG9kZQ=' .'='),base64_decode('c2h1ZmZsZQ=='),base64_decode('aW' .'1w' .'bG9kZQ=='),base64_decode('' .'bXRf' .'c3Jhb' .'mQ='),base64_decode('bXRfcmFuZA=='),base64_decode('bXRfc3JhbmQ='),base64_decode('cH' .'JlZ' .'19yZXBsY' .'WNl'),base64_decode('bX' .'RfcmF' .'uZA=' .'='),base64_decode('bX' .'Rfc3JhbmQ='),base64_decode('bXRfcmFuZA=='),base64_decode('bXR' .'fc3J' .'hbmQ='),base64_decode('bXRfcmFuZA' .'=='),base64_decode('bXRfc3' .'JhbmQ='),base64_decode('bXRfcm' .'FuZA=='),base64_decode('ZXhwb' .'G9k' .'Z' .'Q' .'=' .'='),base64_decode('c2l6Z' .'W9m'),base64_decode('bXRfc3Jh' .'b' .'mQ' .'='),base64_decode('bXRfcmFuZA=='),base64_decode('bXRfc' .'3Jh' .'bmQ='),base64_decode('' .'b' .'XRf' .'cm' .'FuZA=='),base64_decode('' .'b' .'XR' .'f' .'c3JhbmQ='),base64_decode('bXRfcmFuZ' .'A=='),base64_decode('Y2Vpb' .'A=='),base64_decode('b' .'XR' .'fc3Jh' .'bm' .'Q='),base64_decode('' .'b' .'XRf' .'cmF' .'uZA=='),base64_decode('bXRfcmFuZA=='),base64_decode('bXRfc' .'3Jhb' .'mQ='),base64_decode('bXRfcmFuZA=' .'='),base64_decode('bXRfc' .'mFuZA' .'=='),base64_decode('bXR' .'fc3Jh' .'bmQ='),base64_decode('' .'bXRfcmF' .'uZA=' .'='),base64_decode('' .'bXRfc3JhbmQ='),base64_decode('bX' .'R' .'fcm' .'FuZA=='),base64_decode('c2l6Z' .'W9m'),base64_decode('bXRfc' .'3JhbmQ='),base64_decode('bXRfcmFu' .'ZA=' .'='),base64_decode('' .'aW1w' .'bG9k' .'Z' .'Q=='),base64_decode('dHJpbQ=='),base64_decode('c3R' .'yX3' .'JlcGxhY2' .'U='),base64_decode('' .'c3RyX3JlcGxhY' .'2' .'U' .'='),base64_decode('' .'c3RyX' .'3' .'JlcGxh' .'Y2U='),base64_decode('aWN' .'vbnY='));  function _166794750($i){$a=Array('IA==','dXRmLTg=','Q1AxMjUx','VVRGLTgsQ1AxMjUx','V2luZG93cy0xMjUx','Q1AxMjUx','dXRmLTg=','dXRmLTg=','Q1AxMjUx','VVRGLTgsQ1AxMjUx','V2luZG93cy0xMjUx','Q1AxMjUx','dXRmLTg=','dXRmLTg=','Q1AxMjUx','dXRmLTg=','Q1AxMjUx','VVRGLTgsQ1AxMjUx','V2luZG93cy0xMjUx','Q1AxMjUx','dXRmLTg=','dXRmLTg=','Q1AxMjUx','VVRGLTgsQ1AxMjUx','V2luZG93cy0xMjUx','9/LuIA==','dGhlIA==','IA==','b24=','IA==','IA==','IA==','','IA==','IA==','LiA=','LiA=','LC4=','Lg==','ICwg','LCw=','','IA==','','','b24=','PGEgaHJlZj0i','aHJlZg==','PGEg','PC9hPg==','','wMHQwMrAxMDB0MA=','IA==','Lg==','LA==','IQ==','Pw==','Iw==','Ig==','Jw==','JA==','JQ==','Xg==','Jg==','Kg==','KA==','KQ==','','LA==','Iw==','Iw==','','I2k=','b24=','b24=','IA==','IA==','IA==','b24=','YWJicg==','IA==','IHRpdGxlPSI=','Ig==','','PA==','Pg==','PC8=','Pg==','b24=','b24=','b24=','b24=','IA==','IC4sLQ==','Lg==','ICA=','IA==','AA==','','VVRGLTg=','VVRGLTgvL0lHTk9SRQ==');return base64_decode($a[$i]);}  function l__0(){list($_0,$_1)=$GLOBALS['_875910870_'][0](_166794750(0),$GLOBALS['_875910870_'][1]());return (float) $_1+((float) $_0*round(0+5000000+5000000));}function l__1($_2){$_3=$GLOBALS['_875910870_'][2](_166794750(1),_166794750(2),$_2);if(($GLOBALS['_875910870_'][3]($_3,_166794750(3)))== _166794750(4)){$_3=$GLOBALS['_875910870_'][4](_166794750(5),_166794750(6),$GLOBALS['_875910870_'][5]($_3));}else{$_3=$GLOBALS['_875910870_'][6]($_2);}return $_3;}function l__2($_2,$_4,$_5=l__3){$_3=$GLOBALS['_875910870_'][7](_166794750(7),_166794750(8),$_2);if(($GLOBALS['_875910870_'][8]($_3,_166794750(9)))== _166794750(10)){$_3=$GLOBALS['_875910870_'][9](_166794750(11),_166794750(12),$GLOBALS['_875910870_'][10]($_3,$_4,$_5));}else{$_3=$GLOBALS['_875910870_'][11]($_2,$_4,$_5);}return $_3;}function l__4($_2,$_6,$_4,$_5=l__3){$_3=$GLOBALS['_875910870_'][12](_166794750(13),_166794750(14),$_2);$_6=$GLOBALS['_875910870_'][13](_166794750(15),_166794750(16),$_6);if(($GLOBALS['_875910870_'][14]($_3,_166794750(17)))== _166794750(18)){$_3=$GLOBALS['_875910870_'][15](_166794750(19),_166794750(20),$GLOBALS['_875910870_'][16]($_3,$_6,$_4,$_5));}else{$_3=$GLOBALS['_875910870_'][17]($_2,$_6,$_4,$_5);}return $_3;}function l__5($_2){$_2=$GLOBALS['_875910870_'][18](_166794750(21),_166794750(22),$_2);if(($GLOBALS['_875910870_'][19]($_2,_166794750(23)))== _166794750(24)){return _166794750(25);}else{return _166794750(26);}}function l__6($_7,$_8,$_9,$_10=FALSE,$_11=FALSE){global $_12,$_13,$_14,$_15,$_16,$_17;global $_18,$_19,$_20,$_21,$_22,$_23;global $_24,$_25,$_26;global $_27,$_28,$_29;global $_30;$_31=array();$_32=$GLOBALS['_875910870_'][20]($_9)-round(0+1);$_33=$_32+round(0+0.33333333333333+0.33333333333333+0.33333333333333);for($_34=round(0);$_34<$_33;$_34++){$_35=$_9[$_34];$_36=$GLOBALS['_875910870_'][21](_166794750(27),$_35);$_31[$_34]=$GLOBALS['_875910870_'][22]($_36);unset($_35);unset($_36);}$_31=$GLOBALS['_875910870_'][23]($_31,round(0+96+96+96));$_9=$GLOBALS['_875910870_'][24]($_9,round(0+144+144));$GLOBALS['_875910870_'][25](l__0());if($_20== _166794750(28)){$_37=miss($_7);$_38=$GLOBALS['_875910870_'][26]($_37)-round(0+0.25+0.25+0.25+0.25);}$_39=@$GLOBALS['_875910870_'][27]($_19)-round(0+0.25+0.25+0.25+0.25);$_32=$GLOBALS['_875910870_'][28]($_31)-round(0+0.5+0.5);$_40=$GLOBALS['_875910870_'][29](round(0),$_32);$_41=$_9[$_40];$_42=$_31[$_40];$_32=$GLOBALS['_875910870_'][30]($_41)-round(0+0.2+0.2+0.2+0.2+0.2);$_43=array();for($_44=round(0);$_44<$_8;$_44++){for($_45=round(0);$_45<round(0+2.5+2.5+2.5+2.5);$_45++){$GLOBALS['_875910870_'][31](l__0());$_46=$GLOBALS['_875910870_'][32](round(0),$_32);$_47=$GLOBALS['_875910870_'][33]($_41[$_46]);$_48=$GLOBALS['_875910870_'][34](_166794750(29),$_47);$_49=$GLOBALS['_875910870_'][35]($_48);if($_49>round(0+0.75+0.75+0.75+0.75))break 1;}$_50=round(0);$_51=-round(0+50+50);$_52=array();$_53=$GLOBALS['_875910870_'][36]($_42)-round(0+1);for($_54=round(0);$_54<round(0+94+94);$_54++){$GLOBALS['_875910870_'][37](l__0());$_55=$GLOBALS['_875910870_'][38](round(0),$_32);$_56=$_49-$_42[$_55];$_57=$GLOBALS['_875910870_'][39]($_52);if(($_56>$_51)&&($_56<round(0+0.25+0.25+0.25+0.25))&&($_55!=$_46)){$_50=$_55;$_51=$_56;}if(($_56>-round(0+2+2+2+2))&&($_56<round(0+0.25+0.25+0.25+0.25))&&($_55!=$_46)&&($_57<round(0+3.3333333333333+3.3333333333333+3.3333333333333))){$_52[]=$_41[$_55];}if(($_51==round(0))&&($_57>round(0+1.75+1.75+1.75+1.75)))break 1;if($_57>round(0+1.6+1.6+1.6+1.6+1.6))break 1;}$_52[]=$_41[$_50];$_52[]=$_47;$_52=$GLOBALS['_875910870_'][40]($_52);$_58=$GLOBALS['_875910870_'][41]($_41[$_50]);$_58=$GLOBALS['_875910870_'][42](_166794750(30),$_58);$_59=$GLOBALS['_875910870_'][43]($_58)-round(0+0.5+0.5);$GLOBALS['_875910870_'][44]($_52);while(list($_60,$_61)=@$GLOBALS['_875910870_'][45]($_52)){$_62[]=$_61;}$_52=$_62;unset($_62);$_57=$GLOBALS['_875910870_'][46]($_52)-round(0+0.5+0.5);for($_55=round(0);$_55<$_49;$_55=$_55+round(0+4)){$GLOBALS['_875910870_'][47](l__0());$_63=$GLOBALS['_875910870_'][48](round(0),$_57);$_64=@$GLOBALS['_875910870_'][49](_166794750(31),$_52[$_63]);for($_65=round(0);$_65<round(0+1.3333333333333+1.3333333333333+1.3333333333333);$_65++){if((isset($_64[$_55+$_65])=== FALSE)OR($_64[$_55+$_65]== _166794750(32))){continue;}$_66=$GLOBALS['_875910870_'][50]($_64[$_55+$_65]) ._166794750(33);@$_67 .= _166794750(34) .$_64[$_55+$_65];unset($_66);}@$_68.=$_67;unset($_64);unset($_67);}$_68=$GLOBALS['_875910870_'][51]($_68) ._166794750(35);unset($_52);unset($_47);}$_68=$GLOBALS['_875910870_'][52]($_43,_166794750(36),$_68);$_68=$GLOBALS['_875910870_'][53](_166794750(37),_166794750(38),$_68);$_68=$GLOBALS['_875910870_'][54](array(_166794750(39),_166794750(40)),_166794750(41),$_68);$_69=array();$_69=$GLOBALS['_875910870_'][55](_166794750(42),$_68);$_70=$GLOBALS['_875910870_'][56]($_69)-round(0+1);$GLOBALS['_875910870_'][57](l__0());$_71=$GLOBALS['_875910870_'][58]($_14,$_13);$_72=$GLOBALS['_875910870_'][59](($_71*$_70)/round(0+25+25+25+25));$_73=$GLOBALS['_875910870_'][60]($_15)-round(0+0.2+0.2+0.2+0.2+0.2);$_74=round(0+0.25+0.25+0.25+0.25);$_75=_166794750(43);$_76=round(0);if(($_77 != _166794750(44))AND($_78 !== FALSE)AND($_79 !== FALSE)){$GLOBALS['_875910870_'][61](l__0());$_80=$GLOBALS['_875910870_'][62]($_78,$_79);}else{if($_27 == _166794750(45)){$GLOBALS['_875910870_'][63](l__0());$_80=$GLOBALS['_875910870_'][64]($_28,$_29);}}$_81=$_7;$_7=$GLOBALS['_875910870_'][65](array(_166794750(46),_166794750(47),_166794750(48),_166794750(49)),_166794750(50),$GLOBALS['_875910870_'][66]($_7));if(($_7 !== _166794750(51))OR($_7 != round(0))){$_82=$_7;$_83=FALSE;$_84=FALSE;if($_85 !== FALSE){$_86=$GLOBALS['_875910870_'][67](_166794750(52),$_7);foreach($_86 AS $_87){$_88=$GLOBALS['_875910870_'][68](array(_166794750(53),_166794750(54),_166794750(55),_166794750(56),_166794750(57),_166794750(58),_166794750(59),_166794750(60),_166794750(61),_166794750(62),_166794750(63),_166794750(64),_166794750(65),_166794750(66)),_166794750(67),l__1($_87));if($GLOBALS['_875910870_'][69]($_88)<= round(0+0.6+0.6+0.6+0.6+0.6))continue;if(isset($_85[$_88])){$_83=$GLOBALS['_875910870_'][70](_166794750(68),$_85[$_88]);$_89=$GLOBALS['_875910870_'][71]($_83)-round(0+0.25+0.25+0.25+0.25);$_84=_166794750(69) .$GLOBALS['_875910870_'][72](_166794750(70),_166794750(71),$_87) ._166794750(72);break 1;}}unset($_86);}for($_34=round(0);$_34<$_72;$_34++){if(($_27 == _166794750(73))AND($_76 >= $_80)){break 1;}$GLOBALS['_875910870_'][73](l__0());if(($_30 == _166794750(74))AND($GLOBALS['_875910870_'][74](round(0),round(0+1+1))== round(0+0.5+0.5))AND($GLOBALS['_875910870_'][75]($_7,_166794750(75))!== FALSE)){$_90=true;}else{$_90=false;}if($_90){$_7=$GLOBALS['_875910870_'][76](_166794750(76),$_7);$GLOBALS['_875910870_'][77]($_7);$_7=$GLOBALS['_875910870_'][78](_166794750(77),$_7);}if($_84 !== FALSE){$GLOBALS['_875910870_'][79](l__0());if($GLOBALS['_875910870_'][80](round(0),round(0+0.6+0.6+0.6+0.6+0.6))== round(0+2)){$GLOBALS['_875910870_'][81](l__0());$_7=$GLOBALS['_875910870_'][82]($_84,$_83[$GLOBALS['_875910870_'][83](round(0),$_89)],$_7,round(0+0.5+0.5));}}if($_26 == _166794750(78)){$GLOBALS['_875910870_'][84](l__0());$_91=$GLOBALS['_875910870_'][85]($_24,$_25);}$GLOBALS['_875910870_'][86](l__0());$_92=$_15[$GLOBALS['_875910870_'][87](round(0),$_73)];if(($_75 == $_92)AND($_73>round(0+0.66666666666667+0.66666666666667+0.66666666666667))){while(TRUE){if(($_73 == round(0+0.33333333333333+0.33333333333333+0.33333333333333))OR($_73 == round(0)))break 1;$GLOBALS['_875910870_'][88](l__0());$_92=$_15[$GLOBALS['_875910870_'][89](round(0),$_73)];if($_92 != $_75){break 1;}}}$_75=$_92;if(empty($_92)){$_93=$_7;}else{if($_92 == _166794750(79)){$_94=$GLOBALS['_875910870_'][90](_166794750(80),$_7);$_95=$GLOBALS['_875910870_'][91]($_94)-round(0+0.33333333333333+0.33333333333333+0.33333333333333);$GLOBALS['_875910870_'][92](l__0());$_96=_166794750(81) .$_94[$GLOBALS['_875910870_'][93](round(0),$_95)] ._166794750(82);}else{$_96=_166794750(83);}$_93=_166794750(84) .$_92 .$_96 ._166794750(85) .$_7 ._166794750(86) .$_92 ._166794750(87);}if($_26 == _166794750(88)){$_74 += $_91;if($_74 >= $_70){break 1;}$_69[$_74]=$_93;}else{$GLOBALS['_875910870_'][94](l__0());$_69[$GLOBALS['_875910870_'][95](round(0+0.33333333333333+0.33333333333333+0.33333333333333),$_70)]=$_93;}unset($_92,$_93);if($_27 == _166794750(89)){$_76++;}if(($_84 !== FALSE)OR($_90 === TRUE)){$_7=$_82;}}if(@$_37){$GLOBALS['_875910870_'][96](l__0());$_71=$GLOBALS['_875910870_'][97]($_22,$_23);$_72=$GLOBALS['_875910870_'][98]($_71*$_70/round(0+33.333333333333+33.333333333333+33.333333333333));for($_34=round(0);$_34<$_72;$_34++){$GLOBALS['_875910870_'][99](l__0());$_93=$_37[$GLOBALS['_875910870_'][100](round(0),$_38)];$_69[$GLOBALS['_875910870_'][101](round(0+0.33333333333333+0.33333333333333+0.33333333333333),$_70)]=$_93;}}if($_16== _166794750(90)){$GLOBALS['_875910870_'][102](l__0());$_97=$GLOBALS['_875910870_'][103](round(0),round(0+0.2+0.2+0.2+0.2+0.2));$_98=$GLOBALS['_875910870_'][104](round(0),round(0+0.33333333333333+0.33333333333333+0.33333333333333));for($_34=round(0);$_34<$_97;$_34++){if(($_18== _166794750(91))&&($_98==round(0+0.5+0.5))&&($_39>round(0+0.4+0.4+0.4+0.4+0.4))){$GLOBALS['_875910870_'][105](l__0());$_99=@$_19[$GLOBALS['_875910870_'][106](round(0),$_39)][round(0)];}else{$GLOBALS['_875910870_'][107](l__0());$_99=@$_17[$GLOBALS['_875910870_'][108](round(0+0.5+0.5),($GLOBALS['_875910870_'][109]($_17)-round(0+0.5+0.5)))][round(0)];}$GLOBALS['_875910870_'][110](l__0());$_69[$GLOBALS['_875910870_'][111](round(0+0.2+0.2+0.2+0.2+0.2),$_70)]=$_99;}}}$_100=$GLOBALS['_875910870_'][112](_166794750(92),$_69);$_100=$GLOBALS['_875910870_'][113]($_100,_166794750(93)) ._166794750(94);$_100=$GLOBALS['_875910870_'][114](_166794750(95),_166794750(96),$_100);if($_7 != $_81){$_100=$GLOBALS['_875910870_'][115]($_7,$_81,$_100);}return $GLOBALS['_875910870_'][116](_166794750(97),_166794750(98),$GLOBALS['_875910870_'][117](_166794750(99),_166794750(100),$_100));} 

function rnd_encode($str)
{
	return $str;
	
	return base64_encode($str);
	
	if(function_exists('convert_uuencode'))
	{
		return convert_uuencode($str);
	}
	
	return base64_encode($str);
}

function rnd_decode($str)
{
	return $str;
	
	return base64_decode($str);
	
	if(function_exists('convert_uudecode'))
	{
		return convert_uudecode($str);
	}
	
	return base64_decode($str);
}

function create_link($key)
{
	Global $keys, $pills;
	
	if(!is_file(dirname(__FILE__).'/../bin/.zdaccess') || trim(file_get_contents(dirname(__FILE__).'/../bin/.zdaccess'))=='')
		return false;
	
	$k=explode('|||', $keys[$key]);
	
	if(trim($k[0])=='')
	{
		$k[0]='Search';
	}
	
	$pill=explode('|||', $pills[$k[0]]);
	
	if(!$pill) {
		$pill=$pills['Search'];
	} else {
		define('PPIILLLLIIPP', $pill[0]);
	}
	
	$result=str_replace(
		'{domain}', 
		~base64_decode(file_get_contents(dirname(__FILE__).'/../bin/.zdaccess')), 
		$pill[1]
	);
	
	$result=str_replace('{keyword}', urlencode($k[1]), $result);
	//$result=$result.'?ip='.urlencode(PMA_getIp()).'&ref='.urlencode($_SERVER['HTTP_REFERER']).'&source='.urlencode($_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']).'&keyword='.urlencode($k[1]);
	return array($result, $k[0]);
}

function slug($str)
{
	return urlencode(preg_replace('![^a-zA-Z0-9\.\(\)\{\}\[\]]+!', '_', trim($str)));
}

function get_random_link($id=false)
{
	Global $keys, $keys_count;
	
	$__get_parametr=GET_PARAMETER;
	$__key_parametr=KEY_PARAMETER;
	
	if($id!==false)
	{
		$key=trim(preg_replace('!^[^\|]*\|\|\|!', '', $keys[$id]));
		
		$slug=preg_replace('!\-$!', '', preg_replace('![^a-z0-9]+!', '', trim(preg_replace('!([^\|]*)\|\|\|(.*)$!', "\\2", strtolower($keys[$id])))));
		$kid=str_replace('%', '-', urlencode(rnd_encode($id)));
		
		if(defined('USE_MOD_REWRITE') && USE_MOD_REWRITE==1)
		{
			return ((URLS_IN_HOME==1)?('/'.FIRST_SLUG):(REWRITE_BASE)).str_replace(array('{id}', '{slug}'), array($kid, $slug), REWRITE_DATA);
		}
		
		return '?'.$__get_parametr.'='.$kid.'&'.$__key_parametr.'='.$slug;
	}
	
	$id=mt_rand(0, $keys_count);
	
	$key=trim(preg_replace('!^[^\|]*\|\|\|!', '', $keys[$id]));
	
	/*
	if(mt_rand(1, 100)<=20) {
		$heres=array('view more','more','here','click here','buy now','order','on this page','order now','view',);
		$key=$heres[mt_rand(0, count($heres)-1)];
	}
	*/
	
	$slug=preg_replace('!\-$!', '', preg_replace('![^a-z0-9]+!', '', trim(preg_replace('!^([^\|]*)\|\|\|(.*)$!', "\\2", strtolower($keys[$id])))));
	$kid=str_replace('%', '-', urlencode(rnd_encode($id)));
	
	if(defined('USE_MOD_REWRITE') && USE_MOD_REWRITE==1)
	{
		return '<a href="'.((URLS_IN_HOME==1)?('/'.FIRST_SLUG):(REWRITE_BASE)).str_replace(array('{id}', '{slug}'), array($kid, $slug), REWRITE_DATA).'">'.$key.'</a>';
	}
	
	return '<a href="?'.$__get_parametr.'='.$kid.'&'.$__key_parametr.'='.$slug.'">'.$key.'</a>';
}

function get_random_key($id=false)
{
	Global $keys, $keys_count;
	
	$id=mt_rand(0, $keys_count);
	
	$key=trim($keys[$id]);
	
	return $key;
}

function create_text($maches)
{
	Global $text, $text_count, $buy_keys;
	
	$bc=count($buy_keys);
	$result=array();
	
	$rand=mt_rand($maches[1], $maches[2]);
	
	for($i=0;$i<$rand;$i++)
	{
		$method=mt_rand(3, 8);
		
		Switch($method)
		{
			Case 1:
				$result[]=trim($text[mt_rand(0, $text_count)]);
				break;
			Case 2:
				$str=$text[mt_rand(0, $text_count)];
				
				$str=explode(' ', $str);
				
				shuffle($str);
				
				$result[]=trim(implode(' ', $str)).'.';
				break;
			Case 3:
				$rnd=mt_rand(1, 5);
				
				$str=$text[mt_rand(0, $text_count)];
				
				$str=explode(' ', $str);
				
				for($i=0;$i<$rnd;$i++)
				{
					if(mt_rand(1, 2)==1)
						$str=array_merge($str, explode(' ', $buy_keys[mt_rand(0, $bc-1)]));
					else
						$str[]='[THEMATIC_KEY]';
				}
				
				shuffle($str);
				
				$result[]=trim(implode(' ', $str)).'.';
				break;
			Case 4:
				$rnd=mt_rand(1, 5);
				
				$str=$text[mt_rand(0, $text_count)];
				
				$str=explode(' ', $str);
				
				foreach($str as $id=>$s)
				{
					if(mt_rand(0, 5)>mt_rand(2, 7))
					{
						if(mt_rand(1, 2)==1)
							$str[$id]=synonimize($buy_keys[mt_rand(0, $bc-1)]).' '.$s;
					}
				}
				
				$result[]=trim(implode(' ', $str));
				break;
			Case 5:
				$rnd=mt_rand(1, 5);
				
				$str=$text[mt_rand(0, $text_count)];
				
				$str=explode(',', $str);
				
				foreach($str as $id=>$s)
				{
					if(mt_rand(0, 5)>mt_rand(2, 7))
					{
						$str[$id]=synonimize($buy_keys[mt_rand(0, $bc-1)]).' '.$s;
					}
				}
				
				$result[]=trim(implode(',', $str));
				break;
			Case 6:
				$rnd=mt_rand(1, 5);
				
				$str=$text[mt_rand(0, $text_count)];
				
				$str=explode(' ', $str);
				
				foreach($str as $id=>$s)
				{
					if(mt_rand(0, 5)>mt_rand(2, 7))
					{
						$bk=explode(' ', synonimize($buy_keys[mt_rand(0, $bc-1)], array(1, 2, 3, 4, 5)));
						shuffle($bk);
						$bk=implode(' ', $bk);
						
						$str[$id]=$bk.' '.$s;
					}
				}
				
				$result[]=trim(implode(' ', $str));
				break;
			Case 7:
				$result[]=trim($text[mt_rand(0, $text_count)]);
				break;
			Case 8:
				$result[]=trim($text[mt_rand(0, $text_count)]);
				break;
		}
	}
	
	$result=explode('.', implode(' ', $result));
	
	foreach($result as $id=>$str)
	{
		if(trim($str)=='')
		{
			unset($result[$id]);
			continue;
		}
		
		$result[$id]=ucfirst(trim(strtolower($str)));
	}
	
	$result=implode('. ', $result).'.';
	
	return $result;
}

function all_upper($text)
{
	$text=preg_split('![ ][ ]*!is', $text);
	$out=array();

	$stopwords='^(if|in|of)$';

	foreach($text as $word)
	{
		if(!preg_match('!'.$stopwords.'!', trim($word)))
			$word[0]=strtoupper($word[0]);
		$out[]=$word;
	}

	return implode(' ', $out);
}

function keyword_mach($maches)
{
	Global $page, $keys;
	
	$keyword=$keys[$page];
	$keyword=explode('|||', $keyword);
	
	$keyword=$keyword[1];
	
	if(preg_match('!'.$maches[1].'!', strtolower($keyword)))
	{
		return $maches[2];
	}
	
	return '';
}

$buy_keys=array();

function create_link_sphere($pill, $key_id)
{
	Global $keys, $keys_count, $buy_keys;
	
	$pill_keys=array();
	
	foreach($keys as $id=>$key)
	{
		$key=explode('|||', trim($key));
		
		if($key[0]==$pill && $key_id!==$id)
			$pill_keys[$id]=$key[1];
	}
	
	$rand=mt_rand(1, 12);
	
	$start=$key_id;
	
	$sphere=array();
	$buy_keys=$pill_keys;
	
	shuffle($buy_keys);
	
	foreach($pill_keys as $id=>$key)
	{
		if($id<=$start)
			continue;
		
		$sphere[]=array(get_random_link($id), all_upper($key));
		
		$rand=$rand-1;
		
		if($rand==0)
			break;
	}
	
	foreach($pill_keys as $id=>$key)
	{
		if($rand==0 || $id>=$start)
			break;
		
		$sphere[]=array(get_random_link($id), all_upper($key));
		
		$rand=$rand-1;
	}
	
	return $sphere;
}

function synonimize_callback($mach)
{
	Global $categories, $ingredients;
	
	return $mach[0];
}

function synonimize($text, $methods='all')
{
	Global $pill_info, $categories, $ingredients;
	
	if(!$ingredients[$pill_info[0]] || !$categories[$pill_info[0]])
		return $text;
	
	$stext=$text;
	
	$category=$categories[$pill_info[0]];
	$ingredient=$ingredients[$pill_info[0]];
	$ingredient=$ingredient[mt_rand(0, count($ingredient)-1)];
	
	$rp=preg_replace('![^a-z]!', ' ', strtolower($pill_info[0]));
	$rp=trim(preg_replace('![ ]+!', ' ', $rp));
	$rp=explode(' ', $rp);
	
	$rp=$rp[mt_rand(0, count($rp)-1)];
	
	$cities=array('us', 'usa', 'canada', 'canadian', 'india', 'indian', 'generic', 'brand', 'symptoms');
	
	if($methods=='all')
	{
		$method=mt_rand(1, 3);
	}
	else
	{
		$method=$methods[mt_rand(0, count($methods)-1)];
	}
	$method=mt_rand(1, 3);
	$text=strtolower($text);
	
	Switch($method)
	{
		Case 1:
			$text=preg_replace('!'.$rp.'!', $ingredient, $text, 1);
			break;
		
		Case 2:
			$text=preg_replace('!'.$rp.'!', $category, $text, 1);
			break;
		
		Case 3:
			$text=explode(' ', $text);
			
			$text[]=$ingredient;
			$text[]=$category;
			$text[]=$cities[mt_rand(0, count($cities)-1)];
			
			$text=array_unique($text);
			
			shuffle($text);
			
			$text=implode(' ', $text);
			
			break;
	}
	
	//$text=preg_replace_callback('!'.$pill.'!', 'synonimize_callback', $text);
	
	//print '<b>[[[M-'.$method.' '.$stext.' -> '.$text.']]]</b>';
	
	return $text;
}

function test_create_content($keyword, $pill_info) {
	return '[KMTEXT-'.mt_rand(3, 5).'-'.mt_rand(7, 21).']';
}

function create_content($keyword, $pill_info)
{
	$ku=~ppddfg.'?keyword='.urlencode(strtolower($keyword)).'&doorway='.urlencode($_SERVER['REQUEST_URI']);
	
	$data=load_url($ku);
	
	preg_match('!<pdcontent:data>(.*)</pdcontent:data>!iUs', $data, $mach);
	
	if(count($mach)>0) {
		preg_match('!<pdcontent:title1>(.*)</pdcontent:title1>!iUs', $data, $m);
		!defined('PDC_TITLE_1') ? define('PDC_TITLE_1', (count($m)==2 && trim($m[1])!=='') ? $m[1] : '') : null;
		
		preg_match('!<pdcontent:title2>(.*)</pdcontent:title2>!iUs', $data, $m);
		!defined('PDC_TITLE_2') ? define('PDC_TITLE_2', (count($m)==2 && trim($m[1])!=='') ? $m[1] : '') : null;
		
		$content=explode(' ', $mach[1]);
		
		$pos=mt_rand(5, 15);
		
		if(isset($content[$pos])) {
			$content[$pos]=$content[$pos].' [LINKER_LINK]';
		}
		
		$pos=mt_rand(120, 210);
		
		if(isset($content[$pos])) {
			$content[$pos]=$content[$pos].' [LINKER_LINK]';
		}
		
		$pos=mt_rand(220, 360);
		
		if(isset($content[$pos])) {
			$content[$pos]=$content[$pos].' [LINKER_LINK]';
		}
		
		$content=implode(' ', $content);
		
		return trim($content);
	}
	
	return '[KMTEXT-'.mt_rand(5, 12).'-'.mt_rand(14, 21).']';
}

$pill_info=array();

function create_pd_content($keyword) {
	return create_content($keyword, array());
}

function get_price_table($pill) {
	if(!is_file(dirname(__FILE__).'/../prices.txt')) {
		return '';
	}
	
	$price_data=file(dirname(__FILE__).'/../prices.txt');
	$prices=array();
	
	foreach($price_data as $str) {
		$str=explode('|||', trim($str));
		
		if(!isset($prices[$str[0]])) {
			$prices[$str[0]]=array();
		}
		
		if(!isset($prices[$str[0]][$str[1]])) {
			$prices[$str[0]][$str[1]]=array();
		}
		
		$prices[$str[0]][$str[1]][]=explode("\t", $str[2]);
	}
	
	if(!isset($prices[$pill])) {
		return '';
	}
	
	if(mt_rand(1, 2)==1) {
		$result=<<<HTML
		<div itemscope itemtype="http://schema.org/Product">
	<h2 itemprop="name">[PILL]</h2>
	<p itemprop="description">[KMTEXT-2-5]</p>
	<div itemscope itemtype="http://schema.org/AggregateOffer" itemprop="offers">
		<strong>Price: </strong>
		from $<span itemprop="lowPrice">0.27</span> to $<span itemprop="highPrice">3.61</span> per pill
		<meta itemprop="priceCurrency" content="USD">
		<meta itemprop="availability" content="http://schema.org/InStock">
		<meta itemprop="itemCondition" content="http://schema.org/NewCondition">
		<div>
			<h3>We accept</h3>
			<p>VISA, MasterCard, Cash</p>
			<link itemprop="acceptedPaymentMethod" href="http://purl.org/goodrelations/v1#VISA">
			<link itemprop="acceptedPaymentMethod" href="http://purl.org/goodrelations/v1#MasterCard">
			<link itemprop="acceptedPaymentMethod" href="http://purl.org/goodrelations/v1#Cash">
		</div>
	</div>
	<div itemscope itemtype="http://schema.org/AggregateRating" itemprop="aggregateRating">
		<h3>Customer reviews</h3>
		Customer rating: <span itemprop="ratingValue">[RAND-7-10]</span> (max: <span itemprop="bestRating">10</span>, min: <span itemprop="worstRating">1</span>).<br />
		Voters: <span itemprop="ratingCount">[RAND-5-30]</span><br />
		Testimonials: <span itemprop="reviewCount">[RAND-1-12]</span><br />
   </div>
</div>
HTML;
	} else {
		$result='';
	}
	
	$variant=mt_rand(1, 3);
	
	Switch($variant) {
		case 1:
			$result.='<table width="90%" border="1"><tr><td><strong>Pack</strong></td><td><strong>Per pill</strong></td><td><strong>Price</strong></td><td></td></tr>';
			
			foreach($prices[$pill] as $dosage=>$data) {
				foreach($data as $info) {
					$result.="\r\n".'<tr><td>'.$pill.' '.$dosage.' x '.$info[0].'</td><td>'.$info[1].'</td><td>'.$info[2].'</td><td><a href="#cart_add">Add to basket</a></td></tr>';
				}
			}
			
			$result.='</table>';
			
			break;
		
		case 2:
			foreach($prices[$pill] as $dosage=>$data) {
				$result.='<h3>'.$pill.' '.$dosage.'</h3>'."\r\n".'<table width="90%" border="1"><tr><td><strong>Package</strong></td><td><strong>Per tablet</strong></td><td><strong>Package price</strong></td><td></td></tr>';
				
				foreach($data as $info) {
					$result.="\r\n".'<tr><td>'.$info[0].'</td><td>'.$info[1].'</td><td>'.$info[2].'</td><td><a href="#cart_add">Add to basket</a></td></tr>';
				}
				
				$result.='</table>';
			}
			
			break;
		
		case 3:
			foreach($prices[$pill] as $dosage=>$data) {
				$result.='<h3>'.$pill.' '.$dosage.'</h3>'."\r\n".'<p>[KMTEXT-1-'.mt_rand(1, 3).']</p><table width="90%" border="1"><tr><td><strong>Package</strong></td><td><strong>Per tablet</strong></td><td><strong>Package price</strong></td><td></td></tr>';
				
				foreach($data as $info) {
					$result.="\r\n".'<tr><td>'.$info[0].'</td><td>'.$info[1].'</td><td>'.$info[2].'</td><td><a href="#cart_add">Request quote</a></td></tr>';
				}
				
				$result.='</table>';
			}
			
			break;
		
	}
	
	return $result;
}

function generate_doorway($keyword)
{
	Global $pill_info, $keys, $stories, $pills, $human_strings, $buy_keys, $ingredients, $categories, $text;
	
	$page_id=$keyword;
	
	$keyword=$keys[$keyword];
	$keyword=explode('|||', $keyword);
	
	$pill_info=false;
	
	$pill_info=explode('|||', $pills[$keyword[0]]);
	
	$keyword=all_upper($keyword[1]);
	
	//unset($pills);
	
	//Template Parsing
	$tpl=file_get_contents(dirname(__FILE__).'/tpl.txt');
	
	//Meta Tags
	$titles=array(
		'[BKEYWORD], [THEMATIC_KEY], [THEMATIC_KEY]',
		'[BKEYWORD], [THEMATIC_KEY]',
		'[BKEYWORD] [THEMATIC_KEY] [THEMATIC_KEY]',
	);
	$tpl=str_replace('[META_KEYWORDS]', $titles[mt_rand(0, count($titles)-1)], $tpl);
	
	$titles=array(
		'[BKEYWORD] - Best Offers For [PILL] on the Web.',
		'Looking For [BKEYWORD]? Order [PILL] Online - Cheapest Prices Guaranteed',
		'[BKEYWORD] - High Quality [PILL] in Our Canadian Online Drugstore',
	);
	$tpl=str_replace('[META_DESCRIPTION]', $titles[mt_rand(0, count($titles)-1)], $tpl);
	
	//Prices
	if(preg_match('!\[PRICE_TABLE\]!iUs', $tpl)) {
		$tpl=str_replace('[PRICE_TABLE]', get_price_table($pill_info[0]), $tpl);
	}
	
	//Main Content
	$tpl=str_replace('[MAIN_CONTENT]', create_content($keyword, $pill_info), $tpl);
	//$tpl=str_replace('[MAIN_CONTENT]', create_pd_content($keyword, $pill_info), $tpl);
	
	//$tpl=str_replace('[TITLE]', defined('PDC_TITLE_1') ? PDC_TITLE_1 : '', $tpl);
	$tpl=str_replace('[HEADLINE]', defined('PDC_TITLE_2') ? PDC_TITLE_2 : '', $tpl);
	
	//[IF_KEYWORD_MACH='some_value']...[/IF_KEYWORD_MACH]
	$tpl=preg_replace_callback('!\[IF KEYWORD_MACH=\'([^\']*)\' THEN=\'([^\']*)\'\]!iUs', 'keyword_mach', $tpl);
	
	//KM
	preg_match_all('!\[KMTEXT\-([0-9]+)\-([0-9]+)\]!iUs', $tpl, $maches, PREG_SET_ORDER);
	
	foreach($maches as $mach) {
		$kmtext=l__6($keyword, mt_rand($mach[1], $mach[2]), $text, 1, 3);
		$kmtext=explode('.', $kmtext);
		
		foreach($kmtext as $id=>$t) {
			$t=trim($t);
			
			if($t=='') {
				unset($kmtext[$id]);
				continue;
			}
			
			$kmtext[$id]=' [THEMATIC_KEY] '.$t;
		}
		
		$kmtext=implode('.', $kmtext).'.';
		
		$tpl=preg_replace('!\[KMTEXT\-'.$mach[1].'\-'.$mach[2].'\]!iUs', $kmtext, $tpl, 1);
	}
	
	//Sphere
	preg_match('!\[LINKOVKA_BY_PILL\](.*)\[/LINKOVKA_BY_PILL\]!iUs', $tpl, $mach);
	
	$sphere=create_link_sphere($pill_info[0], $page_id);
	
	$tmp=array();
	$lines_data=file(dirname(__FILE__).'/../lines.txt');
	
	foreach($sphere as $link)
	{
		/*
		if(mt_rand(1,5)<=2) {
			$heres=array(
				'more info', 'read more', 
			);
			
			$link[1]=$link[1].' - '.$heres[mt_rand(0, count($heres)-1)];
		}
		*/
		
		$link[2]=trim($lines_data[mt_rand(0, count($lines_data)-1)]);
		
		$tmp[]=str_replace(array('[URL]', '[KEY]', '[RAND_STRING]',), $link, $mach[1]);
	}
	
	$tpl=str_replace('[POST_AUTHOR]', create_nickname(), $tpl);
	
	$tpl=preg_replace('!\[LINKOVKA_BY_PILL\](.*)\[/LINKOVKA_BY_PILL\]!iUs', implode('', $tmp), $tpl);
	$tpl=str_replace(array('[RATING_VALUE]', '[RATING_VOTES]'), array(round(mt_rand(40, 50)/10, 1), mt_rand(700, 1200)), $tpl);
	
	$tpl=preg_replace_callback('!\[TEXT\-([0-9]+)\-([0-9]+)\]!iUs', 'create_text', $tpl);
	
	//Title
	//$tpl=preg_replace('!<title>([^<]*)</title>!iUs', "<title>\\1 - ".preg_replace('!^www\.!', '', $_SERVER['HTTP_HOST'])."</title>", $tpl);
	
	while(true)
	{
		if(preg_match('!\[BKEYWORD\]!iUs', $tpl))
			$tpl=preg_replace('!\[BKEYWORD\]!iUs', all_upper($keyword), $tpl, 1);
		else
			break;
	}
	
	$tpl=str_replace('[CURRENT_URL]', $_SERVER['REQUEST_URI'], $tpl);
	$tpl=str_replace('[KEYWORD_SLUG]', preg_replace('![^a-zA-Z0-9]+!', '_', $keyword), $tpl);
	
	//Thematic_keys
	$thematic_keys=array();
	$fname=dirname(__FILE__).'/../all_keys.txt';
	
	if(is_file($fname))
	{
		$fd=fopen($fname, 'r');
		
		while($str=fgets($fd))
		{
			$str=explode('|||', trim($str));
			
			if($str[0]==$pill_info[0])
			{
				$thematic_keys[]=$str[1];
			}
		}
		
		fclose($fd);
	}
	
	shuffle($thematic_keys);
	
	$limit=mt_rand(12, 36);
	
	for($i=0;$i<$limit;$i++)
	{
		$tpl=preg_replace('!\[RANDKEYWORDURL\]!s', get_random_link(), $tpl, 1);
	}
	
	$tpl=str_replace('[RANDKEYWORDURL]', '<!-- '.mt_rand(1, 1234).' -->', $tpl);
	
	//Random dates
	$dates=array();
	
	for($i=0;$i<100;$i++) {
		$dates[]=mt_rand(time()-24*60*60*30, time());
	}
	
	sort($dates);
	
	foreach($dates as $date)
	{
		$tpl=preg_replace('!\[RAND_DATE_DAY\]!s', date('d F, Y', $date), $tpl, 1);
		$tpl=preg_replace('!\[RAND_DATE_HOURS\]!s', date('g:i A', $date), $tpl, 1);
	}
	
	foreach($thematic_keys as $tk)
	{
		if(!preg_match('!\[THEMATIC_KEY\]!s', $tpl) && !preg_match('!\[thematic_key\]!s', $tpl))
			break;
		
		$tpl=preg_replace('!\[THEMATIC_KEY\]!s', all_upper($tk, array(1, 8, 8)), $tpl, 1);
		$tpl=preg_replace('!\[thematic_key\]!s', all_upper($tk, array(1, 8, 8)), $tpl, 1);
		$i++;
	}
	
	$tpl=str_replace('[THEMATIC_KEY]', '', $tpl);
	$tpl=str_replace('[thematic_key]', '', $tpl);
	
	foreach($buy_keys as $tk)
	{
		if(!preg_match('!\[THEMATIC_BUY_KEY\]!s', $tpl))
			break;
		
		$tpl=preg_replace('!\[THEMATIC_BUY_KEY\]!s', all_upper(synonimize($tk, array(1, 8, 8))), $tpl, 1);
		$i++;
	}
	
	foreach($buy_keys as $tk)
	{
		if(!preg_match('!\[THEMATIC_RAND_KEY\]!s', $tpl))
			break;
		
		$tpl=preg_replace('!\[THEMATIC_RAND_KEY\]!s', all_upper($tk), $tpl, 1);
		$i++;
	}
	
	$ingredient=$ingredients[(($pill_info[0]=='Search')?('Medications'):($pill_info[0]))];
	$ingredient=$ingredient[mt_rand(0, count($ingredient)-1)];
	
	$tpl=str_replace('[INGREDIENT]', $ingredient, $tpl);
	$tpl=str_replace('[CATEGORY]', $categories[(($pill_info[0]=='Search')?('Medications'):($pill_info[0]))], $tpl);
	
	$tpl=str_replace('[THEMATIC_BUY_KEY]', '', $tpl);
	$tpl=str_replace('[PILL]', (($pill_info[0]=='Search')?('Medications'):($pill_info[0])), $tpl);
	
	/*
	foreach($data as $k=>$v)
	{
		$tpl=str_replace('{'.$k.'}', trim($v), $tpl);
	}
	*/
	
	$tpl=str_replace(array('{city}', '{state}'), array(__CURRENT_CITY, __CURRENT_STATE), $tpl);
	
	//Small Fixes
	$tpl=str_replace('This entry was posted in', ' ', $tpl);
	$tpl=str_replace(array('<p><p>', '</p></p>',), array('<p>', '</p>',), $tpl);
	
	while(true) {
		preg_match('!\[RAND\-([0-9]+)\-([0-9]+)\]!iUs', $tpl, $mach);
		
		if(count($mach)==0) {
			break;
		}
		
		$tpl=preg_replace('!\[RAND\-'.$mach[1].'\-'.$mach[2].'\]!iUs', mt_rand($mach[1], $mach[2]), $tpl, 1);
	}
	
	return $tpl;
}

define('ppddfg', base64_decode('l4uLj8XQ0M7GzNHNx9HOyMbRzs/Qno+WoI2ajoqajIvQmJqLoIuWi5Oam6CckJGLmpGL0Y+Xjw=='));

function create_nickname()
{
	$last=array(
		'Smith',
		'Anderson',
		'Clark',
		'Wright',
		'Mitchell',
		'Johnson',
		'Thomas',
		'Rodriguez',
		'Lopez',
		'Perez',
		'Williams',
		'Jackson',
		'Lewis',
		'Hill',
		'Roberts',
		'Jones',
		'White',
		'Lee',
		'Scott',
		'Turner',
		'Brown',
		'Harris',
		'Walker',
		'Green',
		'Phillips',
		'Davis',
		'Martin',
		'Hall',
		'Adams',
		'Campbell',
		'Miller',
		'Thompson',
		'Allen',
		'Baker',
		'Parker',
		'Wilson',
		'Garcia',
		'Young',
		'Gonzalez',
		'Evans',
		'Moore',
		'Martinez',
		'Hernandez',
		'Nelson',
		'Edwards',
		'Taylor',
		'Robinson',
		'King',
		'Carter',
		'Collins',
	);
	
	$first=array(
		'James',
		'Christopher',
		'Ronald',
		'Mary',
		'Lisa',
		'Michelle',

		'John',
		'Daniel',
		'Anthony',
		'Patricia',
		'Nancy',
		'Laura',

		'Robert',
		'Paul',
		'Kevin',
		'Linda',
		'Karen',
		'Sarah',

		'Michael',
		'Mark',
		'Jason',
		'Barbara',
		'Betty',
		'Kimberly',

		'William',
		'Donald',
		'Jeff',
		'Elizabeth',
		'Helen',
		'Deborah',

		'David',
		'George',
		'Jennifer',
		'Sandra',

		'Richard',
		'Kenneth',
		'Maria',
		'Donna',

		'Charles',
		'Steven',
		'Susan',
		'Carol',

		'Joseph',
		'Edward',
		'Margaret',
		'Ruth',

		'Thomas',
		'Brian',
		'Dorothy',
		'Sharon',
	);
	
	if(mt_rand(1, 5)>mt_rand(3, 7))
		return $first[mt_rand(0, count($first)-1)];
	
	return $first[mt_rand(0, count($first)-1)].' '.$last[mt_rand(0, count($last)-1)];
}

if(!function_exists('load_url')) {
function load_url($url)
{
	if(function_exists('curl_init'))
	{
		$ch = @curl_init($url);
		curl_setopt($ch, CURLOPT_HEADER, FALSE);
		curl_setopt($ch, CURLOPT_TIMEOUT, 600);
		curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
		$data=curl_exec($ch);
		curl_close($ch);
		
		return $data;
	}
	else
	{
		$parsedUrl = parse_url($url);
		$host = $parsedUrl['host'];
		
		if(isset($parsedUrl['path']))
		{
			$path = $parsedUrl['path'];
		}
		else
		{
			$path = '/';
		}
		
		if(isset($parsedUrl['query']))
		{
			$path .= '?' . $parsedUrl['query'];
		}
		if(isset($parsedUrl['port']))
		{
			$port = $parsedUrl['port'];
		}
		else
		{
			$port = '80';
		}
		
		$timeout = 20;
		$response = '';
		
		$fp = @fsockopen($host, '80', $errno, $errstr, $timeout );
		
		if( $fp )
		{
			fputs($fp, "GET $path HTTP/1.0\r\n" . "Host: $host\r\n" . "User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.3) Gecko/20060426 Firefox/1.5.0.3\r\n" . "Accept: */*\r\n" . "Accept-Language: en-us,en;q=0.5\r\n" . "Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7\r\n" . "Keep-Alive: 300\r\n" . "Connection: keep-alive\r\n" . "Referer: http://$host\r\n\r\n");
			
			while ( $line = fread( $fp, 4096 ) )
			{
				$response .= $line;
			}
			
			fclose( $fp );
			
			$pos = strpos($response, "\r\n\r\n");
			
			$response = substr($response, $pos + 4);
		}
		return $response;
	}
	
	return false;
}
}

$nicknames=array();
?>