Salta al contenuto
  • CATEGORIES
  • La Community Connect.gt
  • Presentati alla Community
  • News Ufficiali da Connect.gt
  • Internet News
  • A Scuola Di
  • Digital Marketing
  • Intelligenza Artificiale
  • SEO & GEO
  • Web Marketing e Content
  • Google Analytics e Web Analytics
  • Google Ads & Advertising
  • YouTube
  • TikTok, Instagram e altri Social
  • Google Adsense, Affiliazioni e Guadagno
  • E-Commerce
  • Coding e Sistemistica
  • Help Center: consigli per il tuo progetto
  • Hosting e Cloud
  • Coding
  • CMS & Piattaforme Self-Hosted
  • Annunci e Collaborazioni
  • Annunci Vendita e Acquisto: Pubblicità, Domini, Link e altro
  • Collaborazioni WEB e Lavoro: offro e cerco
  • Impresa, Fisco e Leggi
  • Consulenza Legale e Professioni Web
  • Consulenza Fiscale, Imprese, Startup e P.Iva
  • Gli Off Topic
  • PC, Smartphone e altri Hardware
  • Tutti i Software
  • GT Fetish Cafè
  • Discussioni
  • 0 Non letti 0
  • Recenti
  • Hashtag
  • Popolare
  • Utenti
  • Privacy
  • Termini e condizioni
  • © 2026 Search On Media Group S.r.l.
Collassa
Connect.gt
Il network Search On
Connect.gt WMF AI Festival Accademia Advanced SEO Tool AgentCy Social Media Strategies Search Tech
Registrati Accedi
Connect.gt
Stream Interest Categorie Hashtag
  1. La community italiana di SEO, marketing digitale e AI
  2. Categorie
  3. Coding e Sistemistica
  4. Coding
  5. Creazione account php

Creazione account php

Pianificato Fissato Bloccato Spostato Coding
1 Post 1 Autori 2.3k Visualizzazioni 1 Seguito
  • Da Vecchi a Nuovi
  • Da Nuovi a Vecchi
  • Più Voti
Rispondi
  • Risposta alla discussione
