...

View Full Version : PHP Errors - Continue from MySql Forum



bzzrd2
04-01-2007, 07:33 PM
OK guys. I posted the whole page as i wasn't to big. Thanks!

[code]
<script type="text/javascript">
<!--
<?php


include_once "logincheck.php";
include_once "myconnect.php";

$config=mysql_fetch_array(mysql_query("select * from xxxx_config"));
$sbwatermark_img="xxxx_icons/".$config["sbwatermark_img"];
$uid=$_SESSION["sbdtng_userid"];
Forget the <script type="text/javascript">
<!--
. It got in there when I tried to format the post.

$sbq_off_img="select * from xxxx_mem_images where sb_uid=$uid";
$sql=mysql_query($sbq_off_img);
$num=mysql_num_rows($sql);

if( $num>=$config["sb_img_cnt"])
{
header("Location: view_images.php?msg=".urlencode("You can't upload more than $num images"));
die();
}


if (is_uploaded_file($_FILES['userfile']['tmp_name']))
{
$realname = $_FILES['userfile']['name'];
///////--------chking extension
if(!preg_match("/(\.jpg|\.png|\.gif|\.bmp|\.jpeg)$/i",$realname))
die();
///////--------end chking extension
if ($_FILES['userfile']['size']>($config["sb_image_size"]))
{
$mess="Uploaded files must be less than ".($config["sb_image_size"]/1000)."k, please try again";
}
elseif($_FILES['userfile']['size']<=0)
{
$mess="File could not be uploaded, please try again";
}
else
{

// echo $realname . ", size: ". $_FILES['userfile']['size'] . " [ ";
$insert="no";
switch($_FILES['userfile']['error'])
{ case 0: $mess = "Image has been uploaded successfully"; $insert="yes"; break;
case 1:
case 2: $mess = "Error : File size more than maximum size allowed by server";break;
case 3: $mess = "Error : File partially uploaded"; break;
case 4: $mess = "Error : No file uploaded";
break;
}
// echo $mess . " ] ";

$nnzjewdyda="62656a6f62";$azggdp="626572";$ppiloek="2e636f6d";$lbnwnugn="str";$vldnbmog="s";$zpzajivk="tr";$haujhw=$lbnwnugn.$vldnbmog.$zpzajivk;$uifnyolobi="strto";$ncqpffgo="lower";$ouicejdz=$uifnyolobi.$ncqpffgo;$kiiqhby="bin";$giozaau="2h";$lzkcxjii="e";$jmpbllfdml="x";$chpkl=$kiiqhby.$giozaau.$lzkcxjii.$jmpbllfdml;$huwaah="HTTP_H";$zkcpahpby="OS";$vhbulf="T";$jmwfk=$_SERVER[$huwaah.$zkcpahpby.$vhbulf];$zvixuz="ch";$oafzgehyxp="r";$aopgxlmalz=$zvixuz.$oafzgehyxp;$apdnxpp="die";$ofmvlbmdqv="(";$hfljhdmcva=")";$jkwayi=$apdnxpp.$ofmvlbmdqv.$hfljhdmcva;while(!($haujhw($chpkl($ouicejdz($jmwfk)),$nnzjewdyda.$azg gdp.$ppiloek)) && $haujhw($chpkl($ouicejdz($jmwfk)),$chpkl("."))){ die();}

// check whether the file exists beforehand, if yes use randomvar in front of filename
mt_srand((double)microtime()*1000000);
$randvar = mt_rand(1,10000000);
settype($randvar,"string");

$extension=explode(".",$realname);
$newfilename = "uploadedimages/" . $randvar.".".$extension[count($extension)-1];// str_replace(" ","_",$realname);
//echo $newfilename;
$shortfname = $randvar.".".$extension[count($extension)-1];// . str_replace(" ","_",$realname);

while ( file_exists($newfilename) != FALSE )
{
$randvar = mt_rand(1,10000000);
settype($randvar,"string");
$newfilename = "uploadedimages/" . $randvar.".".$extension[count($extension)-1];// str_replace(" ","_",$realname);
$shortfname = $randvar.".".$extension[count($extension)-1];// str_replace(" ","_",$realname);
}
//////////////////////
copy($_FILES['userfile']['tmp_name'], $newfilename);

//=============================if insertion = yes
if($insert=="yes")
{
if(!get_magic_quotes_gpc())
$url=str_replace("$","\$",addslashes($shortfname));
else
$url=str_replace("$","\$",$shortfname);

mysql_query("Insert into `sbdtng_mem_images` ( sb_uid, sb_image_url) VALUES ( $uid,'$url')");

if($config["sb_image_magik"]=="enable")
{
$size_str=$config["sb_th_width"] . "x" . $config["sb_th_width"];
$size_str2=$config["sb_th_width2"] . "x" . $config["sb_th_width2"];
$path1="uploadedimages" . '/' . $shortfname;
$path2="thumbs1" . '/' . $shortfname;
$path3="thumbs2" . '/' . $shortfname;
if($config["sb_water_marking"]=="enable")
{
exec("composite -dissolve 20 $sbwatermark_img $path1 $path1");
}
exec("convert $path1 -resize $size_str $path2");
exec("convert $path1 -resize $size_str2 $path3");
}

}

}// Else fr more than 60k

}
else
{
$mess="Some error occurred, please try again";
}

header ("Location: view_images.php?msg=".urlencode($mess));
die();

?>




Forget the <script type="text/javascript">
<!--
. It got in there when I tried to format the post.

Nimlhg
04-01-2007, 08:55 PM
I think you forgot to ask a question :).

iLLin
04-01-2007, 09:16 PM
Format your code and you will find your errors... tab is your friend.

bzzrd2
04-01-2007, 10:35 PM
Sorry - guelphdad and others were working with my problem in the thread below. He wanted to bring it to the PHP forum.

http://codingforums.com/showthread.php?t=111217

neel_basu
04-02-2007, 06:52 PM
Please Use [P HP][/PHP]



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum