Просмотр файла éÑαß¿∩ 2 »«αΓá½/wml/contact.php

Размер файла: 2.6Kb
<?php
	/**
	 *	Wap Portal русская версия
	 *
	 *	Copyright (C) 2002 - 2005 Красников Виктор
	 *
	 *	Wap Portal
	 *	Developer: Красников Виктор - [email protected]
	 *  Homepage: http://tut.spb.su
	 *	Date: 05/05/2005
	 * 	Version #: 1.0
	**/
?>

<?php /* CONTACT */ ?>
<?php // Check Title
$query = "SELECT * FROM wps_menu WHERE type='component' AND itemid = '$id'";
$result = mysql_query($query);
$row = mysql_fetch_object ($result);
$email_title = $row->title;

$component_id = $id;

if (isset($sendnow) && $sendnow==1) {?>
	<card id="Card6" title="<?php echo $email_title; ?>" ontimer="index.php?option=component&amp;id=<?php echo $component_id; ?>&amp;sendnow=0">
	<timer value="20"/>
	<p>
	<?
		if (isset($sndemail) && $sndemail!="" && ValidEmail($sndemail) && isset($sndmessage) && $sndmessage!="") {
			// Read site info
			$query = "SELECT email FROM wps_site WHERE id = 1";
			$result = mysql_query($query);
			$row = mysql_fetch_row($result);
			// determine whether email was properly sent
			if (mail($row[0], _MAIL_SUBJECT, $sndmessage, "From:$sndemail")) :
				echo _SUCCESS;
			else :
				echo _FAILURE;
			endif;
		} else {
			echo _COMPLETE;
		}
	?>
	</p>
	<p align="center">
	<anchor><?php echo _BACK; ?>
	<prev/>
	</anchor>
	</p>
	</card>
<?

} else {

?>
<card id="Card6" title="<?echo $email_title;?>">
<p align="center">
<?
// include the Contact info
$query = "SELECT contactinfo FROM wps_contact WHERE id = 1";
$result = mysql_query($query);
$row = mysql_fetch_row ($result);
echo $row[0];
?>
</p>
<?
// See if contactform is to be included
$query = "SELECT contactinfo FROM wps_contact WHERE id = 2";
$result = mysql_query($query);
$row = mysql_fetch_row ($result);
if ($row[0] == 'Yes') {?>
	<p>
	<?php echo _YOUR_EMAIL; ?>:<br />
	<input type="text" name="your_email" emptyok="true"/><br />
	<?php echo _MESSAGE; ?>:<br />
	<input type="text" name="message" emptyok="true"/><br />
	<anchor><?php echo _SEND_STR; ?>
	<go href="index.php" method="post">
	<postfield name="sndemail" value="$(your_email)"/>
	<postfield name="sndmessage" value="$(message)"/>
	<postfield name="option" value="component"/>
	<postfield name="id" value="<?php echo $component_id; ?>"/>
	<postfield name="sendnow" value="1"/>
	</go>
	</anchor>
	</p>
<?}?>
<p align="center">
<anchor><?php echo _HOME; ?>
<prev/>
</anchor>
</p>
</card>
<?
}
?>
<?php /* END CONTACT */ ?>
<?php
	function ValidEmail($email) {
		if (eregi("^([._a-z0-9-]+[._a-z0-9-]*)@(([a-z0-9-]+\.)*([a-z0-9-]+)(\.[a-z]{2,4}))$", $email)) {
			return TRUE;
		} else {
			return FALSE;
		}
	}
?>