Jump to content

Facebook style wall posts


merylvingien

Recommended Posts

Hi folks, i have been playing with a script i downloaded from the net and have made some progress with it, however i have a couple of issues which i cannot figure out.

 

There are two undefined variables which keep cropping up, and i cant figure out why or how to deal with it.

 

<?php
include('dbcon.php');

function checkValues($value)
{
	 $value = trim($value);

	if (get_magic_quotes_gpc()) {
		$value = stripslashes($value);
	}

	 $value = strtr($value,array_flip(get_html_translation_table(HTML_ENTITIES)));

	 $value = strip_tags($value);
	$value = mysql_real_escape_string($value);
	$value = htmlspecialchars ($value);
	return $value;

}	

function clickable_link($text = '')
{
	$text = preg_replace('#(script|about|applet|activex|chrome):#is', "\\1:", $text);
	$ret = ' ' . $text;
	$ret = preg_replace("#(^|[\n ])([\w]+?://[\w\#$%&~/.\-;:=,?@\[\]+]*)#is", "\\1<a href=\"\\2\" target=\"_blank\">\\2</a>", $ret);

	$ret = preg_replace("#(^|[\n ])((www|ftp)\.[\w\#$%&~/.\-;:=,?@\[\]+]*)#is", "\\1<a href=\"http://\\2\" target=\"_blank\">\\2</a>", $ret);
	$ret = preg_replace("#(^|[\n ])([a-z0-9&\-_.]+?)@([\w\-]+\.([\w\-\.]+\.)*[\w]+)#i", "\\1<a href=\"mailto:\\2@\\3\">\\2@\\3</a>", $ret);
	$ret = substr($ret, 1);
	return $ret;
}

$next_records = 10;
$show_more_button = 0;

if(checkValues($_REQUEST['value']))

       

{
	$userip = $_SERVER['REMOTE_ADDR'];
	echo "INSERT INTO facebook_posts (post,f_name,userip,date_created) VALUES('".checkValues($_REQUEST['value'])."','99Points','".$userip."','".strtotime(date("Y-m-d H:i:s"))."')";

	mysql_query("INSERT INTO facebook_posts (post,f_name,userip,date_created) VALUES('".checkValues($_REQUEST['value'])."','99Points','".$userip."','".strtotime(date("Y-m-d H:i:s"))."')");

	$result = mysql_query("SELECT *,
	UNIX_TIMESTAMP() - date_created AS TimeSpent FROM facebook_posts order by p_id desc limit 1");

}
}

elseif($_REQUEST['show_more_post']) // more posting paging

{

i have highlighted the two variables which are showing as undefined.

 

The javascript code (not complete script) which goes in hand with this script is:

 

<script type="text/javascript">

// <![CDATA[	

$(document).ready(function(){	

	$('#shareButton').click(function(){

		var a = $("#watermark").val();
		if(a != "What's on your mind?")
		{
			$.post("posts.php?value="+a, {

			}, function(response){

				$('#posting').prepend($(response).fadeIn('slow'));
				$("#watermark").val("What's on your mind?");
			});
		}
	});

$('a.more_records').livequery("click", function(e){

		var next =  $(this).attr('id').replace('more_','');

		$.post("posts.php?show_more_post="+next, {

		}, function(response){
			$('#bottomMoreButton').remove();
			$('#posting').append($(response).fadeIn('slow'));

		});

	});

 

Does anyone have any idea on how or what i can do to stop these error messages appearing?

Any help would be appreciated...

Link to comment
https://forums.phpfreaks.com/topic/219693-facebook-style-wall-posts/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.