Esempio n. 1
0
function bestaddress($guess, $locked)
{
    global $conn;
    # Generate a canonical version of the guess
    $canon = canonize($guess);
    # Get every damn address from the database
    $result = mysql_query("SELECT * FROM caladdress WHERE locked = {$locked}", $conn);
    if (!$result) {
        die(mysql_error());
    }
    # Look for the best match
    $bestmatch = 50;
    while ($record = mysql_fetch_array($result)) {
        $match = cmpcanon($canon, $record["canon"]);
        if ($match >= $bestmatch) {
            $bestmatch = $match;
            $best = $record;
        }
    }
    # Return the best match.  Note that if no address rates at least 75 then
    # $best will be NULL.
    return $best;
}
Esempio n. 2
0
function bestaddress($guess)
{
    global $conn;
    # Generate a canonical version of the guess
    $canon = canonize($guess);
    # Get every damn address from the database
    $result = mysql_query("SELECT * FROM caladdress", $conn);
    if (!$result) {
        return;
    }
    # Look for the best match
    $bestmatch = 75;
    while ($record = mysql_fetch_array($result)) {
        $match = cmpcanon($canon, $record["canon"]);
        print "<!-- cmpcanon(\"{$canon}\", \"{$record[canon]}\") returned {$match} -->\n";
        if ($match >= $bestmatch) {
            $bestmatch = $match;
            $best = $record;
        }
    }
    # Return the best match.  Note that if no address rates at least 75 then
    # $best will be NULL.
    return $best;
}
Esempio n. 3
0
         }
         if ($_REQUEST["area"]) {
             $sql .= "{$comma} area=\"{$_REQUEST[area]}\"";
             $comma = ",";
         }
         if ($_REQUEST["locked"] != "") {
             $sql .= "{$comma} locked={$_REQUEST[locked]}";
             $comma = ",";
         }
         $sql .= " WHERE canon = \"{$_REQUEST[canon]}\"";
         mysql_query($sql, $conn) || die(mysql_error());
         die("happy");
         # Just to avoid sending back a bunch of ignored text
     } else {
         if ($_REQUEST["locname"] && $_REQUEST["address"] && $_REQUEST["area"]) {
             $canon = canonize($_REQUEST["locname"]);
             if (!$canon) {
                 die("canonize(\"{$_REQUEST[locname]}\") returned \"{$canon}\"");
             }
             mysql_query("INSERT INTO caladdress (canon, locname, address, area, locked) VALUES (\"{$canon}\", \"{$_REQUEST[locname]}\", \"{$_REQUEST[address]}\", \"{$_REQUEST[area]}\", 1)", $conn) || die(mysql_error());
         }
     }
 }
 # Output the form.
 print "<center><h1>Venue Editor</h1>\n";
 print "For editing by administrators only!<br>\n";
 print "<button onclick=\"window.location.replace('admin.php');\">Administration Menu</button>\n";
 $result = mysql_query("SELECT * FROM caladdress ORDER BY canon", $conn) or die(mysql_error());
 print "<p>There are currently <strong>" . mysql_num_rows($result) . "</strong> known venues<p>";
 print "<p>\n";
 print "<table border=1 bgcolor=\"#ffe880\">\n";
Esempio n. 4
0
        $msgbody .= "\n";
        $msgbody .= "If you have questions, contact the Calendar Crew\n";
        $msgbody .= 'at ' . SHIFTEMAIL . "\n";
    }
    $to = stripslashes($_REQUEST['email']);
    $subject = '[Shift Cal] ' . stripslashes($_REQUEST['title']);
    $headers = 'From: ' . SHIFTEMAIL . "\r\n" . 'CC: ' . SHIFTEMAIL . "\r\n" . "List-Help: <{$url}>";
    mail($to, $subject, $msgbody, $headers);
}
# Update the list of known venues
if ($locname != "" && ($addressverified == 'Y' || $area == 'V')) {
    # First try to update an unlocked version of the record.  If that fails
    # then try to add it.  Duplicates are automatically rejected, so that
    # can fail if we have a locked version on file already; this is not
    # an error so just ignore it if that insertion fails!
    $canon = canonize($locname);
    if (!mysql_query("INSERT INTO caladdress (canon, locname, address, area, locked) VALUES (\"{$canon}\", \"{$locname}\", \"{$address}\", \"{$area}\", 0)", $conn)) {
        mysql_query("UPDATE caladdress SET locname=\"{$locname}\", address=\"{$address}\", area=\"{$area}\" WHERE canon=\"{$canon}\" AND locked=0", $conn);
    }
}
?>
<hr>
<center>
<button onclick="window.location.replace('calform.php');">Add Another Event</button>
<?php 
print "<button onclick=\"window.location.replace('" . viewurl($daylist[1]['sqldate'], $id) . "');\">View Calendar</button>\n";
if ($_COOKIE['havemore'] == 'bikefun') {
    print "<button onclick=\"window.location.replace('admreview.php" . ($_REQUEST['reviewdates'] ? '?dates=' . $_REQUEST['reviewdates'] : "") . "#a_{$id}');\">Edit Print Descriptions</button>\n";
    print "<button onclick=\"window.location.replace('admin.php');\">Administration Menu</button>\n";
}
?>