Exemple #1
0
/**
 * User login function
 * @param object
 */
function login_user($data)
{
    $chk = sql_data("users", "email='" . $data->email . "' and password='******'");
    if ($chk) {
        $_SESSION['logged'] = 1;
        $_SESSION['name'] = $chk['username'];
        $_SESSION['uid'] = $chk['id'];
        echo success_json('Success!');
    }
}
Exemple #2
0
/**
 * AlQuran Login File
 * @author Shahriar
 * @version 1.0.1
*/
session_start();
if (isset($_SESSION['logged'])) {
    header('location: index?page=dashboard');
}
if (isset($_POST['login'])) {
    require 'config/connect.php';
    require 'config/db.php';
    $user = md5($_POST['username']);
    $pass = md5($_POST['password']);
    $found = sql_data("q_admin", "uname='" . $user . "' and upass='******'");
    if ($found) {
        date_default_timezone_set('Asia/Dhaka');
        $args = array('ulogin' => date('d/m/Y h:i:s') . " " . $_SERVER['REMOTE_ADDR']);
        $chk = update_data('q_admin', $args, "uname='" . $user . "'");
        if ($chk) {
            $_SESSION['logged'] = 1;
            header('location: index?page=dashboard');
        }
    }
}
?>

<!DOCTYPE html>
<html>
	<head>
<?php

/**
 * AlQuran Hadith API for Apps
 * @author Shahriar
 * @version 1.0.1
*/
header('Content-Type: application/json; charset=utf8');
//
if (isset($_POST['api'])) {
    $var = sql_data('q_admin');
    if (md5($_POST['api']) == $var['uapi']) {
        //
        $json = array();
        $json['data'] = array();
        if (isset($_POST['page'])) {
            $page = $_POST['page'];
        } else {
            $page = 0;
        }
        $page_start = $page * 10;
        if (isset($_POST['lang']) && $_POST['lang'] != '') {
            $select = $_POST['lang'];
            $other = getHadithList($select, $page_start);
            // Select language
            $json['data'] = json_decode($other);
            $json['page_remain'] = totalHadithPage($select) - $page - 1;
        } else {
            $hadith = getHadithList('', $page_start);
            $json['data'] = json_decode($hadith);
            // Select All
<?php

include "common.php";
include $Path_Include . "db.php";
include $Path_Include . "lib.php";
$page_id = $_REQUEST["page_id"];
$template_editable_id = $_REQUEST["template_editable_id"];
$sql = "select * from pageas_editable_content where page_id={$page_id} and template_editable_id={$template_editable_id}";
print $sql;
$data = sql_data($sql);
if ($_REQUEST["input_text_field_edit"] != "") {
    if ($data["id"]) {
        $sql = "update pageas_editable_content set content='" . $_REQUEST["input_text_field_edit"] . "' where id=" . $data["id"];
    } else {
        $sql = "insert into pageas_editable_content(page_id,template_editable_id,content) values \n\t\t\t('" . $_REQUEST["page_id"] . "','" . $_REQUEST["template_editable_id"] . "','" . $_REQUEST["input_text_field_edit"] . "')";
    }
} else {
    if ($data["id"]) {
        $sql = "update pageas_editable_content set content='" . $_REQUEST["input_text_area_edit"] . "' where id=" . $data["id"];
    } else {
        $sql = "insert into pageas_editable_content(page_id,template_editable_id,content) values \n\t\t\t('" . $_REQUEST["page_id"] . "','" . $_REQUEST["template_editable_id"] . "','" . $_REQUEST["input_text_area_edit"] . "')";
    }
}
print $sql;
$page_id = sql_insert($sql);
Exemple #5
0
<?php

/**
 * CricBD post view API for Apps
 * @author Shahriar
 * @version 1.0.1
*/
header('Content-Type: application/json;');
//
if (isset($_POST['api_key'])) {
    $var = sql_data('forum_user', "api_key='" . $_POST['api_key'] . "'");
    if ($var) {
        //
        if (isset($_POST['post_id'])) {
            $postId = (int) $_POST['post_id'];
            $chk = single_post($postId);
            $uid = (int) $var['uid'];
            if ($chk) {
                $json = array();
                $json['message'] = "Posts found!";
                $json['success'] = 1;
                $json['data'] = json_decode($chk, true);
                $arr = json_decode($json['data'][0]['post_like']);
                if (in_array($uid, $arr)) {
                    $json['data'][0]['liked'] = 1;
                } else {
                    $json['data'][0]['liked'] = 0;
                }
                $json['data'][0]['post_like'] = count($arr);
                $com = post_comment($postId);
                $json['data'][0]['comments'] = json_decode($com, true);
Exemple #6
0
<?php

/**
 * CricBD register API for Apps
 * @author Shahriar
 * @version 1.0.1
*/
header('Content-Type: application/json;');
//
if (isset($_POST['device_id'])) {
    $var = sql_data('forum_user', "device_id='" . $_POST['device_id'] . "'");
    if (!$var) {
        //
        $api_key = md5($_POST['device_id']);
        date_default_timezone_set('Asia/Dhaka');
        $json = array();
        $args = array('device_id' => $_POST['device_id'], 'social_id' => isset($_POST['social_id']) ? $_POST['social_id'] : 0, 'image' => isset($_POST['image']) ? $_POST['image'] : 'uploads/user.png', 'name' => isset($_POST['name']) ? $_POST['name'] : '', 'password' => md5($_POST['password']), 'api_key' => $api_key, 'join_date' => date('d-m-Y'));
        $chk = insert_data('forum_user', $args);
        if ($chk) {
            $json['message'] = "Successfully Registered!";
            $json['success'] = 1;
            $json['api_key'] = $api_key;
            echo json_encode($json);
        } else {
            echo err_json('Registration Failed!');
        }
        //
    } else {
        echo err_json('Device Already Registered.');
    }
} else {
$sql = "select * FROM `pages` where id=" . $_REQUEST["pageID"];
$data = sql_data($sql);
$sql_template = "select * FROM `template` where id=" . $data["template_id"];
$data_template = sql_data($sql_template);
$template_contents = $data_template["source"];
$sql = "select * from template_editable_contents where template_id=" . $data["template_id"] . " order by id";
//print $sql;
$result = sql_query($sql);
$edit_counter = 1;
while ($row = mysql_fetch_array($result)) {
    $sql_type = "select * from editable_type where id=" . $row["type_id"];
    $data_type = sql_data($sql_type);
    $display_editable_area = $data_type["display_editable_area"];
    $template_contents = str_replace("<%--template_editable_contents.id=" . $row["id"] . "--%>", $display_editable_area, $template_contents);
    $sql_page_content = "select * from pageas_editable_content where page_id=" . $_REQUEST["pageID"] . "  and template_editable_id=" . $row["id"];
    $data_page_content = sql_data($sql_page_content);
    if ($data_page_content["content"]) {
        $template_contents = str_replace('<span id="show_textedit_counter"></span>', '<span id="show_textedit_counter">' . $data_page_content["content"] . '</span>', $template_contents);
        $template_contents = str_replace('<span id="show_textareaedit_counter"></span>', '<span id="show_textareaedit_counter">' . $data_page_content["content"] . '</span>', $template_contents);
    }
    $template_contents = str_replace("edit_counter", $edit_counter, $template_contents);
    $template_contents = str_replace("template_editable_content.id", $row["id"], $template_contents);
    $edit_counter++;
}
print $template_contents;
//print str_replace("edit_counter","12",$template_contents);
//print $data["source"];
?>
				</div>