Site icon Hip-Hop Website Design and Development

Tips on how to create session for person which isn’t an admin person

Good day I’m engaged on constructing a plugin which has the next performance like acknowledged beneath

My downside is I’m caught at level I’ve created registration type for the customers the place customers will have the ability to registered efficiently after that they may obtain an electronic mail and after that they may turn out to be the ultimate person and I additionally make this entry in a separate database desk . I additionally present admin with facility to approve the Consumer. However My predominant downside is how can set the session for the person who has registered with my registered type when he enter particulars into login type which I’ve created they are going to be redirected to their dashboard .

For this I need to create session . However the resolution which I’ve discovered on web I all saying to create a session and set it for WP-login.
So please information me in an accurate manner
Right here is the code of my customized login type

<type technique="POST" id="loginform" identify="loginform">
<p>
<label for="user_login">E-mail<br>
<enter kind="textual content" worth="" class="enter" aria-describedby="login_error" id="user_email" identify="log_mail"></label>
</p>
<p>
<label for="user_pass">Password<br>
<enter kind="password" worth="" class="enter" aria-describedby="login_error" id="user_pass" identify="log_pwd"></label>
</p>
<p>
<label for="user_pass">Consumer Function<br>
<choose identify="role_select" id="role_select">
<choice worth="" chosen>Choose</choice>
<choice identify="simple_user" worth="person">Easy Consumer</choice>
<choice identify="company_user" worth="company_user">Firm Consumer</choice>
</choose></label>
</p>
<p class="forgetmenot"><label for="rememberme"><enter kind="checkbox" worth="perpetually" id="rememberme" identify="rememberme"> Bear in mind Me</label></p>
<p class="submit">
<enter kind="submit" worth="Log In" class="button button-primary button-large" id="wp-submit" identify="custom_submit">
</p>
</type>
<?php
$c_user_mail = $_POST['log_mail']; 
$c_user_role = $_POST['role_select'];
$c_user_pass = $_POST['log_pwd'];
$c_enc_pass = md5($c_user_pass);
world $wpdb;
$wp_path =$_SERVER["DOCUMENT_ROOT"];
require_once($wp_path.'/wp-config.php');
$table_name = $wpdb->prefix . 'final_user_tabel';
echo $sql = "SELECT * FROM " . $table_name . " WHERE (electronic mail = '$c_user_mail') AND (userrol = '$c_user_role')";
$pageposts = $wpdb->get_results($sql, ARRAY_N);

$pass_check = $pageposts[0][4];

$email_check = $pageposts[0][2];

if($c_enc_pass == $pass_check && $c_user_mail == $email_check){}
?>