<?php
/** Connects to database + some functions **/
$dberrormessage = '<h2>Could not connect to database!</h2><p>Convener can not proceed. Please check database configuration which is
located in file "config.php".</p>';
// --- connect to database
if (!@$link = mysql_connect($hostname, $username, $password)) {
die($dberrormessage);
}
// --- select database for convener
@mysql_query('USE ' . $database) OR die($dberrormessage);
// a function to espace data from user inputs (regardless of maqic_quotes_gpc setting), to prevent SQL-injections
function escape_smart($value)
{
// stripslashes if magic_quotes_gpc is set on
if (get_magic_quotes_gpc() == 1) $value = stripslashes($value);
$value = mysql_real_escape_string($value);
return $value;
}
// a function to determine the format of suggestions for given meeting (0 = exact date and location, 1 = free text)
function suggformat($meeting)
{
$result = mysql_query("SELECT starttime FROM suggestions WHERE meetings_id = '$meeting' AND starttime IS NULL LIMIT 1")
OR die(mysql_error());
if (mysql_num_rows($result) == 0) return 0; else return 1;
}
?>