Jump to content

Search the Community

Showing results for tags 'registration'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (PhpStorm, VS Code, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Age


Donation Link

Found 13 results

  1. 1. HTML FORM #for user to enter the data <html> <title>reg</title> <style type="text/css"> body { background-color: rgb(200,200,200); color: white; padding: 20px; font-family: Arial, Verdana, sans-serif;} h4 { background-color: DarkCyan; padding: inherit;} h3 { background-color: #ee3e80; padding: inherit;} p { background-color: white; color: rgb(100,100,90); padding: inherit;} </style> <form method="POST" action="login_back.php" enctype="multipart/form-data"></br> &nbsp<font color="DarkCyan"> Choose a user name:</font> <input type="text" name="username"> </br></br> &nbsp<font color="DarkCyan"> First name:</font> <input type="text" name="firstname"/> </br></br> &nbsp<font color="DarkCyan"> Last name:</font><input type="text" name="lastname"/> </br></br> &nbsp<font color="DarkCyan"> File: <input type="file" name="image"></font> </br></br> <input type="submit" value="Save and Proceed"> </form> </html> ---------- 2 STORING IN DATABASE #backend processing to store and retrieve data from db <?php #echo "<body style='background-color:rgb(200,200,200)'>"; session_start(); if( isset($_POST['username']) && isset($_FILES['image']) ) { $_SESSION['username']=$_POST['username']; $_SESSION['firstname']=$_POST['firstname']; $lastname=$_POST['lastname']; $file=$_FILES['image']['tmp_name']; $image_size=getimagesize($_FILES['image']['tmp_name']); if(!isset($file)) echo"please select an image"; else { $image_name=$_FILES['image']['name']; //grabing image name $image_size=getimagesize($_FILES['image']['tmp_name']); //getting image size } echo "</br>"; #connection to db mysql_connect("localhost","root","")or die(mysql_error()); mysql_select_db("wordgraphic")or die(mysql_error()); #checking the available username $query = mysql_query("SELECT * FROM userdata WHERE username = '" . $_SESSION['username'] . "'" ); $ans=mysql_num_rows($query); if ($ans > 0) { echo "Username already in use please try another."; } else if($image_size==FALSE) { echo"That's not an image."; } else { #Insert data into mysql #1.Inserting user name & image into db $sql="INSERT INTO userdata(username, firstname, lastname, image)VALUES('" . $_SESSION['username'] . "', '" . $_SESSION['firstname'] . "', '$lastname','$image')"; $result1=mysql_query($sql); if($result1) { echo "</br>"; echo "Registration successful"; echo "</br>"; //displaying image $lastid=mysql_insert_id();//get the id of the last record echo "uploaded image is :"; echo "<img src='get.php?id=".$lastid."'>"; > this command has some mistake }#if insertion into db successful else { echo "Problem in database operation"; } }# else block of unique username n img }#end of isset ?> ---------- 3. GET.PHP #additional file that retrieve image from database <?php #connection to db mysql_connect("localhost","root","")or die(mysql_error()); mysql_select_db("wordgraphic")or die(mysql_error()); if(isset($_REQUEST['id']) ) > this block of code is not runninng { $mid=(int)($_REQUEST['id']); $image=mysql_query("SELECT * FROM userdata WHERE id=$mid") or die("Invalid query: " . mysql_error()); $image=mysql_fetch_assoc($image); $image=$image['image']; header("Content-type: image/jpeg"); echo $image; } else { echo"error"; } ?>
  2. 1. HTML FORM #for user to enter the data <html> <title>reg</title> <style type="text/css"> body { background-color: rgb(200,200,200); color: white; padding: 20px; font-family: Arial, Verdana, sans-serif;} h4 { background-color: DarkCyan; padding: inherit;} h3 { background-color: #ee3e80; padding: inherit;} p { background-color: white; color: rgb(100,100,90); padding: inherit;} </style> <form method="POST" action="login_back.php" enctype="multipart/form-data"></br> &nbsp<font color="DarkCyan"> Choose a user name:</font> <input type="text" name="username"> </br></br> &nbsp<font color="DarkCyan"> First name:</font> <input type="text" name="firstname"/> </br></br> &nbsp<font color="DarkCyan"> Last name:</font><input type="text" name="lastname"/> </br></br> &nbsp<font color="DarkCyan"> File: <input type="file" name="image"></font> </br></br> <input type="submit" value="Save and Proceed"> </form> </html> ---------- 2 STORING IN DATABASE #backend processing to store and retrieve data from db <?php error_reporting(0); #echo "<body style='background-color:rgb(200,200,200)'>"; session_start(); #if( isset($_POST['username']) && isset($_FILES['image']) ) #{ $_SESSION['username']=$_POST['username']; $_SESSION['firstname']=$_POST['firstname']; $lastname=$_POST['lastname']; $file=$_FILES['image']['tmp_name']; $image_size=getimagesize($_FILES['image']['tmp_name']); if(!isset($file)) echo"please select an image"; else { #$image=$_FILES['image']['tmp_image']; //grabing the file content $image_name=$_FILES['image']['name']; //grabing image name $image_size=getimagesize($_FILES['image']['tmp_name']); //getting image size } echo "</br>"; #connection to db mysql_connect("localhost","root","")or die(mysql_error()); mysql_select_db("wordgraphic")or die(mysql_error()); #checking the available username $query = mysql_query("SELECT * FROM userdata WHERE username = '" . $_SESSION['username'] . "'" ); $ans=mysql_num_rows($query); if ($ans > 0) { echo "Username already in use please try another."; } else if($image_size==FALSE) { echo"That's not an image."; } else { #Insert data into mysql #1.Inserting user name & image into db $sql="INSERT INTO userdata(username, firstname, lastname, image)VALUES('" . $_SESSION['username'] . "', '" . $_SESSION['firstname'] . "', '$lastname','$image')"; $result1=mysql_query($sql); if($result1) { echo "</br>"; echo "Registration successful"; echo "</br>"; //displaying image $lastid=mysql_insert_id();//get the id of the last record echo "uploaded image is :"; echo "<img src='get.php?id=".$lastid."'>"; > this command has some mistake }#if insertion into db successful else { echo "Problem in database operation"; } }# else block of unique username n img }#end of isset ?> ---------- 3. GET.PHP #additional file that retrieve image from database <?php #connection to db mysql_connect("localhost","root","")or die(mysql_error()); mysql_select_db("wordgraphic")or die(mysql_error()); if(isset($_REQUEST['id']) ) > this block of code is not running { $mid=(int)($_REQUEST['id']); $image=mysql_query("SELECT * FROM userdata WHERE id=$mid") or die("Invalid query: " . mysql_error()); $image=mysql_fetch_assoc($image); $image=$image['image']; header("Content-type: image/jpeg"); echo $image; } else echo"error"; ?>
  3. I have a user registration page that requires the user to input a Username, Password, Confirm Password, Email. If the user passes all the validation requirements for the new account, I then need to have the username, password, email fields saved to a file called 'login.dat' Here is my code that I have so far, it runs perfectly. <?php include 'helpfulfunctions.inc'; include 'productsdata.inc'; $user_login_file = 'login.dat'; //var_dump($_POST); // product data for photo, name, and price. $alluserinfo = load_users_info($user_login_file); //validate users info $errors = array(); if (array_key_exists('register_submit', $_POST)) { //check to see if username is taken $username_entered = $_POST['username']; //check to see if username already exists if (array_key_exists($username_entered, $alluserinfo)) { $errors['username']['username_exists'] = "Username already exists."; } //validate username is 4-11 characters long using only a-z A-Z 0-9 if(preg_match("/^[0-9a-zA-z]{4,11}$/",$_POST['username']) ===0){ $errors['username']['invalid_username']= "Invalid username. Username must be 4-11 characters long and use only letters and numbers."; } //validate password "." means any character //.* allows numbers 0-9 to be inserted anywhere //?= positive lookahead: next text must be like this and follow these rules // must be at least 6 characters, contain 0-9, a-z, A-Z $pw_entered=$_POST['password']; if(preg_match("/^.*(?=.{6,})(?=.*[0-9])(?=.*[a-z])(?=.*[A-Z]).*$/", $_POST["password"]) === 0){ $errors['password']['invalid_password']="Password must be at least 6 characters and must contain at least one lower case letter, one upper case letter and one digit."; } //validate that "confirm password" matches password above $pw_repeat=$_POST['confirmpassword']; if($pw_repeat != $pw_entered){ $errors['confirmpassword']['pw_no_match']="Passwords do not match. Try again."; } //validate email format $email_entered=($_POST['email']); if(!filter_var($email_entered, FILTER_VALIDATE_EMAIL)){ $errors['email']['invalid_email']="Not a valid email. Please try again."; } //no validation errors=>print invoice if (empty($errors)) { include 'invoice.inc'; exit; } } //reprint if invalid entry. if no errors print invoice ?> <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="POST"> <h3>Please register to continue.</h3> <table> <tr> <td> *Username: </td> <td> <input type="text" name="username"/> <?php if (isset($errors['username'])) { print implode('<br>', $errors['username']); } ?> </td> </tr> <tr> <td> *Password: </td> <td> <input type="password" name="password"/> <?php if (isset($errors['password'])) { print implode('<br>', $errors['password']); } ?> </td> </tr> <tr> <td> *Confirm Password: </td> <td> <input type="password" name="confirmpassword"/> <?php if (isset($errors['confirmpassword'])) { print implode('<br>', $errors['confirmpassword']); } ?> </td> </tr> <tr> <td> *Email: </td> <td> <input type="text" name="email"/> <?php if (isset($errors['email'])) { print implode('<br>', $errors['email']); } ?> </td> </tr> <tr> <td> * required info <br> <input type="submit" value="Register" name="register_submit"> <?php //print out hiddens with quantities save_hidden_qty($_POST['quantity']); ?> </form> </td> </tr> </table> In case it's needed, this is the 'helpfulfunctions.inc' file and the included functions: <?php if (!function_exists('load_users_info')) { function load_users_info($users_data_file) { $fp = fopen($users_data_file, 'r'); //read all lines of login.dat file and create user info arrays while (!feof($fp)) { $users_info_line = fgets($fp); $user_info_parts = explode(',', $users_info_line); $user_info_array = array('username' => $user_info_parts[0], 'password' => $user_info_parts[1], 'email' => $user_info_parts[2]); $complete_user_info_array[$user_info_array['username']] = $user_info_array; } fclose($fp); return $complete_user_info_array; } } // function to display products if (!function_exists('display_products')) { function display_products($products_to_display, $quantities = array()) { global $errors; ?> <table border="1"> <tbody> <tr> <td style="text-align: center;"><b><big>Product</big></b></td> <td style="text-align: center;"><b><big>Brand</big></b></td> <td style="text-align: center;"><b><big>Price(each)</big></b></td> <td style="text-align: center;"><b><big>Quantity Desired</big></b></td> </tr> <?php // quantities are 0 unless already inputted, if quantities previously were inputted, return the values. // input boxes for ($i = 0; $i < count($products_to_display); $i++) { if (empty($quantities)) { $qty = isset($_POST['quantity'][$i]) ? $_POST['quantity'][$i] : 0; $qty_str = "<input type=text size=3 maxlength=3 name='quantity[$i]' value='$qty'>"; if (isset($errors['quantity'][$i])) { $qty_str .= "<span style='font-style:italic;font-size:8px;color:red;'>{$errors['quantity'][$i]}</span>"; } } else { $qty_str = $quantities[$i]; } // loop to print out table of photo of board, name of the brand, price, and quantity selected printf(' <tr> <td><img alt="Small" id="lightboxImage" style="width: 119px; height: 88px; bgcolor="#cccccc;" src="http://imgur.com/%s" height="300" width="300"></td> <td style="text-align: center;">%s</td> <td style="text-align: center;">$%.2f</td> <td style="text-align: center;">' . $qty_str . '</td> </tr> ', $products_to_display[$i]['item'], $products_to_display[$i]['board'], $products_to_display[$i]['price']); } ?> <tr><td colspan="4" style="text-align: right; border: none"> <input type="submit" value="Purchase"></td></tr> </tbody> </table> <?php } } if (!function_exists('save_hidden_qty')) { function save_hidden_qty($the_quantities){ foreach ($the_quantities as $key=>$value){ print "<input type='hidden' name='quantity[$key]' value='$value'>\n"; } } } ?> Can anyone help me out?
  4. Hi I am fairly new to using PHP and am struggling connecting the MYSQL database to PHP. It will work but when i enter dummy data into the form it won't update within the database. I have already got someone to look over the PHP and they have just given me hints and tips of which I have followed to improve the PHP. I just want to be able that when I type in a users data it displays within the MySQL database. If someone could help me ASAP that would be great. Thanks dtferguson Registration.zip
  5. Hi guys, I am new to php programming and need your assistance in developing a registration system for my site .I have developed the registration form using html5 , css, jquery and javascript. and now need a functional php script which is going to work for my registration form. The Registration form includes 4 step process for successful registration of a user.The fields of the form are as follows: First Step: username password re-type password Second step: first name last name email Third step age gender country Fourth step: Summary(displaying all user information which user has given through out the registratioin process) For user viewing,I have included a progress bar, which shows the percentage of completion of the registration process. I have attached the screenshot below for the registration form. Kindly help me in building a functional php script for the registration form. Thanks
  6. I am working on a site where the user clicks on a video to watch. When clicked I want to redirect them to a registration form that basically asks name, email and a password. The password is predetermined by the company I work for and are sent to the users. They do not create their own passwords, this not a login system it is just to verify what users are watching the video. after they enter their information and the password is verified it goes to the video. I know how I could do this for each individual video but that would create 100's of registration forms. I am looking for a way to use 1 form to check the passwords in the database and continue on. Any suggestions? I am a novice at PHP. (in reality, I wanted to use a real login system, but my boss didn't , so I am having to work in the constraints of the boss's wishes)
  7. Hello all. This is my first post in a php forum. Thanks, in advance, for any help. This code: <?php // database table 'users' is setup with the following fields: // first_name, last_name, user_name, password $db_hostname = "localhost"; $db_username = "root"; $db_password = ""; $db_name = "justinalba_module3_db"; //connection to the database $dbc = @mysqli_connect($db_hostname, $db_username, $db_password, $db_name) or die("Unable to connect to MySQL"); $sql = "INSERT INTO user (name_first, name_last, name_username, password) VALUES ('Sam', 'Row', 'samrow', 'pw123')"; mysqli_query ($dbc, $sql) or die("Problem executing query"); echo "Rows inserted: ", mysqli_affected_rows($dbc), "<br><br>"; $rowcount = 0; $q = mysqli_query($dbc, "select * from user"); while ($dbc = mysqli_fetch_row($q)) { $rowcount++; for ($k=0; $k<count($dbc); $k++){ echo " $dbc[$k] "; } echo "<br>"; } echo "<p> A total of $rowcount rows<br>"; ?> works perfectly...then I add it to a function: function register(){ if(isset($_POST['submitRegistration'])) $username=$_POST['username']; $firstName = $_POST['firstName']; $lastName = $_POST['lastName']; $password=$_POST['password2']; { if($_POST['username']=="") { echo "Please type username"; } elseif (!preg_match("/^[a-zA-Z1-9]+$/", $username)) //checks for illegal characters, succcess! { echo 'Use alphanumeric characters only.'; } elseif (strlen($username) < 6 || strlen($username) > 15) // checks length of username { echo "Username must be 6 to 15 characters"; } elseif($_POST['password1']==""|$_POST['password2']=="") { echo "Please type password"; } elseif($_POST['password1']!=$_POST['password2']) { echo "Uh-oh. Your passwords don't match."; } else { $username=$_POST['username']; $firstName = $_POST['firstName']; $lastName = $_POST['lastName']; $password=$_POST['password2']; $dbc = @mysqli_connect($db_hostname, $db_username, $db_password, $db_name) or die("Unable to connect to MySQL"); $sql = "INSERT INTO user (id, name_first, name_last, name_username, password) VALUES ('', '$firstName', '$lastName', '$username', '$password')"; mysqli_query ($dbc, $sql) or die("Problem executing query"); echo "Rows inserted: ", mysqli_affected_rows($dbc), "<br><br>"; $rowcount = 0; $q = mysqli_query($dbc, "select * from user"); while ($dbc = mysqli_fetch_row($q)) { $rowcount++; for ($k=0; $k<count($dbc); $k++){ echo " $dbc[$k] "; } echo "<br>"; } echo "<p> A total of $rowcount rows<br>"; } } } and I get the "die("Unable to connect to MySQL")" error. Any thoughts? I know I restated several variables inside the whatif statement. I was just trying to see what the problem was. Thanks, JA. module3_2.php registration.php localhost.sql.zip
  8. i have created a registration form page with id,name,col,branch,etc Coming to the database ID is primary and auto increment, im trying to print the generated value of from the database after the registration is done. For example: "You have Successfully registered with us n your id is xxxxxx" Please someone helpme out with this
  9. Hello. Recently, I've been learning about registration forms in PHP, and I'm wandering how I could improve the one I've already written(this is only an excerpt, obviously): if(!empty($username) && !empty($password) && !empty($re_password) && !empty($firstname) && !empty($lastname)){ if($password === $re_password){ $query_run = mysql_query("SELECT username FROM users WHERE username = '$username'"); if(mysql_num_rows($query_run)==1){ echo 'User '."<strong>".$username."</strong>".' Already Exists!'; }else{ mysql_query("INSERT INTO users VALUES ('','".mysql_real_escape_string($username)."','".mysql_real_escape_string($hashed_password)."','".mysql_real_escape_string($firstname)."','".mysql_real_escape_string($lastname)."')"); header('Location: my119file.php?pass_username='.$username); } }else{ echo 'The Re-Entered Password Doesn\'t Match'; } }else{ echo 'Please Fill Out All The Fields'; } } }else{ echo 'You\'re already logged in'; } I'm mainly concerned about the fact that, if the user inputs invalid information into the fields, he will only be notified of the first error encountered; if there happen to be multiple errors with the filled-out information, the user will not know until the first error is solved. For instance, if the user omits one of the required fields, AND the "confirm password" does't match, only the "Please Fill Out All The Fields" error will be displayed, and the "Password Don't Match" error will be ignored until the first issue is resolved. I would much rather prefer if the form recognized all errors in a single run, but I'm not sure how to do that... Any ideas? Thanks.
  10. I'm having a lot of trouble with php/mysql website registration. once i put the php/mysql code in the html form doesnt load any more. I can't figure out what is causing the code to die without displaying an error. I have a test file on the server and the include file seems to be working fine. I will attach the whole file. <p> register.php
  11. I am using the php-login script. Everything has been working fine but suddenly now when I try logging in with an account (called user1) that has always worked previously, it simply redirects me to the login page. It does not error, it just redirects. Although if I try another account (user 2), I login normally but this one account (user 1) just does not seem to not want to login and just keeps redirecting me back when I try logging in. Also, the script only works if I have the "Remember Me" box checked. I have a feeling that it is an issue with cookies, I have taken a code snippet here: session_start(); session_regenerate_id (true); //prevent against session fixation attacks. // this sets variables in the session $_SESSION['user_id']= $id; $_SESSION['user_name'] = $full_name; $_SESSION['user_level'] = $user_level; $_SESSION['HTTP_USER_AGENT'] = md5($_SERVER['HTTP_USER_AGENT']); //update the timestamp and key for cookie $stamp = time(); $ckey = GenKey(); mysql_query("update users set `ctime`='$stamp', `ckey` = '$ckey' where id='$id'") or die(mysql_error()); //set a cookie if(isset($_POST['remember'])){ setcookie("user_id", $_SESSION['user_id'], time()+60*60*24*365, "/"); setcookie("user_key", sha1($ckey), time()+60*60*24*365, "/"); setcookie("user_name",$_SESSION['user_name'], time()+60*60*24*365, "/"); } header("Location: myaccount.php"); Although, it may be other things. For further reference, the script I am using is from here: http://php-login-script.com Thanks!
  12. Hi , i'm new to php. i'm creating a signup form with email verification (PHPmailer) everything seems to work except when the user confirm the email, their information does not save to the database , so they can't login their account. the error is with the INSERT INTO customer part. can someone help me? thanks <?php if (isset($_GET["passkey"])) { $confirm = $_GET["passkey"]; $con = mysql_connect("localhost","root"); if (!$con) echo(mysql_error()); else { mysql_select_db("dbhotel",$con); $sql = "SELECT * FROM temp WHERE ConfirmCode = '" . $confirm . "'"; $rs = mysql_query($sql,$con); if (mysql_num_rows($rs) == 1) { $rows = mysql_fetch_assoc($rs); $sql = "INSERT INTO customers(FName,LName,Title,Address,Phone,Email,Password) VALUES ('". $rows["FName"] . "','" . $rows["LName"] . "','" . $rows["Title"] . "','" . $rows["Address"] . "','" . $rows["Phone"] . "','" . $rows["Email"] . "','" . $rows["Password"]."')"; mysql_query($sql,$con); $sql = "DELETE FROM temp WHERE ConfirmCode = '" . $confirm . "'"; mysql_query($sql,$con); echo "Congratulations " . $rows["Title"] ." ". $rows["FName"] ." ". $rows["LName"] . ", you are now a member!"; } else { echo "Sorry, we are unable to process your request at this moment. Please try again later."; } } mysql_close($con); } else { echo "You do not have enough permissions to access this page."; } ?>
  13. Hey guys, im trying to create a 'captcha' image for registration security for my site. currently i have 2 separate pages working together, my captcha.php file & my register.php now, what i am doing is trying to get a generate code that will be random and create an image with this string. this image will then be linked in the registration form where the user will have to match that random string image. sounds simple except , for some reason the code i have supplied from the tutorial is not outputting the image in the form. i have GD's installed on my server, and i have the font file saved also in the directory/ my code is : captcha.php <?session_start(); header('Content-type: image/jpeg'); $text = $_SESSION['secure']; $font_size = 30; $image_height = 200; $image_width = 40; $image = imagecreate($image_width, $image_height); imagecolorallocate($image, 255, 255, 255); // white $text_color = imagecolorallocate($image, 0, 0, 0); //black imagettftext($image, $font_size, 0, 15, 30, $text_color, 'font.ttf', $text); imagejpeg($image); ?> so in this i have created the image captcha.php should now be a jpeg.. i then go to my register.php declare the $_SESSION and input the src="captcha.php'' register.php <?php include('include/init.php'); $_SESSION['secure'] = rand(1000,9999); ?> and the form : <tr> <td class="register_td_left2"><span class="">Security Code:</span></td> <td valign="middle" style="padding-left:2px"><input id="security_code" name="security_code" type="text" maxlength="4" size="5"></td> <td align="left" valign="middle"><img src="generate.php" alt="Your Security Code"></td> </tr> this is my first time adding a captcha and going through this process. the only thing i can think that would not be allowing it output the image, would be the 'font.tff' not properly working, or for some odd reason i dont have the GD functions installed correctly. any suggestions ? or ideas ?
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.