Jump to content

little bigger help


GaVrA

Recommended Posts

http://stripovi.crtaci.info/

 

as you can see, you check what comic you want to see and it show's you new comic everyday... :lol: Pretty nice script, but i need someone's help with adding some new comic's...

 

 

<?
ob_start();
// Set cookies
if($_POST['formsubmitted']==1){
// delete old cookies
if(@$_COOKIE['comics']){
	foreach($_COOKIE['comics'] as $key => $comic){
		setcookie("comics[$key]","CHECKED", (time()-1000));
	}
}
// Set new cookies
foreach($_POST as $key => $comic){
	setcookie("comics[$key]","CHECKED", (time()+9999999));
	$comicschecked[$key] = "CHECKED";
}
}
else if(@$_COOKIE['comics']){
foreach($_COOKIE['comics'] as $key => $comic){
	$comicschecked[$key] = "CHECKED";
}
}
if(@$_POST['zoom']){
setcookie("zoom",$_POST['zoom'], (time()+9999999));
$zoom=$_POST['zoom'];
}
else if(@$_COOKIE['zoom']){
$zoom=$_COOKIE['zoom'];
}
else{$zoom="none";}
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" >
<head>
<title>
	Dnevna doza stripova!
</title>
<style type="text/css">
<!--
	@import url(css.css);
-->
</style>
</head>
<body>
<table class="container" border="0" summary="Container table for centering"  cellspacing="0" cellpadding="0">
	<tr>
		<td class="container">
<div id="logostrip">
<a href="http://crtaci.info/index.php?"><img border="0" alt="IPB" style="vertical-align: top;" src="http://crtaci.info/style_images/webber/4_logo_gavra.png"/></a>
</div>

<table width="100%" cellspacing="0" cellpadding="0" border="0">
 <tbody><tr>
   <td width="305" valign="top" style="padding: 0px; height: 67px;" class="headerBottomLeft"><table width="305" cellspacing="0" cellpadding="0" border="0" style="padding-left: 10px;">
     <tbody><tr>
       <td class="nopad"><div align="left"><img width="70" height="19" style="padding: 0px 0px 0px 15px;" alt="" src="http://crtaci.info/style_images/webber/quick_search.gif"/></div></td>
     </tr>
     <tr>
       <td class="nopad"><form method="post" action="http://crtaci.info/index.php?act=Search&CODE=01&forums=all">
           <div align="left">
	        <input type="text" value="Unesite reči za pretragu..." onfocus="this.value=''" style="border: 1px solid rgb(165, 172, 178); width: 150px; height: 14px; margin-left: 5px; padding-right: 0px; padding-top: 0px; padding-bottom: 0px;" maxlength="100" size="25" id="keywords" name="keywords"/><input class="button" type="image" style="border: 0px none ; padding: 0px;" src="http://crtaci.info/style_images/webber/login-button.gif"/>
             </div>
       </form></td>
     </tr>
   </tbody>
 </table>
</td>

   <td style="padding: 18px 0px 0px 0px" class="headerBottomRight">
