Example #1
0
function insert_child()
{
    $father = $_POST['father'];
    $mother = $_POST['mother'];
    //$pswrd=$_POST['pswrd'];
    //$cnf_pswrd=$_POST['cnf_pswrd'];
    //$pswrd = "ABCD";
    $date = $_POST['date'];
    $address = $_POST['address'];
    $city = $_POST['city'];
    $state = $_POST['state'];
    $pin = $_POST['pin'];
    $contact = $_POST['contact'];
    $lat = $_POST['lat'];
    $lng = $_POST['lng'];
    $birth_id = $_POST['birth_id'];
    $hid = $_SESSION['id'] . "/" . date("Y") . "/" . $birth_id;
    $con = open_connection();
    $sql_query = "INSERT INTO child (dob,hid,mother,father,address,city,state,pin,lat,lng,contact) VALUES('{$date}','{$hid}', '{$mother}','{$father}','{$address}','{$city}','{$state}',{$pin},0,0,{$contact})";
    if (mysqli_query($con, $sql_query)) {
        $response['code'] = 1;
        $response['response'] = "Data inaserted";
        $response['response_data'] = $hid;
    } else {
        $response['code'] = 0;
        $response['response'] = "Please try again later";
    }
    echo json_encode($response);
}
 public function buscar_cursos($nomeCurso)
 {
     $conexao = open_connection();
     $dados = array();
     $Where = "";
     if ($nomeCurso == " ") {
         $Where = "";
     } else {
         $Where = " WHERE nome_curso LIKE '%{$nomeCurso}%' ";
     }
     $SQLBusCurso = $conexao->query("SELECT cod_curso,\n\t\t\t\t\t\t\t\t\t\t\t\t   nome_curso,\n\t\t\t\t\t\t\t\t\t\t\t\t   periodo \n\t\t\t\t\t\t\t\t\t\t\t  FROM curso \n\t\t\t\t\t\t\t\t\t\t\t{$Where}\n\t\t\t\t\t\t\t\t\t\t\t LIMIT 7");
     if ($SQLBusCurso) {
         while ($RESBusCurso = $SQLBusCurso->fetch(PDO::FETCH_ASSOC)) {
             if ($RESBusCurso['periodo'] == 1) {
                 $periodo = "Matutino";
             }
             if ($RESBusCurso['periodo'] == 2) {
                 $periodo = "Vespertino";
             }
             if ($RESBusCurso['periodo'] == 3) {
                 $periodo = "Integral";
             }
             $dados[] = array("value" => $RESBusCurso['cod_curso'] . "-" . $RESBusCurso['nome_curso'] . "-" . $periodo);
         }
     }
     return $dados;
 }
 public function __construct()
 {
     $this->connect = open_connection();
     $this->path = $GLOBALS['path'];
     $this->url_rewrite = $GLOBALS['url_rewrite'];
     $this->url_rewrite_report = $GLOBALS['url_rewrite_report'];
     //echo $this->path;
 }
Example #4
0
File: db.php Project: chvid/sjg
function k_query($request)
{
    global $num_queries;
    global $mysql_link;
    if ($mysql_link == false) {
        open_connection();
    }
    $num_queries = $num_queries + 1;
    $result = mysql_query($request, $mysql_link) or die("{$request}<br>Error in: " . mysql_error());
    return $result;
}
Example #5
0
function search($field, $value)
{
    $con = open_connection();
    $sql_query = "SELECT * from child where " . $field . "=" . $value;
    //echo $sql_query;
    if ($result = mysqli_query($con, $sql_query)) {
        if (mysqli_num_rows($result) > 0) {
            $row = mysqli_fetch_assoc($result);
            echo mysqli_num_rows($result);
            //display here
        } else {
            echo "No results found";
        }
    } else {
        echo mysql_error($con);
    }
}
 public function buscar_alunos($nomePessoa)
 {
     $conexao = open_connection();
     $dados = array();
     $Where = "";
     if ($nomePessoa == " ") {
         $Where = "";
     } else {
         $Where = " WHERE nome_aluno LIKE '%{$nomePessoa}%' ";
     }
     $SQLBusAluno = $conexao->query("SELECT cod_aluno,\n\t\t\t\t\t\t\t\t\t\t\t\t   nome_aluno\n\t\t\t\t\t\t\t\t\t\t\t  FROM aluno \n\t\t\t\t\t\t\t\t\t\t\t{$Where}\n\t\t\t\t\t\t\t\t\t\t\t LIMIT 7");
     if ($SQLBusAluno) {
         while ($RESBusAluno = $SQLBusAluno->fetch(PDO::FETCH_ASSOC)) {
             $dados[] = array("value" => $RESBusAluno['cod_aluno'] . "-" . $RESBusAluno['nome_aluno']);
         }
     }
     return $dados;
 }
Example #7
0
function register_hospital()
{
    $name = $_POST['name'];
    $pswrd = $_POST['password'];
    $address = $_POST['address'];
    $city = $_POST['city'];
    $state = $_POST['state'];
    $pin = $_POST['pin'];
    $contact = $_POST['contact'];
    $con = open_connection();
    $query = "INSERT INTO hospital (name,pswrd,address,city,state,pin,lat,lng,contact) VALUES('{$name}','{$pswrd}','{$address}','{$city}','{$state}',{$pin},0,0,{$contact})";
    if (mysqli_query($con, $query)) {
        $response['code'] = 1;
        $response['response'] = "Data inserted.";
    } else {
        $response['code'] = 0;
        $response['response'] = "There was some error. Please try again later";
    }
    echo json_encode($response);
}
<?php ob_start();?>
    <html>
