<?php

/**
 * Created by Sevio®.
 * All rights reserved to Sevio Solutions® SRL
 */
class class_sizes
{
    protected $unique, $witdh,$height;
    public function class_sizes($unique)
    {
        $sql = mysql_query("SELECT * FROM `app_sizes` WHERE `unique`='" . $unique . "'");
        $data = mysql_fetch_array($sql);
        if ($data) {
            $this->unique=$data['unique'];
            $this->width = $data[width];
			$this->height = $data[height];
			}
    }
    static public function add($width,$height)
    {
        $key = rand(1,999).date("is") ;
        $sql = mysql_query("INSERT INTO `app_sizes` (`unique`,`width`,`height`) VALUES ('" . $key . "','" . $width . "','".$height."')");
    }
    public function get_unique()
    {
        return $this->unique;
    }
    public function get_width()
    {
        return $this->width;
    }
	public function get_height()
    {
        return $this->height;
    }
	public function get_size()
    {
        return $this->width."x".$this->height;
    }
    public function set_width($value)
    {
        $this->width = $value;
        $sql = mysql_query("UPDATE `app_sizes` SET `width`='" . $value . "' WHERE `unique`='" . $this->unique . "'");
    }
	public function set_height($value)
    {
        $this->height = $value;
        $sql = mysql_query("UPDATE `app_sizes` SET `height`='" . $value . "' WHERE `unique`='" . $this->unique . "'");
    }
    public function del()
    {
        mysql_query("DELETE FROM `app_sizes` WHERE `unique`='" . $this->unique . "' ");
    }
}
?>