PDA

View Full Version : why does this show up blank?


N!ck
01-20-2003, 04:18 AM
this generates a blank page when i access it without a query string even...anyone know why?

<?php
require("../forums/global.php");
if ($action=="upload") {
if ($folderid=="") {
eval("standarderror(\"".gettemplate("error_gallery_nofolder")."\");");
exit;
}
if ($caption=="") {
eval("standarderror(\"".gettemplate("error_gallery_nocaption")."\");");
exit;
}
if ($picfile=="") {
eval("standarderror(\"".gettemplate("error_gallery_nopic")."\");");
exit;
}
$picsize=getimagesize($_FILES['picfile']['tmp_name']);
if ($picsize[0]<200) {
eval("standarderror(\"".gettemplate("error_gallery_pictoosmall")."\");");
exit;
}
if (!eregi("jpeg",$_FILES['picfile']['type'])) {
eval("standarderror(\"".gettemplate("error_gallery_invalidtype")."\");");
exit;
}
$securitycheck=$DB_site->query_first("SELECT * FROM galfolder WHERE galfolderid='$folder'");
if ($securitycheck['userid']!=$bbuserinfo['userid']) exit;
$DB_site->query("INSERT INTO galphoto (galphotoid,galfolderid,caption,dateline) VALUES ('0','$folder','$caption','".time()."'");
$pictureid=$DB_site->insert_id();
if ($picsize[0]>500) {
$aspectratio=$picsize[0]/500;
$newwidth=500;
$newheight=round($aspectratio*$picsize[1]);
} else {
$newwidth=$picsize[0];
$newheight=$picsize[1];
}
$srcimg=imagecreatefromjpeg($_FILES['picfile']['tmp_name']);
$dstimg=imagecreatetruecolor($newwidth,$newheight) ;
imagecopyresampled($dstimg,$srcimg,0,0,0,0,$newwid th,$newheight,$picsize[0],$picsize[1]);
$color=imagecolorallocate($dstimg,0,0,100);
$fontx=$newwidth-100;
$fonty=$newheight-6;
imagettftext($dstimg,14,0,$fontx,$fonty,$color,"../images/fonts/serpentine.ttf","V-Driveboat.com");
imagejpeg($dstimg,"../images/gallery/photos/".$pictureid.".jpg","100");
imagedestroy($dstimg);
$naspectratio=80/$picsize[0];
$newheight=round($naspectratio*$picsize[1]);
$thmimg=imagecreatetruecolor(80,$nheight);
imagecopyresampled($thmimg,$srcimg,0,0,0,0,80,$nhe ight,$picsize[0],$picsize[1]);
imagejpeg($thmimg,"../images/gallery/thumbs/".$pictureid.".jpg","100");
imagedestroy($thmimg);
imagedestroy($srcimg);
eval("dooutput(\"".gettemplate("gallery_uploaddone")."\");");
exit;
}
eval("dooutput(\"".gettemplate("gallery_upload")."\");");
?>

Icheb
01-20-2003, 08:37 AM
You mean you access it just via <script>.php and not via <script>.php?<variables> ?

In the third line, your script checks for $action being equal to "upload", if there is no such variable, that part of the script doesn't get parsed.

N!ck
01-20-2003, 01:47 PM
right, just <script>.php. but that should work because it is supposed to output a template if the action is not set to "upload".

Icheb
01-20-2003, 02:02 PM
Ok, two things:
Does it work as expected if you call <script>.php?action=upload ?
If so, maybe post the content of the template gallery_upload .

N!ck
01-20-2003, 02:04 PM
no, it doesn't work

Icheb
01-20-2003, 02:08 PM
I think the problem is the

require("../forums/global.php");

tag. In which folder does the actual script and the global.php reside?

N!ck
01-20-2003, 02:13 PM
this script is in:
/public_html/gallery/upload.php

forums are in:
/public_html/forums/

N!ck
01-20-2003, 02:24 PM
thanks for your help, but i just remembered that global.php needs editing before use by scripts in other folders

Link14716
01-20-2003, 02:30 PM
you, oterwise it won't call functions.php (or any of the other scripts for that matter) correctly.