awadgorg / gamehup Goto Github PK
View Code? Open in Web Editor NEWthis is the code for gamehup site
this is the code for gamehup site
I was using the old MySQL to connect and insert and select data from my database and now am changing to mysqli but am getting this problem when I try to insert the register form data to my database
Warning: mysqli_stmt::bind_param(): Number of variables doesn't match number of parameters in prepared statement
and this is the code am using for the form can you please help me defind the error and fix it
i```
f (isset($_POST['submitup'])) {
require '../browser-games/dbh.php';
$username = mysqli_real_escape_string($conn, $_POST['username']);
$email = mysqli_real_escape_string($conn, $_POST['email']);
$password = mysqli_real_escape_string($conn, $_POST['password']);
$Gender = mysqli_real_escape_string($conn, $_POST['Gender']);
$conform = mysqli_real_escape_string($conn, $_POST['conform']);
$email_code = mysqli_real_escape_string($conn,$_POST['username'] + microtime());
$user_date = "3/3/2018";
if(empty($username) || empty($email) || empty($password) || empty($conform)){
$errors[] = "You Left Empty Fields, Fill In All Fields.";
}else{
if (strlen($_POST['password'] < 7)) {
$errors[] = "The Password Should Be At Least 8 Character";
}else{
if($password!==$conform){
$errors[] = "The Password And The Confirm password do not match";
}else{
if (!preg_match("/^[a-zA-Z]*$/",$username)) {
$errors[] = "Only Letters Allowed in The Username";
}else{
if(strlen($_POST['username']) > 30)
{
$errors[] = "The Username can't be more than 30 character";
}else{
if (!empty($_POST)) {
$sql = "SELECT email FROM users WHERE email = ? ";
$stmt = mysqli_stmt_init($conn);
if (!mysqli_stmt_prepare($stmt,$sql)) {
$errors[] = "fale to connect to the database please try again later";
}else{
mysqli_stmt_bind_param($stmt,"s",$email);
mysqli_stmt_execute($stmt);
$result = mysqli_stmt_get_result($stmt);
$emailcheck = mysqli_num_rows($result);
if($emailcheck>0){
$errors[] = "This Email Already exist In Our Database Please Try a different One, Or Contact Us if you lost your Account At GameHup";
}else{
$sql = "SELECT username FROM users WHERE username = ? ";
mysqli_stmt_bind_param($stmt,"s",$username);
mysqli_stmt_execute($stmt);
$result = mysqli_stmt_get_result($stmt);
$usernamecheck = mysqli_num_rows($result);
if($usernamecheck>0){
$errors[] = "This UserName Already Registered At GameHup Please Try A Another One";
}else{
//lock the password;
$passhash = password_hash($password , PASSWORD_DEFAULT);
$sql = $conn->prepare("INSERT INTO users (username,password,email,gender,email_code,user_level,user_date)
VALUES(?,?,?,?,?,?,?)");
$stmt->bind_param("sssssss",
$username,$password,$email,$Gender,$email_code,$user_level,$user_date);
$stmt->execute();
function email($to,$subject,$body){
mail($to,$subject,$body, 'From: [email protected]');
}
email(mysqli_real_escape_string($conn,$_POST['email']), 'Activate your Account GameHup', "
Hello ".$_POST['username']." \n\n There's just one more step to go, and it's the easiest one yet. \n\n
Click the link below to confirm your Account \n\n
http://gamehup.com/activate.php?email=".mysqli_real_escape_string($conn,$_POST['email'])."&code=".$email_code."\n\n GameHup Best Free to play browser games ");
$success[] = "You Registered Successfully At GameHup Please check Your Email Inpox For Confirmation Code";
}
}
}
}
}
}
}
}
}
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.