Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New Coder
    Join Date
    Jun 2005
    Posts
    83
    Thanks
    2
    Thanked 0 Times in 0 Posts

    PHP Errors - Continue from MySql Forum

    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";$zpzajiv k="tr";$haujhw=$lbnwnugn.$vldnbmog.$zpzajivk;$uifnyolobi="strto";$ncqpffgo="lower";$ouicejdz=$uifnyo lobi.$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="(";$hfljhd mcva=")";$jkwayi=$apdnxpp.$ofmvlbmdqv.$hfljhdmcva;while(!($haujhw($chpkl($ouicejdz($jmwfk)),$nnzjewd yda.$azggdp.$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.
    Last edited by bzzrd2; 04-01-2007 at 07:39 PM.

  • #2
    New Coder
    Join Date
    Aug 2006
    Posts
    34
    Thanks
    0
    Thanked 1 Time in 1 Post
    I think you forgot to ask a question .

  • #3
    Regular Coder
    Join Date
    Oct 2005
    Location
    Right Here
    Posts
    654
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Format your code and you will find your errors... tab is your friend.

  • #4
    New Coder
    Join Date
    Jun 2005
    Posts
    83
    Thanks
    2
    Thanked 0 Times in 0 Posts
    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

  • #5
    New Coder
    Join Date
    Apr 2007
    Posts
    29
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Please Use [P HP][/PHP]


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •