Create an account


Welcome, Guest
You have to register before you can post on our site.

Username
  

Password
  





Search Forums

(Advanced Search)

Forum Statistics
» Members: 20,169
» Latest member: crabber45
» Forum threads: 21,721
» Forum posts: 22,605

Full Statistics

Online Users
There are currently 685 online users.
» 1 Member(s) | 679 Guest(s)
Applebot, Baidu, Bing, DuckDuckGo, Yandex, SickProdigy

 
  News - Best Gifts For Gamers 2020: Nintendo Switch, PS4, Xbox One, And PC
Posted by: xSicKxBot - 01-21-2020, 08:37 PM - Forum: Lounge - No Replies

Best Gifts For Gamers 2020: Nintendo Switch, PS4, Xbox One, And PC

It can be hard to find the right gift for a gamer. If you don't play games yourself but have a gamer on your shopping list for a birthday or holiday, you probably have a lot of questions--what are the most popular games right now? How do you pick between Xbox, PlayStation, and Switch? What about PC games? What's the difference between a Switch and a Switch Lite? Do gamers play tabletop/board games too? Virtual reality--do gamers care? Then there's the endless amount of gaming tech, peripherals, and merchandise. Where do you even start?

Whether you’re shopping for a birthday, specific holiday, or just want to surprise them with something nice, no need to worry--we have gift buying guides for every kind of gamer and every kind of budget. From games and consoles to accessories and merchandise, here are the best gifts for gamers for any occasion.

Best Video Game Gifts By Platform

If you know what system your loved one likes to play games on, the easiest solution is to pick up a new game for their library. A new game always makes a great gift, and there are plenty to choose from! Here are some of our personal top picks from recent years.

A Plague Tale: Innocence
A Plague Tale: Innocence

Best PS4 Gift Ideas

GameSpot's best PlayStation games of 2019 included Resident Evil 2, Sekiro: Shadows Die Twice, and Control. The latest in popular first-person shooter series Call of Duty, the new Star Wars game, and sports games like Madden would make great gifts too. Want more options? Check out the list below or browse our list of the best PS4 games of all time.

Control
Control

Best Xbox One Gift Ideas

Some great Xbox titles include role-playing game The Outer Worlds and stealth adventure game A Plague Tale: Innocence (both of which made our Best Games of 2019 list) as well as third-person shooter Gears 5. Want more options? Check out the list below or browse our list of the best Xbox One games of all time.

Luigi's Mansion 3
Luigi's Mansion 3

Best Nintendo Switch Gift Ideas

Pokemon Sword and Shield was one of our top picks for best Switch games to buy during the holidays and one of the best Switch games of 2019. It remains popular, especially with the recently announced expansions on the way. There's also Luigi's Mansion 3, Fire Emblem: Three Houses, and Assassin's Creed: The Rebel Collection. Want more options? Check out the list below or browse our list of the best Nintendo Switch games of all time.

Best Console Gifts For Gamers

There's only one thing better than a video game when it comes to game-related gifts, and that's a brand-new console or console-related accessories.

If you're going to buy a new console, we have a list of the current best deals you can get on the PS4, Xbox One, and Switch, including the relatively new Switch Lite. We also have a separate buying guide for the Nintendo Switch since there are a few different versions and controller options to choose from. You can also grab the Sega Genesis Mini, which was a popular retro console that was released in 2019, based on the classic Sega Genesis from 1989. Adding in an extra controller or a headset is always a good idea too. It's also worth noting that a new wave of next-gen consoles, the PlayStation 5 and Xbox Series X, are slated to launch this holiday season, but pre-orders are not yet available.

Best Console Accessories For Gamers

With the exception of controllers, most great gaming accessories are just optional luxuries, so they make great gifts. Headphones, charging stations, carrying cases, storage devices, and more--treat someone with the best accessories from our console gaming gift guides below.

Best VR Gifts For Gamers

Virtual reality has garnered a bit more interest in the last couple months with the reveal of a highly-anticipated Half-Life sequel called Half-Life: Alyx, so a VR headset would make a perfect gift if you're willing to spend big.

The best VR headset to get depends a lot on what kind of gaming PC or console the gift-receiver has. The best VR headsets for gamers with VR gaming-ready PCs include the Oculus Rift S, the Valve Index, and the HTC Vive. PlayStation VR is perfect for PS4 owners who don't have a gaming PC but still want to experience VR. Other VR headset options for people who don't have a gaming PC are the Oculus Quest, a standalone VR headset, the Oculus Go, and--for mobile-compatible VR--the Samsung Gear VR or Google Daydream View.

Check out our list of the best VR games from 2019 for ideas on what to play.

Best Tech And Accessories For PC Gamers

PC gamers can be a bit harder to shop for because most PC games are purchased digitally and the hardware can be a lot pricier. There are so many brands at so many different price points--Alienware, Razer, ASUS, Logitech, Corsair, and more--and they're all popular for very specific reasons. We've broken down some of the major PC gaming categories in the gift guides below.

Best General Gifts For Gamers

If you don't have the time, expertise, or budget to get a gaming console or fancy headset for the gaming fan in your life, and you're not sure which of the popular games they've played already, there's still a number of cool gifts for you to choose from, including fun services and more traditional games the whole family can play.

Best Subscription Services For Gamers

Subscription services like PlayStation Plus and Xbox Game Pass, which can be purchased on a monthly or yearly basis, give gamers access to tons of additional games, online services, and bonuses. Year-long subs usually cost less in the long run, but can still get super pricey, so they make really excellent gifts--especially if you're not sure what game to get someone.

Best Amiibo and Funko Pop Gifts

Amiibo and Funko Pop figures are two of the most popular gaming-related collectibles because they're affordable and feature a wide variety of fan-favorite characters from franchises across gaming, movies, comics, and TV. You can find a few great Amiibo in our Switch accessories gift guide, plus a breakdown of some of the most popular Funko Pop figures in our Funko Pop gift guide. These make cool gifts on their own, but they can also act as a stocking stuffer for the holidays or an added bonus to turn a great gift into a perfect gift set.

Best Fortnite Gifts

If the gamer you're shopping for is all Fortnite, all the time, check out our Fortnite gift guide for the best gifts related to the hit battle royale game.

Best Board Game Gifts

Board and card games are accessible to people of all ages. They make great gifts for gamers and families who like to game, even if it's not in front of the TV. Browse our tabletop games guide below for some good ideas that fit any budget range.

Best Holiday Gifts For Gamers

If you're shopping for a specific person or holiday and want your gift to match the occasion, check out more of our holiday gift guides below.


https://www.gamespot.com/articles/best-g...0-6472853/

Print this item

  [Tut] Python Regex Fullmatch
Posted by: xSicKxBot - 01-21-2020, 02:48 PM - Forum: Python - No Replies

Python Regex Fullmatch

Why have regular expressions survived seven decades of technological disruption? Because coders who understand regular expressions have a massive advantage when working with textual data. They can write in a single line of code what takes others dozens!

This article is all about the re.fullmatch(pattern, string) method of Python’s re library. There are three similar methods to help you use regular expressions:

  • The findall(pattern, string) method returns a list of string matches. Check out our blog tutorial.
  • The search(pattern, string) method returns a match object of the first match. Check out our blog tutorial.
  • The match(pattern, string) method returns a match object if the regex matches at the beginning of the string. Check out our blog tutorial.

So how does the re.fullmatch() method work? Let’s study the specification.

How Does re.fullmatch() Work in Python?


The re.fullmatch(pattern, string) method returns a match object if the pattern matches the whole string.

Specification:

re.fullmatch(pattern, string, flags=0)

The re.fullmatch() method has up to three arguments.

  • pattern: the regular expression pattern that you want to match.
  • string: the string which you want to search for the pattern.
  • flags (optional argument): a more advanced modifier that allows you to customize the behavior of the function. Want to know how to use those flags? Check out this detailed article on the Finxter blog.

We’ll explore them in more detail later.

Return Value:

The re.fullmatch() method returns a match object. You may ask (and rightly so):

What’s a Match Object?


If a regular expression matches a part of your string, there’s a lot of useful information that comes with it: what’s the exact position of the match? Which regex groups were matched—and where?

The match object is a simple wrapper for this information. Some regex methods of the re package in Python—such as fullmatch()—automatically create a match object upon the first pattern match.

At this point, you don’t need to explore the match object in detail. Just know that we can access the start and end positions of the match in the string by calling the methods m.start() and m.end() on the match object m:

>>> m = re.fullmatch('h...o', 'hello')
>>> m.start()
0
>>> m.end()
5

In the first line, you create a match object m by using the re.fullmatch() method. The pattern ‘h…o’ matches in the string ‘hello’ at start position 0 and end position 5. But note that as the fullmatch() method always attempts to match the whole string, the m.start() method will always return zero.

Now, you know the purpose of the match object in Python. Let’s check out a few examples of re.fullmatch()!

A Guided Example for re.fullmatch()


First, you import the re module and create the text string to be searched for the regex patterns:

>>> import re
>>> text = '''
Call me Ishmael. Some years ago--never mind how long precisely
--having little or no money in my purse, and nothing particular
to interest me on shore, I thought I would sail about a little
and see the watery part of the world. '''

Let’s say you want to match the full text with this regular expression:

>>> re.fullmatch('Call(.|\n)*', text)
>>>

The first argument is the pattern to be found: 'Call(.|\n)*'. The second argument is the text to be analyzed. You stored the multi-line string in the variable text—so you take this as the second argument. The third argument flags of the fullmatch() method is optional and we skip it in the code.

There’s no output! This means that the re.fullmatch() method did not return a match object. Why? Because at the beginning of the string, there’s no match for the ‘Call’ part of the regex. The regex starts with an empty line!

So how can we fix this? Simple, by matching a new line character ‘\n’ at the beginning of the string.

>>> re.fullmatch('\nCall(.|\n)*', text)
<re.Match object; span=(0, 229), match='\nCall me Ishmael. Some years ago--never mind how>

The regex (.|\n)* matches an arbitrary number of characters (new line characters or not) after the prefix ‘\nCall’. This matches the whole text so the result is a match object. Note that there are 229 matching positions so the string included in resulting match object is only the prefix of the whole matching string. This fact is often overlooked by beginner coders.

What’s the Difference Between re.fullmatch() and re.match()?


The methods re.fullmatch() and re.match(pattern, string) both return a match object. Both attempt to match at the beginning of the string. The only difference is that re.fullmatch() also attempts to match the end of the string as well: it wants to match the whole string!

You can see this difference in the following code:

>>> text = 'More with less'
>>> re.match('More', text)
<re.Match object; span=(0, 4), match='More'>
>>> re.fullmatch('More', text)
>>>

The re.match(‘More’, text) method matches the string ‘More’ at the beginning of the string ‘More with less’. But the re.fullmatch(‘More’, text) method does not match the whole text. Therefore, it returns the None object—nothing is printed to your shell!

What’s the Difference Between re.fullmatch() and re.findall()?


There are two differences between the re.fullmatch(pattern, string) and re.findall(pattern, string) methods:

  • re.fullmatch(pattern, string) returns a match object while re.findall(pattern, string) returns a list of matching strings.
  • re.fullmatch(pattern, string) can only match the whole string, while re.findall(pattern, string) can return multiple matches in the string.

Both can be seen in the following example:

>>> text = 'the 42th truth is 42'
>>> re.fullmatch('.*?42', text)
<re.Match object; span=(0, 20), match='the 42th truth is 42'>
>>> re.findall('.*?42', text)
['the 42', 'th truth is 42']

Note that the regex .*? matches an arbitrary number of characters but it attempts to consume as few characters as possible. This is called “non-greedy” match (the *? operator). The fullmatch() method only returns a match object that matches the whole string. The findall() method returns a list of all occurrences. As the match is non-greedy, it finds two such matches.

