I am trying to build a web-based application in which users send an image to a back office (this works via a database), where the image is either approved or denied by an admin and a message is sent back to the user informing them of the decision.
This is part of a scavenger hunt web app I am making and there will be different teams, which will need to receive different messages/clues depending on their stage in the game. The message from the back office needs to be sent to a specific session, so I take team_name as a variable and need compare it to the $_SESSION['team_name']
in order to make sure I am sending it to the right guys.
I also need to take the message as a string to pass to the users index page. My backoffice form looks like this:
<form method="post">
Team Name:
<input type="text" name="team_name" value="<?php echo $_SESSION['team_name'];?>">
<input type="submit" name="autosend" value="Send Next Clue">
Manually Type Clue:
<input type="text" name="clue" value="<?php echo $_POST['clue'];?>">
<input type="submit" name="manualsend" value="Send Typed Clue">
</form>
I have been playing around with php's different types of superglobals, but the I cannot seem to get the message to display in the other page, which essentially echoes the variables.
The message cannot be sent as $_SESSION variable, because the backoffice is an admin page and therefore not in the same session.
So what is the best method to pass a message between two php scripts, without using $_SESSION variables or a database?
The session is specific to the user, you can not access someone's session form another user session.
What you can on the other hand is store the value from the admin to the db. When the user refreshes the page you just check what you have in the db for that user. This is how all PHP apps are doing.