Jump to content

Sending messages to certain people


dean7

Recommended Posts

Hey all, I've been coding a thing for my website which allows Users to apply for a crew via the Crew Profile Page. The code all works just when the User applys I want the Crew Staff to get a message just to let them know.

 

I've tryed things of which I though could work but none of them did. I also tryed with a function, witch didn't work but I'm not to sure on Functions at the moment.

 

My Code so far:

<?php
session_start();
include "includes/config.php";
include "includes/functions.php";
include "includes/bb-codes.php";
logincheck();
$username= $_SESSION['username'];
$viewcrew= $_GET['viewcrew'];

$fetch=mysql_fetch_object(mysql_query("SELECT * FROM crews WHERE name='$viewcrew'"));

$mysql1 = mysql_query("SELECT * FROM `users` WHERE username = '$username'") or die ("Error, Line 13 " . mysql_error()); // Doing User Query
$userfetch = mysql_fetch_object($mysql1); // Getting User Object

$needcrewstaff = mysql_query("SELECT * FROM crews WHERE name='$viewcrew'");
$pleasework = mysql_fetch_object($needcrewstaff);

// Start Send Staff Message Function

function sendstaffmessage(){
$message = "You have an Crew Application. Click <a href='crewapp.php' target='mainFrame'>here</a> to Accept or Decline it!";
if ($pleasework->owner == $username){
mysql_query("INSERT INTO `inbox` ( `id` , `to` , `from` , `message` , `date` , `read` , `saved` , `event_id` )
VALUES (
'', '$pleasework->owner', '$username', '$message', '$date', '0', '0', '0'
)");
} 
if ($pleasework->coowner == $username){
mysql_query("INSERT INTO `inbox` ( `id` , `to` , `from` , `message` , `date` , `read` , `saved` , `event_id` )
VALUES (
'', '$pleasework->owner', '$username', '$message', '$date', '0', '0', '0'
)");
}
if ($pleasework->underboss == $username){
mysql_query("INSERT INTO `inbox` ( `id` , `to` , `from` , `message` , `date` , `read` , `saved` , `event_id` )
VALUES (
'', '$pleasework->underboss', '$username', '$message', '$date', '0', '0', '0'
)");
}
if ($pleasework->recruiter == $username){
mysql_query("INSERT INTO `inbox` ( `id` , `to` , `from` , `message` , `date` , `read` , `saved` , `event_id` )
VALUES (
'', '$pleasework->recruiter', '$username', '$message', '$date', '0', '0', '0'
)");
}
if ($pleasework->recruiterone == $username){
mysql_query("INSERT INTO `inbox` ( `id` , `to` , `from` , `message` , `date` , `read` , `saved` , `event_id` )
VALUES (
'', '$pleasework->recruiterone', '$username', '$message', '$date', '0', '0', '0'
)");
}
}

// End the Function!

if (strip_tags($_POST['apply'])){
if ($userfetch->crew != "0"){
echo ("You can not Apply for <strong>$viewcrew</strong> when already being in <strong>$get->crew</strong>!");
}else{
sendstaffmessage();
mysql_query("UPDATE users SET crewapp='$viewcrew' WHERE username='$username'");
echo ("$viewcrew Applied for! - Note: If you Apply for a different Crew this App will be Deleted.");
}
}
?>

 

Is there any way to change my code which will send the Crew Boss etc.. a Message when somebody has applyed?

 

Thanks for any help.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.