The given statement is
"It is necessary to have a password to log on to the server."
Here $p$ is You log on to the server.
$q$ is You have a password.
The given statement in the form if $p$ then $q$ is
If you log on to the server then you have a password.