Location: PHPKode > projects > RepMan > repman/inc/session.php
<?
  $session_results = split("\.", $_GET["ss"] /*, limit (int)*/);  // rozdeli parametr ss mezi teckama do pole
  if (count($session_results) == 3) {
    ConnectIt();    // pripoji databazi
    $cl_ok = 0;
    foreach (Query("SELECT id FROM client;") as $cl) {    // test existence klienta
      if ($cl[0] == $session_results[0]) { $cl_ok = 1;}
    }
    $jo_ok = 0;
    foreach (Query("SELECT id FROM job;") as $jo) {       // test existence jobu
      if ($jo[0] == $session_results[1]) { $jo_ok = 1;}
    }
    if ($cl_ok && $jo_ok) {
      if(Query("INSERT INTO sess(client_id,job_id,status,finished) VALUES($session_results[0],$session_results[1],".mysql_escape_string($session_results[2]).",NOW());")) {   // vlozeni session
        echo "QOK\n";
        logdebug("$session_results[0],$session_results[1],".mysql_escape_string($session_results[2])." uspesne vlozeno.");
      } else {
        echo "QK_SQL\n";                    // oznam prip. neuspech
        logdebug("QueryKilled_SQL");
      }
    } else {
      if (!$cl_ok) {
        echo "QK_CLID\n";       // oznam nesouhlas klienta
        logdebug("QueryKilled_CLID. Zadane id == ".$session_results[0]);
      }
      if (!$jo_ok) {
        echo "QK_JOID\n";       // oznam nesouhlas jobu
        logdebug("QueryKilled_JOID. Zadane id == ".$session_results[0]);
      }
    }
  } else {
    echo "QK_count(".count($session_results).")\n";      // oznam nesouhlas parametru
    logdebug("QueryKilled_count. Pocet parametru == ".count($session_results));
  }
?>
Return current item: RepMan