function all_posts() { include "includes/db_con.inc"; $conn = conDB(); $query = "SELECT * FROM posts"; $posts = q($query); return $posts; }
function find_post($id) { include "includes/db_con.inc"; $conn = conDB(); $query = "SELECT * FROM posts where posts.id = '" . $id . "'"; $result = q($query); $post = mysql_fetch_array($result); return $post; }
function create_post($title, $content) { //establish a database connection include "includes/db_con.inc"; $conn = conDB(); //build an insert query $query = sprintf("INSERT INTO posts (title, body, created, modified) VALUES('%s', '%s', '%s', '%s') ", mysql_real_escape_string($title), mysql_real_escape_string($content), date("Y-m-d H:i:s"), date("Y-m-d H:i:s")); q($query); //select the most recently created post $result = q("SELECT id FROM posts ORDER BY posts.id DESC LIMIT 1"); $post = mysql_fetch_array($result); //return the id of the last post return $post['id']; }
<?php session_start(); include "phpconf.php"; include "func.php"; conDB(); ?> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=tis-620"> <title>- - ÃкºÍÔ¹·ÃÒà¹çµ | <?php echo " " . $Hospname . " "; ?> | - - ÀÒÇÐâÀª¹Ò¡Òà ºÑªÕ 3áÅÐ4 - - |</title> <style type="text/css"> <!-- body { margin: 0px 0px; padding: 0px 0px} body{font-family:MS Sans Serif;font-size:10pt} table,td{font-family:MS Sans Serif;font-size:10pt} form{font-family:MS Sans Serif;font-size:10pt} --> </style> <?php //set theme print "<link href='css/{$Theme}.css' rel='stylesheet' type='text/css'>"; ?> <script language="JavaScript" type="text/JavaScript"> <!-- function MM_reloadPage(init) { //reloads the window if Nav4 resized if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) { document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
function getLocationName($LID) { $conn = conDB(); $sql = "SELECT Name FROM locations WHERE IDKey='{$LID}'"; $result = mysqli_query($conn, $sql); $row = $result->fetch_assoc(); $name = $row["Name"]; return $name; }
<?php //Initial Setup session_start(); $_SESSION["servername"] = "localhost"; $_SESSION["Dusername"] = "******"; $_SESSION["Dpassword"] = ""; $_SESSION["dbname"] = "crm2"; $_SESSION["username"] = $_POST["user"]; $_SESSION["password"] = $_POST["pass"]; $_SESSION["idnum"] = 0; $_SESSION["MINI"] = "0"; $_SESSION["DISPLAY"] = "1"; //Grant access to Core include_once 'Core.php'; //Print out the header NoSessionHeadprint(); $conn = conDB(); $user = $_SESSION["username"]; $pass = $_SESSION["password"]; $_SESSION["idnum"] = login($user, $pass); $AID = $_SESSION["idnum"]; printUI($AID, "0", "0", FALSE); //Print out the Tail section, possibly to be discontinued soon TailPrint();
function getIndexPermissions($IndexID) { $conn = conDB(); $sql = "SELECT PermIDV,PermIDE FROM cusindex WHERE IDKey='{$IndexID}'"; $result = mysqli_query($conn, $sql); $row = $result->fetch_assoc(); $returns = array(); $returns[0] = $row["PermIDV"]; $returns[1] = $row["PermIDE"]; return $returns; }