Sh3ll
OdayForums


Server : Apache
System : Linux profile 3.10.0-1160.88.1.el7.x86_64 #1 SMP Tue Mar 7 15:41:52 UTC 2023 x86_64
User : apache ( 48)
PHP Version : 8.0.28
Disable Function : NONE
Directory :  /var/www/html/mmishra/erp-22-05-2018/views/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //var/www/html/mmishra/erp-22-05-2018/views/erp_view.php
<?php
date_default_timezone_set('Asia/Kolkata');   

class erpView {

    var $controller;
    var $model;
	
    public function __construct($erpController, $erpModel) {

        $this->controller 	= $erpController;	// instantiate controller
        $this->model 		= $erpModel;		// instantiate model

    }

    public function __destruct() {
        if ($this->controller->app == '/' || $this->controller->app == 'about' || $this->controller->app == 'upload' || $this->controller->app == 'logout') {
        } else {  
			print(":|:" .$this->erpXupdate($this->controller->loginID, $this->controller->menu). ":|:" .$this->erpError(). ":|:" .$this->erpClock());
    	}
	}

    public function erpBanner() {
        $str = "<div class='fixedbar'>
		<div class='logo'><img src='images/iLogo.png' width='75' height='75' border='0'></div>
        <h2 class='title'>INDIAN<img src='images/tricolor.png' width='175' height='22' border='0'><br>INSTITUTE OF<br>INFORMATION<br>TECHNOLOGY<br>ALLAHABAD</h2>
        <div class='version'>( Version 1.0 <sub style='color:grey; font-size:10px'><i>beta</i></sub> )</div>
		<div class='helpbar' id='helpbar'></div>";
    
    	return $str;
    }
	
	function erpClock() {
		return "<i style='font-size:14px;' class='fas fa-clock'></i> " .date("l, d M, Y h:i:s A");
	}
	
    function erpModule($moduleID, $app='erp') {
		if ($moduleID) {
			$this->controller->moduleID = $moduleID;
		} else {
			$moduleID 					= $this->controller->moduleID;
		}
        $modules = $this->model->moduleList();
        $str = "<table width='200px'>";
        foreach ($modules as $module) {
            if ($moduleID == $module['moduleID']) { 
                $str .= "<tr><td align='center'><i class='" .$module['moduleIcon']. "' style='font-size:20px'></i></td><td><b>" .$module['moduleName']. " <i class='fas fa-check'></i></b></td></tr>";
				$_SESSION["moduleID"] = $moduleID;
            } else {
				$str .= "<tr><td align='center'><a href='' onclick=\"inner('$app/module/render/" .$module['moduleID']. "'); return false;\" title='" .$module['description']. "'><i class='" .$module['moduleIcon']. "' style='font-size:20px'></i></a></td><td> " .$module['moduleName']. "</td></tr>";
            }
        }
        $str .= "</table>";
        if ($this->controller->app == '/' || $this->controller->app == 'about' || $this->controller->app == 'upload' || $this->controller->app == 'logout') {
        } else {  
        	$str .= ":|:" .$this->erpMenu($this->controller->loginID, $moduleID);
    	}

        return $str;
    }

    function erpError($errorText='') {
       	if (!$errorText) {
			$errorText = $this->controller->errorText;
			$str = "<i class='fas fa-bullhorn'></i> " .$errorText;
		}
		
		return $str;
	}
	
	function erpHelper($tuple) {
	 	if ($tuple == -1)
			$str = '';
		else {
			$str = "<h3><span class='button'><i class='far fa-question-circle'></i></span> Help Tips <span class='toolbar'><a href='' onclick=\"inner('erp/helper/render/-1'); return false;\" title='Close Helper'><span class='button'><i class='far fa-times-circle'></i></span></a></span></h3>";
			if ($tuple > 0) {
				$str .=	"<pre class='wordwrap'>" .$this->model->getMenuHelp($tuple). "</pre>";
			} else {
				$str .= "Helper does not offer any 'Help Tips' for this interface. Please click <i class='far fa-times-circle'></i> button above to close this helper.";
			}
	 	}
		
		return $str;
	}
	
