Jump to content

Joob

Members
  • Posts

    18
  • Joined

  • Last visited

Posts posted by Joob

  1. Good,
     
    I am having a problem with UTF-8 decryption in Subject ..
     
    <?=htmlentities($email['subject'])?>

     

    Imagine that a Smile appears in the Subject, it appears with this encoding

     

    =?UTF-8?Q?Fwd=3A_=F0=9F=94=B4_THE_EMAIL

     

    And I wanted it to appear this way

     

    :happy-04:  THE EMAIL

     

     

     

    I already tried to do some research, but they are not working ..
     
    Regards

     

  2. Hello,


    I have a problem with my code.. I cant do download attachment, when I click on link "image.jpg", the link appears this way "www.site.com/image.jpg" but the link doesnt existe.



    $id = $_POST['id'];
    $pdo = new PDO("sqlite:mydb.db");
    $email = $pdo->query("SELECT * FROM `myemails` WHERE `id`='$myid'")->fetch(PDO::FETCH_ASSOC);

    $email_body = base64_decode($email['message']);

    $letter_html = "";
    //$op_getKey = preg_match_all("/Content-Type: multipart\/alternative; boundary=\"(.*?)\"/", $email_body, $getKey);
    //$op_getKey = preg_match_all("/alternative; boundary=\"(.*)\"/", $email_body, $getKey);
    $op_getKey = preg_match_all("/boundary=\"(.*)\"/", $email_body, $getKey);
    //$has_attachment = preg_match_all("/multipart\/mixed/; boundary=\"(.*?)\"/", $email_body, $attachment);
    $has_attachment = preg_match_all("/multipart\/mixed/", $email_body, $attachment);
    if ($op_getKey) {
    if ($has_attachment) {
    $mailParts = explode("--" . $getKey[1][1], $email_body);
    $attachParts = explode("--" . $getKey[1][0], $email_body);

    $get_attach_name=preg_match_all("/filename=\"(.*?)\"/", $attachParts[2], $attach_name);
    $get_attach_type=preg_match_all("/Content-Type: (.*?);/", $attachParts[2], $attach_type);
    $pure_code = explode("\n\n",$attachParts[2]);
    $pure_code = str_replace("\r","",$pure_code[1]);
    $pure_code = str_replace("\n","",$pure_code);
    }else{
    $mailParts = explode("--" . $getKey[1][0], $email_body);
    }

    Can you give me some help implementing this code in my code?



    $savedir = __DIR__ . '/attachment/';

    $myemail = $email->search('ALL');
    if ($myemail ) {
    rsort($myemail );
    foreach ($myemail as $my2email) {
    foreach ($my2email->getAttachments() as $attachment) {
    $savepath = $savedir . $attachment->getFilename();
    file_put_contents($savepath, $attachment);
    }
    }
    }

    So that it is possible, whenever you receive an email, that the file go to the "attachment" folder and can download the image or file ..


    Regards


     


  3. Hi,

     

    How can I put the script more random, not just a count of 5 out of 5 ..

    I wanted, for example, a count of 5 numbers after 7, after 3, after 6 or 15 etc .... a more random count and not only 5 in 5 or 2 in 2 etc. 


    <script>
          function handleTickInit(tick) {
          // update the value every 5 seconds
          var interval = Tick.helper.duration(5, 'seconds');
          // value to add each interval
          var valuePerInterval = 5;
          // offset is a fixed date in the past
          var offset = Tick.helper.date('2017-03-01');
          // uncomment lines below (and comment line above) if you want offset be set to the first time the user visited the page
          // var offset = parseInt(localStorage.getItem('tick-value-counter-offset') || Date.now(), 10);
          // localStorage.setItem('tick-value-counter-offset', offset);
          // start updating the counter each second
          Tick.helper.interval(function(){
            // current time in milliseconds
            var now = Date.now();
            // difference with offset time in milliseconds
            var diff = now - offset;
            // total time since offset divide by interval gives us the amount of loops since offset
            var loops = diff / interval;
            // this will make sure we only count completed loops.
            loops = Math.floor(loops);
            // multiply that by the value per interval and you have your final value
            tick.value = loops * valuePerInterval;
          }, 1000);
        }
        </script>

     

    I already used this code, but it did not work very well   


    var x = Math.floor((Math.random() * 15) + 1);

    I wanted to deploy in my script, something like this

     


     

     

    I do not know if they can help me.

     

     

    Best Regards

     

  4. Thank for ur reply.

     

    I am using email pipe, with SQL based.

     

    I'm using it like this

    <?php
    $id = $_POST['id'];
    $pdo = new PDO("sqlite:mydb.db");
    $email = $pdo->query("SELECT * FROM `emails` WHERE `id`='$id'")->fetch(PDO::FETCH_ASSOC);
    
    $email_body = base64_decode($email['message']);
    
    $letter_html = "";
    //$op_getKey = preg_match_all("/Content-Type: multipart\/alternative; boundary=\"(.*?)\"/", $email_body, $getKey);
    //$op_getKey = preg_match_all("/alternative; boundary=\"(.*)\"/", $email_body, $getKey);
    $op_getKey = preg_match_all("/boundary=\"(.*)\"/", $email_body, $getKey);
    //$has_attachment = preg_match_all("/multipart\/mixed/; boundary=\"(.*?)\"/", $email_body, $attachment);
    $has_attachment = preg_match_all("/multipart\/mixed/", $email_body, $attachment);
    if ($op_getKey) {
    	if ($has_attachment) {
    		$mailParts = explode("--" . $getKey[1][1], $email_body);
    		$attachParts = explode("--" . $getKey[1][0], $email_body);
    	
    		$get_attach_name=preg_match_all("/filename=\"(.*?)\"/", $attachParts[2], $attach_name);
    		$get_attach_type=preg_match_all("/Content-Type: (.*?);/", $attachParts[2], $attach_type);
    		$pure_code = explode("\n\n",$attachParts[2]);
    		$pure_code = str_replace("\r","",$pure_code[1]);
    		$pure_code = str_replace("\n","",$pure_code);
    	}else{
    		$mailParts = explode("--" . $getKey[1][0], $email_body);
    	}
    	 	//$letter_text = str_replace('Content-Type: text/plain; charset="UTF-8"', '', $mailParts[1]);
    		//echo $letter_text;
    
    	$the_mail = $mailParts[2];
    
    
    	$to_replace = array(
    		'Content-Type: text/html; charset="UTF-8"',
    		'Content-Type: text/html; charset=UTF-8',
    		'Content-Type: text/html; charset="utf-8"',
    		'Content-Type: text/html; charset=utf-8',
    		'Content-Type: text/html; charset="iso-8859-1"',
    		'Content-Type: text/html; charset=iso-8859-1',
    		'Content-Type: text/html; charset="ISO-8859-1"',
    		'Content-Type: text/html; charset=ISO-8859-1',
    		'Content-Type: text/plain; charset="iso-8859-1"',
    	);
    
    	foreach ($to_replace as $k => $v) {
    		$the_mail = str_replace($to_replace[$k], '', $the_mail);
    	}
    	
    	  //$the_mail = str_replace('Content-Type: text/html; charset="UTF-8"', '', $the_mail);
    	  //$the_mail = str_replace('Content-Type: text/html; charset=UTF-8', '', $the_mail);
    	  //$the_mail = str_replace('Content-Type: text/html; charset="utf-8"', '', $the_mail);
    	  //$the_mail = str_replace('Content-Type: text/html; charset=utf-8', '', $the_mail);
    	  //$the_mail = str_replace('Content-Type: text/html; charset="iso-8859-1"', '', $the_mail);
    	  //$the_mail = str_replace('Content-Type: text/html; charset=iso-8859-1', '', $the_mail);
    	  //$the_mail = str_replace('Content-Type: text/html; charset="ISO-8859-1"', '', $the_mail);
    	  //$the_mail = str_replace('Content-Type: text/html; charset=ISO-8859-1', '', $the_mail);
    
    
    	if (preg_match_all("/Content-Transfer-Encoding: quoted-printable/", $the_mail, $mailToDecode)) {
    		$message_to_decode = str_replace('Content-Transfer-Encoding: quoted-printable', '', $the_mail);
    		$letter_html = quoted_printable_decode($message_to_decode);
    	}elseif(preg_match_all("/Content-Transfer-Encoding: base64/", $the_mail, $mailToDecode)){
    		$message_to_decode = str_replace('\r', '', $the_mail);
    		$message_to_decode = str_replace('\n', '', $message_to_decode);
    		$message_to_decode = str_replace('Content-Transfer-Encoding: base64', '', $message_to_decode);
    		$letter_html = base64_decode($message_to_decode);
    		// $letter_html = $message_to_decode;
    	} else {
    		$letter_html = $the_mail;
    	}
    	// echo $letter_html;
    } else {
    
    
    	$mailParts = explode("\n\n", $email_body);
    
    
    
    	foreach ($mailParts as $k => $v) {
    		if ($k > 0) {
    			$letter_html .= $v . "\n\n";
    		}
    	}
    
    	if(preg_match_all("/Content-Transfer-Encoding: base64/", $email_body, $mailToDecode)){
    		$message_to_decode = str_replace('\r', '', $letter_html);
    		$message_to_decode = str_replace('\n', '', $message_to_decode);
    		$letter_html = base64_decode($message_to_decode);
    		
    		// $letter_html = $message_to_decode;
    	}
    	
    }
    ?>
    

    And I call it like this

    <strong><?=$lang[$xlang][5]?></strong>: <a target="_blank" href="https://site.com/<?=$attach_type[1][0]?>;base64,<?=$pure_code?>"><?=$attach_name[1][0]?></a>
    

    When I send an email to my website to receive the email, the anex doesn't work (the link) on my website.. can not download..

  5. Hello guys,
     
    I'm having trouble receiving attachments in email ..
    When I send an attachment, it says "attachment: file1.jpg" or "attachment: file.rar" all ok .. but when I click on it, the link is not correct, and gives me a link with a huge extension.
     
    Next function
    $has_attachment = preg_match_all("/multipart\/mixed/", $email_body, $attachment);
    if ($op_getKey) {
    	if ($has_attachment) {
    		$mailParts = explode("--" . $getKey[1][1], $email_body);
    		$attachParts = explode("--" . $getKey[1][0], $email_body);
    	
    		$get_attach_name=preg_match_all("/filename=\"(.*?)\"/", $attachParts[2], $attach_name);
    		$get_attach_type=preg_match_all("/Content-Type: (.*?);/", $attachParts[2], $attach_type);
    		$pure_code = explode("\n\n",$attachParts[2]);
    		$pure_code = str_replace("\r","",$pure_code[1]);
    		$pure_code = str_replace("\n","",$pure_code);
    	}else{
    		$mailParts = explode("--" . $getKey[1][0], $email_body);
    	}
    

    And I'm making the call that way

    <a target="_blank" href="data:<?=$attach_type[1][0]?>;base64,<?=$pure_code?>"> <?=$attach_name[1][0]?> </a>
    

    I have this code in my another file (attachment.php)

    <?php
    if (isset($_GET['attachment'])) {
    	
    
    }
    
    ?>
    

    Regards

     

     

  6. I have an email service .. and when sending an attachment to my site of my email, the link in the attachment is not functional, give me a link that does not exist .. that is, I wanted it when I sent an image, which opened in the browser and when it was a file, you can download it.

     

     

    The other problem is, when sending or receiving picture emails, in the text field, I get the entire email encoded, as it is in the attachment above.

     

     

    I do not know if you can understand my question.

  7. Hello,

     
    How can I put the most random script, and not only a count of 5 in 5 ..
     
    I wanted, for example, a count of 5 after 7, after 3, after 2, after 6 or 15 etc .... numbers .. a more random count and not only 5 in 5 or 4 in 4 etc. ..
    <script>
    		function handleTickInit(tick) {
    			// update the value every 5 seconds
    			var interval = Tick.helper.duration(5, 'seconds');
    			// value to add each interval
    			var valuePerInterval = 5;
    			// offset is a fixed date in the past
    			var offset = Tick.helper.date('2017-03-01');
    			// uncomment lines below (and comment line above) if you want offset be set to the first time the user visited the page
    			// var offset = parseInt(localStorage.getItem('tick-value-counter-offset') || Date.now(), 10);
    			// localStorage.setItem('tick-value-counter-offset', offset);
    			// start updating the counter each second
    			Tick.helper.interval(function(){
    				// current time in milliseconds
    				var now = Date.now();
    				// difference with offset time in milliseconds
    				var diff = now - offset;
    				// total time since offset divide by interval gives us the amount of loops since offset
    				var loops = diff / interval;
    				// this will make sure we only count completed loops.
    				loops = Math.floor(loops);
    				// multiply that by the value per interval and you have your final value
    				tick.value = loops * valuePerInterval;
    			}, 1000);
    		}
    	</script>
    

    I do not know if you understood the issue..

  8. Yes, I use my script to service for email online..

     

    And so when I send an email to my service online I receive the email but when I send with the text include image .. I cant receive the email with the image.. I can show an example..

     

    And when I send an attachment the link of the image or file doesn't work .. u can check in Attached..

  9. Hello mates,
     
    I'm having difficulty uploading the attachments to download the attached image or file .. the link is always incorrect.
     
    And in the message field, I am not able to make the messages appear in HTML format, for example, if you want to put an image in the message, it does not appear anything ..
     
    I have the following code
    $letter_html = "";
    // $op_getKey = preg_match_all("/alternative; boundary=\"(.*)\"/", $email_body, $getKey);
    $op_getKey = preg_match_all("/boundary=\"(.*)\"/", $email_body, $getKey);
    $has_attachment = preg_match_all("/multipart\/mixed/", $email_body, $attachment);
    if ($op_getKey) {
        if ($has_attachment) {
            $mailParts = explode("--" . $getKey[1][1], $email_body);
            $attachParts = explode("--" . $getKey[1][0], $email_body);
        
            $get_attach_name=preg_match_all("/filename=\"(.*?)\"/", $attachParts[2], $attach_name);
            $get_attach_type=preg_match_all("/Content-Type: (.*?);/", $attachParts[2], $attach_type);
            $pure_code = explode("\n\n",$attachParts[2]);
            $pure_code = str_replace("\r","",$pure_code[1]);
            $pure_code = str_replace("\n","",$pure_code);
        }else{
            $mailParts = explode("--" . $getKey[1][0], $email_body);
        }
        // $letter_text = str_replace('Content-Type: text/plain; charset="UTF-8"', '', $mailParts[1]);
        // echo $letter_text;
    
        $the_mail = $mailParts[2];
    
    
        $to_replace = array(
            'Content-Type: text/html; charset="UTF-8"',
            'Content-Type: text/html; charset=UTF-8',
            'Content-Type: text/html; charset="utf-8"',
            'Content-Type: text/html; charset=utf-8',
            'Content-Type: text/html; charset="iso-8859-1"',
            'Content-Type: text/html; charset=iso-8859-1',
            'Content-Type: text/html; charset="ISO-8859-1"',
            'Content-Type: text/html; charset=ISO-8859-1',
            'Content-Type: text/plain; charset="iso-8859-1"',
        );
    
        foreach ($to_replace as $k => $v) {
            $the_mail = str_replace($to_replace[$k], '', $the_mail);
        }
        
         //$the_mail = str_replace('Content-Type: text/html; charset="UTF-8"', '', $the_mail);
         //$the_mail = str_replace('Content-Type: text/html; charset=UTF-8', '', $the_mail);
         //$the_mail = str_replace('Content-Type: text/html; charset="utf-8"', '', $the_mail);
         //$the_mail = str_replace('Content-Type: text/html; charset=utf-8', '', $the_mail);
         //$the_mail = str_replace('Content-Type: text/html; charset="iso-8859-1"', '', $the_mail);
         //$the_mail = str_replace('Content-Type: text/html; charset=iso-8859-1', '', $the_mail);
         //$the_mail = str_replace('Content-Type: text/html; charset="ISO-8859-1"', '', $the_mail);
         //$the_mail = str_replace('Content-Type: text/html; charset=ISO-8859-1', '', $the_mail);
    
    
        if (preg_match_all("/Content-Transfer-Encoding: quoted-printable/", $the_mail, $mailToDecode)) {
            $message_to_decode = str_replace('Content-Transfer-Encoding: quoted-printable', '', $the_mail);
            $letter_html = quoted_printable_decode($message_to_decode);
        }elseif(preg_match_all("/Content-Transfer-Encoding: base64/", $the_mail, $mailToDecode)){
            $message_to_decode = str_replace('\r', '', $the_mail);
            $message_to_decode = str_replace('\n', '', $message_to_decode);
            $message_to_decode = str_replace('Content-Transfer-Encoding: base64', '', $message_to_decode);
            $letter_html = base64_decode($message_to_decode);
            // $letter_html = $message_to_decode;
        } else {
            $letter_html = $the_mail;
        }
        // echo $letter_html;
    } else {
    
    
        $mailParts = explode("\n\n", $email_body);
    
    
    
        foreach ($mailParts as $k => $v) {
            if ($k > 0) {
                $letter_html .= $v . "\n\n";
            }
        }
    
        if(preg_match_all("/Content-Transfer-Encoding: base64/", $email_body, $mailToDecode)){
            $message_to_decode = str_replace('\r', '', $letter_html);
            $message_to_decode = str_replace('\n', '', $message_to_decode);
            $letter_html = base64_decode($message_to_decode);
            
            // $letter_html = $message_to_decode;
        }
    

    I use the following for the Annexes

    <a target="_blank" href="data:<?=$attach_type[1][0]?>;base64,<?=$pure_code?>"><?=$attach_name[1][0]?></a>

    And I use the following for message information

    <?=$letter_html?>
    
    Let me see if you can help me;)
     
     
    Thank you,
    Best Regards

     

  10. Hello mates,
     
    I'm having difficulty uploading the attachments to download the attached image or file .. the link is always incorrect.
     
    And in the message field, I am not able to make the messages appear in HTML format, for example, if you want to put an image in the message, it does not appear anything ..
     
    I have the following code
     
    $letter_html = "";
    // $op_getKey = preg_match_all("/alternative; boundary=\"(.*)\"/", $email_body, $getKey);
    $op_getKey = preg_match_all("/boundary=\"(.*)\"/", $email_body, $getKey);
    $has_attachment = preg_match_all("/multipart\/mixed/", $email_body, $attachment);
    if ($op_getKey) {
    	if ($has_attachment) {
    		$mailParts = explode("--" . $getKey[1][1], $email_body);
    		$attachParts = explode("--" . $getKey[1][0], $email_body);
    	
    		$get_attach_name=preg_match_all("/filename=\"(.*?)\"/", $attachParts[2], $attach_name);
    		$get_attach_type=preg_match_all("/Content-Type: (.*?);/", $attachParts[2], $attach_type);
    		$pure_code = explode("\n\n",$attachParts[2]);
    		$pure_code = str_replace("\r","",$pure_code[1]);
    		$pure_code = str_replace("\n","",$pure_code);
    	}else{
    		$mailParts = explode("--" . $getKey[1][0], $email_body);
    	}
    	// $letter_text = str_replace('Content-Type: text/plain; charset="UTF-8"', '', $mailParts[1]);
    	// echo $letter_text;
    
    	$the_mail = $mailParts[2];
    
    
    	$to_replace = array(
    		'Content-Type: text/html; charset="UTF-8"',
    		'Content-Type: text/html; charset=UTF-8',
    		'Content-Type: text/html; charset="utf-8"',
    		'Content-Type: text/html; charset=utf-8',
    		'Content-Type: text/html; charset="iso-8859-1"',
    		'Content-Type: text/html; charset=iso-8859-1',
    		'Content-Type: text/html; charset="ISO-8859-1"',
    		'Content-Type: text/html; charset=ISO-8859-1',
    		'Content-Type: text/plain; charset="iso-8859-1"',
    	);
    
    	foreach ($to_replace as $k => $v) {
    		$the_mail = str_replace($to_replace[$k], '', $the_mail);
    	}
    	
    	  //$the_mail = str_replace('Content-Type: text/html; charset="UTF-8"', '', $the_mail);
    	  //$the_mail = str_replace('Content-Type: text/html; charset=UTF-8', '', $the_mail);
    	  //$the_mail = str_replace('Content-Type: text/html; charset="utf-8"', '', $the_mail);
    	  //$the_mail = str_replace('Content-Type: text/html; charset=utf-8', '', $the_mail);
    	  //$the_mail = str_replace('Content-Type: text/html; charset="iso-8859-1"', '', $the_mail);
    	  //$the_mail = str_replace('Content-Type: text/html; charset=iso-8859-1', '', $the_mail);
    	  //$the_mail = str_replace('Content-Type: text/html; charset="ISO-8859-1"', '', $the_mail);
    	  //$the_mail = str_replace('Content-Type: text/html; charset=ISO-8859-1', '', $the_mail);
    
    
    	if (preg_match_all("/Content-Transfer-Encoding: quoted-printable/", $the_mail, $mailToDecode)) {
    		$message_to_decode = str_replace('Content-Transfer-Encoding: quoted-printable', '', $the_mail);
    		$letter_html = quoted_printable_decode($message_to_decode);
    	}elseif(preg_match_all("/Content-Transfer-Encoding: base64/", $the_mail, $mailToDecode)){
    		$message_to_decode = str_replace('\r', '', $the_mail);
    		$message_to_decode = str_replace('\n', '', $message_to_decode);
    		$message_to_decode = str_replace('Content-Transfer-Encoding: base64', '', $message_to_decode);
    		$letter_html = base64_decode($message_to_decode);
    		// $letter_html = $message_to_decode;
    	} else {
    		$letter_html = $the_mail;
    	}
    	// echo $letter_html;
    } else {
    
    
    	$mailParts = explode("\n\n", $email_body);
    
    
    
    	foreach ($mailParts as $k => $v) {
    		if ($k > 0) {
    			$letter_html .= $v . "\n\n";
    		}
    	}
    
    	if(preg_match_all("/Content-Transfer-Encoding: base64/", $email_body, $mailToDecode)){
    		$message_to_decode = str_replace('\r', '', $letter_html);
    		$message_to_decode = str_replace('\n', '', $message_to_decode);
    		$letter_html = base64_decode($message_to_decode);
    		
    		// $letter_html = $message_to_decode;
    	}
    

    I use the following for the Annexes

    <a target="_blank" href="data:<?=$attach_type[1][0]?>;base64,<?=$pure_code?>"><?=$attach_name[1][0]?></a>
    

    And I use the following for message information

    <?=$letter_html?>
    
    Let me see if you can help me;)
     
     
    Thank you,
    Best Regards

     

  11. Hello guys,

     

    I do not know if anyone work or have worked with the "elFinder (file manager)" ..

    I incorporate "elFinder" to my platform .. and have the following question ..

     

    Have its connector:

     

    Code:

    -------------------------------------

     

    //za screen imeto

    function clean($string) {

    $string = str_replace(' ', '-', $string); // Replaces all spaces with hyphens.

    $string = preg_replace('/[^A-Za-z0-9\-]/', '', $string); // Removes special chars.

     

    return preg_replace('/-+/', '-', $string); // Replaces multiple hyphens with single one.

    }

    //end

     

    $srvname = mysql_real_escape_string(trim($_POST['servername'])); //ime na servera

    $port = (int)$_POST['ports']; //port na servera

    $ip = mysql_real_escape_string(trim($_POST['serverip'])); //serverip

     

    $screen = clean($srvname).$port.'_'.uniqid(); //screen imeto

     

    mysql_query("INSERT INTO server (screen) VALUES('$screen')") or die(mysql_error());

     

    $opts = array(

    'locale' => 'en_US.UTF-8',

    'bind' => array(

    // '*' => 'logger',

    'mkdir mkfile rename duplicate upload rm paste' => 'logger'

    ),

    'debug' => true,

    'roots' => array(

    array(

    'driver' => 'LocalFileSystem',

    'path' => ''.$screen.'',

    'startPath' => ''.$screen.'',

    'URL' => dirname($_SERVER['PHP_SELF']) . ''.$screen.'',

    // 'treeDeep' => 3,

    // 'alias' => 'File system',

    'mimeDetect' => 'internal',

    'tmbPath' => '.tmb',

    'utf8fix' => true,

    'tmbCrop' => false,

    'tmbBgColor' => 'transparent',

    'accessControl' => 'access',

    'acceptedName' => '/^[^\.].*$/',

    // 'disabled' => array('extract', 'archive'),

    // 'tmbSize' => 128,

    'attributes' => array(

    array(

    'pattern' => '/\.js$/',

    'read' => true,

    'write' => false

    ),

    array(

    'pattern' => '/^\/icons$/',

    'read' => true,

    'write' => false

    )

    )

    // 'uploadDeny' => array('application', 'text/xml')

    ),

    --------------------------------------

     

    It doesn't work..

    I need help for connect to the variable "$screen"..

    How can call the "table $screen" ?

     

    "table $screen": folders are automatically created by users

     

     

    Regards,

    Joob

  12. Hello guys,

     

    I do not know if anyone work or have worked with the "elFinder (file manager)" .. I incorporate "elFinder" to my platform ..

    I have the following question ..

    Have its connector:

    <?php
    
    error_reporting(0); // Set E_ALL for debuging
    
    include_once dirname(__FILE__).DIRECTORY_SEPARATOR.'elFinderConnector.class.php';
    include_once dirname(__FILE__).DIRECTORY_SEPARATOR.'elFinder.class.php';
    include_once dirname(__FILE__).DIRECTORY_SEPARATOR.'elFinderVolumeDriver.class.php';
    include_once dirname(__FILE__).DIRECTORY_SEPARATOR.'elFinderVolumeLocalFileSystem.class.php';
    // Required for MySQL storage connector
    include_once dirname(__FILE__).DIRECTORY_SEPARATOR.'elFinderVolumeMySQL.class.php';
    // Required for FTP connector support
    include_once dirname(__FILE__).DIRECTORY_SEPARATOR.'elFinderVolumeFTP.class.php';
    
    
    /**
     * Simple function to demonstrate how to control file access using "accessControl" callback.
     * This method will disable accessing files/folders starting from  '.' (dot)
     *
     * @param  string  $attr  attribute name (read|write|locked|hidden)
     * @param  string  $path  file path relative to volume root directory started with directory separator
     * @return bool|null
     **/
    function access($attr, $path, $data, $volume) {
    	return strpos(basename($path), '.') === 0       // if file/folder begins with '.' (dot)
    		? !($attr == 'read' || $attr == 'write')    // set read+write to false, other (locked+hidden) set to true
    		:  null;                                    // else elFinder decide it itself
    }
    
    $opts = array(
    	// 'debug' => true,
    	'roots' => array(
    		array(
    			'driver'        => 'LocalFileSystem',   // driver for accessing file system (REQUIRED)
    			'path'          => '/home/',         // path to files (REQUIRED)
    			'URL'           => dirname($_SERVER['PHP_SELF']) . '/home/', // URL to files (REQUIRED)
    			'accessControl' => 'access'             // disable and hide dot starting files (OPTIONAL)
    		)
    	)
    );
    
    // run elFinder
    $connector = new elFinderConnector(new elFinder($opts));
    $connector->run();
    
    I want him to make the call the "$screen" (folder will be created automatically by the user) of each user .. and not the "/home/" (as an example of put) .. the "$screen" comes from my platform, and I add the "elFinder" to it ..

    Imagine that each user creates "1/2/3 or 4, etc .." folders ..
    The user then enters the "elFinder" and see the folder created "1/2/3 or 4" (created on the left side of the folders ) and want only see your folders him.

     

    My Example..

     

    It gives me error when I try to use these functions .. I use these functions for the "$screen" ..
    Of course, that I try connect only the folder .. but the result was 0 ..
    //za screen imeto
    function clean($string) {
       $string = str_replace(' ', '-', $string); // Replaces all spaces with hyphens.
       $string = preg_replace('/[^A-Za-z0-9\-]/', '', $string); // Removes special chars.
    
       return preg_replace('/-+/', '-', $string); // Replaces multiple hyphens with single one.
    }
    //end
    
    $srvname = mysql_real_escape_string(trim($_POST['servername'])); //ime na servera
    $port = (int)$_POST['ports']; //port na servera
    $ip = mysql_real_escape_string(trim($_POST['serverip'])); //serverip
    
    $screen = clean($srvname).$port.'_'.uniqid(); //screen imeto
    $dir = "/home/";
    
    $opts = array(
    	// 'debug' => true,
    	'roots' => array(
    		array(
    			'driver'        => 'LocalFileSystem',   // driver for accessing file system (REQUIRED)
    			'path'          => '$dir/$screen',         // path to files (REQUIRED)
    			'URL'           => dirname($_SERVER['PHP_SELF']) . '$dir/$screen', // URL to files (REQUIRED)
    			'accessControl' => 'access'             // disable and hide dot starting files (OPTIONAL)
    		)
    	)
    );
    

    This example of more folders..

    $opts = array(
        'roots' => array(
            array(
                'driver'        => 'LocalFileSystem',           // driver for accessing file system (REQUIRED)
                'path'          => 'path/to/files/first_root',  // path to files (REQUIRED)
                'URL'           => 'http://localhost/files/first_root/',   // URL to files (REQUIRED)
                'alias'         => 'First home', // The name to replace your actual path name. (OPTIONAL)
                'accessControl' => 'access'      // disable and hide dot starting files (OPTIONAL)
            ),
            array(
                'driver'        => 'LocalFileSystem',
                'path'          => 'path/to/files/second_root',
                'URL'           => 'http://localhost/files/second_root/',
                'alias'         => 'Second home'
            )
        )
    );
    

    But I need to be automatic, for each creation of user..

    I use the variable "$screen" to create automatic folder of user.. but how to call the database of $screen ? the $screen exist only on my platform..

     

    I don't know if you understand me..

     

     

    Regards,

    Joob

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.