Jump to content

php mod


driver_x

Recommended Posts

im trying to implement a modification to a script i use. the modification actually sends an email between two parties when an individual invites another to join their friendslist. the code that i am trying to implement is the following:

 

Line 90: function PageListFriend($sourceID, $targetID)
Line 91: {

On line 92, insert this code:

global $site; // this makes site-wide variables available for this function

Then, find:

Line 114: else
Line 115: {
Line 116: $query = "INSERT INTO `FriendList` SET `ID` = '$sourceID', `Profile` = '$targetID', `Check` = '0′;";
Line 117: if( db_res( $query ) )
Line 118: {
Line 119: $ret = _t_action('_User was invited to friend list');

The line number could be off because you have inserted another line of code from above step. But the most important thing is that you find a code block that looks like line 114 - line 119.

On line 120, insert the following code:

$recipient = getProfileInfo( $targetID );
$aReporter = getProfileInfo( $sourceID );
$rnickname = $recipient['NickName'];
$nickname = $aReporter['NickName'];
$message ="
Hi {$rnickname},

You have received a new friend request at {$site['title']}!
from {$nickname}.

You may login to your account at

{$site['url']}member.php

and approve or reject this friend request.

–
{$site['title']} mail delivery system

Auto-generated e-mail, please, do not reply
";
$subject = "You Have A New Friend Request!";
sendMail( $recipient['Email'], $subject, $message );

 

I am trying to place it into the following script and have tried numerous variations but im getting nowhere.

 

My current code

 

if ( $action == "friend" )
{
$ret  =  "<table width=90% height=90% cellpadding=5 cellspacing=1>";
$ret .= "<td width=100% height=100% align=center valign=center><div class=small>";

$query = "SELECT * FROM FriendList WHERE (ID={$_COOKIE[memberID]} and Profile=$actID) or (ID=$actID and Profile={$_COOKIE[memberID]})";
$temp = db_arr($query);
if (!$temp['ID'])
{
	$query = "SELECT * FROM FriendList WHERE ID=$actID and Profile={$_COOKIE[memberID]}";
	$temp = db_arr($query);
	if ( '0' == $temp['Check'])
	{
		db_res("UPDATE FriendList SET `Check` = 1 WHERE ID = {$actID} AND Profile = {$_COOKIE['memberID']}", 0);
		$ret .= "<center> "._t("_User was added to friend list")." </center>";
	}
	elseif ('1' != $temp['Check'])
	{
		db_res("INSERT INTO FriendList SET ID = $_COOKIE[memberID], Profile = $actID", 0);
		$ret .= "<center> "._t("_User was invited to friend list")." </center>";
	}
}

Can someone please help me with this code its driving me insane

Thanks in advance

Link to comment
https://forums.phpfreaks.com/topic/170967-php-mod/
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.