function get_active_changlanges() { $db_connection = new pg_database_class(); if (false === $db_connection->open_connection(FUNCTION_LIBRARY_POSTGRES_DB_NAME, FUNCTION_LIBRARY_POSTGRES_USER, FUNCTION_LIBRARY_POSTGRESS_PASSWORD)) { trigger_error('Database DEAD...' . $db_connection->get_last_error_message()); exit; } $sql = "SELECT * from wl_challenage where end_date > 'now' order by start_date DESC"; $rs = $db_connection->db_query($sql); if ($rs === false) { die("bad sql" . pg_last_error($db_connection->get_pg_resource())); } $output = ''; while ($row = pg_fetch_assoc($rs)) { $output .= "<option value='" . $row['id'] . "'>" . htmlspecialchars($row['name'], ENT_QUOTES) . '</option>'; } return $output; }
<?php require_once 'libs/common/global_inc.php'; if (is_loged_in()) { header('Location: ' . WEB_BASE_COMMON . 'index.php'); die; } $db_connection = new pg_database_class(); if (false === $db_connection->open_connection(FUNCTION_LIBRARY_POSTGRES_DB_NAME, FUNCTION_LIBRARY_POSTGRES_USER, FUNCTION_LIBRARY_POSTGRESS_PASSWORD)) { trigger_error('Database DEAD...' . $db_connection->get_last_error_message()); exit; } if ($_REQUEST && isset($_REQUEST['email'])) { $sql = "Select user_id from wl_users where email_address ='{$_REQUEST['email']}'"; $rs = $db_connection->db_query($sql); if (pg_num_rows($rs) == 0) { echo json_encode(array("status" => "FAIL", "message" => "No User Found")); } else { $row = pg_fetch_assoc($rs); $uid = $row['user_id']; echo json_encode(array("status" => 'SUCCESS', "uid" => $uid)); } die; } display_html_start(); echo ' </head><body>', get_header_html(), ' <h3>Create user</h3> </div> <div class="row" id="message"></div> <div class="row">
<?php require_once 'libs/common/global_inc.php'; if (is_loged_in()) { header('Location: ' . WEB_BASE_COMMON . 'index.php'); die; } $db_connection = new pg_database_class(); if (false === $db_connection->open_connection(FUNCTION_LIBRARY_POSTGRES_DB_NAME, FUNCTION_LIBRARY_POSTGRES_USER, FUNCTION_LIBRARY_POSTGRESS_PASSWORD)) { trigger_error('Database DEAD...' . $db_connection->get_last_error_message()); exit; } foreach ($_REQUEST as $key => $val) { $_REQUEST[$key] = make_database_safe(strip_tags(trim($val))); } if ($_REQUEST && isset($_REQUEST['user_id'])) { $sql = "Select sec_question,user_id from wl_users where user_id ='{$_REQUEST['user_id']}'"; $rs = $db_connection->db_query($sql); if (pg_num_rows($rs) == 0) { echo json_encode(array("status" => "FAIL", "message" => "No User Found")); } else { $row = pg_fetch_assoc($rs); echo json_encode(array("status" => 'SUCCESS', "sec_question" => $row['sec_question'], "user_id" => $row['user_id'])); } die; } elseif ($_REQUEST && isset($_REQUEST['seca'])) { $sql = "Select sec_question from wl_users where user_id ='{$_REQUEST['uid']}' and sec_ans='{$_REQUEST['seca']}'"; $rs = $db_connection->db_query($sql); if (pg_num_rows($rs) == 0) { echo json_encode(array("status" => "FAIL", "message" => "Anwser is not correct")); } else {