Friday, May 20, 2022

AS filter version 2

 <?php


/*
CALL for nothing to delete, just list all:

localhost/p1.php?x=0

CALL for specific second message to delete and list all:

localhost/p1.php?x=2

*/


function is_base64($s)
{
      return (bool) preg_match('/^[a-zA-Z0-9\/\r\n+]*={0,2}$/', $s);
}

function get_between_data($string, $start, $end)
{
$pos_string = stripos($string, $start);
$substr_data = substr($string, $pos_string);
$string_two = substr($substr_data, strlen($start));
$second_pos = stripos($string_two, $end);
$string_three = substr($string_two, 0, $second_pos);
// remove whitespaces from result
$result_unit = trim($string_three);
// return result_unit
return $result_unit;
}


$user = "info@rubirosa.rs";
$pass = "Maja123";


//$imap = imap_open("{mail.rubirosa.rs:995/pop3/ssl/novalidate-cert}", $user, $pass);
//$imap = imap_open("{mail.rubirosa.rs:995/pop3/ssl/novalidate-cert}INBOX", $user, $pass);


$imap = imap_open("{mail.rubirosa.rs:110/pop3/notls}", $user, $pass);

//imap_delete($imap, 1);

if( $imap ) {
   
     //Check no.of.msgs
     $num = imap_num_msg($imap);

for ($x = 1; $x <= $num; $x++) {
  echo "The number is: $x <br>";
//  echo imap_qprint(imap_body($imap, $x));

$s= imap_qprint(imap_body($imap, $x));

$r = get_between_data($s,"base64"," ");

echo base64_decode($r);

$ss = " ";

$rr =  get_between_data($ss," "," ");

echo base64_decode($rr);

echo base64_decode($s);

if (is_base64($s)) {

  echo base64_decode($s);
}
else
{
  echo $s;
  //echo base64_decode($s);
 
}
 
  echo "<hr>";
 
  $header = imap_header($imap, $x);
$from = $header->from;
foreach ($from as $id => $object) {
    $fromname = $object->personal;
    $fromaddress = $object->mailbox . "@" . $object->host;

echo $fromname . "<br>";
echo $fromaddress;

}

  echo "<hr>";

}

//mn = message number

$mn = $_GET['x'];
$rb = intval($mn);

if ($rb > 0) {

imap_delete($imap, $rb);  //mark some message for delete with specific message number

imap_expunge($imap);    //delete marked message

}
else {
echo "Pogresan parametar za brisanje";  
 
}


     //close the stream
     imap_close($imap);
}

?>

++Do you need encouragement while typing the best code ever?
Try this:




Linux with Windows look:



ULTRA UBER BACKUP:


Freetube withot comercials:

No comments:

Post a Comment

Коментар: