<?PHP

//........................

if (empty($_GET['id'])) {

        $SQLbeta = "SELECT * from $table WHERE TITLE = ''";
        $resultbeta = @mySQL_query( $SQLbeta ); while( $rowbeta = @mySQL_fetch_array( $resultbeta ) ) {

        $dir = "../uploads/$rowbeta[ID]";
        removeDir($dir);

        }
}

//........................

if (empty($_GET['id']) || $_GET['clone'] == 1) {

        $SQLbeta = "SELECT * from $table WHERE TITLE = ''";
        $resultbeta = @mySQL_query( $SQLbeta ); while( $rowbeta = @mySQL_fetch_array( $resultbeta ) ) {

                $dir = "../uploads/$rowbeta[ID]";
                removeDir($dir);

        }

        $SQLbeta = "DELETE FROM $table WHERE TITLE = ''"; mySQL_query("$SQLbeta");

//........................
        $SQLbeta = "INSERT INTO $table SET TITLE = ''";
        $querybeta = mySQL_query($SQLbeta);

        $SQLbeta = "SELECT * from $table ORDER BY ID DESC";
        $resultbeta = mySQL_query( $SQLbeta );
        $rowbeta = mySQL_fetch_array( $resultbeta );
        $_GET['id'] = $rowbeta['ID'];
        copy_directory("$_SERVER[DOCUMENT_ROOT]/webifycore/jquery/ulimages","../uploads/$_GET[id]");
}

//........................

?>
