phpvox Posted June 24, 2007 Share Posted June 24, 2007 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 More sharing options...
trq Posted June 24, 2007 Share Posted June 24, 2007 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 More sharing options...
phpvox Posted June 24, 2007 Author Share Posted June 24, 2007 i know this script sucks, thats why im having a problem.....im going to hire a company to redo the whole script, but i wish i can fix this problem first Link to comment https://forums.phpfreaks.com/topic/56919-guys-i-need-your-help/#findComment-281440 Share on other sites More sharing options...
phpvox Posted June 24, 2007 Author Share Posted June 24, 2007 it says that they got stamps in their profile, but it still dosent give them access to comummicate with other members Link to comment https://forums.phpfreaks.com/topic/56919-guys-i-need-your-help/#findComment-281445 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.