0byt3m1n1
Path:
C:
/
wamp64
/
www
/
cpms_new
/
USER
/
[
Home
]
File: acc_acc_ctrl.php
<?php require_once "../lib/config.php"; require_once BASE_DIR."/lib/db/connection.php"; include( "../lib/config.php"); include_once("../model/defaults_mdl.php"); require_once "../model/defaultValues_mdl.php"; $u_id= @$_SESSION['user_id']; $p_id=@$_SESSION['project_id']; $sql="select * from accgroup where user_id='$u_id' and project_id='$p_id' "; $sql=mysql_query($sql); $i=0; while($row=mysql_fetch_array($sql)) { $acc_group=$row['groupname']; $i=$i+1; $acc_group_array[$i]=$acc_group; } $accountname=""; $error_flag=0; $accountname_restore=@$_POST['txtaccount']; $groupname_restore=@$_POST['cmbgroup']; $g_name=$acc_group_array[$groupname_restore]; if(isset($_POST['add'])) {//28 //---------Null--------// if($accountname_restore=="") { $error['accountname_null']="Please Enter accountname"; $error_flag=1; } //Checking default accounts. Not allow to edit or delete $result=Common::defaultaccount_check($accountname_restore,$acc_head,$acc_head_count); if($result=="True") { $message="Sorry. This is default account head. You cannot create it."; $error_flag=1; } //$sql="select `account_name` from account where user_id='$u_id' and project_id='$p_id' and account_name='$accountname_restore'"; $sql="select * from account where user_id='$u_id' and project_id='$p_id' and account_name='$accountname_restore' and group_name='$g_name'"; mysql_query($sql); if (mysql_affected_rows()>0) { $error['account_exist']="Account name under this head already exist"; $error_flag=1; } if($error_flag==1) { include("acc_acc.php"); exit(); } else { $table_id=Common::getTableID("account","account_id"); $table_id=$table_id+1; $u_id=@$_SESSION['user_id']; $p_id=@$_SESSION['project_id']; $sql="INSERT INTO `account`( `account_id`, `user_id`, `project_id`, `group_name`, `account_name` ) VALUES ( '$table_id','$u_id','$p_id','$g_name','$accountname_restore' ) "; mysql_query($sql); if (mysql_affected_rows()>0) { $message="Registration Completed successfully.."; include("acc_acc.php"); exit(); } else { $message= "Registration Failed.Invalid charactors found"; include("acc_acc.php"); exit(); } } }//28 ?>