    public function erpHeader($action='') {
        $str = "
		<div class='clockbar' id='clockbar'>" .$this->erpClock(). "</div>
        <div class='modulebar' id='modulebar'>" .$this->erpModule($this->controller->moduleID). "</div><br>
        <div class='errorbar' id='errorbar'>" .$this->erpError(). "</div>
        <div class='loginbar'>";
		if ($this->controller->sessionID) {
			$str .= "Welcome <b>" .$this->controller->loginID. "</b> !!! <i style='font-size:14px; color:#247BBB' class='far fa-thumbs-up'></i>
			you are logged in as <b>" .$this->model->getUserGroup($this->controller->loginID). "</b>. Please quit your session here... 
			<a href='/logout/'><i style='font-size:14px; color:#247BBB' class='fas fa-sign-out-alt'></i></a>";
		} else {
			$str .= "<form method='post' action='/' id='form'>Welcome to ERP @ IIITA !!!&nbsp;&nbsp;&nbsp;&nbsp; 
			<i style='font-size:14px;' class='fas fa-user'></i> <input type='text' name='uid' size='10' value='" .$this->controller->loginID. "' placeholder='login ID'> 
			<i style='font-size:14px;' class='fas fa-key'></i> <input type='password' name='pwd' size='10' placeholder='password' onchange=\"document.querySelector('form').submit(); return false;\"> 
			<a href='javascript:void(0)' onclick=\"document.querySelector('form').submit(); return false;\"><i style='font-size:16px;' class='fas fa-sign-in-alt'></i></a></form>";
		}
		$str .= "</div><br>
		<div class='menubar' id='menubar'>" .$this->erpMenu($this->controller->loginID, $this->controller->moduleID). "</div><br>
		</div>";

        return $str;
    }

	function erpXlogin($loginID) {
		$str = "<i class='fas fa-exchange-alt'></i> ";
		if ($loginID && $this->controller->sessionID) {
            $str .= $this->model->getXlogin($loginID);
		} else {
			$str .= "ERP reports last login timestamp here.";
		}

		return $str;
	}

	function erpXupdate($loginID, $menu) {
		$str = "<i class='far fa-clock'></i> ";
		if ($loginID && $menu) { // && $this->controller->sessionID) {
			$tmstamp = $this->model->getXupdate($loginID, $menu);
			$str .= $tmstamp ? $tmstamp : "ERP reports update timestamp of current record here.";
        } else {
			$str .= "ERP reports update timestamp of current record here.";
		}
		
        return $str;	
		
	}
	
	function erpMenu($loginID, $moduleID) {
		if ($moduleID) { 
			$this->controller->moduleID = $moduleID;
		} else {
			$moduleID = $this->controller->moduleID;
		}
		// list menu items to interact with of ERP system, the first top level menu is HOME
        $str = "<div align='left'>
        <table><tr><td>
        <!--sphider_noindex-->
        <ul id='menu'>
        	<div class='spanx'>
            	<li><a href='/' class='drop'><font size=+1 color='skyblue'><i class='fa fa-home'></i></font> Home </a>
            	</li><!-- End 4 columns Item -->
        	</div>
        </ul>
        <!--/sphider_noindex--></td>";
		// list top level other menu items to interact with applications of ERP system
        $apps = $this->model->appList($moduleID);
        foreach ($apps as $app) {
        	if ($app['universal'] || $this->model->checkGreadACL($loginID, $app['appID'])) {
               	$str .= "<td><!--sphider_noindex-->
               	<ul id='menu'>
               	<div class='spanx'>";
		           	if (substr($app['appURL'], 0, 4) == "http") {
                		$str .= "<li><a href='" .$app['appURL']. "' class='drop' title='" .$app['description']. "' target='_new'><font size=+1 color='" .$app['iconColor']. "'><i class='" .$app['appIcon']. "'></i></font> " .$app['appName']. " </a>
                		</li><!-- End of top menu Item -->";
    
    		       	} else {
    		       		// list drop down menu items to list user interfaces for input, output and configuration of ERP system
            	    	$str .=	"<li><a href='' onclick=\"inner('" .$app['appCode']. "/dashboard/render/0'); return false;\" class='drop'><font size=+1 color='" .$app['iconColor']. "'><i class='" .$app['appIcon']. "'></i></font> " .$app['appName']. " </a>
                		<!-- Begin 4 columns Item -->
                		<div class='dropdown_4columns'><!-- Begin 4 columns container -->
                   			<div class='col_4'>
                       			<h2><i class='" .$app['appIcon']. "'></i> " .$this->model->getModuleName($app['moduleID']). " - " .$app['appName']. " panel</h2>
                   			</div>
                   			<div class='col_2'>
                       			<h3><i class='far fa-question-circle'></i> ABOUT " .strtoupper($app['appCode']). "</h3>
                       			<p>" .$app['description']. "</p>
                       			<ul>";
								// list interfaces for configuration of ERP system
                       			$menus = $this->model->menuList($app['appID'], 'C');
                       			foreach ($menus as $menu) {
                           			if ($menu['protection'] == 0 || $this->model->checkUreadACL($loginID, $menu['menuID'])) {
                               			if (substr($menu['menuURL'], 0, 4) == "http") {
                                   			$str .= "<li><a href='" .$menu['menuURL']. "' title='" .$menu['description']. "' target='_new'><font size=+1><i class='fa " .$menu['menuIcon']. "'></i></font> " .$menu['menuName']. "</a></li>";
                               			} else {
                                   			$str .= "<li><a href='' onclick=\"inner('" .$app['appCode']. "/".$menu['menuURL']."/new/0'); return false;\" title='" .$menu['description']. "'><font size=+1><i class='fa " .$menu['menuIcon']. "'></i></font> " .$menu['menuName']. "</a></li>";
                               			}
                           			}
                       			}
                        		$str .= "</ul>
                    		</div>
                    		<div class='col_1'>
                        		<h3><i class='far fa-keyboard'></i> INPUT</h3>
                        		<ul>";
                        		// list interfaces for input to the ERP system
                        		$menus = $this->model->menuList($app['appID'], 'I');
                        		foreach ($menus as $menu) {
                           			if ($menu['protection'] == 0 || $this->model->checkUreadACL($loginID, $menu['menuID'])) {
                               			if (substr($menu['menuURL'], 0, 4) == "http") {
                                   			$str .= "<li><a href='" .$menu['menuURL']. "' title='" .$menu['description']. "' target='_new'><font size=+1><i class='fa " .$menu['menuIcon']. "'></i></font> " .$menu['menuName']. "</a></li>";
                               			} else {
                                   			//$str .= "<li><a href='' onclick=\"inner('menuID=" .$menu['menuID']. "'); return false;\" title='" .$menu['description']. "'><font size=+1><i class='fa " .$menu['menuIcon']. "'></i></font> " .$menu['menuName']. "</a></li>";
                                   			$str .= "<li><a href='' onclick=\"inner('" .$app['appCode']. "/".$menu['menuURL']."/new/0'); return false;\" title='" .$menu['description']. "'><font size=+1><i class='fa " .$menu['menuIcon']. "'></i></font> " .$menu['menuName']. "</a></li>";
                               			}
									}
                        		}
                        		$str .= "</ul>
                    		</div>
                    		<div class='col_1'>
                        		<h3><i class='fa fa-print'></i> OUTPUT</h3>
                        		<ul>";
	                    		// list interfaces for output from the ERP system
                        		$menus = $this->model->menuList($app['appID'], 'O');
                        		foreach ($menus as $menu) {
                           			if ($menu['protection'] == 0 || $this->model->checkUreadACL($loginID, $menu['menuID'])) {
                               			if (substr($menu['menuURL'], 0, 4) == "http") {
                                   			$str .= "<li><a href='" .$menu['menuURL']. "' title='" .$menu['description']. "' target='_new'><font size=+1><i class='fa " .$menu['menuIcon']. "'></i></font> " .$menu['menuName']. "</a></li>";
                               			} else {
                                   			$str .= "<li><a href='' onclick=\"inner('" .$app['appCode']. "/".$menu['menuURL']."/list/0'); return false;\" title='" .$menu['description']. "'><font size=+1><i class='fa " .$menu['menuIcon']. "'></i></font> " .$menu['menuName']. "</a></li>";
                               			}
                           			}
                        		}
                        		$str .= "</ul>
                    		</div>
                		</div><!-- End 4 columns container -->
                	</li><!-- End 4 columns Item -->
               		";
               	}
               	$str .= "</div>
               	</ul>
               	<!--/sphider_noindex--></td>";
        	}
        }
        $str .= "</tr></table></div>";
        
        return $str;
    }

