Results 1 to 5 of 5
  1. #1
    Join Date
    Jul 2004
    Location
    Webby Forums!
    Posts
    1,879
    Tokens
    0

    Latest Awards:

    Default Cutenews Registering :)

    Ok so fed up with spammers on your cutenews system? Or just want to add a register system? Well here is the script. First go to your cutenews file and make a register.php and then add this script:

    <?PHP
    /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    register.php - Build 004a - Configuration
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */

    // With what level to be registered member.
    // 4 = Commenter
    // 3 = Journalist
    // 2 = Editor
    // 1 = Administrator
    $register_level = "4";

    // Allow multiple users to use same Email Address?
    // yes
    // no
    $email_multiple = "no";

    // Send password in an email (if no the script will ask for password)
    // yes
    // no
    $email_password = "no";

    // Send an email to the admin when a new user signs up?
    // yes
    // no
    $email_admin = "no";

    // Username Filter
    // These characters will not be allowed in usernames or passwords
    $filter = array(" ", "<", ">", "\n", "\r", "|", "'", "\"");

    /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    END - END - END - END - END -- Do Not Edit Below
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
    if ($register_level=="4") $level_mail="Commenter";
    if ($register_level=="3") $level_mail="Journalist";
    if ($register_level=="2") $level_mail="Editor";
    if ($register_level=="1") $level_mail="Administrator";
    error_reporting (E_ALL ^E_NOTICE);
    require_once("./inc/functions.inc.php");
    require_once("./data/config.php");
    require_once("./skins/${config_skin}.skin.php");

    if($action != "doregister"){
    echoheader("user", "$level_mail Registration");

    if ($email_password == "no") {
    $prompt_password = <<<HTML
    <tr>
    <td width=80>Password: </td>
    <td><input tabindex=3 type=text name=regpassword style="width:134" size="20"></td>
    </tr>
    <tr>
    <td width=80>Confirm Password: </td>
    <td><input tabindex=4 type=text name=confpassword style="width:134" size="20"></td>
    </tr>
    HTML;
    } else { $prompt_password = ""; }

    echo<<<HTML
    <table leftmargin=0 marginheight=0 marginwidth=0 topmargin=0 border=0 height=100% cellspacing=0>
    <form name=login action="$PHP_SELF" method=post>
    <tr>
    <td width=80><br>Username: </td>
    <td><br><input tabindex=1 type=text name=regusername style="width:134" size="20"></td>
    </tr>
    $prompt_password
    <tr>
    <td width=80>Email: </td>
    <td><input tabindex=3 type=text name=regemail style="width:134" size="20"></td>
    </tr>
    <tr>
    <td width=80>Confirm Email: </td>
    <td><input tabindex=4 type=text name=confemail style="width:134" size="20"></td>
    </tr>
    <tr>
    <td width=80>Hide Email: </td>
    <td><input type=checkbox name=reghide></td>
    </tr>
    <tr>
    <td></td>
    <td ><input accesskey="s" type=submit style="background-color: #F3F3F3;" value='Register'></td>
    </tr>
    <input type=hidden name=action value=doregister>
    </form>
    </table>
    HTML;

    echofooter();
    }else{
    if($email_password == "yes"){ $regpassword = makeRandomPassword(); $confpassword = $regpassword; }
    if(!$regusername){ msg("error","Error !!!", "Username can not be blank"); }
    if(!$regpassword || !$confpassword || $regpassword != $confpassword) { msg("error","Error !!!", "Password can not be blank, both fields must match"); }
    if(!$regemail || !$confemail || $regemail != $confemail) { msg("error","Error !!!", "Email can not be blank, both fields must match"); }
    if(!preg_match("/^[\.A-z0-9_\-]+[@][A-z0-9_\-]+([.][A-z0-9_\-]+)+[A-z]{1,4}$/", $regemail)){ msg("error","Error !!!", "Invalid Email."); }
    for ($f = 0; $f <= sizeof($filter); $f++) { if (stristr($regusername, $filter[$f])) { msg("error","Error !!!", "Invalid Username."); } }
    for ($f = 0; $f <= sizeof($filter); $f++) { if (stristr($regpassword, $filter[$f])) { msg("error","Error !!!", "Invalid Password."); } }

    $add_time = time()+($config_date_adjust*60);
    if ($reghide=="on") { $hidemail="1"; } else { $hidemail="0"; }

    $all_users = file("./data/users.db.php");
    foreach($all_users as $null => $user_line) {
    $user_arr = explode("|", $user_line);
    if(stristr("|".$user_arr[2]."|", "|".$regusername."|")){ msg("error", "Error", "This username is already taken"); }
    if($email_multiple=="no" && stristr("|".$user_arr[5]."|", "|".$regemail."|")){ msg("error", "Error", "This email address is registered to another user!"); }
    }

    $users_file = fopen("./data/users.db.php", "a");
    fwrite($users_file, "$add_time|$register_level|$regusername|".md5($reg password)."||$regemail|0|$hidemail||||||\n");
    fclose($users_file);

    if ($email_password == "yes"){ cute_mail($regemail, "Registration at $SERVER_NAME", "$regusername, you have registered successfully. \n ---------- \n Your User Level is: $level_mail \n Your Password is: $regpassword \n You can change this once you login. \n ---------- \n You can login here: $config_http_script_dir/ \n Thank You for Registering!"); }
    if ($email_admin == "yes") { cute_mail($config_mail_admin_address, "New User: $regusername", "$regusername has registered on your CuteNews system. \n The address used to register was: $regemail \n To delete this user go to the following address: $config_http_script_dir/index.php?mod=editusers&action=dodeleteuser&id=$ad d_time"); }

    if (!isset($config_mail_admin_address) || $config_mail_admin_address == "") { $problem_contact = "our staff"; }
    else { $problem_contact = "<a href=\"mailto:".$email_admin_address."\" target=\"_blank\">".$email_admin_address."</a>"; }
    if ($email_password == "yes"){ msg("user", "$level_mail Added", "You have successfully registered as <b>\"$regusername\"</b>.<br>Your password has been emailed to <b>\"$regemail\"</b>.<br>If this information is wrong or you do not recieve your password please contact $problem_contact."); }
    else { msg("user", "$level_mail Added", "You have successfully registered as <b>\"$regusername\"</b>.<br>Your password is <b>\"$regpassword\"</b>.<br>Your email address is <b>\"$regemail\"</b>.<br>If this information is wrong please contact $problem_contact."); }
    }
    ?>

    Once you have done that then find this bit at the top of the script and edit the bits you want to change !

    BIT TO EDIT::

    // With what level to be registered member.
    // 4 = Commenter
    // 3 = Journalist
    // 2 = Editor
    // 1 = Administrator
    $register_level = "4";

    // Allow multiple users to use same Email Address?
    // yes
    // no
    $email_multiple = "no";

    // Send password in an email (if no the script will ask for password)
    // yes
    // no
    $email_password = "no";

    // Send an email to the admin when a new user signs up?
    // yes
    // no
    $email_admin = "no";

    // Username Filter
    // These characters will not be allowed in usernames or passwords
    $filter = array(" ", "<", ">", "\n", "\r", "|", "'", "\"");

    TAKEN FROM CUTEPHP.COM FORUMS! Thank you!
    Last edited by splintercell!; 17-03-2005 at 10:00 PM.


    Chilimagik.net // Reviews, Band Biographies, News, Pics + Loads More!!
    [Thybag.co.uk - Vive la revolutione]

  2. #2
    Join Date
    Oct 2004
    Location
    Scotland
    Posts
    2,280
    Tokens
    1,075

    Latest Awards:

    Default

    well done, pretty helpfull.

    http://www.stupidian.com
    (contains mild swearing)

  3. #3
    Join Date
    Feb 2005
    Posts
    207
    Tokens
    0

    Default

    thats easy just download the file form cutephp.com u have just copyed it

  4. #4
    Join Date
    Mar 2005
    Posts
    116
    Tokens
    0

    Default

    Good Good Good Good doggeh

  5. #5
    Join Date
    Jul 2004
    Location
    Webby Forums!
    Posts
    1,879
    Tokens
    0

    Latest Awards:

    Default

    no I created it all by myself :| I did copy but Its just to help others


    Chilimagik.net // Reviews, Band Biographies, News, Pics + Loads More!!
    [Thybag.co.uk - Vive la revolutione]

Posting Permissions

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