Location: PHPKode > scripts > Fancy Free PHP Image Gallery > fancy-img/ajax/sessions.php
<?php require '../config.php'; ?>
<?php
if(isset($_GET))
{
    if(isset($_GET['action']))
    {
        switch($_GET['action'])
        {
            
            case "dim":
                if(isset($_GET['width']) && isset($_GET['height']))
                {
                    $_SESSION['w'] = (int) $_GET['width'];
                    $_SESSION['h'] = (int) $_GET['height'];
                    print 'ok';
                }else{
                    print 'Width & Height must be specified';
                }
            break;
            
            case "align":
                if(isset($_GET['align']))
                {
                    $_SESSION['align'] = (string) $_GET['align'];
                    print 'ok';
                }else{
                    print 'Alignment must be specified';
                }             
            break;
            
            case "save":
            
                if(isset($_GET['id']) && isset($_GET['left']) && isset($_GET['top']))
                {
                    $_SESSION[(string) $_GET['id']] = array("left" => (int) $_GET['left'], "top" => (int) $_GET['top'] - 249);
                    print 'ok';
                }else{
                    print 'Image ID, Left & Right positions required';
                }
            
            break;
            
            case "write":
            
                $myFile = '../settings.scriptoggle';                
                $fh = fopen($myFile, 'w') or die("can't open file $myFile. check permissions");                
                $stringData = serialize($_SESSION)."\n";
                fwrite($fh, $stringData) or die("can't write to file $myFile. check permissions");
                fclose($fh);
                
                print 'ok';
            
            break;
            
        }
    }
}
?>
Return current item: Fancy Free PHP Image Gallery