    function erpDashboard() {
        $str = "<h3>Dashboard</h3>
        <table class='report' style='width:20%' align='left'>";

        $data = $this->model->getDashboard();
        foreach($data as $key => $value) {
            $str .= "<tr><td nowrap>" .ucfirst($key). "</td><th>" .$value. "</th></tr>";
        }	

        $str .= "</table>";

        return $str;
    }

    public function erpToolbar() {
		$app 		= $this->controller->app;
		$menu 		= $this->controller->menu;
		$action		= $this->controller->action;
		$tuple		= $this->controller->tuple ? $this->controller->tuple : 0;
		$userACL 	= $this->model->getUserACLs($this->controller->loginID, $menu);
		$filterText = $this->controller->filterText;
			 
		// toolbar according to aclInsert, acl Update, aclDelete privileges
        $str = "<span class='toolbar'>
		<a href='' onclick=\"inner('$app/$menu/new/0'); return false;\" title='Refresh page'><span class='button'><i class='fas fa-sync-alt'></i></span></a>";
		
		// privileged insert operation
        $str .= "<a href='' onclick=\"inner('$app/$menu/new/0'); return false;\" title='New record'><span class='button'><i class='far fa-file'></i></span></a>";
            
		// privileged save operations
		$str .= ($tuple && substr($userACL, 1, 1) == '1' ? "<a href='' onclick=\"inner('$app/$menu/edit/$tuple'); return false;\" title='Edit record'><span class='button'><i class='far fa-edit'></i></span></a>" : "<span class='button'><i class='far fa-edit'></i></span>");
		$str .= (substr($userACL, 0, 1) == '1' || substr($userACL, 1, 1) == '1' ? "<a href='' onclick=\"inner('$app/$menu/save/$tuple'); return false;\" title='Save record'><span class='button'><i class='far fa-save'></i></span></a>" : "<span class='button'><i class='far fa-save'></i></span>");
		$str .= ($tuple && substr($userACL, 1, 1) == '1' ? "<a href='' onclick=\"inner('$app/$menu/upper/$tuple'); return false;\" title='Move upward'><span class='button'><i class='fas fa-arrow-up'></i></span></a>" : "<span class='button'><i class='fas fa-arrow-up'></i></span>");
		$str .= ($tuple && substr($userACL, 1, 1) == '1' ? "<a href='' onclick=\"inner('$app/$menu/lower/$tuple'); return false;\" title='Move downward'><span class='button'><i class='fas fa-arrow-down'></i></span></a>" : "<span class='button'><i class='fas fa-arrow-down'></i></span>");
		$str .= ($tuple && substr($userACL, 1, 1) == '1' ? "<a href='' onclick=\"inner('$app/$menu/disable/$tuple'); return false;\" title='Disable record'><span class='button'><i class='far fa-thumbs-down'></i></span></a>" : "<span class='button'><i class='far fa-thumbs-down'></i></span>");
        $str .= ($tuple && substr($userACL, 1, 1) == '1' ? "<a href='' onclick=\"inner('$app/$menu/enable/$tuple'); return false;\" title='Enable record'><span class='button'><i class='far fa-thumbs-up'></i></span></a>" : "<span class='button'><i class='far fa-thumbs-up'></i></span>");
        
		// privileged delete operation
        $str .= ($tuple && substr($userACL, -1) == '1' ? "<a href='' onclick=\"inner('$app/$menu/trash/$tuple'); return false;\" title='Delete record'><span class='button'><i class='far fa-trash-alt'></i></span></a>" : "<span class='button'><i class='far fa-trash-alt'></i></span>");
		// initiated delete confirmation
		$str .= ($action == 'trash' ? "[<b class='alert'>Are you sure?</b><a href='' onclick=\"inner('$app/$menu/delete/$tuple'); return false;\" title='Confirm deletion'><span class='button'><i class='far fa-check-circle'></i></span></a>|<a href='' onclick=\"inner('$app/$menu/open/$tuple'); return false;\" title='Cancel deletion'><span class='button'><i class='far fa-times-circle'></i></span></a>]" : '');
		
		// regular filter, print and help tool buttons
        $str .= "<a href='' onclick=\"inner('$app/$menu/search/$tuple'); return false;\" title='Filter record'><span class='button'><i class='fas fa-search'></i></span></a>";
		//$str .= ($action == 'search' || $filterText ? "[<b class='alert'>Filter on</b> <input type='text' id='filter' name='filterText' value='$filterText' size='10' autofocus='autofocus' onkeyup=\"if (this.value.length > 2) {inner('$app/$menu/filter/$tuple'); $('#filter').focus(); return false;}\"><a href='' onclick=\"$('#filter').val(''); inner('$app/$menu/open/$tuple'); return false;\" title='Cancel filter'><span class='button'><i class='far fa-times-circle'></i></span></a>]" : '');
		$str .= ($action == 'search' || $filterText ? "[<b class='alert'>Filter on</b> <input type='text' id='filter' name='filterText' value='$filterText' size='10' autofocus='autofocus'><a href='' onclick=\"inner('$app/$menu/filter/$tuple'); return false;\" title='Filter list'><span class='button'><i class='far fa-check-circle'></i></span></a>|<a href='' onclick=\"$('#filter').val(''); inner('$app/$menu/open/$tuple'); return false;\" title='Cancel filter'><span class='button'><i class='far fa-times-circle'></i></span></a>]" : '');
		$str .= "<a href='' onclick=\"printMe('contentbar'); return false;\" title='Print record'><span class='button'><i class='fa fa-print'></i></span></a>
		<a href='' onclick=\"inner('$app/helper/render/" .$this->model->getMenuID($menu). "'); return false;\" title='Helper Tips'><span class='button'><i class='far fa-question-circle'></i></span></a>
		</span>";
       
        return $str;
    }

