#!/cgi-bin/php
741 N 3rd St.
San Jose, CA 95112 (map)
Look for yellow fire hydrant and front yard succulents
Parking is on the street";
// When ?
$when = "July 19, 2025 at 4pm";
// What ?
$what = "Let's get together again
This event will be held outside";
// Bring ?
$bring = "Beverages, dessert, entrees, salad, or snacks
Note: no barbeque grill will be available";
// Last date to reply ? (can be "" then it is not included, is only shown by the script, later answers are possible)
$lastdate = "";
// Contact ? (phone no. or similar) (can be "" then it is not included)
$contact = "1-408-294-4687 (140-TAXI-HOUSE or 1-408-A-WHIM-TRIM or 1-408-BY-HINTS or 140VAX-4-GNUS)";
// Picture ? (e.g. "invite.jpg" , can be "" then it is not included)
$picture = "http://clipart-library.com/img1/1465723.jpg";
// *************************************************
// ** Administrator pwd, email , files and layout **
// *************************************************
//Change under "admin" with your own password. It's required for editing the entries. Not super-safe, so don't share with bank passwords etc..
$admin_password = "teralaser";
//Enter your email here (spam protected, no robot can see it , however other users can. Other users' emails are fully protected)
$admin_email = "acg7vfasvu@liamekaens.com";
//Your website URL
$home = "http://invite.liberatedsoftware.com";
//Name of file used to store your guest list.
$data_file = "/var/tmp/invite.dat";
//Send you an email when someone answers your invitation, YES or NO
$notify = "NO";
//Your Operating System
//For Windows/NT user : WIN
//For Linux/Unix user : UNIX
$os = "UNIX";
//Color & font setting
$background = "#FFFFFF";
$table_top = "#E3C6FE";
$table_content_1a = "#EDEEFA";
$table_content_1b = "#E4E4F6";
$table_content_2a = "#EFE8F2";
$table_content_2b = "#EFEFFF";
$table_bottom = "#E3C6FE";
$table_border = "#000000";
$title_color = "black";
$link = "blue";
$visited_link = "blue";
$active_link = "red";
$font_face = "helvetica";
$message_font_face = "arial";
$message_font_size = "3";
//Maximum entry per page (not implemented properly yet)
$max_entry_per_page = "60";
//Maximum entries stored in data file (if 0, it is not checked) PS: Every change is an entry too.
$max_record_in_data_file = "400";
// ***************************
// ** End of options to set **
// ***************************
// --------------------------------------------------------
//-- Don't change below this line --
if (!empty($_GET)) {
if (isset($_GET["do"])) $do = $_GET["do"];
if (isset($_GET["page"])) $page = $_GET["page"];
}
if (isset($_POST["do"])) $do = $_POST["do"];
if (!isset($PHP_SELF)) {
if (isset($_SERVER["PHP_SELF"])) $PHP_SELF = $_SERVER["PHP_SELF"];
else if (isset($HTTP_SERVER_VARS["PHP_SELF"])) $PHP_SELF = $HTTP_SERVER_VARS["PHP_SELF"];
}
$iversion = "1.0";
if (!isset($do)) $do = "";
else if (preg_match("/\W/",$do)) $do = "";
if (!isset($page) or $page == 0) $page=1;
if (!file_exists($data_file)) {
echo "Error !! Can't find data file : $data_file.
Webmaster/administrator : If this was the intended location please make an empty file.
";
exit;
} else {
if ($max_record_in_data_file != "0") {
$f = file($data_file);
$j = count($f);
if ($j > $max_record_in_data_file) {
rsort($f);
for ($i = 0; $i < $j; $i++) {
if (isset($f[$i])) {
$r = $record[$i];
$row = explode("|~~|",$r);
$chkmail = $row[2];
for($h = $i+1; $h < $jmlrec; $h++) {
$r = $f[$h];
$row = explode("|~~|",$r);
if (strcasecmp($row[2],$chkmail)==0 ) $f[$h] = "";
}
}
}
$rf = fopen($data_file,"w");
if (strtoupper($os)=="UNIX") {
if (flock($rf,LOCK_EX)) {
for ($i=0; $i<$max_record_in_data_file; $i++) {
if ($f[$i] != "") fwrite($rf,$f[$i]);
}
flock($rf,LOCK_UN);
}
} else {
for ($i=0; $i<$max_record_in_data_file; $i++) {
if ($f[$i] != "") fwrite($rf,$f[$i]);
}
}
fclose($rf);
}
}
}
$emailmsg = "";
// Check email if list
if ($do == "list") {
if (isset($_POST["vemail"])) $vemail = $_POST["vemail"];
if (!isset($vemail)) $vemail = $_GET["vemail"];
$vemail = trim($vemail);
$f = file($data_file);
rsort($f);
$found = -1;
$frow[0] = $frow[1] = $frow[2] = $frow[3] = $frow[4] = $frow[5] =
$frow[6] = $frow[7] = "";
for ($i = 0; $i < $j; $i++) {
if (isset($f[$i])) {
$frow = explode("|~~|",$f[$i]);
if (strcasecmp($frow[2],$vemail) == 0 ) { $found = $i; break; }
}
}
if ( $found < 0 ) {
if (!preg_match("/([\w\.\-]+)(\@[\w\.\-]+)(\.[a-z]{2,4})+/i", $vemail)) {
echo "
Error !
Invalid email address. Please click here and try again.";
exit;
}
if ( $vemail == "" ) {
$do = "";
$vemail = "(not given)";
$emailmsg = "The email " . $vemail . " is not in the guest list. Please check with the invitation for the correct email.";
} else {
$idx = date("YmdHis");
$tgl = date("F d, Y - h:i A");
#$vname = $vemail;
#$domain = strpos($vname, '@');
#if ($domain > 0) $vname = substr($vname, 0, $domain);
$vname = "";
$newdata = "//|~~|$idx|~~|$vemail|~~|$vname|~~|looked|~~||~~||~~||~~|$tgl|~~|?>\n";
$newdata = stripslashes($newdata);
$tambah = fopen($data_file,"a");
if (flock($tambah,LOCK_EX)) {
fwrite($tambah,$newdata);
flock($tambah,LOCK_UN);
}
fclose($tambah);
}
}
// Check if vreply is never then change to "looked"
if ( $frow[4] == "never" && $found >= 0 ) {
$idx = date("YmdHis");
$tgl = date("F d, Y - h:i A");
$frow[4] = "looked";
$newdata = "//|~~|$idx|~~|$frow[2]|~~|$frow[3]|~~|looked|~~|$frow[5]|~~|$frow[6]|~~|$frow[7]|~~|$tgl|~~|?>\n";
$newdata = stripslashes($newdata);
$tambah = fopen($data_file,"a");
if (strtoupper($os)=="UNIX") {
if (flock($tambah,LOCK_EX)) {
fwrite($tambah,$newdata);
flock($tambah,LOCK_UN);
}
} else fwrite($tambah,$newdata);
fclose($tambah);
}
}
switch ($do) {
case "list":
$record = file($data_file);
rsort($record);
$jmlrec = count($record);
// Delete duplicates (the dum way...)
for ($i = 0; $i < $jmlrec; $i++) {
if (isset($record[$i])) {
$r = $record[$i];
$row = explode("|~~|",$r);
if (count($row) < 3) {
continue;
}
$chkmail = $row[2];
for($j = $i+1; $j < $jmlrec; $j++) {
$r = $record[$j];
$row = explode("|~~|",$r);
if (count($row) < 3) {
continue;
}
if (strcasecmp($row[2],$chkmail)==0 ) { $record[$j] = ""; }
}
}
}
//
?>
" link="" vlink="" alink="" topmargin="0" marginheight="0">
">
">(:: ">"> ::)
Where:
|
echo "$where"; ?>
|
When:
|
echo "$when"; ?>
|
What:
|
echo "$what"; ?>
|
Food to bring:
|
echo "$bring"; ?>
|
Last date to reply:
|
echo "$lastdate"; ?>
|
Contact:
|
echo "$contact"; ?>
|
";
if (isset($picture) && $picture != "") echo "
";
?>
Invited guests:
|
Coming:
|
Undecided |
No |
Yes |
0) $jml_page++;
// Set $nomaybe, $nono, $noyes DEBUG
$nomaybe = 0;
$nono = 0;
$noyes = 0;
$countmaybe = 0;
$countno = 0;
$countyes = 0;
$counttotal = 0;
$no = 0;
if ($jmlrec == 0) echo "There is no entries. | ";
$w = 0; //--Color
for ($i=0; $i<$max_entry_per_page; $i++) {
// Find the lowest next possible record.
$no = $jmlrec + 1;
if ($nomaybe < $jmlrec ) $no = $nomaybe + 1;
if ($nono < $no - 1 ) $no = $nono + 1;
if ($noyes < $no - 1 ) $no = $noyes + 1;
// Check this is valid.
do {
while (($no < $jmlrec + 1) && (!isset($record[$no-1]) || $record[$no-1] == "")) { $no++; }
$recno = $no - 1;
$cont = 0;
if ($no < $jmlrec + 1) {
$row = explode("|~~|",$record[$recno]);
$vr = $row[4];
$cont = 0;
if (($vr == "never" || $vr == "looked" || $vr == "maybe") && ($no <= $nomaybe)) $cont = 1;
if (($vr == "no" ) && ($no <= $nono)) $cont = 1;
if (($vr == "yes" || $vr == "host") && ($no <= $noyes)) $cont = 1;
if ($cont == 1) $no++;
}
} while ($cont == 1);
if (isset($record[$recno]) && $record[$recno] != "") {
if ($w==0) {
$warna = $table_content_1a;
$warna2 = $table_content_1b;
$w=1;
} else {
$warna = $table_content_2a;
$warna2 = $table_content_2b;
$w=0;
}
echo "
";
do {
$nomaybe++;
$recno = $nomaybe-1;
if (isset($record[$recno]) && $record[$recno] != "") {
$row = explode("|~~|",$record[$recno]);
}
else {
$row[4] = "";
}
} while ($nomaybe <= $jmlrec && $row[4] != "never" && $row[4] != "looked" && $row[4] != "maybe" );
if ($row[4] == "never" || $row[4] == "looked" || $row[4]=="maybe") {
echo "$row[3] ";
$countmaybe++;
}
if ($row[4] == "looked") echo "(looked $row[8])";
if ($row[4] == "maybe") echo "(maybe $row[8])";
if (isset($row[7]) && ($row[4]=="looked" || $row[4]=="maybe") && $row[7] != "")
echo " Comment: $row[7]";
echo " | ";
do {
$nono++;
$recno = $nono-1;
if (isset($record[$recno]) && $record[$recno] != "") {
$row = explode("|~~|",$record[$recno]);
}
else {
$row[4] = "";
}
} while ($nono <= $jmlrec && $row[4] != "no" && $row != "looked" && $row[5] != "maybe" );
if (isset($record[$recno]) && $record[$recno] != "") {
$row = explode("|~~|",$record[$recno]);
}
else {
$row[4] = "";
}
if ($row[4] == "no" ) { echo "$row[3] ($row[8])";
if (isset($row[7]) && $row[7] != "") echo " Comment: $row[7]";
$countno++;
}
echo " | ";
do {
$noyes++;
$recno = $noyes-1;
if (isset($record[$recno]) && $record[$recno] != "") {
$row = explode("|~~|",$record[$recno]);
}
else {
$row[4] = "";
}
} while ($noyes <= $jmlrec && $row[4] != "yes" && $row[4] != "host" );
if ($row[4] == "yes" || $row[4] == "host" ) {
echo "$row[3] (";
if ($row[4] == "host") print "host ";
echo "$row[8])";
if (isset($row[5]) && $row[5] != "1" && $row[5] != "") echo " ($row[5] guests)";
if (isset($row[7]) && $row[7] != "" ) echo " Comment: $row[7]";
if (isset($row[6]) && $row[6] != "" ) echo " Food bringing: $row[6]";
$countyes++;
if (isset($row[5]) && $row[5] != "") {
$count = intval($row[5]);
$counttotal = $counttotal + ($count > 0 ? $count : 1);
}
else {
$counttotal += 1;
}
}
echo " | ";
} //--end if
} //--end for
echo "";
if ($jml_page > 1) {
if ($page <> 1) echo "[Top] "; else echo "[Top] ";
echo "Page # ";
if ($jml_page > 10) {
if ($page < 5) {
$start = 1;
$stop = 10;
} elseif ($jml_page - $page < 5) {
$start = $jml_page - 9;
$stop = $jml_page;
} else {
$start = $page-4;
$stop = $page+5;
}
if ($start <> 1) echo "... ";
for ($p=$start; $p<=$stop; $p++) {
if ($p == $page) echo "$p ";
else echo "$p ";
}
if ($stop <> $jml_page) echo "... ";
echo "of $jml_page ";
} else {
for ($p=1; $p<=$jml_page; $p++) {
if ($p == $page) echo "$p ";
else echo "$p ";
}
}
if ($page <> $jml_page) echo "[Bottom]"; else echo "[bottom]";
} else echo "Page #1 of 1";
echo " Undecided : $countmaybe No : $countno Yes : $countyes Total guests : $counttotal";
echo " | ";
?>
|

