Просмотр файла admin/includes/contact.php

Размер файла: 2.81Kb
<?php
	/**
	 *	Wap Portal Server
	 *
	 *	Copyright (C) 2002 - 2004 Emir Sakic
	 *
	 *	Wap Portal Server
	 *	Developer: Emir Sakic - [email protected]
	 *  Homepage: http://www.sakic.net
	 *	Date: 15/03/2004
	 * 	Version #: 1.2
	**/

// Update database
if (isset($update)) {
	// Replace new lines
	//$contactcontent = ereg_replace("(\r\n|\n|\r)", "<br />", $contactcontent);
	$contactcontent = preg_replace("/(\015\012)|(\015)|(\012)/","<br />",$contactcontent);

	// Replace quotes
	if (!get_magic_quotes_gpc()) $contactcontent = str_replace("'","\'",$contactcontent);

	$query = "UPDATE wps_contact SET contactinfo = '$contactcontent' WHERE id = 1";
	$result = mysql_query($query)
	    or die("Update failed");
	$query = "UPDATE wps_contact SET contactinfo = '$select' WHERE id = 2";
	$result = mysql_query($query)
	    or die("Update failed");
	$update = 0;
}
?>
<script language="JavaScript">
<!--
function validate(){
		if (document.form.contactcontent.value==""){
		alert('Please complete the form!');
		return false;
		}
	else {
		return true;
		}
	}
//-->
</script>

  <table width="600">
    <tr>
      <td colspan="2"><a href='index.php' border=0>Home</a> &gt; Contact Management</td>
    </tr>
    <tr>
      <td align="center" width="75%"><b>Edit Contact Info</b></td>
      <td align="center" width="25%"><b>Resources</b></td>
    </tr>
    <tr>
      <td>
        <?// Read contact from mySQL database
$query = "SELECT contactinfo FROM wps_contact WHERE id = 1";
$result = mysql_query($query);
$row = mysql_fetch_row($result);
$row[0] = str_replace("<br />","\r\n",$row[0]);
?>
        <form name="form" method="post" action="index.php?option=contact" onSubmit="return validate()">
          <p>
            <textarea name="contactcontent" rows="8" cols="40"><? echo $row[0]; ?></textarea>
          </p>

<p>Contact Form Active<br>
<?
		$query = "SELECT contactinfo FROM wps_contact WHERE id = 2";
		$result = mysql_query($query);
		$row = mysql_fetch_row($result);
?>
Yes:
<input type="radio" name="select" value="Yes"<?if ($row[0]=='Yes') echo " checked";?>>
No:
<input type="radio" name="select" value="No"<?if ($row[0]=='No') echo " checked";?>>
</p>
          <input type="hidden" name="update" value="1">
          <input type="submit" name="Submit" value="Submit">
        </form>
      </td>
      <td valign="top">&lt;br /&gt;&nbsp;new line<br>
        &lt;p&gt;&lt;/p&gt;&nbsp;paragraph<br>
        &lt;b&gt;&lt;/b&gt;&nbsp;<b>bold</b><br>
        &lt;i&gt;&lt;/i&gt;&nbsp;<i>italic</i><br>
        &lt;u&gt;&lt;/u&gt;&nbsp;<u>underline</u><br>
        &lt;big&gt;&lt;/big&gt;&nbsp;big<br>
        &lt;small&gt;&lt;/small&gt;&nbsp;small<br>
        <br>
<?php
	$common->setup_default_emulator();
	$common->display_emulator();
?>
      </td>
    </tr>
  </table>