<?php
include("../db.php");
//header("Access-Control-Allow-Origin: * ");
header('Content-Type: application/json');


$tokendata = $_GET["token_data"];

// echo $tokendata;


if ($tokendata === "hZkOOgEtvc110iY9qoC9") {
    // $sqlsec = "select session from session";

    // $result1 = mysqli_query($db, $sqlsec);

    // while ($rowc = mysqli_fetch_assoc($result1)) {

    $rowc = $db->getRows("select session from session");

    foreach($rowc as $list){
        $jsonc[] = $list['session'];
    }

        


    // }

    // $sqlinfo = "select * from tbl_info";

    // $result2 = mysqli_query($db, $sqlinfo);
    
    // print_r($result2);

    // while ($rowd = mysqli_fetch_assoc($result2)) {


    $rowd = $db->getRow("select * from tbl_info");
    
    // print_r($alldata);


        //$jsond[]=array("facebook_url"=>$rowd['facebook_url'],"school_website"=>$rowd['school_website'],"GST"=>$rowd['GST'],"convenience"=>$rowd['convenience'],"youtube"=>$rowd['you_tube_url'],"homework_sms_status"=>$rowd['homework_sms_status'],"st_circular_sms_status"=>$rowd['st_circular_sms_status'],"att_pre_status"=>$rowd['att_pre_status'],"att_abs_status"=>$rowd['att_abs_status']);
        

        $facebook = $rowd['facebook_url'];
        $school_website = $rowd['school_website'];
        $GST = $rowd['GST'];
        $convenience = $rowd['convenience'];
        $youtube = $rowd['you_tube_url'];
        $homework_sms_status = $rowd['homework_sms_status'];
        $st_circular_sms_status = $rowd['st_circular_sms_status'];
        $att_pre_status = $rowd['att_pre_status'];
        $att_abs_status = $rowd['att_abs_status'];
        $app_version = "$rowd[app_version]";
        $result_pattern = $rowd['result_pattern'];
        $fee_month = $rowd['fee_month'];
        $online_payment = $rowd['online_payment'];
        $Merchant = $rowd['Merchant'];
        $photo = $rowd['photo'];
        $app_theme_color = $rowd['app_theme_color'];
        $online_study_server = $rowd['online_study_server'];
        $is_cls_same = $rowd['is_online_study_cls_same'];
        $pdf_view_mode = $rowd['pdf_view_mode'];
        
        $result_view_mode = $rowd['result_view_mode'];
        
        $pay_mode = $rowd['online_pay_mode'];
        $pay_mid = $rowd['mid'];
        $pay_key = $rowd['pay_key'];
        $pay_salt = $rowd['salt'];
        $token = $rowd['token'];
        
        $school_code = $rowd['school_code'];

        $is_practice_visible = $rowd['is_practice_visible'];


    // }


    $sitename = ucfirst($LinksDetails["site_name"]);

    $json['status'] = 1;
    $json['msg'] = "successful";
    $json['data'] = array("logo" => $LinksDetails["logo"], "site_name" => $sitename, "address" => $LinksDetails["contact_content"], "session" => $jsonc,
        "ftp" => array("port" => 21, "uid" => savarna, "pass" => "cfh&#!*DQM273a%", "timeout" => 300000, "folder_path" => '/public_html/school_sms/bps/sms/uploads/gallery/'),
        "status-info" => array("facebook_url" => $facebook, "school_website" => $school_website, "GST" => $GST, "convenience" => $convenience, "youtube" => $youtube,
            "homework_sms_status" => $homework_sms_status, "st_circular_sms_status" => $st_circular_sms_status, "att_pre_status" => $att_pre_status, "att_abs_status" => $att_abs_status,
            "app_version" => $app_version, "result_pattern" => $result_pattern, "fee_month" => $fee_month, "online_payment" => $online_payment, "Merchant" => $Merchant, "photo" => $photo,
            "app_theme_color" => $app_theme_color,"online_study_server" => $online_study_server,"is_cls_same"=>$is_cls_same,"pdf_view_mode"=>$pdf_view_mode,"result_view_mode"=>$result_view_mode,
            "online_pay_mode"=>$pay_mode,"mid"=>$pay_mid,"pay_key"=>$pay_key,"salt"=>$pay_salt,"token"=>$token, "school_code"=>$school_code, "is_practice_visible"=>$is_practice_visible));


    echo json_encode($json);
} else {
    // echo "a";
    echo json_encode(array("status" => '0', "msg" => "tokem mis match"));
}

?>