SpamAssassin test

By Zilli,

To test SpamAssassin just send the following text into an e-mail and must surely be recognized as spam:

XJS*C4JDBQADN1.NSBN3*2IDNEN*GTUBE-STANDARD-ANTI-UBE-TEST-EMAIL*C.34X

  Category: OS
  Comments: None

Detect Browser Language in PHP

By Zilli,

<?php   
    $lang = getenv("HTTP_ACCEPT_LANGUAGE");
    $set_lang = explode(',', $lang);
    if (isset($_POST['lang'])) 
        {
            $taal = $_POST['lang'];
            setcookie("lang", $taal);
            header('Location: /p/');
        }
    else 
        {
            setcookie("lang", $set_lang[0]);
            echo $set_lang[0];
            echo '<br>';
            echo $set_lang[1];
            header('Location: /p/');
        } 
?>

Nivo slider options

By Zilli,

$("#nivoSlider").nivoSlider({
effect: 'random', // Specify sets like: 'fold,fade,sliceDown'
slices: 15, // For slice animations
boxCols: 8, // For box animations
boxRows: 4, // For box animations
animSpeed: 500, // Slide transition speed
pauseTime: 3000, // How long each slide will show
startSlide: 0, // Set starting Slide (0 index)
directionNav: true, // Next & Prev navigation
controlNav: true, // 1,2,3... navigation
controlNavThumbs: false, // Use thumbnails for Control Nav
pauseOnHover: true, // Stop animation while hovering
manualAdvance: false, // Force manual transitions
prevText: 'Prev', // Prev directionNav text
nextText: 'Next', // Next directionNav text
randomStart: false, // Start on a random slide
beforeChange: function(){}, // Triggers before a slide transition
afterChange: function(){}, // Triggers after a slide transition
slideshowEnd: function(){}, // Triggers after all slides have been shown
lastSlide: function(){}, // Triggers when last slide is shown
afterLoad: function(){} // Triggers when slider has loaded
});

How do I uninstall Java 7 and later versions on my Mac?

By Zilli,

Following the steps listed will uninstall Oracle Java from your system using a Terminal.

Click on the Finder icon located in your dock
Click on Applications tab on sidebar
Click on the Utilities folder
Double-click on the Terminal icon
In the Terminal window, copy and paste the command:

sudo rm -fr /Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin

https://www.java.com/en/download/help/mac_uninstall_java.xml

  Category: OS
  Comments: None

PDO connection with MySQL

By Zilli,

<?PHP
# gestione delle eccezioni in fase di connessione con PDO

// collegamento al database
$col = 'mysql:host=localhost;dbname=DATABASE_NAME';

// blocco try per il lancio dell'istruzione
try {
  // connessione tramite creazione di un oggetto PDO
  $db = new PDO($col , 'username', 'password');
}
// blocco catch per la gestione delle eccezioni
catch(PDOException $e) {
  // notifica in caso di errorre
  echo 'Attenzione: '.$e->getMessage();
}


/* disabilitazione dell'auto-commit
$db->beginTransaction();

// esecuzione delle query
$sql = $db->exec("UPDATE filnet_page SET img_code = 'AU002.jpgTEST' WHERE id = 67");

// applicazione delle modifiche
$db->commit(); */


# utilizzo del metodo query()

// definizione della query 
$sql = 'SELECT field1, field2 FROM table_name ORDER BY id';  

// visualizzazione dei risultati
foreach($db->query($sql) as $row){  ?>