ID; $email = get_option( '2stepauth_emailverify_'.$uid ); $userid = $current_user->ID; global $wpdb; $table = $wpdb->prefix."cookies"; /* check for cookies */ $namecheck = "2stepauth_rem_".$current_user->ID; // If cookie corresponding to $namecheck is present, proceed. if ( isset ( $_COOKIE[$namecheck] ) ) { // Get the value of user browser cookie in $id $id = $_COOKIE[$namecheck]; $date1 = date( 'y-m-d' ); // Get all valid cookie values from DB $cookieArr = $wpdb->get_results('Select cookie from '.$table.' where userid='.$userid.' AND date>'.$date1); if ( $cookieArr ) { foreach ( $cookieArr as $ck ) { $cookieVal[] = $ck->cookie; } foreach ( $cookieVal as $c ) { // Compare browser cookie value with values in DB if ( $c == $id ) { //echo "Cookie matched"; update_option( '2stepauth_verificationdone_'.$uid, 1 ); wp_redirect( admin_url() ); } } } } /*end check for cookies */ if ( $_POST['submit'] ) { // Get Backup codes corresponding to current user from DB global $wpdb; $table = $wpdb->prefix."backup"; $return = $wpdb->get_results("Select backup from ".$table." where userid=".$uid); foreach ( $return as $r ) { $backup[] = $r->backup; } // Get user entered Backup code in $getcode $getcode = $_REQUEST['codeh']; // Compare foreach ( $backup as $b ) { if ( $getcode == $b ) { global $wpdb; $table = $wpdb->prefix."backup"; $wpdb->query('Delete from '.$table.' where backup="'.$getcode.'"'); $backup1 = $wpdb->get_results("Select backup from ".$table." where userid=".$uid); $sizebackup = sizeof($backup1); // Options for Notifications related to Low backup count if ( $sizebackup < 3 ) { update_option( '2stepauth_lowbackup_'.$uid, 1 ); } if ( $sizebackup > 2 ) { update_option( '2stepauth_lowbackup_'.$uid, 0 ); } if ( $sizebackup == 0 ) { update_option( '2stepauth_elbackup_'.$uid, 1 ); } // Remember Me is checked if ( $_POST['remember'] ) { $randomval = send111(); $cookie = $userid.$randomval; $data['userid'] = $current_user->ID; $data['cookie'] = $cookie; $ts = strtotime('+2 weeks'); $data['date'] = date('y-m-d',$ts); global $wpdb; $table1 = $wpdb->prefix."cookies"; $wpdb->insert($table1,$data); $name = "2stepauth_rem_".$current_user->ID; setcookie($name, $cookie, time()+(60*60*24*14),"/"); } update_option( '2stepauth_verificationdone_'.$uid, 1 ); wp_redirect( admin_url() ); } } // If code does not match, show incorrect code error message if ( get_option( '2stepauth_verificationdone_'.$uid ) == 0 ) { ?> ' type='text/css' media='all' /> ' type='text/css' media='all' />