Location: PHPKode > projects > Course-manager > courseman-0.1.1/gather-results.php
<?php
  require('global-php.php');
  require('local-criteria.php');
  $verbindung = database_connection($lang_database_failure[$language]);
  $client_ip = $_SERVER["REMOTE_ADDR"];
  $client_agent = $_SERVER["HTTP_USER_AGENT"];
  db_exec("INSERT INTO client_ip (ip)
	SELECT '" . pg_escape_string($client_ip) . "'
		WHERE NOT EXISTS (
			SELECT true FROM client_ip
				WHERE ip='"
		. pg_escape_string($client_ip)
		. "');");
  db_exec("INSERT INTO client_agent (agent)
	SELECT '" . pg_escape_string($client_agent) . "'
		WHERE NOT EXISTS (
			SELECT true FROM client_agent
				WHERE agent='"
		. pg_escape_string($client_agent)
		. "');");
  function output_category($category) {
    global $client_ip,$client_agent;
    $count = $_REQUEST[$category];
    for ($current = 0; $current < $count; $current++) {
      $result = $_REQUEST[$category . $current];
      if ($result) {
?>
<p><?=$result?></p>
<?php
        db_exec("INSERT INTO result_string (result)
	SELECT '" . pg_escape_string($result) . "'
		WHERE NOT EXISTS (
			SELECT true FROM result_string
				WHERE result='"
		. pg_escape_string($result)
		. "');");
        db_exec("INSERT INTO test_$category (ip,agent,result)
	SELECT client_ip.id,client_agent.id,result_string.id
		FROM client_ip,client_agent,result_string
		WHERE ip='" . pg_escape_string($client_ip) . "'
		AND agent='" . pg_escape_string($client_agent) . "'
		AND result='" . pg_escape_string($result) . "';");
      }
    }
  }
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
       "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title><?=ucfirst($lang_test_results[$language])?></title>
<link rel="stylesheet"
      href="local.css"
      type="text/css">
<?=$local_stylesheets?>
</head>
<body>
<?=conditional_layout_before_content(ucfirst($lang_test_results[$language]))?>
<h1><?ucfirst($plural[$lang_success[$language]])?></h1>
<?php
  output_category('success');
?>
<h1><?ucfirst($plural[$lang_failure[$language]])?></h1>
<?php
  output_category('failure');
?>
<br />
<?=$impressum_link?>
<?=conditional_layout_after_content()?>
</body>
</html>
Return current item: Course-manager