<?php
    include "../../config/config.php";
    include "$path/header.php";
    include "$path/title.php";
?>

        <body>
<?php
    include "$path/menu.php";
    $status=$_GET['status'];
    $id=$_SESSION['Aset_ID'];
?>
            <?php
        open_connection();
        
        if (isset($_GET['act']))
        {
            if ($_GET['act'] == 'Edit')
            {
                $queryselect = "SELECT a.*, b.* From Penilaian AS a LEFT JOIN NilaiAset AS b ON a.Penilaian_ID = b.Penilaian_ID
                WHERE a.Penilaian_ID = '$_GET[id]'";
                // print_r($queryselect);
                
                $result=mysql_query($queryselect) or die(mysql_error());  
                
				if ($result){
                    //echo mysql_num_rows($result);
                    $row =  mysql_fetch_object($result);
					// pr($row);
Example #9
0
function xmpp_connect($options, $access_token)
{
    global $STREAM_XML, $AUTH_XML, $RESOURCE_XML, $SESSION_XML, $CLOSE_XML, $START_TLS;
    $fp = open_connection($options['server']);
    if (!$fp) {
        return false;
    }
    // initiates auth process (using X-FACEBOOK_PLATFORM)
    send_xml($fp, $STREAM_XML);
    if (!find_xmpp($fp, 'STREAM:STREAM')) {
        return false;
    }
    if (!find_xmpp($fp, 'MECHANISM', 'X-FACEBOOK-PLATFORM')) {
        return false;
    }
    // starting tls - MANDATORY TO USE OAUTH TOKEN!!!!
    send_xml($fp, $START_TLS);
    if (!find_xmpp($fp, 'PROCEED', null, $proceed)) {
        return false;
    }
    stream_socket_enable_crypto($fp, true, STREAM_CRYPTO_METHOD_TLS_CLIENT);
    send_xml($fp, $STREAM_XML);
    if (!find_xmpp($fp, 'STREAM:STREAM')) {
        return false;
    }
    if (!find_xmpp($fp, 'MECHANISM', 'X-FACEBOOK-PLATFORM')) {
        return false;
    }
    // gets challenge from server and decode it
    send_xml($fp, $AUTH_XML);
    if (!find_xmpp($fp, 'CHALLENGE', null, $challenge)) {
        return false;
    }
    $challenge = base64_decode($challenge);
    $challenge = urldecode($challenge);
    parse_str($challenge, $challenge_array);
    // creates the response array
    $resp_array = array('method' => $challenge_array['method'], 'nonce' => $challenge_array['nonce'], 'access_token' => $access_token, 'api_key' => $options['app_id'], 'call_id' => 0, 'v' => '1.0');
    // creates signature
    $response = http_build_query($resp_array);
    // sends the response and waits for success
    $xml = '<response xmlns="urn:ietf:params:xml:ns:xmpp-sasl">' . base64_encode($response) . '</response>';
    send_xml($fp, $xml);
    if (!find_xmpp($fp, 'SUCCESS')) {
        return false;
    }
    // finishes auth process
    send_xml($fp, $STREAM_XML);
    if (!find_xmpp($fp, 'STREAM:STREAM')) {
        return false;
    }
    if (!find_xmpp($fp, 'STREAM:FEATURES')) {
        return false;
    }
    send_xml($fp, $RESOURCE_XML);
    if (!find_xmpp($fp, 'JID')) {
        return false;
    }
    send_xml($fp, $SESSION_XML);
    if (!find_xmpp($fp, 'SESSION')) {
        return false;
    }
    // we made it!
    send_xml($fp, $CLOSE_XML);
    print "Authentication complete<br>";
    fclose($fp);
    return true;
}
?>

        <div class="container">
            <fieldset class="col-md-8 col-md-offset-2">
                <legend>Cadastro de matrĂ­culas</legend>
                <form action="ModelCadMatricula.php" method="get" onsubmit="return validarPreenchimentoDosCampos();">
                    <div class="form-group">
                        <label>Aluno: *</label>
                        <input type="text" id="nome_aluno" name="nome_aluno" class="form-control inputUnico" placeholder="Campo auto-complete">
                    </div>
                    <div class="form-group">
                        <label>Curso: *</label>
                        <select id="curso" name="curso" class="form-control inputUnico">
                            <option value="0">----Selecione um curso----</option>
                                <?php 
$conexao = open_connection();
$SQLBusCurso = $conexao->query("SELECT cod_curso,\n                                                                           nome_curso,\n                                                                           periodo\n                                                                      FROM curso");
if ($SQLBusCurso) {
    while ($RESBusCurso = $SQLBusCurso->fetch(PDO::FETCH_ASSOC)) {
        $cod_curso = $RESBusCurso['cod_curso'];
        $nome_curso = $RESBusCurso['nome_curso'];
        $periodo = $RESBusCurso['periodo'];
        if ($periodo == 1) {
            $periodo = "Matutino";
        }
        if ($periodo == 2) {
            $periodo = "Vespertino";
        }
        if ($periodo == 3) {
            $periodo = "Integral";
        }