$newdata .= $firstexp[$i] . " "; } $formatted = trim($newdata); } else { $formatted = $firstexp[0]; } } if (!$formatted && stristr($msg, "Just REPLY to this Email")) { $thirdexp = explode("Just REPLY to this Email", $msg); $formatted = $thirdexp[0]; } if ($formatted) { $msg = $formatted; } } else { $msg = getEmailMsg($header, $message); } $query1 = "SELECT User.id,User.name,ProjectUser.company_id FROM users as User, project_users as ProjectUser WHERE User.email='" . $mail_id . "' AND User.id=ProjectUser.user_id AND ProjectUser.project_id='" . $row_pid['id'] . "'"; $result1 = mysql_query($query1) or die('Query failed: ' . mysql_error()); $row1 = mysql_fetch_assoc($result1); $user_id = $row1['id']; //user id of the sender $unq = md5(uniqid()); //uniq id in md5 format $gmt_dttime = gmdate('Y-m-d H:i:s'); $checkExists = mysql_num_rows(mysql_query("select id from easycases where message='" . addslashes($msg) . "' and user_id='" . $user_id . "' and project_id = '" . $row_pid['id'] . "' and title='' and case_no = '" . $cs_no . "'")); if ($checkExists >= 1) { echo "Same Post Postign Again..."; continue; } if ($msg != "" && $user_id && mysql_num_rows($result)) {
$newdata .= $firstexp[$i] . " "; } $formatted = trim($newdata); } else { $formatted = $firstexp[0]; } } if (!$formatted && stristr($msg, "Just REPLY to this Email")) { $thirdexp = explode("Just REPLY to this Email", $msg); $formatted = $thirdexp[0]; } if ($formatted) { $msg = $formatted; } } else { $msg = getEmailMsg($header, $message, $row_pusers, $chk_multibyt); } /*$hj_test = fopen('wotextt_today_o_p.txt','a'); fwrite($hj_test,$cs_uniq_id); fwrite($hj_test,$msg); fwrite($hj_test,'----uid:'.$user_id); fclose($hj_test);*/ if ($msg != "" && $user_id && mysql_num_rows($result)) { //checking company is not cancel $task_posted = 1; $valid_comp = 0; if ($row1['company_id']) { $sqlCom = "SELECT id,is_free,is_cancel,subscription_id FROM user_subscriptions as UserSubscription WHERE UserSubscription.company_id='" . $row1['company_id'] . "' ORDER BY created DESC LIMIT 1"; $qryCom = mysql_query($sqlCom) or die('Query failed: ' . mysql_error()); if (mysql_num_rows($qryCom)) { $resCom = mysql_fetch_assoc($qryCom);