What’s the Difference Between re.fullmatch() and re.search()?


The methods re.fullmatch() and re.search(pattern, string) both return a match object. However, re.fullmatch() attempts to match the whole string while re.search() matches anywhere in the string.

You can see this difference in the following code:

>>> text = 'Finxter is fun!'
>>> re.search('Finxter', text)
<re.Match object; span=(0, 7), match='Finxter'>
>>> re.fullmatch('Finxter', text)
>>>

The re.search() method retrieves the match of the ‘Finxter’ substring as a match object. But the re.fullmatch() method has no return value because the substring ‘Finxter’ does not match the whole string ‘Finxter is fun!’.

How to Use the Optional Flag Argument?


As you’ve seen in the specification, the fullmatch() method comes with an optional third ‘flag’ argument:

re.fullmatch(pattern, string, flags=0)

What’s the purpose of the flags argument?

Flags allow you to control the regular expression engine. Because regular expressions are so powerful, they are a useful way of switching on and off certain features (for example, whether to ignore capitalization when matching your regex).


Syntax Meaning
re.ASCII If you don’t use this flag, the special Python regex symbols w, W, b, B, d, D, s and S will match Unicode characters. If you use this flag, those special symbols will match only ASCII characters — as the name suggests.
re.A Same as re.ASCII
re.DEBUG If you use this flag, Python will print some useful information to the shell that helps you debugging your regex.
re.IGNORECASE If you use this flag, the regex engine will perform case-insensitive matching. So if you’re searching for [A-Z], it will also match [a-z].
re.I Same as re.IGNORECASE
re.LOCALE Don’t use this flag — ever. It’s depreciated—the idea was to perform case-insensitive matching depending on your current locale. But it isn’t reliable.
re.L Same as re.LOCALE
re.MULTILINE This flag switches on the following feature: the start-of-the-string regex ‘^’ matches at the beginning of each line (rather than only at the beginning of the string). The same holds for the end-of-the-string regex ‘$’ that now matches also at the end of each line in a multi-line string.
re.M Same as re.MULTILINE
re.DOTALL Without using this flag, the dot regex ‘.’ matches all characters except the newline character ‘n’. Switch on this flag to really match all characters including the newline character.
re.S Same as re.DOTALL
re.VERBOSE To improve the readability of complicated regular expressions, you may want to allow comments and (multi-line) formatting of the regex itself. This is possible with this flag: all whitespace characters and lines that start with the character ‘#’ are ignored in the regex.
re.X Same as re.VERBOSE

Here’s how you’d use it in a practical example:

>>> text = 'Python is great!'
>>> re.search('PYTHON', text, flags=re.IGNORECASE)
<re.Match object; span=(0, 6), match='Python'>

Although your regex ‘PYTHON’ is all-caps, we ignore the capitalization by using the flag re.IGNORECASE.

Where to Go From Here?


This article has introduced the re.fullmatch(pattern, string) method that attempts to match the whole string—and returns a match object if it succeeds or None if it doesn’t.

Learning Python is hard. But if you cheat, it isn’t as hard as it has to be:

Download 8 Free Python Cheat Sheets now!



https://www.sickgaming.net/blog/2020/01/...fullmatch/

Print this item

  [Tut] User Registration in PHP with Login: Form with MySQL and Code Download
Posted by: xSicKxBot - 01-21-2020, 12:28 PM - Forum: PHP Development - No Replies

User Registration in PHP with Login: Form with MySQL and Code Download

Last modified on January 3rd, 2020 by Vincy.

Are you looking for code to create user registration in PHP? A lightweight form with MySQL database backend. Read on!

There are lots of PHP components for user registration available on the Internet. But these contain heavy stuff and lots of dependencies.

An appropriate code should be lightweight, secure, feature-packed and customizable. I am going to explain how to code this user registration in PHP with a login.

With this code, you can customize or put any add-ons as per your need and enhance it.

User Registration in PHP with Login Form

What is inside?


  1. Example code for user registration in PHP
  2. Create user registration and login form
  3. Registration and login form validation
  4. Process user registration in PHP
  5. PHP login authentication code
  6. User dashboard
  7. MySQL database script
  8. Screenshot of user registration and login form

Example code for user registration in PHP


In this example, I have created user registration in PHP with the login script. In a previous article, we have seen how to create a login script with PHP session.

On a landing page, it shows a login form with a signup link. The registered user can enter their login details with the login form. Once done, he can get into the dashboard after authentication.

If the user does not have an account, then he can click the signup option to create a new account.

The user registration form requests username, email, password from the user. On submission, PHP code allows registration if the email does not already exist.

This example code has client-side validation for validating the entered user details. And also, it includes contains the server-side uniqueness test. The user email is the base to check uniqueness before adding the users to the MySQL database.

This linked article includes a basic example of implementing user registration in PHP and MySQL.

File structure

User Registration File Structure

Create user registration and login form


I have created three HTML view login form, registration form and the dashboard for this code.

Below HMTL code is for displaying the login form to the user. In this form, it has two inputs to allow the user to enter their username and password.

Without these details, a validation code will not allow the login to proceed. The login form tag’s on-click attribute is with loginValidation(). This function contains the login form validation script.

On submitting this login form, the PHP code will validate the user. If the users clear the authentication, then it will redirect him to the dashboard.

If the user attempts to log in with the wrong data, then the code will display a login error message in the login form. If you want to limit the failed login attempts, the linked article has an example of that.

See also login form with forgot password and remember me.

login-form.php

