Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    New to the CF scene
    Join Date
    Feb 2003
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Sign up scripts?

    Hey, I'm using NeoMail, and I was wondering, where can I get some good scripts that allows my users to sign up? I'm pretty new at PHP, so, if somebody is willing to construct me through the process, it would be very helpful.

    I just need a program that can allow users to sign up, and send an automatic validation email.

    Any comments, help, or anything would really help out

  • #2
    Senior Coder missing-score's Avatar
    Join Date
    Jan 2003
    Location
    UK
    Posts
    2,194
    Thanks
    0
    Thanked 0 Times in 0 Posts

    What Are you using

    Are you using a MySQL database? To send validation e-mail your web server / hosting company needs an smtp server.

    Tell we what you are using and then I should be able to help you from there.

  • #3
    New to the CF scene
    Join Date
    Feb 2003
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Yeah, I think i am using what you mentioned, thanks for being interested in helping out

  • #4
    Senior Coder missing-score's Avatar
    Join Date
    Jan 2003
    Location
    UK
    Posts
    2,194
    Thanks
    0
    Thanked 0 Times in 0 Posts

    No prior MySQL experience!

    I dont have a MySQL database and I dont know much about MySQL. If you are using a MySQL database then you would be definate about it, not: i think, so I will try an example without using MySQL. Tell me if there are bugs and I will try and fix them. I will put this in 3 parts.

    PART 1: make file signup.php

    <form name="signup" action="complete.php" method="post">
    Name: <input type="text" name="name" value="<?php echo $name ?>" /> <br />
    Surname: <input type="text" name="surname" value="<?php echo $surname ?>" /> <br />
    E-mail: <input type="text" name="email" value="<?php echo $email ?>" /> <br /><br />
    Username: <input type="text" name="username" value="<?php echo $username ?>" /><br />
    Password: <input type="password" name="pass1" /><br />
    Re-enter password: <input type="password" name="pass2" /><br /><br />
    <input type="submit" value="Submit" /><br /><br />
    </form>

    PHP Code:
    <?php if($failed == 'true'){
    echo 
    "Some information was not correct"// For if they get sent back from the completion page
    ?>
    ___

    BEAR IN MIND THAT YOU DO NOT HAVE TO HAVE THESE FIELDS, CHANGE DELETE AND ADD AS YOU WISH, JUST BE SURE TO EDIT THE PHP CODE.
    ___

  • #5
    Senior Coder missing-score's Avatar
    Join Date
    Jan 2003
    Location
    UK
    Posts
    2,194
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Cont...

    PART 2: make file complete.php

    PHP Code:
    <?php

    $required 
    = array($name,$email,$username,$pass1,$pass2); // Array of required fields ( eg $name, $email )


    for ( $i 0$i count($required); $i++ )
    {
          
    $replacedSpaces str_replace(' ','',$required[$i]); // Check all required fields, and replace all spaces with nothing temporarily to make sure the person has not just put a space in each field.
          
    if($required[$i] == '' || $replacedSpaces == '')
          {
                
    header('location:signup.php?failed=true');
          }
    }
    if(
    $pass1 != $pass2// Check passwords match
    {
          
    header('location:signup.php?failed=true');
    }
    ?>
    _______

    MAKE SURE THE ABOVE CODE GOES BEFORE THE HTML TAG ON YOUR PAGE
    _______


    <html>
    <head>
    <title>Complete signup</title>
    </head>
    <body>
    PHP Code:
    <?php
    if(!file_exists("$username$password.dat"))
    {
          
    $newfile fopen("$username$password.dat");
          
    fwrite($newfile,"$name|$sname|$email|$username|$pass1");
          
    fclose($newfile);
          echo 
    "Account Created";
          
    mail("you@youremail.com","You have a new user","The users name is: $name\n\n
    The users surname is $surname\n\n
    The users e-mail is $email\n\n
    The users username is $username\n\n
    The users password is $password"
    ,"From: Me! <you@youremail.com>\n");
    }
    ?>
    This will create a new file for the user, and send an e-mail to you informing you of them. You should know that this script if off the top of my head so there may be a couple of bugs.

  • #6
    Senior Coder missing-score's Avatar
    Join Date
    Jan 2003
    Location
    UK
    Posts
    2,194
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Finally...

    STEP 3: login.php

    Again, include this code before the HTML tag.

    PHP Code:
    <?php 

    if(file_exists($username) && file_exists($password) && $username != $password)
    {
          
    header('location:loggedinusers.php');
    } else {
    $status "Not logged in yet";
    }
    ?>

    <form name="log" action="<?php echo $PHP_SELF ?>" method="post" />
    <input type="text" name="username" />
    <input type="password" name="password" />
    </form>

    <br /><br />
    PHP Code:
    <?php echo $status ?> // Writes "Not logged in yet" if they have not logged in
    I hope this helps...

    Bear in mind that a MySQL database option is much better. I might resarch it and post back here with a new script. Post If you need any more help or find a bug.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •