PHP Example
Shibboleth passes several variables relating to the user in the $_SERVER array. The two variables of most use (and used in the example below) are:
- eppn (a unique identifier, in the form <userID>@ncl.ac.uk)
- mail (your University email address)
Using Shibboleth headers in a PHP web form
In the example below, the user will enter form data (in the "<other form fields>" section) and, when the form is submitted, the username and email address of the user logged into Shibboleth will be transmitted - along with the user-entered information - to the page specified in the form's action parameter.
Code:
<?php $name = $_SERVER['eppn']; $email = $_SERVER['mail']; ?> <form action="result.php" method="post"> <input type="hidden" name="name" value="<?php echo $name; ?>" /> <input type="hidden" name="email" value="<?php echo $email; ?>" /> . . <other input fields> . . <input type="submit" value="Submit" /> </form>