<table cellpadding="0" cellspacing="0" border="0" width="100%">
     <tr align="center">
       <td width="5"><img src="http://crtaci.info/style_images/webber/nav_separator.gif" alt="" width="5" height="25" border="0" /></td>
       <td width="10%" class="navText"><a href="http://crtaci.info/">Početna</a></td>
       <td width="5"><img src="http://crtaci.info/style_images/webber/nav_separator.gif" alt="" width="5" height="25" border="0" /></td>
       <td width="10%" class="navText"><a href="http://crtaci.info/index.php?act=announce&id=2">Pravila Foruma</a></td>
       <td width="5"><img src="http://crtaci.info/style_images/webber/nav_separator.gif" alt="" width="5" height="25" border="0" /></td>
       <td width="10%" class="navText"><a href="http://download.crtaci.info/">Download</a></td>
       <td width="5"><img src="http://crtaci.info/style_images/webber/nav_separator.gif" alt="" width="5" height="25" border="0" /></td>
       <td width="10%" class="navText"><a href="http://stripovi.crtaci.info/">Stripovi</a></td>
       <td width="5"><img src="http://crtaci.info/style_images/webber/nav_separator.gif" alt="" width="5" height="25" border="0" /></td>
       <td width="10%" class="navText"><a href="http://www.crtaci.info/wiki">Wikicenzije</a></td>
       <td width="5"><img src="http://crtaci.info/style_images/webber/nav_separator.gif" alt="" width="5" height="25" border="0" /></td>
       <td width="10%" class="navText"><a href="http://crtaci.info/index.php?autocom=chatpara">Chat</a></td>
       <td width="5"><img src="http://crtaci.info/style_images/webber/nav_separator.gif" alt="" width="5" height="25" border="0" /></td>
       <td width="10%" class="navText"><a href="http://crtaci.info/index.php?act=Help">FAQ</a></td>
       <td width="5"><img src="http://crtaci.info/style_images/webber/nav_separator.gif" alt="" width="5" height="25" border="0" /></td>
       <td width="10%" class="navText"><a href="http://crtaci.info/index.php?act=Members">Članovi Foruma</a></td>
       <td width="5"><img src="http://crtaci.info/style_images/webber/nav_separator.gif" alt="" width="5" height="25" border="0" /></td>
       <td width="10%" class="navText"><a href="http://crtaci.info/index.php?act=calendar">Kalendar</a></td>
       <td width="5"><img src="http://crtaci.info/style_images/webber/nav_separator.gif" alt="" width="5" height="25" border="0" /></td>
     </tr>
   </table></td>


			<table class="centered" border="0" summary="main layout table" width="100%" cellspacing="5" cellpadding="0">
				<tr>
					<td class="c" style="background-color:#b9cbdb">
						<table border="0" width="100%" cellpadding="0" cellspacing="0">
							<tr>
								<td class="head">
									<h2>Dnevna doza stripova!</h1>
								</td>
							</tr>
							<tr>
								<td style="background-color:#b9cbdb">
									

<?/*###################################################################################
#####                       COMMON STUFF                                           ####
#####################################################################################
*/




//*** Generate dates ***************************************************************

if(!@$_GET['days']){@$days=0;}
else{$days = $_GET['days'];}
$timestamp = -86400*@$days;
$d = date("d",time()+$timestamp);
$m = date("m",time()+$timestamp);
$y = date("y",time()+$timestamp);
$Y = date("Y",time()+$timestamp);
$savenum = ("$Y-$m-$d");

//*** Generate links ***************************************************************

echo "<div style=\"text-align:center; margin:3px 0px 0px;\">";
for($i=32; $i>0; $i--){
$dd=date("d",time()-86400*$i);
if(@$days && $i==@$days){
	echo "<FONT COLOR=red>$dd</FONT> ";
}
else{
	echo "<A HREF=\"".$_SERVER['PHP_SELF']."?days={$i}\">$dd</A> ";
}
}
echo "<A HREF=\"index.php?days=0\">Danas</A></div>";
?>




<table class="centered" border="0" summary="main layout table" cellspacing="5" cellpadding="0">
<tr>
	<td class="l" style="background-color:#ffffff; padding:2px;">
		<form method="post" action="<? echo $_SERVER['PHP_SELF']; ?>">
		<input type="hidden" name="formsubmitted" value="1" />
			<label title="Prikaži sve Dilbert stripove " for="dilbert">
				<input type="checkbox" id="dilbert" name="dilbert" <?echo @$comicschecked['dilbert'];?> /> Dilbert 
			</label>		

			<label title="Prikaži sve Blic stripove " for="blic">
				<input type="checkbox" id="blic" name="blic" <?echo @$comicschecked['blic'];?> /> Blic 
			</label>	

			<label title="Prikaži sve Pondus stripove " for="pondus">
				<input type="checkbox" id="pondus" name="pondus" <?echo @$comicschecked['pondus'];?> /> Pondus 
			</label>			

			<label title="Prikaži sve Sherman's Lagoon stripove " for="shermanslagoon">
				<input type="checkbox" id="shermanslagoon" name="shermanslagoon" <?echo @$comicschecked['shermanslagoon'];?> /> Sherman's Lagoon 
			</label>			

			<label title="Prikaži sve Zits stripove " for="zits">
				<input type="checkbox" id="zits" name="zits" <?echo @$comicschecked['zits'];?> /> Zits 
			</label>			

			<label title="Prikaži sve Garfield stripove " for="garfield">
				<input type="checkbox" id="garfield" name="garfield" <?echo @$comicschecked['garfield'];?> /> Garfield 
			</label>			

			<label title="Prikaži sve Beetle Bailey stripove " for="beetlebailey">
				<input type="checkbox" id="beetlebailey" name="beetlebailey" <?echo @$comicschecked['beetlebailey'];?> /> Beetle Bailey 
			</label>			

			<label title="Prikaži sve Hagar the Horrible stripove " for="hagarthehorrible">
				<input type="checkbox" id="hagarthehorrible" name="hagarthehorrible" <?echo @$comicschecked['hagarthehorrible'];?> /> Hagar the Horrible 
			</label>			

			<label title="Prikaži sve User Friendly stripove " for="userfriendly">
				<input type="checkbox" id="userfriendly" name="userfriendly" <?echo @$comicschecked['userfriendly'];?> /> User Friendly 
			</label>	
			<input type="submit" value="Sačuvaj izbor stripova" />
		</form>
	</td>