    public function erpPrintbar() {
		$app 		= $this->controller->app;
		$menu 		= $this->controller->menu;

        $str = "<span class='toolbar'>
		<a href='' onclick=\"inner('$app/$menu/new/0'); return false;\" title='Refresh page'><span class='button'><i class='fas fa-sync-alt'></i></span></a>
		<a href='' onclick=\"printMe('contentbar'); return false;\" title='Print record'><span class='button'><i class='fa fa-print'></i></span></a>
    	</span>";

        return $str;
    }

	public function erpPasswd($action, $tuple) {
		$action = $this->controller->managePasswd($action, $this->controller->loginID);
		
		$str = "<h3><i class='fas fa-street-view'></i> LDAP Password <a href='' onclick=\"inner('erp/passwd/reset/1'); return false;\" title='Change password'><span class='button'><i class='fas fa-save'></i></span></a></h3>
		<table width='50%'>
		<tr><th colspan='2'>Reset Password  [ LoginID: " .$this->controller->loginID. " ]</th></tr>
		<tr><td>New password</td><td><input type='password' name='passwd1' size='30'></td></tr>
		<tr><td>Confirm password</td><td><input type='password' name='passwd2' size='30'></td></tr>
		</table><br>
		Try to set a complex password comprising alphbets, number and special characters.<br>
		Please keep on changing your password once in every month for better security of your account.";
		
		return $str; // required to split content in ajax
	}

	
    public function erpContent($action='') {
        $str = "<div class='contentbar' id='contentbar'>";
		//for file upload, ajax will not work so a form with action='includes/erp_upload.php' is needed 

		if ($action == "About") {
			$app 		= $this->controller->app;					// application envoked        
			$menu 		= $this->controller->menu;					// menu envoked        

			include "includes/erp_about.inc";

        	//$str = "<h3>" .$this->model->getMenuTitle($action) .$this->erpPrintbar(). "</h3>";
			$str .= $about;
			
		} else {
		
			$str .= $this->erpDashboard();
		
		}
		
		$str .= "</div>";

        return $str;
    }
    
