Jump to content


Check out our Community Blogs

ghost2012

Member Since 27 Oct 2009
Offline Last Active Dec 16 2010 02:07 PM
-----

Posts I've Made

In Topic: Update via Textarea

16 December 2010 - 01:06 PM

I'm using $_POST. I'm trying to be able to edit content from mysql via a <textarea> tag kinda like the (edit) buttons here on the forum.

This is the code I'm using.

<?php 
session_start();
if(!$_SESSION['username']){
header('Location: ../login.php');
} else {
include_once '../functions/index.php';
$sql = "SELECT * FROM pages;";
$result = mysql_query($sql);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type="text/javascript" src="tiny_mce/tiny_mce.js"></script>
<script type="text/javascript">
tinyMCE.init({
mode : "textareas"
});
</script>
<style type="text/css">
.button {
border: 1px solid #006;
background: #9cf;
}
</style>
</head>
<body>

<?php
if($_POST['updatePost'])
{
$id;
$content;
$id = $_POST['id'];
$content = $_POST['content'];
mysql_query("UPDATE pages SET content='$content' WHERE id='$id'");
exit;;

}

if($_POST['edit'])
{
$id = $_POST['id'];
$sql = "SELECT * FROM pages WHERE id='$id'";
$result = mysql_query($sql);
while($row = mysql_fetch_array($result))
{
?>
<form method="post">
<fieldset style="width:500px;">
<legend>Front Page</legend>
<table>
<tr>
<td width="20%"><label>Title:</label></td>
<td><?php echo $row['title'] ?></td>
</tr>
<tr>
<td width="20%" valign="top"><label>Content: </label></td>
<td><textarea rows="30" cols="60" name="content" /><?php echo $row['content'] ?></textarea></td>
<input type="hidden" name="id" value="' . $row['id'] . '" />
</tr>
<tr>
<td></td><td align="center"><input type="submit" name="updatePost" id="updatePost" value="Update Post" style="width:200px;" class="button"/></td>
</tr>
</table>
</fieldset>
</form>
<?php
exit;
}
}
?>
<form method="post">
<p>Edit content by entering number
<input type="text" name="id" id="id" style="width:30px" />
<input type="submit" name="edit" id="edit" value="Edit" class="button"/>
</p>
</form>
<?php

echo '<table';
while($row=mysql_fetch_array($result))
{
echo '<tr>
<td width="50">Title:</td>
<td width="400">' . $row['title'] . '</td>
<td>' . $row['id'] . '</td>
</tr>';
}
echo '</table>';
?>

</body>
</html>
<?php
}
?>

In Topic: Send text message via php (issue)

26 June 2010 - 08:08 PM

As you should be aware all SMTP reciepts contain the originating server name, and the accepting host has the option to reveal it or not. You cannot "cloak" the host name without the target host dropping the e-mail for frame security reasons.

If you're claiming it is a "security risk" on the host name being displayed, it isn't. It's revealed for the opposite reason.


The host I'm referring to is the hosting server not the site where the request is sent from. This is a sample of the script send yourself a text msg and you'll see what I'm referring to. Send someone you know an SMS message via Thumbalong.com

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download