kvnm Posted November 19, 2013 Share Posted November 19, 2013 I want to make a list of users for my site. With the abillity of block a user. change e-mail address change username change password e.t.c Can you help Link to comment Share on other sites More sharing options...
davej Posted November 19, 2013 Share Posted November 19, 2013 What type of website? Link to comment Share on other sites More sharing options...
kvnm Posted November 19, 2013 Author Share Posted November 19, 2013 forum site Link to comment Share on other sites More sharing options...
davej Posted November 19, 2013 Share Posted November 19, 2013 (edited) Does your site have a forum, or are you saying you want to create a forum? Edited November 19, 2013 by davej Link to comment Share on other sites More sharing options...
kvnm Posted November 22, 2013 Author Share Posted November 22, 2013 I want to create Link to comment Share on other sites More sharing options...
Ingolme Posted November 22, 2013 Share Posted November 22, 2013 What kind of help are you looking for? This is a very large task. Proper design is important before you start even writing code. Decide in theory what every part of the program does, then design the database tables it needs, then decide the structure of the code. Link to comment Share on other sites More sharing options...
kvnm Posted November 22, 2013 Author Share Posted November 22, 2013 I had already decided.... I just need a code for user adminstrating Link to comment Share on other sites More sharing options...
justsomeguy Posted November 22, 2013 Share Posted November 22, 2013 There is not one single piece of code that works for every application. If you want to start with a framework, the Zend Framework has plenty of user management modules to help get you started, but even so you will have to extend those modules to add things that are specific to your application. If you want to get a general idea of some code to handle registering and logging in users, there is a simple, if outdated, example here: http://w3schools.invisionzone.com/index.php?showtopic=12509 Link to comment Share on other sites More sharing options...
kvnm Posted November 22, 2013 Author Share Posted November 22, 2013 So....If I have a code that iclude html and php code, I will save it as what??? Link to comment Share on other sites More sharing options...
kvnm Posted November 22, 2013 Author Share Posted November 22, 2013 well.... Link to comment Share on other sites More sharing options...
justsomeguy Posted November 22, 2013 Share Posted November 22, 2013 If you want to execute PHP code then you need to save files with a .php extension, and your web server needs to have PHP installed and configured. Link to comment Share on other sites More sharing options...
thescientist Posted November 22, 2013 Share Posted November 22, 2013 well what? It sounds like you have little experience, which, although not a bad thing, means that you might want to start with other smaller projects first. I think you might be better served by going through some basic PHP tutorials and references at minimum and practicing with forms, databases, and making AJAX requests to PHP first. A solid set of fundamental skills should be your goal first. Link to comment Share on other sites More sharing options...
kvnm Posted November 23, 2013 Author Share Posted November 23, 2013 <?php require_once 'db.php'; $page_mode = isset($_POST['page_mode']) ? $_POST['page_mode'] : ''; $error_string = ''; if ($page_mode == 'register'){ $email = trim($_POST['email']); // trim to remove whitespace $name = trim($_POST['name']); // trim to remove whitespace $password = $_POST['password']; $conf_password = $_POST['conf_password']; if (!isValidEmail($email)) $error_string .= 'Please enter a valid email address.<br>'; if ($name == '') $error_string .= 'Please enter your name.<br>'; if (strlen(trim($password)) < 6) $error_string .= 'You must enter a password of at least 6 characters.<br>'; if ($password != $conf_password) $error_string .= 'The password and confirmation password do not match.<br>'; if ($error_string == '') { $result = db_query("SELECT id FROM users WHERE email='" . mysql_real_escape_string($email) . "'"); if (mysql_num_rows($result) > 0) $error_string .= 'That email address is already registerd.<br>'; else { $email = mysql_real_escape_string($email); // protect against SQL attacks $name = mysql_real_escape_string($name); $password = sha1($password); // hash password db_query("INSERT INTO users (email, name, password) VALUES ('{$email}', '{$name}', '{$password}')"); header('Location: thankyou.php'); exit(); } }} function isValidEmail($email = ''){ return preg_match("/^[dw/+!=#|$?%{^&}*`'~-][dw/.+!=#|$?%{^&}*`'~-]*@[A-Z0-9][A-Z0-9.-]{1,61}[A-Z0-9].[A-Z]{2,6}$/ix",$email);} ?><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"><html> <head> <title>Register</title> <style type="text/css"> .error_text { color: #FF0000; width: 400px; text-align: center; } .left_box { float: left; width: 150px; text-align: right; padding-right: 5px; } .right_box { clear: right; } </style> </head> <body> <div class="error_text"><?php echo $error_string; ?></div> <form action="register.php" method="post"> <input type="hidden" name="page_mode" value="register"> <div class="left_box">Email address</div> <div class="right_box"><input type="text" name="email" size="30" maxlength="255" value="<?php if (isset($email)) echo $email; ?>"></div> <div class="left_box">Name</div> <div class="right_box"><input type="text" name="name" size="30" maxlength="255" value="<?php if (isset($name)) echo $name; ?>"></div> <div class="left_box">Password</div> <div class="right_box"><input type="password" name="password" size="30"></div> <div class="left_box">Confirm Password</div> <div class="right_box"><input type="password" name="conf_password" size="30"></div> <div class="left_box"> </div> <div class="right_box"><input type="submit" value="Register" size="30"></div> </form> </body></html> If I had a code like this. as what I gonna save it?? sa html, as php...what? Link to comment Share on other sites More sharing options...
davej Posted November 24, 2013 Share Posted November 24, 2013 That's Php code. It would be a filename ending in .php So do you have a working website with a working forum? Link to comment Share on other sites More sharing options...
kvnm Posted November 24, 2013 Author Share Posted November 24, 2013 Yes. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now