	function erpFooter() {
		$str = "
		<div class='xloginbar' id='xloginbar'>" .$this->erpXlogin($this->controller->loginID);
		if ($this->controller->sessionID) $str .= "<br><a href='' onclick=\"inner('erp/passwd/open/0'); return false;\" title='Change LDAP password'><i style='font-size:12px;' class='fas fa-key'></i> Change Password</a>";
		$str .= "</div>
		<div class='xupdatebar' id='xupdatebar'>" .$this->erpXupdate($this->controller->loginID, $this->controller->menu);
		if ($this->controller->sessionID) $str .= "<br><a href='backup.php' title='Take backup of database'><i style='font-size:12px;' class='fas fa-database'></i> Backup Database</a>";
		$str .= "</div>		
		<div class='footer'>
		[ Your IP <i style='font-size:14px; color:#247BBB' class='fa fa-laptop'></i> " .$this->controller->userIP. " ]
        <hr>
    	<b><span style='font-size:14px;'>&copy;</span>2017 ERP & Automation, IIIT Allahabad, Devghat, Jhalwa, Allahabad-211012 (UP) INDIA<br>
    	Institute ERP system is under development by internal automation team.<br>
    	Contact: 0532-2922011/2042/2238, erp.support@iiita.ac.in
    	<hr></div>";
            
        return $str;
    }