<div class="sign-up-container"> <div class="login-signup"> <a href="user-registration-form.php">Sign up</a> </div> <div class="signup-align"> <form name="login" action="" method="post" on‌submit="return loginValidation()"> <div class="signup-heading">Login</div> <?php if(!empty($loginResult)){?> <div class="error-msg"><?php echo $loginResult;?></div> <?php }?> <div class="row"> <div class="inline-block"> <div class="form-label"> Username<span class="required error" id="username-info"></span> </div> <input class="input-box-330" type="text" name="username" id="username"> </div> </div> <div class="row"> <div class="inline-block"> <div class="form-label"> Password<span class="required error" id="signup-password-info"></span> </div> <input class="input-box-330" type="password" name="signup-password" id="signup-password"> </div> </div> <div class="row"> <input class="sign-up-btn" type="submit" name="login-btn" id="login-btn" value="Login"> </div> </form> </div> </div> 

This is a user registration form getting minimal user data from the user. All form fields are mandatory.

It will pass-through a JavaScript validation before processing the user registration in PHP.

On submitting the registration form fields, it will invoke the signupValidation() JavaScript method. In this method, it validates with the non-empty check, email format, and the password match.

After validation, the PHP registration will take place with the posted form data.

user-registration-form.php

<HTML> <HEAD> <TITLE>Registration</TITLE> <link href="./assets/css/phppot-style.css" type="text/css" rel="stylesheet" /> <link href="./assets/css/user-registration.css" type="text/css" rel="stylesheet" /> </HEAD> <BODY> <div class="phppot-container"> <div class="sign-up-container"> <div class="login-signup"> <a href="login-form.php">Login</a> </div> <div class=""> <form name="sign-up" action="" method="post" on‌submit="return signupValidation()"> <div class="signup-heading">Registration</div> <?php if(!empty($registrationResponse["status"])) { ?> <?php if($registrationResponse["status"] == "error") { ?> <div class="server-response error-msg"><?php echo $registrationResponse["message"]; ?></div> <?php } else if($registrationResponse["status"] == "success") { ?> <div class="server-response success-msg"><?php echo $registrationResponse["message"]; ?></div> <?php } ?> <?php } ?> <div class="error-msg" id="error-msg"></div> <div class="row"> <div class="inline-block"> <div class="form-label"> Username<span class="required error" id="username-info"></span> </div> <input class="input-box-330" type="text" name="username" id="username"> </div> </div> <div class="row"> <div class="inline-block"> <div class="form-label"> Email<span class="required error" id="email-info"></span> </div> <input class="input-box-330" type="email" name="email" id="email"> </div> </div> <div class="row"> <div class="inline-block"> <div class="form-label"> Password<span class="required error" id="signup-password-info"></span> </div> <input class="input-box-330" type="password" name="signup-password" id="signup-password"> </div> </div> <div class="row"> <div class="inline-block"> <div class="form-label"> Confirm Password<span class="required error" id="confirm-password-info"></span> </div> <input class="input-box-330" type="password" name="confirm-password" id="confirm-password"> </div> </div> <div class="row"> <input class="sign-up-btn" type="submit" name="signup-btn" id="signup-btn" value="Sign up"> </div> </form> </div> </div> </div> </BODY> </HTML> 

Landing page loads login registration forms

index.php

<?php use Phppot\Member; session_start(); ?> <HTML> <HEAD> <TITLE>user-registration</TITLE> <link href="./assets/css/phppot-style.css" type="text/css" rel="stylesheet" /> <link href="./assets/css/user-registration.css" type="text/css" rel="stylesheet" /> <script src="./vendor/jquery/jquery-3.3.1.js" type="text/javascript"></script> </HEAD> <BODY> <div class="phppot-container"> <?php require_once "login-form.php";?> </div> </BODY> </HTML> 

And the below CSS is for presenting this example of user registration in PHP.

user-registration.css

