pj-photohost /uploads/include/downmix.inc.php

Language PHP Lines 97
MD5 Hash d6f07396b01dc948b745c43237339d16 Estimated Cost $1,980 (why?)
Repository http://pj-photohost.googlecode.com/svn/trunk/ View Raw File
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
<?php
function RndString(&$body)
{
	//??????(???????p????????????????????)
	$maxpos = 1024;

	//font ?????
	$fontColor = "#FFFFFF";

	//div span p ???????
	$st1 = chr(mt_rand(ord('A'),ord('Z'))).chr(mt_rand(ord('a'),ord('z'))).chr(mt_rand(ord('a'),ord('z'))).mt_rand(100,999);
	$st2 = chr(mt_rand(ord('A'),ord('Z'))).chr(mt_rand(ord('a'),ord('z'))).chr(mt_rand(ord('a'),ord('z'))).mt_rand(100,999);
	$st3 = chr(mt_rand(ord('A'),ord('Z'))).chr(mt_rand(ord('a'),ord('z'))).chr(mt_rand(ord('a'),ord('z'))).mt_rand(100,999);
	$st4 = chr(mt_rand(ord('A'),ord('Z'))).chr(mt_rand(ord('a'),ord('z'))).chr(mt_rand(ord('a'),ord('z'))).mt_rand(100,999);
	$rndstyle[1]['value'] = ".{$st1} { display:none; }";
	$rndstyle[1]['name'] = $st1;
	$rndstyle[2]['value'] = ".{$st2} { display:none; }";
	$rndstyle[2]['name'] = $st2;
	$rndstyle[3]['value'] = ".{$st3} { display:none; }";
	$rndstyle[3]['name'] = $st3;
	$rndstyle[4]['value'] = ".{$st4} { display:none; }";
	$rndstyle[4]['name'] = $st4;
	$mdd = mt_rand(1,4);
	$rndstyleValue = $rndstyle[$mdd]['value'];
	$rndstyleName = $rndstyle[$mdd]['name'];
	$reString = "<style> $rndstyleValue </style>\r\n";

	//????
	$rndem[1] = 'font';
	$rndem[2] = 'div';
	$rndem[3] = 'span';
	$rndem[4] = 'p';

	//???????
	$fp = fopen(DEDEDATA.'/downmix.data.php','r');
	$start = 0;
	$totalitem = 0;

	while(!feof($fp))
	{
		$v = trim(fgets($fp,128));
		if($start==1)
		{
			if(ereg("#end#",$v))
			{
				break;
			}
			if($v!='')
			{
				$totalitem++; $rndstring[$totalitem] = ereg_replace("#,","",$v);
			}
		}
		if(ereg("#start#",$v))
		{
			$start = 1;
		}
	}
	fclose($fp);

	//?????????
	$bodylen = strlen($body) - 1;
	$prepos = 0;
	for($i=0;$i<=$bodylen;$i++)
	{
		if($i+2 >= $bodylen || $i<50)
		{
			$reString .= $body[$i];
		}
		else
		{
			$ntag = @strtolower($body[$i].$body[$i+1].$body[$i+2]);
			if($ntag=='</p' || ($ntag=='<br' && $i-$prepos>$maxpos) )
			{
				$dd = mt_rand(1,4);
				$emname = $rndem[$dd];
				$dd = mt_rand(1,$totalitem);
				$rnstr = $rndstring[$dd];
				if($emname!='font')
				{
					$rnstr = " <$emname class='$rndstyleName'>$rnstr</$emname> ";
				}
				else
				{
					$rnstr = " <font color='$fontColor'>$rnstr</font> ";
				}
				$reString .= $rnstr.$body[$i];
				$prepos = $i;
			}
			else
			{
				$reString .= $body[$i];
			}
		}
	}
	return $reString;
}//????
?>
Back to Top