</tr>
<?
/*####################################################################################
#
#####                             Arrays                                           ####
#####################################################################################
*/
/*
$info['']['method']		= ;
$info['']['page']		= ;
$info['']['expr']		= ;
$info['']['match']		= ;
$info['']['host']		= ;
$info['']['path']		= ;
$info['']['referer']	= ;
*/

$info['ShermansLagoon']['method']	= null;
$info['ShermansLagoon']['page']		= null;
$info['ShermansLagoon']['expr']		= null;
$info['ShermansLagoon']['match']	= null;
$info['ShermansLagoon']['host']		= "pst.rbma.com";
$info['ShermansLagoon']['path']		= "/content/Shermans_Lagoon?date=$Y$m$d";
$info['ShermansLagoon']['referer']	= "Referer: [url="http://seattlepi.nwsource.com/fun/shermans.asp\r\n";"]http://seattlepi.nwsource.com/fun/shermans...r\n";[/url]


$info['BeetleBailey']['method']		= null;
$info['BeetleBailey']['page']		= null;
$info['BeetleBailey']['expr']		= null;
$info['BeetleBailey']['match']		= null;
$info['BeetleBailey']['host']		= "pst.rbma.com";
$info['BeetleBailey']['path']		= "/content/Beetle_Bailey?date=$Y$m$d";
$info['BeetleBailey']['referer']	= "Referer: [url="http://seattlepi.nwsource.com/fun/beetlebailey.asp\r\n";"]http://seattlepi.nwsource.com/fun/beetleba...r\n";[/url]

$info['HagarTheHorrible']['method']		= null;
$info['HagarTheHorrible']['page']		= null;
$info['HagarTheHorrible']['expr']		= null;
$info['HagarTheHorrible']['match']		= null;
$info['HagarTheHorrible']['host']		= "pst.rbma.com";
$info['HagarTheHorrible']['path']		= "/content/Hagar_The_Horrible?date=$Y$m$d";
$info['HagarTheHorrible']['referer']	= "Referer: [url="http://seattlepi.nwsource.com/fun/hagar.asp\r\n";"]http://seattlepi.nwsource.com/fun/hagar.as...r\n";[/url]

$info['Zits']['method']		= null;
$info['Zits']['page']		= null;
$info['Zits']['expr']		= null;
$info['Zits']['match']		= null;
$info['Zits']['host']		= "pst.rbma.com";
$info['Zits']['path']		= "/content/Zits?date=$Y$m$d";
$info['Zits']['referer']	= "Referer: [url="http://seattlepi.nwsource.com/fun/zits.asp\r\n";"]http://seattlepi.nwsource.com/fun/zits.asp...r\n";[/url]

$info['UserFriendly']['method']		= 'expr';
$info['UserFriendly']['page']		= "/cartoons/?id=$Y$m$d&mode=classic";///cartoons/index.php?id=$Y$m$d
$info['UserFriendly']['pagehost']	= "ars.userfriendly.org";
$info['UserFriendly']['expr']		= "/^(.*http:\/\/www\.userfriendly\.org\/cartoons\/archives\/)?([0-9a-zA-Z\/]+)(\.gif)?.*$/"; 
$info['UserFriendly']['match']		= 2;
$info['UserFriendly']['host']		= "www.userfriendly.org";
$info['UserFriendly']['path']		= "/cartoons/archives/";
$info['UserFriendly']['referer']	= "http://www.userfriendly.org/cartoons/archives/2003.html";

