<?php
		  // PHPCards v0.2, Allows people to set up simple online greeting cards. 
                  // Copyright (C) 2000, Mike Gifford www.openconcept.on.ca 
                  // 
                  // This script is free software; you can redistribute it and/or 
                  // modify it under the terms of the GNU General Public License 
                  // as published by the Free Software Foundation; either version 2 
                  // of the License, or (at your option) any later version. 
                  // 
                  // This program is distributed in the hope that it will be useful, 
                  // but WITHOUT ANY WARRANTY; without even the implied warranty of 
                  // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
                  // GNU General Public License http://www.gnu.org/copyleft/ for more details. 
                  // 
                  // If you distribute this code, please maintain this header. 
                  // 
                  // This script allows users to select an image and write a personalized message. 
                  // It then sends a notice to the user specified email address and saves that 
                  // information to a text file. The receipient then can go and access both 
                  // the saved message and image from the website at a specified URL. 
                  // 
                  // Includes: send.phtml, send.php3, receive.phtml, receive.php3 


include("$DOCUMENT_ROOT/ireru/ecardsconfig.php3");

$idnumber&
$eci_array = explode("-", $eci);
$viewcard = $eci_array[0];
$eci = $eci_array[1];

// Load Cardfile into array and view specified file.
$dataarray=file("$cardfile");
$httpcounter=0;  
$slected_message="";  
$record = explode("<>", $dataarray[$viewcard-1]);
for ($x=0; $x<8; $x++)
{
$record[$x] = stripslashes($record[$x]);
// print '<br />$record['.$x.'] = '.$record[$x] ;
}
		if ($record[1]) { 
	  	$slected_message .= '<img src="graphics/'.$record[1].'">';
		}
		
		if ($record[3]) { 
		 // Recipient's Name
		$slected_message .= $record[3];
		}
		
		if ($record[5]) { 
		 // Sender's Name
		$slected_message .= 'Sent by: '.$record[5];
		}
		
		if ($record[4]) { 
	 	// Sender's email address
		$slected_message .= ' ('.$record[4].')';
		}
		
	       if ($record[6]) {  
	        // Message
		$slected_message .= 'Message: '.$record[6];
		}
		
	       if ($record[7]) {    // Stored Random Number
		$eci_stored = $record[7];
		
		// print '<br />eci_stored: "'.$eci_stored.'"';
		// print '<br />eci: "'.$eci.'"';
		}


  // Security - Is The Random # the same as the Saved Random Number?
if (trim($eci_stored) == $eci)  {  // Successful Combination, Message Returned!
echo $slected_message;

}
else {  // Incorrect Combination, Try Again?
echo 'The confirmation number does not appear to be valid for this card. <br />Please type your confimation number below:<br />';
echo '<form method="GET" action="receive.php3">
Confirmation Number: <input type="text" size="10" name="eci"><br />
<input type="submit" value="View Card!">
</form>';

} 
?> 