The table containing the users is correct and it is registering each user individually in the table. The problem is on their individual machines.
Here is the login
$cteam_id = $_POST['team_id'];
$cscenario_id = $_POST['scenario_id'];
$cteam_name = $_POST['team_name'];
$cteam_hall = $_POST['team_hall'];
$cteam_tg = $_POST['team_tg'];
$sql = "INSERT INTO team (team_id, scenario_id, team_name, team_hall, team_tg) VALUES ('".$cteam_id."', ".$cscenario_id.", '".$cteam_name."', '".$cteam_hall."', '".$cteam_tg."')";
$result = @mysql_query($sql, $connection) or die (mysql_error());
$cookie_name = "cookieteam_id";
$cookie_value = $cteam_id;
$cookie_expire = time()+6000;
setcookie($cookie_name, $cookie_value, $cookie_expire);
$cookie_name = "cookiescenario_id";
$cookie_value = $cscenario_id;
$cookie_expire = time()+6000;
setcookie($cookie_name, $cookie_value, $cookie_expire);
$cookie_name = "cookieteam_name";
$cookie_value = $cteam_name;
$cookie_expire = time()+6000;
setcookie($cookie_name, $cookie_value, $cookie_expire);
header("Location: start.php");
exit;
This displays a welcome message containing the name. This does not work and it displays other team names
<?
$team_name = $_COOKIE[cookieteam_name];
echo "Welcome $team_name";
?>
As for sending messages (where the system muddles up the originator). This is done by
<?
include("functions.php");
include("variables.php");
$team_id = $_COOKIE['cookieteam_id'];
$scenario_id = $_COOKIE['cookiescenario_id'];
?>
<form id="sendpm" name="sendpm" method="post" action="dosend.php">
<p align="right">
<textarea name="pm_text" cols="40" rows="5" id="pm_text"></textarea>
</p>
<p align="right">
<input name="pm_group" type="hidden" id="pm_group" value="0" />
<input name="team_id" type="hidden" id="team_id" value="<? echo "$team_id" ?>" />
<input name="pm_status" type="hidden" id="pm_status" value="Unanswered" />
<input name="pm_id" type="hidden" id="pm_id" value="X" />
<input name="scenario_id" type="hidden" id="scenario_id" value="<? echo "$scenario_id" ?>" />
<input name="pm_type" type="hidden" id="pm_type" value="Q" />
<input type="submit" name="Submit" value="Send Message" />
</p>
</form>
which goes to
<?
include("functions.php");
include("variables.php");
$team_id = $_POST['team_id'];
$scenario_id = $_POST['scenario_id'];
$pm_text = $_POST['pm_text'];
$pm_group = $_POST['pm_group'];
$pm_type = $_POST['pm_type'];
$user_id = $_COOKIE['cookieuser_id'];
$pm_status = $_POST['pm_status'];
$pm_id = $_POST['pm_id'];
addmsg($team_id, $scenario_id, $pm_text, $pm_group, $user_id, $pm_type);
if ($pm_id !='X') {
changepmstatus($pm_id, $pm_status);
}
?>
The addmsg function is
function addmsg($team_id, $scenario_id, $pm_text, $pm_group, $user_id, $pm_type) {
$sql = "INSERT into pm (team_id, scenario_id, pm_text, pm_group, user_id, pm_type)values('$team_id', $scenario_id, '$pm_text', $pm_group, '$user_id', '$pm_type')";
$result = @mysql_query($sql, $connection) or die (mysql_error());
}