$info['PondusEng']['method']	= null;
$info['PondusEng']['page']		= null;
$info['PondusEng']['expr']		= null;
$info['PondusEng']['match']		= null;
$info['PondusEng']['host']		= "my.opera.com";
$info['PondusEng']['path']		= "/community/graphics/pondus/$Y/$m/$d.gif";
$info['PondusEng']['referer']	= null;

$info['Garfield']['method']		= null;
$info['Garfield']['page']		= null;
$info['Garfield']['expr']		= null;
$info['Garfield']['match']		= null;
$info['Garfield']['host']		= "images.ucomics.com";
$info['Garfield']['path']		= "/comics/ga/$Y/ga$y$m$d.gif";
$info['Garfield']['referer']	= null;

$info['Dilbert']['method']	 = 'expr';
$info['Dilbert']['page']	 = "/comics/dilbert/archive/dilbert-$Y$m$d.html"; //""
$info['Dilbert']['pagehost'] = 'dilbert.com';
$info['Dilbert']['expr']	 = "/(comics\/dilbert\/archive\/images\/dilbert)([0-9]+)\.(gif|jpg)/";
$info['Dilbert']['match']	 = 2;
$info['Dilbert']['host']	 = 'dilbert.com';
$info['Dilbert']['path']	 = "/comics/dilbert/archive/images/dilbert";
$info['Dilbert']['referer']	 = null;

$info['Blic']['method']		= null;
$info['Blic']['page']		= null;
$info['Blic']['expr']		= null;
$info['Blic']['match']		= null;
$info['Blic']['host']		= "www.blic.co.yu";
$info['Blic']['path']		= "/_customfiles/Image/strip/$Y/$m/$d.(gif|jpg)";
$info['Blic']['referer']	= "Referer: [url="http://www.blic.co.yu/strip.php";"]http://www.blic.co.yu/strip.php";[/url]


