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. Problema script attivazione registrazione

Problema script attivazione registrazione

Pianificato Fissato Bloccato Spostato Coding
2 Post 1 Autori 468 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.
  • R
    R
    ravo
    scritto su ultima modifica di
    User Newbie 0
    #1
    Problema script attivazione registrazione

    Ciao a tutti.
    Aiuto!!!!!

    ho un problema con lo script di login e di attivazione.In pratica vorrei che nella pagina di attivazione(active.php) venisse visualizzato il numero di attivazione che viene creato in add.php..

    ADD.PHP

    <?PHP
    //retrieve al the variables that had been submited by the from
    $username1 = $HTTP_POST_VARS["username"];
    $mailadres1 = $HTTP_POST_VARS["mailadres"];
    $password1 = $HTTP_POST_VARS["password"];
    $confirmpassword1 = $HTTP_POST_VARS["confirmpassword"];
    //generate an random number for the user neede to activate there account
    $actnum = rand( 1,999999999999);
    //make sure that the activation number is positive (YES it can happen that the number is negatief.)
    if ($actnum < 0){
    $actnum = $actnum + ($actnum*-2);
    }
    //set the error variable to an empty string.
    $error = "";
    //check it the fields are not empty. if they are, append the error to the error variable ($error)
    if ($username1 == ""){$error = "$error<li>No username given<BR>\n";}
    if ($password1 == ""){$error = "$error<li>No password given<BR>\n";}
    if ($mailadres1== ""){$error = "$error<li>No mailadres given<BR>\n";}
    //check if the passwords match. if they don't append the error to the error variable ($errir)
    if ($password1 <> $confirmpassword1) {$error = "$error<li>Passwords do not match<BR>\n";}
    // let the config.php file make an database connection
    include("config.php");
    //make an query which checks if the username OR the emailadres ar in the database. if they are append an error.
    $query = "Select * from signup where username='$username1' or mailadres='$mailadres1'";
    $result = mysql_query($query); 
    if ($row = mysql_fetch_array($result)){ 
    if  ($row["username"] == $username1){$error = "$error<li>Your username is already used by another member<br>\n";}
    if  ($row["mailadres"] == $mailadres1){$error = "$error<li>Your e-mail adres is already registrated in our database<br>\n";}
    }
    //if ther error variable is still an empty string. The summission was oke and you can start proccesing the submission
    if ($error == ""){
    //first we check wat the date and time is for the signupdate field
    $datetime = date("d-m-Y G:i ");
    //then we submit al this to the database
    $query = "INSERT INTO signup (username, password, mailadres, actnum, userlevel, signupdate ,lastlogin, lastloginfail, numloginfail) VALUES ('$username1','$password1','$mailadres1','$actnum', '1', '$datetime','0','0','0')";  
    $result = mysql_query($query); 
    //and we make an (e-mail)message which contains the activation numer
    //also possible is to put a link in that message like :
    //http:-// your url /activate.php?username=$username1&actnum=$actnum
    //this would allow the user to direcly submit there activation without having to enter
    //al the data again in the activation form
    $message = "Activation number: $actnum";
    // mail the message to the user
    //mail($mailadres1, "Sign up script user activationcode", $message, "From: Sign-up script");
    // and redirect the user to the activation page
    header("Location: activate.php"); 
    }
    else
    //if $error is no longer a empty stirng there must have been error in the submision.
    //here we echo an nice line which says there are a coulple of errors and we onpen an 
    //unorder list (just the <ul> tag) and we prinnt the error. also we include a link back to the
    //sign-upform
    {echo "You could not be added to the database because of the following reasons<ul>
    $error
    </ul>Please return to <a href=\"signup.php\">signup form</a> and try again.";
    }
    ?>
    

    ACTIVE.PHP

    <?PHP
    //retrieve the usernaem and the activation number from the url
    $username1 = $HTTP_GET_VARS["username"];
    $actnum1 = $HTTP_GET_VARS["actnum"];
    //let the config.php page connected to the database
    include("config.php");
    //check it the combination of username/password is correct.
    $query = "Select * from signup where username='$username1' And actnum='$actnum1'";
    $result = mysql_query($query); 
    //if it is update the user's records. Set actnum to 0
    if ($row = mysql_fetch_array($result)){ 
     $query = "UPDATE signup Set actnum = '0' where username='$username1'";  
     $result = mysql_query($query); 
    // show the "thank you for activating" page.
    ?>
    <html>
    <head>
    <title>Activate account</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    </head>
    <body>
    Thank you for activating your account. You may now <a href="login.php">login</a>
    </body>
    </html>
    <?PHP }
    //if the username/actnum combination doesn't match check why.
    else
    {
    //if the username is empty just show the form.
    if ($username1 == ""){makeform();}
    //but if the username isn't empyt that means the user did submit the form.
    //therefore we print an error page and (again) the form.
    else
    {?>
    <html>
    <head>
    <title>Activate account</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    </head>
    <body>
    <form name="form1" method="get" action="activate.php">
      The username/activation-combination you entered is not correct. Please try again.<br>
      Username: 
      <input name="username" type="text" id="username">
      <br>
      Activation code: 
      <input name="actnum" type="text" id="actnum">
      <br>
      <input type="submit" name="Submit" value="Activate">
    </form>
    </body>
    <?PHP
    }
    }
    // the makeform function. prints the default form for activating.
    function makeform(){
    ?>
    <html>
    <head>
    <title>Activate account</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    </head>
    <body>
    <form name="form1" method="get" action="activate.php">
      Thank you for signing up. An activationcode has been send to your e-mail adres.<br>
      Username: 
      <input name="username" type="text" id="username">
      <br>
      Activation code: 
      <input name="actnum" type="text" id="actnum">
      <br>
      <input type="submit" name="Submit" value="Activate">
    </form>
    </body>
    </html>
    <?PHP } ?>
    

    In teoria il numero di attivazione doveva essere mandato per mail ma vorrei che venisse visualizzato nella stessa pagina in cui devo inserirlo(active.php). Il codice scritto così funziona,ma voglio prelevare actnum dal db ma non ci riesco..

    Grazie a tutti

    1 Risposta Ultima Risposta
    Miglior risposta 0
    0
    • R
      R
      ravo
      scritto su ultima modifica di
      User Newbie 0
      #2

      Grazie a tutti ho risolto.....

      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.