Changing webdate code

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
kit
Forum Newbie
Posts: 3
Joined: Sat Mar 27, 2004 12:47 am

Changing webdate code

Post by kit »

I have a matching/dating site (using webDate software) that sends these "Virtual Kisses" to the member’s personal email. I want to change it so the "Virtual Kiss" just goes to the member’s internal inbox not to their personal email. Can anyone tell me how to change this script to do this? Thanks

send_vkiss.pml - page which just goes to members personal email:

Code: Select all

<?
    if($profile_id == "")
    {
        include "templates/index.ihtml";
        return;
    }

    $f_profile = f(q("SELECT id, name, status FROM dt_profile WHERE member_id='$fMember[id]'"));
    $f_target_profile = f(q("SELECT member_id FROM dt_profile WHERE id='$profile_id'"));
    $f_target_member = f(q("SELECT email FROM dt_members WHERE id='$f_target_profile[member_id]'"));

    if($f_profile[ status ] != 1)
    {
        include "templates/vkiss_failed.ihtml";
    }
    else
    {
        $profile_name = $f_profile[ name ];
        $profile_link = $root_host."index.php?page=view_profile&id=$f_profile[id]";
        $profile_free_text = "";

        $gm = f(q("select id from dt_members where member_id='$fMember[id]' and system_status='1' and system_status_end>='".strtotime(date("d M Y H:i:s"))."'"));
        if($gm != "")
        {
            $profile_free_text = "You can contact this user for free!";
        }

        mailSend($f_target_member[ email ], "virtual_kiss");
        include "templates/vkiss_success.ihtml";
    }
?>
Now the following script (page) is for sending messages, which sends the message to the member’s internal inbox and a "you have new mail" message to their personal email. Just though having this script would help find a solution.
send_message.pml - page:

Code: Select all

<?

        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"))).")");
                           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(! $valid)
                        {
                            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";
                }
?>
User avatar
patrikG
DevNet Master
Posts: 4235
Joined: Thu Aug 15, 2002 5:53 am
Location: Sussex, UK

Post by patrikG »

From looking briefly at the code you've posted: you've got the answer sitting right in front of you. You already have the relevant code bits (from what I can tell).

It's not difficult and very logical - I am sure you can do it yourself :)
kit
Forum Newbie
Posts: 3
Joined: Sat Mar 27, 2004 12:47 am

Post by kit »

patrikG wrote:From looking briefly at the code you've posted: you've got the answer sitting right in front of you. You already have the relevant code bits (from what I can tell).

It's not difficult and very logical - I am sure you can do it yourself :)
Yeah that's what I thought. I know that when there are internal emails you simply store the message into a database. Well I tried to copy the database bit from send_message page and paste it into the send_vkiss page but I could not get it to insert info into the database. I gone over it hours before I even thought of asking the forum for help. I am still having problems if anyone could help. Or even more of a little hint. Thanks
Post Reply