Jump to content

Guys I need your help <:


phpvox

Recommended Posts

This code is from my social networking script send_message.pml", this is the file that "sends your email" to user.........it checks to see if you are a paid member or not, if yes, then it sends your email to user, if not, then it will take you to the billings page to pay.  Here is the problem

 

users when they buy contact stamps fails to let them send emails, it dosent function..... it still takes them to the billing page even tho they have stamps......it shouldnt do that, it should send your email to the other users. heres the code. any help would be nice......thanks

 

<?php
    if($action == send)
{
        $fBlocked = f(q("SELECT id FROM dt_blocked WHERE member_id = '$rid' and blocked_id = '$fMember[id]'"));
        if ($fBlocked[id] != "")
        {
             $errors_num++;
             $errors_string .= "$errors_num. You have been blocked by this user!<br>\n";
        }
        if ($rid =="")
        {
             $errors_num++;
             $errors_string .= "$errors_num. Please enter a recepient.<br>\n";
        }
        if ($subject =="")
        {
             $errors_num++;
             $errors_string .= "$errors_num. Please enter a subject.<br>\n";
        }
        if ($message =="")
        {
             $errors_num++;
             $errors_string .= "$errors_num. Please enter a message.<br>\n";
        }
        if ($errors_num)
        {
           $r_records = q("SELECT * FROM dt_address_book WHERE member_id='$fMember[id]'");
           include "templates/send_message.ihtml";
        }
        else
        {
		q("INSERT INTO dt_messages (sid, rid, subject, message, timesent) VALUES (".$fMember[id].", $rid, '$subject', '$message', ".(strtotime(date("d M Y H:i:s"))).")");

		// Begin New Code
		$action = "add";
		$owner_member_id = $fMember[id];
		$member_id = $rid;
		$hotlist_type = "messaged";
		include "engine/pages/hot_lists.pml";
		// End New Code

		include "templates/message_sent.ihtml";

		$query = "select * from dt_members where id = '$rid'";
		$user_info = f(q($query));
		$login = $user_info["login"];
		$generated_link = $root_host."index.php?page=sign_in";
		mailSend($user_info["email"], "new_mail");
        }
}
else if($action == "new")
{
  		$f_balance = f(q("SELECT balance FROM dt_stamps_balance WHERE member_id='$fMember[id]'"));
	$action = "";
	$free_profile = 0;
	$can_contact = 0;
	$valid = 0;

	if($fMember[id] == "") return;

	if(($fMember[ unlimited ] && $fMember[ unlimited_end ] > strtotime(date("d M Y H:i:s"))) || $free_initiate) $free_profile = 1;
	else if($f_balance[ balance ] >= 1) $can_contact = 1;


	if(!$free_profile && !$can_contact)
	{
		include "templates/cannot_contact.ihtml";
		return;
	}

	if($free_profile)
	{
		$valid = 1;
		include "engine/pages/send_message.pml";
		return;
	}

	if($can_contact)
	{
		q("UPDATE dt_stamps_balance SET balance=balance-1 WHERE member_id='$fMember[id]'");
		$valid = 1;
		include "engine/pages/send_message.pml";
		return;
	}
}
    else
    {
        if((($reply == "") && (!$valid)) || (!$free_reply && $fMember[unlimited] != 1))
        {

		include "templates/cannot_contact.ihtml";
            return;
        }
        if ($reply != "")
        {
            $r_records = q("SELECT * FROM dt_messages WHERE id=$reply");
        }
        elseif ($mid != "")
        {
            $f_record = f(q("SELECT * FROM dt_address_book WHERE (member_id='$fMember[id]' AND contact_profile_id = '$mid')"));
        }
        elseif ($pid != "")
        {
            $f_record = f(q("SELECT * FROM dt_address_book WHERE (member_id='$fMember[id]' AND contact_profile_id = '$pid')"));
        }
        else
        {
            $r_records = q("SELECT * FROM dt_address_book WHERE member_id='$fMember[id]'");
        }

        include "templates/send_message.ihtml";
    }
?>

 

Link to comment
https://forums.phpfreaks.com/topic/56919-guys-i-need-your-help/
Share on other sites

Could be any number of things. Don't want to be harsh or anything but, honestly, that code is terrible. Naming functions simply f() and q() is rediculous, but anyway. It appears you never ever check to see if any of these queries return a valid result before you use them. I would put somechecking in place first and see how you go from there.

Link to comment
https://forums.phpfreaks.com/topic/56919-guys-i-need-your-help/#findComment-281199
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.