	function erpUpload() {
		$str = "<table width='100%'>
    	<tr><td>Select Certificate</td><td><select name='certCode' style='width: 265px'>";
    	foreach ($this->controller->certFiles as $code => $desc) {
			$str .= "<option value='" .$code. "'>" .$desc. "</option>";
		}
		$str .= "</select></td>
		<td>Select File</td><td><input type='file' name='fileToUpload' id='fileToUpload' size='50'></td> 
		<td><input type='submit' name='submit' value='UPLOAD'></td></tr>
		</table>
		<input type='hidden' name='callerID' value='" .$_POST['callerID']. "'>
		<div align='center'>
		[ <a href='' onclick=\"inner('" .$this->controller->app. "/" .$this->controller->menu. "/new/" .$this->controller->tuple. "'); return false;\" title='Refresh upload'>Refresh</a> ]
		</div>";
            
        return $str;
    }

   	// online pg service integratiob
	public function erpIPG() {
		$str = "</form><form  method='post' action='https://secure.ebs.in/pg/ma/payment/request/' name='frmTransaction' id='frmTransaction' >  	 
     	<table width='600' cellpadding='2' cellspacing='2' border='0'>
        <tr><th colspan='2'>Transaction Details</th></tr>
		<tr>
            <td class='fieldName'><span class='error'>*</span> Channel</td>
            <td align='left'><select name='channel'>
			<option value='10'>Standard</option>
			</select></td>
        </tr>
	   	<tr>
            <td class='fieldName' width='50%'><span class='error'>*</span> Account Id</td>
            <td  align='left' width='50%'> <input name='account_id' type='text' value='25146'/><br><span><font color='red'> Please Enter your Account ID provided.</font></span> </td> 
        </tr>
        <tr>
            <td class='fieldName' width='50%'><span class='error'>*</span> Secret Key</td>
            <td  align='left' width='50%'> <input name='secretkey' type='text' value='' size='35'/><br><span><font color='red'> Please Enter your Secret Key provided.</font></span></td>
        </tr>
	   	<tr>
            <td class='fieldName' width='50%'><span class='error'>*</span> Reference No</td>
            <td  align='left' width='50%'> <input name='reference_no' type='text' value='<?php echo time();?>' /></td>
        </tr>
        <tr>
            <td class='fieldName' width='50%'><span class='error'>*</span> Sale Amount</td>
            <td  align='left' width='50%'> <input name='amount' type='text' value='<?php echo  rand(100,999);?>' /> <select name='currency' >
			<option value='INR'>INR</option>
			</select></td>
        </tr>
		<tr>
		  	<td class='fieldName'><span class='error'>*</span> Description</td>
		  	<td align='left'><input name='description' type='text' value='Test Product' /></td>
	   	</tr>
		<tr>
		  	<td class='fieldName'><span class='error'>*</span> Return Url</td>
		  	<td align='left'><input name='return_url' type='text' size='60' value='http://127.0.0.1/hdfcpg/response.php' /></td>
	   	</tr>
		<tr>
		  	<td class='fieldName'><span class='error'>*</span> Mode</td>
		  	<td align='left'><select name='mode' >
            <option value='LIVE' selected>LIVE</option>
          	</select></td>
	   	</tr>
        <tr><th colspan='2'>Billing Address</th></tr>
	    <tr>
            <td class='fieldName'><span class='error'>*</span> Name</td>
            <td align='left'>
            <input name='name' type='text' value='Test Name' /></td>
        </tr>
        <tr>
            <td class='fieldName'><span class='error'>*</span>Address</td>
            <td align='left'>
            <textarea name='address'>Test Address</textarea>            </td>
        </tr>
        <tr>
            <td class='fieldName'><span class='error'>*</span>City</td>
            <td align='left'>
            <input name='city' type='text' value='Mumbai' />            </td>
        </tr>
        <tr>
            <td class='fieldName'>State/Province</td>
            <td align='left'>
            <input name='state' type='text' value='MH' />            </td>
        </tr>
        <tr>
            <td class='fieldName'><span class='error'>*</span>ZIP/Postal Code</td>
            <td align='left'>
            <input name='postal_code' type='text' value='400069' />            </td>
        </tr>
        <tr>
            <td class='fieldName'><span class='error'>*</span>Country</td>
            <td align='left'>
            <input name='country' type='text' value='IND' />            </td>
        </tr>
        <tr>
            <td class='fieldName'><span class='error'>*</span>Email</td>
            <td align='left'>
            <input name='email' type='text' value='test@test.com' />            </td>
        </tr>
        <tr>
            <td class='fieldName'><span class='error'>*</span>Telephone</td>
            <td align='left'><input name='phone' type='text' value='2211112222' /></td>
        </tr>
        <tr>
            <th colspan='2'>Delivery Address</th>
        </tr>
		<tr>
            <td class='fieldName'> Name</td>
            <td align='left'>
            <input name='ship_name' type='text' value='Test Name' /></td>
        </tr>
        <tr>
            <td class='fieldName'>Address</td>
            <td align='left'>
            <input name='ship_address' type='text' value='Test Address' />            </td>
        </tr>
        <tr>
            <td class='fieldName'>City</td>
            <td align='left'>
            <input name='ship_city' type='text' value='Mumbai' />            </td>
        </tr>
        <tr>
            <td class='fieldName'>State/Province</td>
            <td align='left'>
            <input name='ship_state' type='text' value='MH' />            </td>
        </tr>
        <tr>
            <td class='fieldName'>ZIP/Postal Code</td>
            <td align='left'>
            <input name='ship_postal_code' type='text' value='400069' />            </td>
        </tr>
        <tr>
            <td class='fieldName'>Country</td>
            <td align='left'><input name='ship_country' type='text' value='IND' /></td>
        </tr>
        <tr>
            <td class='fieldName'>Telephone</td>
            <td align='left'><input name='ship_phone' type='text' value='2211112222' /></td>
        </tr>
        <tr>
            <td valign='top' align='center' colspan='2'>
            <input name='submitted' value='Submit' type='submit' />&nbsp;     
            <input value='Reset' type='reset' />                            </td>
        </tr>
        <tr>
            <td valign='top' align='center' colspan='2'>
            <span class='error'>*</span> 
            <span>denotes required field</span>            </td>
        </tr>
    	</table>
		</form><form>
		";
		
		return $str;
	}

	public function erpPGresponse() {
		$HASHING_METHOD = 'sha512'; // md5,sha1

		// This response.php used to receive and validate response.
		if (!isset($_SESSION['SECRET_KEY']) || empty($_SESSION['SECRET_KEY']))
			$_SESSION['SECRET_KEY'] = ''; //set your secretkey here
	
		$hashData = $_SESSION['SECRET_KEY'];
		ksort($_POST);
		foreach ($_POST as $key => $value){
			if (strlen($value) > 0 && $key != 'SecureHash') {
				$hashData .= '|'.$value;
			}
		}
	
		if (strlen($hashData) > 0) {
			$secureHash = strtoupper(hash($HASHING_METHOD , $hashData));

			if ($secureHash == $_POST['SecureHash']){	
				if($_POST['ResponseCode'] == 0) {
					// update response and the order's payment status as SUCCESS in to database
					//for demo purpose, its stored in session
					$_POST['paymentStatus'] = 'SUCCESS';
					$_SESSION['paymentResponse'][$_POST['PaymentID']] = $_POST;
				} else {
					// update response and the order's payment status as FAILED in to database	
					//for demo purpose, its stored in session
					$_POST['paymentStatus'] = 'FAILED';
					$_SESSION['paymentResponse'][$_POST['PaymentID']] = $_POST;
				}
				// Redirect to confirm page with reference.
				$confirmData = array();
				$confirmData['PaymentID'] = $_POST['PaymentID'];
				$confirmData['Status'] = $_POST['paymentStatus'];
				$confirmData['Amount'] = $_POST['Amount'];
		
				$hashData = $_SESSION['SECRET_KEY'];

				ksort($confirmData);
				foreach ($confirmData as $key => $value){
					if (strlen($value) > 0) {
						$hashData .= '|'.$value;
					}
				}
				if (strlen($hashData) > 0) {
					$secureHash = strtoupper(hash($HASHING_METHOD , $hashData));
				}
					
				$str .= "<html>
				<body onLoad='document.payment.submit();'>
				<form action='confirm.php' name='payment' method='POST'>";

				foreach($confirmData as $key => $value) {
					$str .= "<input type='hidden' value='" .$value. "' name='" .$key. "'/>";
				}
				$str .= "<input type='hidden' value='" .$secureHash. "' name='SecureHash'/>
				</form>
				</body>
				</html>";
			} else {
				$str .= "<h1>Error!</h1>
				<p>Hash validation failed</p>";
			}
		} else {
			$str .= "<h1>Error!</h1>
			<p>Invalid response</p>";
		}
		
		return $str;
	}
	
 // erp backup generation
	public function erpDb($action, $db) {
		if ($action == 'backup') {
			$str = $this->controller->erpBackup();
		} else {
			$str = "Action not mentioned.";
		}
		
		return $str;
	}
	
	//*********************************************** reports on session, log and sql commands
	public function erpSession($action, $dated='') {
		$app 		= $this->controller->app;					// application envoked        
		$menu 		= $this->controller->menu;					// menu envoked        

		if (!$dated) $dated = date("Y-m-d");		
		$rows = $this->model->listSessions($dated, $this->controller->loginID);
        
        $str = "<h3>" .$this->model->getMenuTitle($menu) .$this->erpPrintbar(). "</h3>";
        $str .= $this->dateTool($dated);
		$str .= $this->printReport($rows);
        
        return $str;
	}

	public function erpLog($action, $dated='') {
		$app 		= $this->controller->app;					// application envoked        
		$menu 		= $this->controller->menu;					// menu envoked        
		
		if (!$dated) $dated = date("Y-m-d");		
		$rows = $this->model->listLogs($dated, $this->controller->loginID);
        
        $str = "<h3>" .$this->model->getMenuTitle($menu) .$this->erpPrintbar(). "</h3>";
        $str .= $this->dateTool($dated);
		$str .= $this->printReport($rows);

        return $str;
	}

	public function erpSql($action, $dated='') {
		$app 		= $this->controller->app;					// application envoked        
		$menu 		= $this->controller->menu;					// menu envoked        

		if (!$dated) $dated = date("Y-m-d");		
		$rows = $this->model->listSqls($dated, $this->controller->loginID);
        
        $str = "<h3>" .$this->model->getMenuTitle($menu) .$this->erpPrintbar(). "</h3>";
        $str .= $this->dateTool($dated);
		$str .= $this->printReport($rows);

        return $str;
	}
	
	public function dateTool($dated) {
		$app 		= $this->controller->app;					// application envoked        
		$menu 		= $this->controller->menu;					// menu envoked        

		if (!$dated) $dated = date("Y-m-d");		
		$yester = date('Y-m-d', strtotime($dated .' -1 day'));
		$tomoro = date('Y-m-d', strtotime($dated .' +1 day'));

        $str = "<div align='center'>
		<a href='' onclick=\"inner('$app/$menu/filter/$yester'); return false;\" title='Previous'> <span class='button'><i class='fas fa-chevron-circle-left'></i></span></a> 
		<b>[ " .$dated. " ]</b>" .($dated != date("Y-m-d") ? "
		<a href='' onclick=\"inner('$app/$menu/filter/$tomoro'); return false;\" title='Next'> <span class='button'><i class='fas fa-chevron-circle-right'></i></span></a>" : ''). "
		</div>";

		return $str;
	}
	
