<?php
/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
include "../includes/config.php";
include "../includes/session.php";
include "../includes/functions.php";
include "../classes/cls_store.php";
$sellerid   =   $_REQUEST['sellerid'];
$buyerid    =    $_REQUEST['userid'];

// Switch To seller Dashboard
if($sellerid!='')
    {
            $sellerObj  =    Store::get_seller_account_info($sellerid);
       
            if($sellerObj->status==SUCCESS)
                    {
                        $sellerObjVal                       =   $sellerObj->data;
                       
                        $expiry_staus                       =   $sellerObjVal->plan_expired;
                        $vapproved                          =   $sellerObjVal->vapproved;
                        $deleted                            =   $sellerObjVal->deleted;

                                 if($expiry_staus=='Y')
                                {

                                        header("Location:seller_plan_upgrade.php?sellerid=".$_SESSION["sess_artistid"]);
                                         exit;
                                }else if($vapproved!='Y')
                                    {
                                         header("Location:login.php");
                                         exit;
                                    }

                                    else if($deleted=='Y')
                                    {
                                         header("Location:login.php");
                                         exit;
                                    }
                                    else{
                                             $_SESSION["sess_artistname"]        =   $sellerObjVal->artist_name;
                                             $_SESSION["sess_artistid"]          =   $sellerObjVal->artist_id;
                                             header("Location:artistmain.php");
                                             exit;
                                    }
                    }else{

                             header("Location:login.php");
                             exit;
                    }

                   
    }


    // Swith to Buyer Dashboard

    if($buyerid>0)
        {
               if(isset($_SESSION["sess_userid"]) and $_SESSION["sess_userid"]!= ""){
                    header("Location:".SITE_URL."/myaccount.php");
                    exit;
            }else{
                        $_SESSION["sess_userid"] = $buyerid;
                       header("Location:".SITE_URL."/myaccount.php");
                        exit;
                }
        }
?>
