<?php
 
$checkReferer='http://www.iscripts.com/easycreate/demo.php';
$referrer = $_SERVER[HTTP_REFERER];

$action = $_GET['action'];
include "includes/session.php";
include "includes/config.php";
include "includes/function.php";

if($referrer==$checkReferer && $action == 'frontend'){
	$userName = "user";
	$userPass = "pass";
   	$sql="SELECT * from tbl_user_mast WHERE vuser_login='".$userName."' and vuser_password='".md5($userPass)."' and vdel_status='0'";
    $result=mysql_query($sql,$con) or die(mysql_error());
    if(mysql_num_rows($result) > 0) {
        while($row=mysql_fetch_array($result)) {
            //set sessions
            $_SESSION["session_loginname"]=$userName;
            $_SESSION["session_userid"]=$row["nuser_id"];
            $_SESSION["session_email"]=$row["vuser_email"];
            $_SESSION["session_style"]=$row["vuser_style"];
            $_SESSION["session_template_dir"] = getSettingsValue('template_dir');

            /* For setting editor path */
            $rootPath = getSettingsValue('rootpath');
            $_SESSION['ROOT_PATH']=$rootPath;

            $rootserver = getSettingsValue('rootserver');
            $_SESSION['INSTALL_PATH'] = $rootserver;

            $serverPermission = getSettingsValue('serverPermission');
            if($serverPermission=="0755"){
                $_SESSION['SERVER_PERMISSION']= 0755;
            }
            else{
                $_SESSION['SERVER_PERMISSION']= 0777;
            }
            header("location:usermain.php?succ=msg");   
        }
    }
}
else if($referrer==$checkReferer && $action == 'admin'){
	 
	$adminPass = 'admin';
	$adminName = 'admin';
  //check if login information are correct
   $sql="SELECT * from tbl_lookup WHERE vname='admin_pass' and  vvalue='".md5(mysql_real_escape_string($adminPass))."'";
   $result=mysql_query($sql,$con) or die(mysql_error());

   if((mysql_num_rows($result) > 0) ){

          $_SESSION["session_username"] = "admin";
		  $_SESSION["session_advCatId"] = "";
		  $_SESSION["session_advTemplateDir"] = "";
		  $_SESSION["session_steps"] = "";
		  $_SESSION["session_advTemplateType"] = "";
          header("location:admin/dashboard.php");
   }
}

?> 