Invitation echo "$iversion" ?> :: ">admin
">
echo "$emailmsg" ?>
Invitation :: "> admin
70) $vname = substr($vname,0,70);
}
if (isset($_POST["vemail"])) {
$vemail = $_POST["vemail"];
$vemail = trim($vemail);
if (strlen($vemail) > 100) $vemail = substr($vemail,0,100);
}
if (isset($_POST["vreply"])) {
$vreply = $_POST["vreply"];
if (strlen($vreply) > 10) $vreply = substr($vreply,0,10);
}
if (isset($_POST["vamount"])) {
$vamount = $_POST["vamount"];
if (strlen($vamount) > 4) $vamount = substr($vamount,0,4);
}
if (isset($_POST["vbrings"])) {
$vbrings = $_POST["vbrings"];
if (strlen($vbrings) > 70) $vbrings = substr($vbrings,0,70);
}
if (isset($_POST["vcomment"])) $vcomment = $_POST["vcomment"];
}
if (trim($vemail)=="") {
echo "Error !
The email got lost. Please try again from the start. Please click here and try again.";
exit;
}
if (!preg_match("/([\w\.\-]+)(\@[\w\.\-]+)(\.[a-z]{2,4})+/i", $vemail)) {
echo "Error !
Invalid email address. Please click here and try again.";
exit;
}
$test_comment = explode(" ",$vcomment);
$jmltest = count($test_comment);
for ($t=0; $t<$jmltest; $t++) {
if (strlen(trim($test_comment[$t])) > 35) {
echo "Error!
Please don't abuse my invitation. Click here and try again.";
exit;
}
}
//--only maxchar characters allowed for comment, change this value if necessary
$maxchar = 150;
if (strlen($vcomment) > $maxchar) $vcomment = substr($vcomment,0,$maxchar)."...";
$idx = date("YmdHis");
$tgl = date("F d, Y - h:i A");
$vname = str_replace("<","",$vname);
$vname = str_replace(">","",$vname);
$vname = str_replace("~","-",$vname);
$vname = str_replace("\"",""",$vname);
$vcomment = str_replace("<","<",$vcomment);
$vcomment = str_replace(">",">",$vcomment);
$vcomment = str_replace("~","-",$vcomment);
$vcomment = str_replace("\"",""",$vcomment);
$vbrings = str_replace("<","<",$vbrings);
$vbrings = str_replace(">",">",$vbrings);
$vbrings = str_replace("~","-",$vbrings);
$vbrings = str_replace("\"",""",$vbrings);
if (strtoupper($os) == "WIN") {
$vcomment = str_replace("\r\n","
",$vcomment);
$vcomment = str_replace("\r","",$vcomment);
$vcomment = str_replace("\n","",$vcomment);
} else {
$vcomment = str_replace("\n","
",$vcomment);
$vcomment = str_replace("\r","",$vcomment);
}
$newdata = "//|~~|$idx|~~|$vemail|~~|$vname|~~|$vreply|~~|$vamount|~~|$vbrings|~~|$vcomment|~~|$tgl|~~|?>\n";
$newdata = stripslashes($newdata);
$tambah = fopen($data_file,"a");
if (strtoupper($os)=="UNIX") {
if (flock($tambah,LOCK_EX)) {
fwrite($tambah,$newdata);
flock($tambah,LOCK_UN);
}
} else fwrite($tambah,$newdata);
fclose($tambah);
//--SEND MAIL
if (strtoupper($notify) == "YES") {
$msgtitle = $vname." answered your invitation :".$vreply;
$vcomment = str_replace(""","\"",$vcomment);
$vcomment = stripslashes($vcomment);
$vcomment = str_replace("
","\n",$vcomment);
if ($vcomment == "") $vcomment = "(no comment)";
$msgcontent = "Local time : ".$tgl."\n\nThe reply : ".$vreply;
if ($vamount != "1") $msgcontent .= "\n $vname will bring a total of ". $vamount . " guests.";
$msgcontent .= " \nThe comments from ".$vname." :\n----------------------------\n\n".$vcomment."\n";
if ($vbrings != "" ) $msgcontent .= "He or she will bring : " . $vbrings . "\n";
$msgcontent .= "\n----------------------------\n";
mail($admin_email,$msgtitle,$msgcontent,"From: ".$vemail."\n");
}
//-----------
header("Location: http://". $_SERVER['HTTP_HOST']. $_SERVER['PHP_SELF'] . "?do=list&vemail=" . $vemail );
exit;
break;
case "admin":
?>
Administrator