	public function printReport($rows) {
		$str = "<table width='100%'>";
		foreach($rows as $row) {
			$i++;			
			if ($i == 1) {
				$str .= "<tr><th>#</th>";
				foreach ($row as $key => $value) {
					$str .= "<th>" .ucfirst($key). "</th>";
				}
				$str .= "</tr>";
			}
			$str .= "<tr valign='top'><td>$i</td>";
			foreach ($row as $key => $value) {
				$str .= "<td>$value</td>";
			}
			$str .= "</tr>";
		}
        $str .= "</table>";

		return $str;
	}
}

//fpdf - pdf generator
require_once(dirname(__FILE__).DIRECTORY_SEPARATOR.'../includes/fpdf.php');
	
class iReceipt extends FPDF {
    function Header() {
	    if ($this->page == 1) {
			$this->Image('images/logo.png', 6, 8, 20);
			$this->Image('images/iiitahindi.png', 38, 7, 134, 6);
			$this->SetXY(10, 10);
			$this->SetFont('Helvetica','B', 15);
			$this->Cell(0, 14, 'Indian Institute of Information Technology Allahabad', 0, 1, 'C');
			$this->SetFont('Helvetica', 'B', 10);
			$this->Cell(0, 0, 'Devghat, Jhalwa, Allahabad-211015', 0, 1, 'C');
			$this->Line(0, 30, 500, 30);
			$this->Ln(15);
		}
    }