.sign-up-container { border: 1px solid; border-color: #9a9a9a; background: #fff; border-radius: 4px; padding: 10px; width: 350px; margin: 50px auto; } .page-header { float: right; } .login-signup { margin: 10px; text-decoration: none; float: right; } .login-signup a { text-decoration: none; color: #000; font-weight: 700; } .signup-heading { font-size: 2em; font-weight: bold; padding-top: 60px; text-align: center; } .inline-block { display: inline-block; } .row { margin: 15px 0px; text-align: center; } .form-label { margin-bottom: 5px; text-align: left; } input.input-box-330 { width: 250px; } .sign-up-container .error { color: #ee0000; padding: 0px; background: none; border: #ee0000; } .sign-up-container .error-field { border: 1px solid #d96557; } .sign-up-container .error:before { content: '*'; padding: 0 3px; color: #D8000C; } .error-msg { padding-top: 10px; color: #D8000C; text-align: center; } .success-msg { padding-top: 10px; color: #23a600; text-align: center; } input.sign-up-btn { background-color: #ffb932; border-color: #ffc87a #e2a348 #da9d0a; text-align: center; cursor: pointer; color: #000; width: 250px } .signup-align { margin: 0 auto; } .page-content { font-weight: bold; padding-top: 60px; text-align: center; } 

Registration and login form validation


In this section, we are going to see the code created in JavaScript for form validation.

There are two methods for validating the form fields before sending the data to the PHP code.

On invalid data submission, the code will return a boolean false. It forces the user to enter the required fields by highlighting them.

login-form.php (JavaScript)

function loginValidation() { var valid = true; $("#username").removeClass("error-field"); $("#password").removeClass("error-field"); var UserName = $("#username").val(); var Password = $('#signup-password').val(); $("#username-info").html("").hide(); $("#email-info").html("").hide(); if (UserName.trim() == "") { $("#username-info").html("required.").css("color", "#ee0000").show(); $("#username").addClass("error-field"); valid = false; } if (Password.trim() == "") { $("#signup-password-info").html("required.").css("color", "#ee0000").show(); $("#signup-password").addClass("error-field"); valid = false; } if (valid == false) { $('.error-field').first().focus(); valid = false; } return valid; } 

user-registration-form.php (JavaScript)

function signupValidation() { var valid = true; $("#username").removeClass("error-field"); $("#email").removeClass("error-field"); $("#password").removeClass("error-field"); $("#confirm-password").removeClass("error-field"); var UserName = $("#username").val(); var email = $("#email").val(); var Password = $('#signup-password').val(); var ConfirmPassword = $('#confirm-password').val(); var emailRegex = /^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/; $("#username-info").html("").hide(); $("#email-info").html("").hide(); if (UserName.trim() == "") { $("#username-info").html("required.").css("color", "#ee0000").show(); $("#username").addClass("error-field"); valid = false; } if (email == "") { $("#email-info").html("required").css("color", "#ee0000").show(); $("#email").addClass("error-field"); valid = false; } else if (email.trim() == "") { $("#email-info").html("Invalid email address.").css("color", "#ee0000").show(); $("#email").addClass("error-field"); valid = false; } else if (!emailRegex.test(email)) { $("#email-info").html("Invalid email address.").css("color", "#ee0000") .show(); $("#email").addClass("error-field"); valid = false; } if (Password.trim() == "") { $("#signup-password-info").html("required.").css("color", "#ee0000").show(); $("#signup-password").addClass("error-field"); valid = false; } if (ConfirmPassword.trim() == "") { $("#confirm-password-info").html("required.").css("color", "#ee0000").show(); $("#confirm-password").addClass("error-field"); valid = false; } if(Password != ConfirmPassword){ $("#error-msg").html("Both passwords must be same.").show(); valid=false; } if (valid == false) { $('.error-field').first().focus(); valid = false; } return valid; } 

Process user registration in PHP


After submitting the form details, it processes user registration in the PHP code.

This code uses default form submit to post data to the PHP. If you want the user registration code with AJAX, then we have to prevent the default submit with a script.

I have added this code at the beginning of the user-registration-form.php. It checks if the user submitted the form. Then, it invokes the registerMember() method defined in the Member model.

login-form.php (PHP code)

<?php use Phppot\Member; if (! empty($_POST["signup-btn"])) { require_once './Model/Member.php'; $member = new Member(); $registrationResponse = $member->registerMember(); } ?> 

I have shown the Member model class code below. It contains all the functions related to this user registration and login example.

In the registerMember() function, it checks if the posted email already exists. If so, it truncates the registration flow and returns the error. Otherwise, it creates the Insert query to add the member record into the MySQL database.

The loginMember() function checks if there is any match for the entered login details. If the match found, it clears the authentication and allows the user to access the dashboard.

Model/Member.php

<?php namespace Phppot; class Member { private $ds; function __construct() { require_once __DIR__ . './../lib/DataSource.php'; $this->ds = new DataSource(); } public function isMemberExists($email) { $query = 'SELECT * FROM tbl_member where email = ?'; $paramType = 's'; $paramValue = array( $email ); $insertRecord = $this->ds->select($query, $paramType, $paramValue); $count = 0; if (is_array($insertRecord)) { $count = count($insertRecord); } return $count; } public function registerMember() { $result = $this->isMemberExists($_POST["email"]); if ($result < 1) { if (! empty($_POST["signup-password"])) { $hashedPassword = password_hash($_POST["signup-password"], PASSWORD_DEFAULT); } $query = 'INSERT INTO tbl_member (username, password, email) VALUES (?, ?, ?)'; $paramType = 'sss'; $paramValue = array( $_POST["username"], $hashedPassword, $_POST["email"] ); $memberId = $this->ds->insert($query, $paramType, $paramValue); if(!empty($memberId)) { $response = array("status" => "success", "message" => "You have registered successfully."); } } else if ($result == 1) { $response = array("status" => "error", "message" => "Email already exists."); } return $response; } public function getMember($username) { $query = 'SELECT * FROM tbl_member where username = ?'; $paramType = 's'; $paramValue = array( $username ); $loginUser = $this->ds->select($query, $paramType, $paramValue); return $loginUser; } public function loginMember() { $loginUserResult = $this->getMember($_POST["username"]); if (! empty($_POST["signup-password"])) { $password = $_POST["signup-password"]; } $hashedPassword = $loginUserResult[0]["password"]; $loginPassword = 0; if (password_verify($password, $hashedPassword)) { $loginPassword = 1; } if ($loginPassword == 1) { $_SESSION["username"] = $loginUserResult[0]["username"]; $url = "./home.php"; header("Location: $url"); } else if ($loginPassword == 0) { $loginStatus = "Invalid username or password."; return $loginStatus; } } } 

PHP login authentication code


Below PHP code is for invoking the authentication function after login. It is in the login-form.php file above the HTML code.

user-registration-form.php (PHP Code)

<?php if (! empty($_POST["login-btn"])) { require_once './Model/Member.php'; $member = new Member(); $loginResult = $member->loginMember(); } ?> 

User dashboard


This is the user dashboard HTML code. It shows a welcome message with the logged-in member name. It also has an option to logout from the current session.

home.php

<?php session_start(); $username = $_SESSION["username"]; ?> <HTML> <HEAD> <TITLE>Welcome</TITLE> <link href="./assets/css/phppot-style.css" type="text/css" rel="stylesheet" /> <link href="./assets/css/user-registration.css" type="text/css" rel="stylesheet" /> </HEAD> <BODY> <div class="phppot-container"> <div class="page-header"> <span class="login-signup"><a href="login-form.php">Logout</a></span> </div> <div class="page-content">Welcome <?php echo $username;?></div> </div> </BODY> </HTML> 

DataSource.php

<?php /** * Copyright © 2019 Phppot * * Distributed under MIT license with an exception that, * you don’t have to include the full MIT License in your code. * In essense, you can use it on commercial software, modify and distribute free. * Though not mandatory, you are requested to attribute this URL in your code or website. */ namespace Phppot; /** * Generic datasource class for handling DB operations. * Uses MySqli and PreparedStatements. * * @version 2.5 - recordCount function added */ class DataSource { // PHP 7.1.0 visibility modifiers are allowed for class constants. // when using above 7.1.0, declare the below constants as private const HOST = 'localhost'; const USERNAME = 'root'; const PASSWORD = 'test'; const DATABASENAME = 'user-registration'; private $conn; /** * PHP implicitly takes care of cleanup for default connection types. * So no need to worry about closing the connection. * * Singletons not required in PHP as there is no * concept of shared memory. * Every object lives only for a request. * * Keeping things simple and that works! */ function __construct() { $this->conn = $this->getConnection(); } /** * If connection object is needed use this method and get access to it. * Otherwise, use the below methods for insert / update / etc. * * @return \mysqli */ public function getConnection() { $conn = new \mysqli(self::HOST, self::USERNAME, self::PASSWORD, self::DATABASENAME); if (mysqli_connect_errno()) { trigger_error("Problem with connecting to database."); } $conn->set_charset("utf8"); return $conn; } /** * To get database results * * @param string $query * @param string $paramType * @param array $paramArray * @return array */ public function select($query, $paramType = "", $paramArray = array()) { $stmt = $this->conn->prepare($query); if (! empty($paramType) && ! empty($paramArray)) { $this->bindQueryParams($stmt, $paramType, $paramArray); } $stmt->execute(); $result = $stmt->get_result(); if ($result->num_rows > 0) { while ($row = $result->fetch_assoc()) { $resultset[] = $row; } } if (! empty($resultset)) { return $resultset; } } /** * To insert * * @param string $query * @param string $paramType * @param array $paramArray * @return int */ public function insert($query, $paramType, $paramArray) { $stmt = $this->conn->prepare($query); $this->bindQueryParams($stmt, $paramType, $paramArray); $stmt->execute(); $insertId = $stmt->insert_id; return $insertId; } /** * To execute query * * @param string $query * @param string $paramType * @param array $paramArray */ public function execute($query, $paramType = "", $paramArray = array()) { $stmt = $this->conn->prepare($query); if (! empty($paramType) && ! empty($paramArray)) { $this->bindQueryParams($stmt, $paramType, $paramArray); } $stmt->execute(); } /** * 1. * Prepares parameter binding * 2. Bind prameters to the sql statement * * @param string $stmt * @param string $paramType * @param array $paramArray */ public function bindQueryParams($stmt, $paramType, $paramArray = array()) { $paramValueReference[] = & $paramType; for ($i = 0; $i < count($paramArray); $i ++) { $paramValueReference[] = & $paramArray[$i]; } call_user_func_array(array( $stmt, 'bind_param' ), $paramValueReference); } /** * To get database results * * @param string $query * @param string $paramType * @param array $paramArray * @return array */ public function getRecordCount($query, $paramType = "", $paramArray = array()) { $stmt = $this->conn->prepare($query); if (! empty($paramType) && ! empty($paramArray)) { $this->bindQueryParams($stmt, $paramType, $paramArray); } $stmt->execute(); $stmt->store_result(); $recordCount = $stmt->num_rows; return $recordCount; } } 

MySQL database script


Below SQL script shows the MySQL database table’s create statement. It also has the specification for the key and indexes.

User registration MySQL schema

Import this script into your PHP development root to execute this example.

sql/user-registration.sql

-- -- Database: `user-registration` -- -- -------------------------------------------------------- -- -- Table structure for table `tbl_member` -- CREATE TABLE `tbl_member` ( `id` int(11) NOT NULL, `username` varchar(255) NOT NULL, `password` varchar(200) NOT NULL, `email` varchar(255) NOT NULL, `create_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Indexes for dumped tables -- -- -- Indexes for table `tbl_member` -- ALTER TABLE `tbl_member` ADD PRIMARY KEY (`id`); -- -- AUTO_INCREMENT for dumped tables -- -- -- AUTO_INCREMENT for table `tbl_member` -- ALTER TABLE `tbl_member` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT; 

Screenshot of user registration and login form


Login form with validation response:

User Login Form Output

User registration form server-side validation response:

Screenshot User Registration in-php PHP

Download

↑ Back to Top



https://www.sickgaming.net/blog/2019/12/...-download/

Print this item

  (Indie Deal) ? To The Moon | 93% OFF & Van Helsing Franchise Sale
Posted by: xSicKxBot - 01-21-2020, 12:28 PM - Forum: Deals or Specials - No Replies

? To The Moon | 93% OFF & Van Helsing Franchise Sale

To The Moon | 93% OFF | Crackerjack Deal
[www.indiegala.com]
An innovative mix between adventure game elements and classic RPG aesthetics at an affordable price (for less than a dollar).

Van Helsing Franchise Sale, all titles -75%
[www.indiegala.com]
The Massive Gameplay Giveaway has been restocked and it is open for just a few hours.[www.indiegala.com]

The GalaQuiz[www.indiegala.com] will take place today. The theme will be Mario Foes.

Check out IndieGala on Twitter, YouTube & Facebook[www.facebook.com]


https://steamcommunity.com/groups/indieg...5338610502

Print this item

  (Free Game Key) The Talos Principle - Free Epic Game (Daily Encore Giveaway - Day 11)
Posted by: xSicKxBot - 01-21-2020, 12:28 PM - Forum: Deals or Specials - No Replies

The Talos Principle - Free Epic Game (Daily Encore Giveaway - Day 11)

Visit the giveaway page:

https://store.epicgames.com/GRABFREEGAMES/the-talos-principle

Create an account or log in an already existing one and permanently add the game on your account. Alternatively you can redeem it from the Epic Launcher on the game's giveaway page.

This is the 11th daily giveaway that lasts only 24 hours. They will give away one free game per day until the end of 2019.

Epic is also giving away 10$ coupons for free on anyone who logs on their site https://www.epicgames.com/store/promotion/holiday-sale-2019

We are welcoming everyone to join our discord server (link below). We are more active there on finding giveaways, small or large.

?GrabFreeGames.com ?Twitter ?Steam Curator ?Facebook[fb.me]?Discord[discord.gg]
❤️Support us: ✔️HumbleBundle Partner[www.humblebundle.com] Epic Tag: GrabFreeGames


https://steamcommunity.com/groups/GrabFr...7573120782

Print this item

  AppleInsider - Rumor: ‘iPhone 12’ will look like a slimmer, taller iPhone 11
Posted by: xSicKxBot - 01-21-2020, 10:44 AM - Forum: Apples Mac and OS X - No Replies

Rumor: ‘iPhone 12’ will look like a slimmer, taller iPhone 11

 

Rumblings out of Apple’s East Asian supply chain this week offer fresh insight into this year’s iPhone release cycle, with a report on Monday claiming the company’s 2020 handsets will be similar in design to the iPhone 11 lineup albeit with a few sizing tweaks.

iPhone 11

iPhone 11 and iPhone 11 Pro.

Citing an unnamed Chinese supplier, Mac Otakara reports Apple’s next-generation iPhone range, tentatively dubbed “iPhone 12,” will share a case design with iPhone 11 and 11 Pro.

Until today, most predictions pointed to the adoption of a squared metal frame design that harkens back to iPhone 4 and iPhone 4S. Noted TF Securities analyst Ming-Chi Kuo first delivered word of the “significant” design change last September, saying the new frame structure would rely on a “more complex segmentation design, new trenching, and injection molding procedures.”

Today’s report casts doubt on Kuo’s expectations and suggests iPhone will retain a metal chassis with gently bowed edges.

Seemingly confirming rumors that Apple will field three screen sizes in 2020 — 5.4-, 6.1- and 6.7-inch variants — sources claim to have information on chassis dimensions. The height of the smallest 5.4-inch version is said to be between that of the iPhone SE and iPhone 8, while the 6.1-inch model lies between the iPhone 11 and iPhone 11 Pro. Apple’s largest 2020 model, predicted to boast a 6.7-inch screen, will supposedly be slightly taller than this year’s iPhone 11 Pro Max.

The report goes on to say Apple’s 2020 iPhone range will boast a depth of around 7.40 millimeters, much thinner than the 8.1mm iPhone 11 Pro or 8.3mm iPhone 11. Bezel size is expected to be about 2mm, roughly equivalent to current generation iPhones.

All 2020 models are anticipated to benefit from OLED screens, a new “A14” system-on-chip processor and 5G connectivity. The entry-level 5.4- and 6.1-inch iPhones will likely sport dual rear-facing cameras, while the top-end 6.1-inch and 6.7-inch versions should carry over iPhone 11 Pro’s triple-camera array. High-end iterations are also predicted to gain VCSEL time of flight sensors for depth sensing operations.



https://www.sickgaming.net/blog/2020/01/...iphone-11/

Print this item

  News - Soon You’ll Be Able To Try Yooka-Laylee And The Impossible Lair Before You Buy
Posted by: xSicKxBot - 01-21-2020, 10:44 AM - Forum: Nintendo Discussion - No Replies

Soon You’ll Be Able To Try Yooka-Laylee And The Impossible Lair Before You Buy


When we reviewed Yooka-Laylee And The Impossible Lair back in October 2019, we said it was “a fantastic sophomore effort that pays tribute to Rare’s past and establishes Playtonic as one of the UK’s most exciting studios.” If that wasn’t enough encouragement for you to buy it, then perhaps the ability to sample a portion of the game before you take the plunge will suffice?

That’s precisely what Playtonic is doing at the end of this month. A free demo will hit the eShop on January 30th (a week after Steam). The demo will include “an assortment of vibrant and exciting 2D levels”, a ‘Pagie Challenge’, a state change for one of the stages, some tonics to sample (one of which gives Yooka a massive head), and access to titular Impossible Lair itself (gasp!). Furthermore, your progress from the demo can be carried over to the full game.

But why now, and why not at the time of release, you may ask? Well, according to Playtonic’s Twitter, demos aren’t just something you pop out with minimal effort – they have to be certified just like a full release, and there simply wasn’t the time or resource to produce a demo at launch. We’ll let them off, because they’re good people.

Will you be downloading this demo on the 30th? Let us know by voting in the poll below.



https://www.sickgaming.net/blog/2020/01/...e-you-buy/

Print this item

  News - Xbox: You Can Check Your Decade's Achievements With This Great Tool
Posted by: xSicKxBot - 01-21-2020, 10:44 AM - Forum: Lounge - No Replies

Xbox: You Can Check Your Decade's Achievements With This Great Tool

Xbox Achievements remain a core part of the Xbox ecosystem, and having a high gamerscore in a game--or finally snagging a difficult Achievement--can feel pretty good. Xbox achievement tracking site True Achievements has created a tool, called #MyDecadeOnXbox, to give you some insight into your own play habits.

Log into your Xbox account and the site's tracker will tell you how many games you played over that decade on Xbox, how many achievements and gamerscore you unlocked, how many of those achievements were rare, and much more. It tracks your best month and day for achievements, gives you a platform breakdown, and lists your rarest achievements.

It's worth noting that this is not an official Microsoft initiative--you will need a True Achievements account, and you'll need to give them access to your Xbox account information to get these figures.

It's an interesting list of statistics, and a good way to chart how your play habits on Xbox systems have or have not changed. Xbox Achievements have changed a lot over the decade, as the distinction between retail and "arcade" games has been dropped, and Microsoft has been less rigid over how many Achievements a game can or can't have. You can even earn them on Switch, but only in a tiny handful of games.

Achievements will likely remain a big part of the Xbox Series X when it launches in late 2020. There are still plenty of Xbox One games on the horizon as well, though, so Achievement hunters will be able to keep busy this year.


https://www.gamespot.com/articles/xbox-y...0-6472875/

Print this item

  Mobile - Carcassonne is Dead, Long Live Carcassonne
Posted by: xSicKxBot - 01-21-2020, 03:58 AM - Forum: New Game Releases - No Replies

Carcassonne is Dead, Long Live Carcassonne

Digital board game ports are a wonderful thing, but they can be at times confusing. As an inherently license’-based activity (with one or two exceptions), it can create weird situations like what happened with the digital adaptation of Carcassonne.

There in fact two different versions of Carcassonne you can buy on the market right now, one developed by The Coding Monkeys that’s only available on iOS, and then a slightly shinier version that came later developed by Asmodee Digital, which is only available on Steam and Android. That’s about to change come March 1st, 2020.

The Coding Monkeys Carcassonne

The Coding Monkeys announced over the weekend that their deal with the Carcassonne license holder, Hans im Glück, is coming to an end and won’t be renewed. Their version of the game will be removed from the App store come March, and you won’t be able to buy it again. Here’s what you need to bear in mind:

  • If you already own the game and it’s installed on your device, you’ll be able to play it beyond March 1st, 2020.
  • If you already own the game but it’s not installed, in theory you should still be able to download it regardless but this can be an inconsistent principle at times – best to put it on a device for safe keeping.
  • TCM have said they will keep their servers running for at least a year, so multiplayer will still work for a time. What happens after that will depend on whether the studio can afford to keep them running.
  • Even if they turn off the servers, as far as we know the game didn’t need to connect to an online server to play so solo/pass-and-play should still work.

iOS users need not fear that they’ll lose access to Carcassonne forever – Asmodee Digital’s own port will finally be coming to the Apple App Store come March. I imagine this is something they’ve been wanting ever since they made their own version of the game a couple of years ago.

asmodee digital carcassonne

The Coding Monkey’s version of the game is held in pretty high esteem and is a poster-child example of board game ports on mobile. Asmodee’s version is fine and is in 3D, giving it more appealing visuals, but i’d be hard-pressed to say it was the ‘better’ version. Still, it’s probably better to have a single, unified app for things like this.

As a final farewell, The Coding Monkeys are running a sale on their version of the game plus everything else they’ve made to date, so be sure to check it out.

What are your thoughts on this and the two versions of Carcassonne? Let us know in the comments!



https://www.sickgaming.net/blog/2020/01/...rcassonne/

Print this item

  AppleInsider - Apple working on preventative healthcare technology, CEO Cook reveals
Posted by: xSicKxBot - 01-21-2020, 03:57 AM - Forum: Apples Mac and OS X - No Replies

Apple working on preventative healthcare technology, CEO Cook reveals

 

Apple CEO Tim Cook on Monday said the company is investigating technology that could help identify health risks at an early stage, similar to heart monitoring features introduced with Apple Watch.

Cycle

Apple Watch’s new Cycle app tracks menstrual cycles.

Cook commented on Apple’s contributions to the healthcare space during a panel, suggesting what started with heart health tracking on Apple Watch could soon branch out into other areas of interest.

Current Apple Watch models are equipped with sensors capable to detecting atrial fibrillation, or AFib, a common heart arrhythmia that can lead to stroke in some patients. Apple Watch Series 4 and Series 5 go a step further and include an FDA-approved electrocardiogram function for more accurate readings.

As the first FDA-approved consumer device to incorporate an ECG, Apple Watch is an early entrant in what appears to be a burgeoning crossover sector that joins consumer tech with healthcare.

“I’m seeing that this intersection has not yet been explored very well. There’s not a lot of tech associated with the way people’s healthcare is done unless they get into very serious trouble.”” Cook said in a Q&A session with IDA Ireland CEO Martin Shanahan, according to Silicon Republic. IDA on Monday presented Cook with the inaugural Special Recognition Award for Apple’s 40 years of investment in Ireland

Most Apple Watch heart monitoring features, like AFib detection, are inherently preventative and can potentially reduce healthcare fees or even save lives.

“I think you can take that simple idea of having preventive things and find many more areas where technology intersects healthcare, and I think all of our lives would probably be better off for it,” Cook said. He added that the cost of healthcare can “fundamentally be taken down, probably in a dramatic way” by integrating common healthcare technologies in consumer devices.

“Most of the money in healthcare goes to the cases that weren’t identified early enough,” Cook said. “It will take some time but things that we are doing now — that I’m not going to talk about today — those give me a lot of cause for hope.”

Apple is known to be at work on multiple health-focused initiatives, though none have been formally announced. A recent patent filing from December, for example, suggests the company is developing methods of using Apple Watch to detect Parkinson’s Disease and diagnose tremor symptoms. Similar initiatives, like the sound monitoring Noise app and menstrual cycle tracking Cycle app, were announced and subsequently released with watchOS 6.

The Apple chief also touched on AR, once again calling it the “next big thing” in tech. Cook has long been bullish on the prospects of AR, which are being borne in iOS app releases.

“I think it’s something that doesn’t isolate people. We can use it to enhance our discussion, not substitute it for human connection, which I’ve always deeply worried about in some of the other technologies.”



https://www.sickgaming.net/blog/2020/01/...k-reveals/

Print this item

 
Latest Threads
(Indie Deal) Directive 80...
Last Post: xSicKxBot
1 hour ago
News - New Fallout Game I...
Last Post: xSicKxBot
1 hour ago
Black Ops (BO1, T5) DLC's...
Last Post: crabber45
5 hours ago
Thank you
Last Post: cschir10
6 hours ago
News - Xbox Kills Obsidia...
Last Post: xSicKxBot
Yesterday, 10:52 PM
Black Ops 2 GSC Studio | ...
Last Post: Cellulose
Yesterday, 06:50 PM
Black Ops 2 (BO2,T6) 1.19...
Last Post: Cellulose
Yesterday, 06:48 PM
Black Ops 2 Jiggy v4.3 PC...
Last Post: Cellulose
Yesterday, 06:47 PM
Redacted T6 Nightly Offli...
Last Post: xavier_aeee
Yesterday, 09:25 AM
News - Love And Deepspace...
Last Post: xSicKxBot
Yesterday, 06:30 AM

Forum software by © MyBB Theme © iAndrew 2016