gd en gif
hier me script
Code (php)
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
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
<?php
while (list($global) = each($GLOBALS))
{
if (!preg_match('/^(_SERVER|GLOBALS)$/', $global)) {
unset($$global);
}
}
unset($global);
$imgtypes = array("gif");
define("e_QUERY", preg_replace("#&|/?PHPSESSID.*#i", "", $_SERVER['QUERY_STRING']));
$recnum = preg_replace("#\D#", "", e_QUERY);
if (!$recnum) {
exit;
}
$mySQLserver = "";
@include_once(dirname(__FILE__)."e107_config.php");
$a = 0;
$p = "";
while (!$mySQLserver && $a < 5) {
$a++;
$p .= "../";
@include_once($p."e107_config.php");
}
mysql_connect($mySQLserver, $mySQLuser, $mySQLpassword);
mysql_select_db($mySQLdefaultdb);
$result = mysql_query("SELECT tmp_info FROM {$mySQLprefix}tmp WHERE tmp_ip = '{$recnum}'");
if (!$row = mysql_fetch_array($result)) {
exit;
}
list($code, $url) = explode(",", $row['tmp_info']);
$type = "none";
foreach($imgtypes as $t)
{
if (function_exists("imagecreatefrom".$t))
{
$type = $t;
break;
}
}
$path = realpath(dirname(__FILE__)."/../")."/".$IMAGES_DIRECTORY;
switch($type)
{
case "gif":
$image = ImageCreateFromGIF($path."generic/code_bg.gif");
break;
}
$text_color = ImageColorAllocate($image, 80, 80, 80);
//ob_clean();
// Header("Content-type: image/".$type);
ImageString ($image, 5, 12, 2, $code, $text_color);
switch($type)
{
case "gif":
ImageGIF($image, '', 75);
break;
}
ImageDestroy($image);
die();
?>
while (list($global) = each($GLOBALS))
{
if (!preg_match('/^(_SERVER|GLOBALS)$/', $global)) {
unset($$global);
}
}
unset($global);
$imgtypes = array("gif");
define("e_QUERY", preg_replace("#&|/?PHPSESSID.*#i", "", $_SERVER['QUERY_STRING']));
$recnum = preg_replace("#\D#", "", e_QUERY);
if (!$recnum) {
exit;
}
$mySQLserver = "";
@include_once(dirname(__FILE__)."e107_config.php");
$a = 0;
$p = "";
while (!$mySQLserver && $a < 5) {
$a++;
$p .= "../";
@include_once($p."e107_config.php");
}
mysql_connect($mySQLserver, $mySQLuser, $mySQLpassword);
mysql_select_db($mySQLdefaultdb);
$result = mysql_query("SELECT tmp_info FROM {$mySQLprefix}tmp WHERE tmp_ip = '{$recnum}'");
if (!$row = mysql_fetch_array($result)) {
exit;
}
list($code, $url) = explode(",", $row['tmp_info']);
$type = "none";
foreach($imgtypes as $t)
{
if (function_exists("imagecreatefrom".$t))
{
$type = $t;
break;
}
}
$path = realpath(dirname(__FILE__)."/../")."/".$IMAGES_DIRECTORY;
switch($type)
{
case "gif":
$image = ImageCreateFromGIF($path."generic/code_bg.gif");
break;
}
$text_color = ImageColorAllocate($image, 80, 80, 80);
//ob_clean();
// Header("Content-type: image/".$type);
ImageString ($image, 5, 12, 2, $code, $text_color);
switch($type)
{
case "gif":
ImageGIF($image, '', 75);
break;
}
ImageDestroy($image);
die();
?>
{
if (!preg_match('/^(_SERVER|GLOBALS)$/', $global)) {
unset($$global);
}
}
die moet je bij de bovenste while loop hebben
Since all GIF support was removed from the GD library in version 1.6, this function is not available if you are using that version of the GD library.
van het PHP Manual
Maar dan zou die een foutmelding moeten weergeven.
Maar het vreemde is dat op mijn locale server hij wel werkt en op de server van m'n school niet werkt.
Locaal: apache 2.0.55 (win32), PHP 5.0.5 met GD 2.1.9 met gif support enabled
En op de server van school: apache 2.0.55 (NETWARE), PHP 5.0.5 met GD 2.0 met gif support
De GD modules zijn wel juist geactiveerd. Ik zal dan maar even de server configuratie doorspitten.
Gewijzigd op 23/11/2005 22:05:00 door Dennis S