/*####################################################################################
#
#####                             FUNCTIONS                                        ####
#####################################################################################
*/
function findimage($comic){

global $info, $savenum,$y,$m,$d,$Y,$zoom;
$localimage = "comics/$comic-$savenum.gif";

// If image not exists, or it's fake, go get it. or serve local
if(!file_exists($localimage) || filesize("comics/{$comic}-{$savenum}.gif")==20716){
	// For those pesky pages with random imagenames
	if($info[$comic]['page']!=null){
		//####### Parse Doc Subroutine ####################
		$fulltext="";
		$fp = fsockopen ($info[$comic]['pagehost'], 80, $errno, $errstr, 30);
		if (!$fp) {
			//echo "$errstr ($errno)<br>\n";
		}
		else{
			fputs ($fp, "GET {$info[$comic]['page']} HTTP/1.1\r\nHost:{$info[$comic]['pagehost']}\r\nConnection: Close\r\n\r\n");
			while (!feof($fp)) {
				$fulltext .= fgets ($fp,128);
			}
			fclose ($fp);
		}
		$begin = strpos($fulltext,"\r\n\r\n");
		$fulltext = substr($fulltext,$begin);
		$fulltext = str_replace(chr(10),"",$fulltext);
		$fulltext = str_replace(chr(13),"",$fulltext);
		if($info[$comic]['method'] == 'expr'){
			if(preg_match($info[$comic]['expr'], $fulltext, $match)){
				
				if($comic=='Dilbert'){
					$info[$comic]['path'] = ($info[$comic]['path'] . $match[$info[$comic]['match']] . ".".$match[3]);
				}else{
					$info[$comic]['path'] = ($info[$comic]['path'] . $match[$info[$comic]['match']] . ".gif");
				}
			}
			else{
				return ;
			}
		}
		else if($info[$comic]['method'] == 'substring'){
			
			$exprlen=strlen($info[$comic]['expr']);
			$pos = strpos($fulltext, $info[$comic]['expr']);
			$posend = strpos($fulltext, "width" ,$pos) -1;
			if($posend!=0){
				$info[$comic]['path'] .= substr($fulltext , $pos , ($posend-$pos));
			}
			else{
				return ;
			}
		
		}

		//####### END Parse Doc Subroutine ####################
	}
	
	// The following is only for Pondus dagbladet, due to it's lack of direct links to previous days.
	if($info[$comic]['method'] == 'substring'){ 
		$im="";
		$fp = fsockopen ($info[$comic]['host'], 80, $errno, $errstr, 30);
		$fp2= fsockopen ($info[$comic]['host'], 80, $errno, $errstr, 30);
		if ($fp) {
			fputs ($fp, "GET {$info[$comic]['path']} HTTP/1.1\r\nHost:{$info[$comic]['host']}\r\n{$info[$comic]['referer']}Connection: Close\r\n\r\n");
			while (!feof($fp)) {
				$im .= fread ($fp,128);
			}
			fclose ($fp);
		}

		$pos = strpos($im, "/tegneserie/pondusarkiv/");
		$posend = strpos($im, ".gif" ,$pos) +4;
		if($posend!=0){
			$info[$comic]['path'] = substr($im , $pos , ($posend-$pos));
		}
				
		fputs ($fp2, "GET {$info[$comic]['path']} HTTP/1.1\r\nHost:{$info[$comic]['host']}\r\n{$info[$comic]['referer']}Connection: Close\r\n\r\n");
		while (!feof($fp2)) {
			$im2 .= fread ($fp2,128);
		}

		$im=$im2;
		$begin = strpos($im,"\r\n\r\n");
		$im = substr($im,$begin+4);
		$imgfile = fopen ("comics/{$comic}-{$savenum}.gif", "wb");
		$fp = fwrite($imgfile,$im);
		fclose($imgfile);
	}
	else{ 
		$im="";
		$fp = fsockopen ($info[$comic]['host'], 80, $errno, $errstr, 30);
		if (!$fp) {
			//echo "$errstr ($errno)<br>\n";
		} else {
			fputs ($fp, "GET {$info[$comic]['path']} HTTP/1.1\r\nHost:{$info[$comic]['host']}\r\n{$info[$comic]['referer']}Connection: Close\r\n\r\n");
			while (!feof($fp)) {
				$im .= fread ($fp,128);
			}
			fclose ($fp);
		}
		$begin = strpos($im,"\r\n\r\n");
		$im = substr($im,$begin+4);
		$imgfile = fopen ("comics/{$comic}-{$savenum}.gif", "wb");
		$fp = fwrite($imgfile,$im);
		fclose($imgfile);
	}

}

@list($width, $height, $type, $tag) = getimagesize($localimage);
if($width){$relation = $height/$width;}else{return;}

if($zoom!="none"){	
	$newheight = floor($zoom * $relation);
	$tag = "width=\"$zoom\" height=\"$newheight\"";
}
else{
	$tag = "width=\"$width\" height=\"$height\"";
}
$returnimage = "<tr><td class=\"c\" style=\"background-color:#ffffff; padding:2px;\"><img src=\"$localimage\" $tag /></td></tr>";
return $returnimage;
}

if($comicschecked['pondus']=="CHECKED"){echo findimage('PondusEng');}
if($comicschecked['dilbert']=="CHECKED"){echo findimage('Dilbert');}
if($comicschecked['blic']=="CHECKED"){echo findimage('Blic');}
if($comicschecked['shermanslagoon']=="CHECKED"){echo findimage('ShermansLagoon');}
if($comicschecked['zits']=="CHECKED"){echo findimage('Zits');}
if($comicschecked['garfield']=="CHECKED"){echo findimage('Garfield');}
if($comicschecked['beetlebailey']=="CHECKED"){echo findimage('BeetleBailey');}
if($comicschecked['hagarthehorrible']=="CHECKED"){echo findimage('HagarTheHorrible');}
if($comicschecked['userfriendly']=="CHECKED"){echo findimage('UserFriendly') ;}
?>										</table>
								</td>
							</tr>
						</table>
					</td>
				</tr>
			</table>
		</td>
	</tr>
</table>
</body>
</html>

 

 

I am trying to add this comic named "blic" which is located here:

 

http://www.blic.co.yu/strip.php

 

sooo i think this is 5 min job for someone who know's what to look, so plzzzz anyone who know's php look this script and plzzz try to help... :)

Link to comment
Share on other sites


Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use and Privacy Policy.