Disable NON-SSL access for a subdomain

I have a subdomain secure.domain.com and want it to be accessible through SSL only. All the files for secure.domain.com are in the private_html, however I want to completely disable the option to login without SSL and redirect all non-ssl to the ssl-folder.. Using a php redirect script isn't possible, because I would need to put it in every subdir.
RewriteEngine On

RewriteBase /

RewriteCond %{HTTP_HOST} !^$
RewriteCond %{HTTP_HOST} ^example.com$
RewriteRule ^ http://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]

RewriteCond %{HTTP_HOST} ^www\. [NC]
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}

javascript ajax post

function Inint_AJAX() 
{

   try { return new ActiveXObject("Msxml2.XMLHTTP");  } catch(e) {} //IE
   try { return new ActiveXObject("Microsoft.XMLHTTP"); } catch(e) {} //IE
   try { return new XMLHttpRequest();          } catch(e) {} //Native Javascript
   alert("XMLHttpRequest not supported");
   return null;

}

var http = Inint_AJAX(); var url = "example.php"; var params = "content=1"; http.open("POST",url+"?"+params, true); http.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); http.setRequestHeader("Content-length", params.length); http.setRequestHeader("Connection", "close"); http.onreadystatechange = function() {//Call a function when the state changes. if(http.readyState == 4 && http.status == 200) { document.getElementById('divid').innerHTML=http.responseText; //retuen value }

Bulk Rename Files in a Folder - PHP

$dir = "img1";
$fileType = "jpg";
$charsToTrim = 4;
if($handle = opendir($dir))
{
    $count = 1;
    while (false !== ($file = readdir($handle))) 
   {
    if(is_file($dir."\\".$file))
    {
        $extension = substr(strrchr($file,"."),1);
        if(strcasecmp($fileType,$extension) == 0)
        {
           // $newName = substr($file,$count); 
      $newName = $count;
            $success = rename($dir."\\".$file, $dir."\\".$newName.'.'.$extension); 
            if($success)
            {
                echo $file." renamed to ".$newName;
                echo "
"; $count++; } else { echo "Cannot rename ".$file. " to ".$newName."
"; echo "
"; } } } } echo $count." files renamed"; } closedir($handle);

Creating Dynamic Image Thumbnails Depending Upon Height Using PHP

function createthumb($name, $newname, $new_height, $border=false, $transparency=true, $base64=false) {
 
  if(file_exists($newname))
        @unlink($newname);
    if(!file_exists($name))
        return false;
    $arr = explode(".",$name);
    $ext = $arr[count($arr)-1];

    if($ext=="jpeg" || $ext=="jpg" || $ext=="JPEG" || $ext=="JPG"){
        $img = @imagecreatefromjpeg($name);
  
    } elseif($ext=="png"){
        $img = @imagecreatefrompng($name);
    } elseif($ext=="gif") {
        $img = @imagecreatefromgif($name);
    }
    if(!$img)
        return false;
    $old_x = imageSX($img);
    $old_y = imageSY($img);

 $avg = $old_y/$old_x;

    $new_h = $new_height;

 $new_w = floor($new_h/$avg);

 if($old_x < $new_w && $old_y < $new_h) 
 {
        $thumb_w = $old_x;
        $thumb_h = $old_y;
    }elseif($old_x < $old_y)
 {
    echo $thumb_w= floor($new_height*$zing);
  $thumb_h=$new_height;
    
 }else
 {
  $thumb_w = $new_w;
        $thumb_h = $new_h;
 }

    $thumb_w = ($thumb_w<1) ? 1 : $thumb_w;
    $thumb_h = ($thumb_h<1) ? 1 : $thumb_h;
    $new_img = ImageCreateTrueColor($thumb_w, $thumb_h);
   
    if($transparency) {
        if($ext=="png") {
            imagealphablending($new_img, false);
            $colorTransparent = imagecolorallocatealpha($new_img, 0, 0, 0, 127);
            imagefill($new_img, 0, 0, $colorTransparent);
            imagesavealpha($new_img, true);
        } elseif($ext=="gif") {
            $trnprt_indx = imagecolortransparent($img);
            if ($trnprt_indx >= 0) {
                $trnprt_color = imagecolorsforindex($img, $trnprt_indx);
                $trnprt_indx = imagecolorallocate($new_img, $trnprt_color['red'], $trnprt_color['green'], $trnprt_color['blue']);
                imagefill($new_img, 0, 0, $trnprt_indx);
                imagecolortransparent($new_img, $trnprt_indx);
            }
        }
    } else {
        Imagefill($new_img, 0, 0, imagecolorallocate($new_img, 255, 255, 255));
    }
   
    imagecopyresampled($new_img, $img, 0,0,0,0, $thumb_w, $thumb_h, $old_x, $old_y);
    if($border) {
        $black = imagecolorallocate($new_img, 0, 0, 0);
        imagerectangle($new_img,0,0, $thumb_w, $thumb_h, $black);
    }
    if($base64) {
        ob_start();
        imagepng($new_img);
        $img = ob_get_contents();
        ob_end_clean();
        $return = base64_encode($img);
    } else {
        if($ext=="jpeg" || $ext=="jpg" || $ext=="JPEG" || $ext=="JPG"){
            imagejpeg($new_img, $newname);
            $return = true;
        } elseif($ext=="png"){
            imagepng($new_img, $newname);
            $return = true;
        } elseif($ext=="gif") {
            imagegif($new_img, $newname);
            $return = true;
        }
    }
    imagedestroy($new_img);
    imagedestroy($img);
    return $return;
}

createthumb($src, $dest,$height,false, true, false);