codice HTML:
<!DOCTYPE html>
<html>
    <head>
        <title></title>
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <meta charset="utf-8">
         <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
        <link href="config.css" type="text/css" rel="stylesheet">
    </head>

    <body onload="loadDoc()">

        <div id="form-riconoscimento">
            <h4>modulo di riconoscimento</h4>
                <table>
                    <form method="get" action="server.php">

                        <tr>
                            <td><input type="text" name="username" placeholder="username"></td>
                        </tr>    
                        <tr>    
                            <td><input type="password" name="password" placeholder="password"></td>
                        </tr>
                        <tr>
                            <td><input type="radio" name="opzioneUtente" value="registrareUtente">registrasi</td></tr>
                        <tr>
                            <td><input type="radio" name="opzioneUtente" value="loggareUtente">accedere</td>
                        </tr>
                        <tr>
                            <td><input type="submit" value="invio"></td></tr>
                    </form>
                </table>
        </div>
<!--
        <p id="demo"></p>

        <button onclick="nuovoUtente()" id="IngressoChat">entra in chat</button>
        <button onclick="uscire()" id="uscitaChat">uscire</button>
        <div id="body"></div>

        <div id="form">
              <form method="get" action="server.php">
                  <input type="text" name="mex">
                  <input type="submit" value="invio">
            </form>
        </div>

</body>
</html>
Codice PHP:
<?php
session_start
();
$conex mysql_connect('localhost''root');
mysql_select_db("my_laboraccio"$conex);
$uname $_GET['username'];
$pw =  $_GET['password'];
$opzioneUtente $_GET['opzioneUtente'];
echo 
$opzioneUtente;
echo 
$uname;
echo 
$pw;
echo 
gettype($opzioneUtente);
if(
$opzioneUtente == 'registrareUtente'){
    function 
registraUtente(){
        
$sql "SELECT * FROM utenti WHERE username='$uname'";
        
$resource mysql_query($sql) or die (mysql_error());
        
$result mysql_num_rows($resource);
        echo 
$result;
        if(
$result == 0) {
            
$sql "INSERT INTO utenti (id, username, password) VALUES (NULL, '$uname', '$pw')";
            
mysql_query($sql);
            
header("Refresh:10; url=http://www.laboraccio.altervista.org/");
              echo 
"nuovo utente creato";
 
            echo 
"registrazione completata";
        }
        elseif(
$result == 1){
            echo 
"username gia in uso, riprova con un altro";
              
header("Refresh:10; url=http://www.laboraccio.altervista.org/");
           }
    }
}
elseif(
$opzioneUtente == "loggareUtente") {
    function 
loggareUtente(){
        
$sql "SELECT * FROM utenti WHERE username='$uname' AND password='$pw'";
        
$resource mysql_query($sql) or die (mysql_error());
        
$result mysql_num_rows($resource);
        if(
$result == 1) {
            
$_SESSION['username'] = $uname;
            
$_SESSION['password'] = $pw;
        echo 
"benvenuto alla tua area personale".$uname;
        
        }

    
    }
}

?>
SITO www.laboraccio.altervista.org
non capisco perche le funzioni non vanno