MMCT TEAM
Server IP : 2a02:4780:3:1493:0:3736:a38e:7  /  Your IP : 216.73.216.112
Web Server : LiteSpeed
System : Linux sg-nme-web1393.main-hosting.eu 4.18.0-553.40.1.lve.el8.x86_64 #1 SMP Wed Feb 12 18:54:57 UTC 2025 x86_64
User : u926327694 ( 926327694)
PHP Version : 7.4.33
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : OFF  |  Python : OFF
Directory (0755) :  /home/u926327694/domains/smsoft.in/public_html/demo/src/../../api/../help2/../admin/

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : /home/u926327694/domains/smsoft.in/public_html/demo/src/../../api/../help2/../admin/dbFunctions.php
<?php
class dbFunction
{ 

		  private $db;
		  private $con;
		  

    //put your code here
    // constructor
    function __construct() { 
        require_once 'DB_Connect.php';
        // connecting to database
        $this->db = new DB_Connect();
        $this->con=$this->db->connect();
        // print_r($this->db);
    }
    // destructor
    function __destruct() {
        
    }
    function sqlRunner($sql)
    {
        if(mysqli_query($this->con,$sql)or die(mysqli_error($this->con)))
        {
            return true;
        }
        else
        {
            return false;
        }
    }
    public function lastInsertedId()
    {
       return mysqli_insert_id($this->con);
    }
    public function trusteeList()
    {
        $response=array();
        $res=mysqli_query($this->con,"SELECT * FROM `users` ORDER BY `id` DESC
")or die(mysqli_erro($this->con));
        while($data=mysqli_fetch_array($res))
        {
            $response[]=$data['username'];
        }
        return $response;
    }

    public function trusteeData()
    {
        $response=array();
        $res=mysqli_query($this->con,"SELECT * FROM `users` ORDER BY `id` DESC
")or die(mysqli_erro($this->con));
        while($data=mysqli_fetch_array($res))
        {
                $response[]=$data;
        }
        return $response;
    }
    public function TrusteeSchools($trusteeUserName)
    {
        $response=array();
        $res=mysqli_query($this->con,"SELECT * FROM `schools` WHERE `username`='$trusteeUserName'")or die(mysqli_error($this->con));
        while($data=mysqli_fetch_array($res))
        {
                $response[]=$data;
        }
        return $response;
    }

    public function fetchCurrentUserTable($id)
    {
        $res=mysqli_query($this->con,"SELECT * FROM `schools` WHERE `id`='$id'")or die(mysqli_error($this->con));
        while($data=mysqli_fetch_array($res))
        {
            $response['db']=$data['dbFees'];
            $response['dbUsername']=$data['dbUsername'];
            $response['dbPassword']=$data['dbPassword'];
        }
        return $response;
    }
    
      public function rootFileCreater($dir)
    {
       error_reporting(E_ALL);

             $newFileName = "../".$dir."/"."dirroot.txt";
            $newFileContent = $dir;
            
            if (file_put_contents($newFileName, $newFileContent) !== false) {
               // echo "File created (" . basename($newFileName) . ")";
            } else {
                //echo "Cannot create file (" . basename($newFileName) . ")";
            }
    }
    
    
     function fieldsGetter()
    {

   	$sql="SHOW COLUMNS FROM `schools`";
    $data_res=mysqli_query($this->con,$sql)or die(mysqli_error($this->con));
	while($data=mysqli_fetch_array($data_res))
		{	
			$column[]= $data['Field'];
		}
		return $column;	
    }
    
         function schoolInfoById($id)
    {

   	$sql="SELECT * FROM `schools` WHERE `id` = '$id'";
    $data_res=mysqli_query($this->con,$sql)or die(mysqli_error($this->con));
	$data=mysqli_fetch_array($data_res);
        $response['username']=$data['username'];
        $response['schoolname']=$data['schoolname'];
        $response['schooldomain']=$data['schooldomain'];
        $response['schoolCode']=$data['schoolCode'];
        $response['startingDate']=$data['startingDate'];
        $response['endingDate']=$data['endingDate'];
        $response['dbFees']=$data['dbFees'];
        $response['dbStudent']=$data['dbStudent'];
        $response['dbLibrary']=$data['dbLibrary'];
        $response['dbUsername']=$data['dbUsername'];
        $response['dbPassword']=$data['dbPassword'];
        $response['smsId']=$data['smsId'];
        $response['smsAPI']=$data['smsAPI'];
        $response['smsURL']=$data['smsURL'];
        $response['smsUsername']=$data['smsUsername'];
        $response['smsPassword']=$data['smsPassword'];
		
		return $response;	
    }
    
    function queryRunner($field,$value,$id,$tablename)
    {
        
 
 $value="'".$value."'";
        if(mysqli_query($this->con,"UPDATE `$tablename` SET $field=$value WHERE `id` = '$id'")or die(mysqli_error($this->con)))
        {
            return "ageti";
        }
        else
        {
            return "agilla";
        }
    }
    
    
      function usersGet($dbName)
    {
        $response=array();
        $userId=array();
          $password=array();
            $type=array();
               
        
           $connect = mysqli_connect("localhost", "raghu80504822", "5EqjoMZIm2*b", $dbName);
           if(!$connect)
           {
                 die("Connection error: " . mysqli_connect_error());
           }
           $res=mysqli_query($connect,"SELECT * FROM `users`");
           while($data=mysqli_fetch_array($res))
           {
                
                $userId[]=$data['username'];
                $password[]=$data['passwordText'];
                $type[]=$data['type'];
           }
            
        return $response=array($userId,$password,$type);
           
    }

}

?>

MMCT - 2023