    function Footer() {
       	$this->SetY(-18);
       	$this->SetDrawColor(188, 188, 188);
       	$this->SetLineWidth(1);
       	$this->Line(startpoint, 45, endpoint-50, 45);

       	$this->SetXY(65, -15);
       	$this->SetFont('Helvetica', 'I', 8);
    	$this->Write(5, 'Please use this receipt for your education loan from any bank.');
    }
}

class iIDCard extends FPDF {
    function Header() {
	    if ($this->page == 1) {
			$this->Rect(0, 0, 100, 14 , F);
			$this->Image('images/logo.png', 2, 3, 8);
			$this->Image('images/iiitahindic.png', 11, 2, 70, 3);
			$this->SetTextColor( 250, 207, 32);
			$this->SetXY(16, 1);
			$this->SetFont('Helvetica', 'B', 8);
			$this->Cell(0, 14, 'Indian Institute of Information Technology Allahabad', 0, 1, 'C');
			$this->SetXY(15, 12);
			$this->SetFont('Helvetica', '', 6);
			$this->Cell(0, 0, '(An Institute of National Importance by Act of Parliament)', 0, 1, 'C');
			$this->Line(0, 14, 100, 14);
			$this->Ln(1);
		}
	}
	
    function Footer() {
       	/* $this->SetY(-1);
       	$this->SetDrawColor(188, 188, 188);
       	$this->SetLineWidth(1);
       	$this->Line(startpoint, 45, endpoint-50, 45);

       	$this->SetXY(65, -1);
       	$this->SetFont('Helvetica', 'I', 8);
    	$this->Write(5, '');
		*/
    }
}

class lReceipt extends FPDF {
    function Header() {
	    $this->Image('logol.png', 6, 8, 20);
        $this->SetFont('Helvetica','B', 15);
        $this->SetXY(10, 10);
        $this->Cell(0, 14, 'Indian Institute of Information Technology Lucknow', 0, 1, 'C');
        $this->SetFont('Helvetica', 'B', 10);
        $this->Cell(0, 0, 'Camp Office: IIITA, Devghat, Jhalwa, Allahabad-211015', 0, 1, 'C');
		$this->Line(0, 30, 500, 30);
		$this->Ln(15);
    }

    function Footer() {
       	$this->SetY(-18);
       	$this->SetDrawColor(188, 188, 188);
       	$this->SetLineWidth(1);
       	$this->Line(startpoint, 45, endpoint-50, 45);

       	$this->SetXY(65, -15);
       	$this->SetFont('Helvetica', 'I', 8);
    	$this->Write(5, 'Please use this receipt for your education loan from any bank.');
    }
}

class lIDCard extends FPDF {
    function Header() {
	    $this->Image('logol.png', 6, 8, 20);
        $this->SetFont('Helvetica','B', 15);
        $this->SetXY(5, 5);
        $this->Cell(0, 14, 'भारतीय सूचना प्रौद्योगिकी संस्थान , लखनऊ ', 0, 1, 'C');
        $this->Cell(0, 14, 'Indian Institute of Information Technology Lucknow', 0, 1, 'C');
        $this->SetFont('Helvetica', 'B', 10);
        $this->Cell(0, 0, '(An Institute of National Importance by Act of Parliament)', 0, 1, 'C');
		$this->Line(0, 30, 500, 30);
		$this->Ln(15);
    }

    function Footer() {
       	$this->SetY(-18);
       	$this->SetDrawColor(188, 188, 188);
       	$this->SetLineWidth(1);
       	$this->Line(startpoint, 45, endpoint-50, 45);

       	$this->SetXY(65, -15);
       	$this->SetFont('Helvetica', 'I', 8);
    	$this->Write(5, '');
    }
}

?>

ZeroDay Forums Mini