Public feed #598902

sara

public php v1 · immutable
Raw Edit
·published 2007-07-01 18:12 UTC
rendered paste body
<?php require_once('Connections/stdVarify.php'); ?><?phpif (!function_exists("GetSQLValueString")) {function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") {  $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);  switch ($theType) {    case "text":      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";      break;        case "long":    case "int":      $theValue = ($theValue != "") ? intval($theValue) : "NULL";      break;    case "double":      $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";      break;    case "date":      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";      break;    case "defined":      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;      break;  }  return $theValue;}}$varabc_rs = "%";if (isset(Request.querystring("txt"))) {  $varabc_rs = Request.querystring("txt");}mysql_select_db($database_stdVarify, $stdVarify);$query_rs = sprintf("SELECT * FROM std WHERE stid LIKE %s", GetSQLValueString($varabc_rs, "text"));$rs = mysql_query($query_rs, $stdVarify) or die(mysql_error());$row_rs = mysql_fetch_assoc($rs);$totalRows_rs = mysql_num_rows($rs);?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>Untitled Document</title></head><body><form action="test.php" method="get" name="form1" target="_self" id="form1">  <label>  <input name="txt" type="text" id="txt" size="12" maxlength="12" />  </label>  <label>  <input type="submit" value="search" />  </label></form><p><?php echo $row_rs['stid']; ?></p><p><?php echo $row_rs['stname']; ?></p><p><?php echo $row_rs['course']; ?></p><p><?php echo $row_rs['stdate']; ?></p><p><?php echo $row_rs['enddate']; ?></p></body></html><?phpmysql_free_result($rs);?>