Effettua l'accesso per rispondere
Questa discussione è stata eliminata. Solo gli utenti con diritti di gestione possono vederla.
  • P
    P
    piterrey
    scritto su ultima modifica di
    User Attivo 0
    #1
    Creazione account php

    Salve ragazzi
    Ho uno script php che mi permette di creare account.
    Avendo creato una tabella mysql e inserendo mon password ed email mi crea l'account e basta; ora come posso creare il resto?
    Cioe'
    ho questi file:
    account.php

     include_once("functions.inc.php");
    
    if ($_REQUEST["action"] != "signup" && $_REQUEST["action"] != "confirm") {
    
     signupForm();
    
    }
    
    if ($_REQUEST["action"] == "signup") {
    
     $username = $_POST["username"];
     $password = $_POST["password"];
     $email    = $_POST["email"];
    
     createAccount($username,$password,$email);
    
    }
    
    if ($_REQUEST["action"] == "confirm" && $_REQUEST["confirm"] != "") {
    
     confirm($_REQUEST["confirm"]);
    
    }
    

    config.php

    # Database name
    $db = "xxx";
    
    # Internet address or hostname of database host
    $db_host = "localhost";
    
    # Database username
    $db_user = "xxx";
    
    # Database password
    $db_password = "xxx";
    

    functions.php

    include_once("config.inc.php");
    
    function confirm ($random) {
    
     # Inherit database connection information from variables defined in config.inc.php
     global $db, $db_host, $db_user, $db_password;
    
     # Connect to the database and report any errors on connect.
     $cid = mysql_connect($db_host,$db_user,$db_password);
    
     if (!$cid) {
    
      die("ERROR: " . mysql_error() . "\n");
    
     }
    
     # Setup SQL statement, update account to show that user has confirmed.
     $SQL = "UPDATE account SET confirmed = '0' WHERE random = '$confirm'";
     $result = mysql_db_query($db,$SQL,$cid);
    
     # Check for errors.
     if (!$result) {
    
      die("ERROR: " . mysql_error() . "\n");
    
     } else {
    
      echo "Congratulations, your account has been confirmed successfully. You may now login.";
    
     }
    
     mysql_close($cid); 
    
    }
    
    function signupForm () {
    
     # Nothing more than spitting out HTML for the form
     echo "<form name=\"signup\" method=\"POST\" action=\"?action=signup\">";
     echo "Username: <input type=\"text\" name=\"username\"><br>";
     echo "Password: <input type=\"password\" name=\"password\"><br>";
     echo "E-Mail: <input type=\"text\" name=\"email\"><br>";
     echo "<input type=\"submit\"></form>";
    
    }
    
    function createAccount ($username, $password, $email) {
    
     if ($username == "" || $password == "" || $email == "") {
    
      die("ERROR: Please make sure that all entries are valid!");
     
     }
    
     # Inherit database connection information from variables defined in config.inc.php
     global $db, $db_host, $db_user, $db_password;
    
     # Connect to the database and report any errors on connect.
     $cid = mysql_connect($db_host,$db_user,$db_password);
    
     if (!$cid) {
    
      die("ERROR: " . mysql_error() . "\n");
    
     } 
    
     # Create Random number
     $floor = 100000;
     $ceiling = 999999;
     srand((double)microtime()*1000000);
     $random = rand($floor, $ceiling);
    
     # Message sent in the e-mail to the user that's signing up.
     $message = "You or someone using your email address has requested an account on the system. If you requested the account please click on the confirmation link below. If not, please send a message to email.\n\nhttp://www.miosito/account/account.php?action=confirm&confirm=$random\n\nThanks!";
    
     # Send the confirmation e-mail to the user.
     mail($email, "Account Confirmation", $message);
    
     # I usually hash the passwords instead of storing the plaintext password in the database.
     # Just comment the next line out if you'd prefer to store them as plaintext.
     $password = md5($password);
    
     # Setup SQL statement and add the account into the system.
     $SQL = "INSERT INTO account VALUES ('$username','$password','$email','1','$random')";
     $result = mysql_db_query($db,$SQL,$cid);
    
     # Check for errors.
     if (!$result) {
    
      die("ERROR: " . mysql_error() . "\n");
    
     } else {
    
      echo "Congratulations, your account has been added into the system. Check your e-mail for the confirmation message";
    
     }
    
     mysql_close($cid);
    
    }
    

    cioe' devo creare il login e la pag utente.
    Mi aiutate?

    1 Risposta Ultima Risposta
    Miglior risposta 0
    0

    Ciao! Sembra che tu sia interessato a questa conversazione, ma non hai ancora un account.

    Stanco di dover scorrere gli stessi post a ogni visita? Quando registri un account, tornerai sempre esattamente dove eri rimasto e potrai scegliere di essere avvisato delle nuove risposte (tramite email o notifica push). Potrai anche salvare segnalibri e votare i post per mostrare il tuo apprezzamento agli altri membri della comunità.

    Con il tuo contributo, questo post potrebbe essere ancora migliore 💗

    Registrati Accedi
    Rispondi
    • Risposta alla discussione
    Effettua l'accesso per rispondere
    • Da Vecchi a Nuovi
    • Da Nuovi a Vecchi
    • Più Voti


    • Accedi

    • Non hai un account? Registrati

    • Accedi o registrati per effettuare la ricerca.
    • Primo post
      Ultimo post
    Home Accedi Registrati
    Menu
    • CATEGORIES
    • La Community Connect.gt
    • Presentati alla Community
    • News Ufficiali da Connect.gt
    • Internet News
    • A Scuola Di
    • Digital Marketing
    • Intelligenza Artificiale
    • SEO & GEO
    • Web Marketing e Content
    • Google Analytics e Web Analytics
    • Google Ads & Advertising
    • YouTube
    • TikTok, Instagram e altri Social
    • Google Adsense, Affiliazioni e Guadagno
    • E-Commerce
    • Coding e Sistemistica
    • Help Center: consigli per il tuo progetto
    • Hosting e Cloud
    • Coding
    • CMS & Piattaforme Self-Hosted
    • Annunci e Collaborazioni
    • Annunci Vendita e Acquisto: Pubblicità, Domini, Link e altro
    • Collaborazioni WEB e Lavoro: offro e cerco
    • Impresa, Fisco e Leggi
    • Consulenza Legale e Professioni Web
    • Consulenza Fiscale, Imprese, Startup e P.Iva
    • Gli Off Topic
    • PC, Smartphone e altri Hardware
    • Tutti i Software
    • GT Fetish Cafè
    • Discussioni
    • Non letti 0
    • Recenti
    • Hashtag
    • Popolare
    • Utenti
    • Privacy
    • Termini e condizioni
    • © 2026 Search On Media Group S.r.l.