Normal OOP Registration

1.Method Create

<?php

class Crud {

	public $conn;

	public function __construct() {
		$this->conn = mysqli_connect( "localhost", "root", "", "fresh" );
		if ( mysqli_connect() ) {
			//echo "Connect Successfully";
		} else {
			die( "connection error" );
		}
		session_start();
	}

	/* registration insert */

	public function regiInsert( $table, $firstname, $lastname, $username, $email, $password, $phone, $gender, $address ) {
		$query = mysqli_query( $this->conn, "INSERT INTO $table SET firstname='$firstname', lastname='$lastname', username='$username', email='$email', password='$password', phone='$phone', gender='$gender', address='$address' " );
		if ( mysqli_affected_rows( $this->conn ) > 0 ) {
			return true;
		} else {
			return false;
		}
	}


}

$obj = new Crud();

2.registration.php

<?php
include_once('../crud.php');
if (isset($_REQUEST['save'])) {
    //echo "<pre>";
    //print_r($_REQUEST);
    extract($_REQUEST);
    if ($obj->regiInsert("registration", $firstname, $lastname, $username, $email, sha1($password), $phone, $gender, $address)) {
        $err_msg = "Successfully You Registered, Please Sign in";
    } else {
        $err_msg = "Your registration not include";
    }
}
if(isset($_SESSION['username'])){
	header('location:home.php');
}
?>



<!doctype html>
<html>
    <head>
        <title>Registration Form</title>
        <!-- Bootstrap CSS -->
        <link rel="stylesheet" href="../bootstrap/css/bootstrap.min.css"/>

        <!-- BootstrapValidator CSS -->
        <link rel="stylesheet" href="../bootstrap/css/bootstrapValidator.min.css"/>

        <!-- jQuery and Bootstrap JS -->
        <script type="text/javascript" src="../bootstrap/js/jquery-1.11.3.min.js"></script>
        <script type="text/javascript" src="../bootstrap/js/bootstrap.min.js"></script>

        <!-- BootstrapValidator JS -->
        <script type="text/javascript" src="../bootstrap/js/bootstrapValidator.min.js"></script>
    </head>
    <body>
        <div class="container">
            <div class="row">
                <div style="border: 1px solid #ddd; padding: 0 0 15px;" class="col-md-8 col-md-offset-2">
                    <div class="page-header">
                        <h2 style="text-align: center; font-family: initial;">Sign up</h2>
                        <p style="text-align:center; color: #4D73E4;">
                            <?php
                            echo isset($err_msg) ? $err_msg : "";
                            ?>
                        </p>
                    </div>

                    <form action="registration.php" id="registrationForm" method="post" class="form-horizontal">

                        <div class="form-group">
                            <label class="col-xs-3 control-label">Full name</label>
                            <div class="col-xs-4">
                                <input type="text" class="form-control" name="firstname" placeholder="First name" />
                            </div>
                            <div class="col-xs-4">
                                <input type="text" class="form-control" name="lastname" placeholder="Last name" />
                            </div>
                        </div>

                        <div class="form-group">
                            <label class="col-sm-3 control-label">Username</label>
                            <div class="col-sm-5">
                                <input type="text" class="form-control" name="username" />
                            </div>
                        </div>

                        <div class="form-group">
                            <label class="col-sm-3 control-label">Email address</label>
                            <div class="col-sm-5">
                                <input type="text" class="form-control" name="email" />
                            </div>
                        </div>

                        <div class="form-group">
                            <label class="col-sm-3 control-label">Password</label>
                            <div class="col-sm-5">
                                <input type="password" class="form-control" name="password" />
                            </div>
                        </div>

                        <div class="form-group">
                            <label class="col-xs-3 control-label">Phone number</label>
                            <div class="col-xs-5">
                                <input type="text" class="form-control" name="phone" placeholder="Phone Number" />
                            </div>
                        </div>	

                        <div class="form-group">
                            <label class="col-sm-3 control-label">Gender</label>
                            <div class="col-sm-5">
                                <div class="radio">
                                    <label>
                                        <input type="radio" name="gender" value="male" /> Male
                                    </label>
                                </div>
                                <div class="radio">
                                    <label>
                                        <input type="radio" name="gender" value="female" /> Female
                                    </label>
                                </div>
                                <div class="radio">
                                    <label>
                                        <input type="radio" name="gender" value="other" /> Other
                                    </label>
                                </div>
                            </div>
                        </div>
                        <!-- 
                        <div class="form-group">
                             <label class="col-sm-3 control-label">Date of birth</label>
                             <div class="col-sm-5">
                                 <input type="date" class="form-control" name="date"  placeholder="YYYY/MM/DD" />
                             </div>
                         </div>-->

                        <div class="form-group">
                            <label class="col-sm-3 control-label">Address</label>
                            <div class="col-sm-5">
                                <textarea name="address" class="form-control" rows="5" cols="25"></textarea>
                            </div>
                        </div>

                        <div class="form-group">
                            <div class="col-sm-9 col-sm-offset-3">
                                <!-- Do NOT use name="submit" or id="submit" for the Submit button -->
                                <button type="submit" name="save" value="submit" class="btn btn-default">Sign up</button>
                                <a class="btn btn-default" href="http://127.0.0.1/ibcs/fresh/template/admin/">Sign In</a>
                            </div>
                            
                        </div>
                    </form>
                </div>
            </div>
        </div>

        <script>
            $(document).ready(function () {
                $('#registrationForm').bootstrapValidator({
                    // To use feedback icons, ensure that you use Bootstrap v3.1.0 or later
                    feedbackIcons: {
                        valid: 'glyphicon glyphicon-ok',
                        invalid: 'glyphicon glyphicon-remove',
                        validating: 'glyphicon glyphicon-refresh'
                    },
                    fields: {
                        firstname: {
                            row: '.col-xs-4',
                            validators: {
                                notEmpty: {
                                    message: 'The first name is required'
                                }
                            }
                        },
                        lastname: {
                            row: '.col-xs-4',
                            validators: {
                                notEmpty: {
                                    message: 'The last name is required'
                                }
                            }
                        },
                        username: {
                            message: 'The username is not valid',
                            validators: {
                                notEmpty: {
                                    message: 'The username is required and cannot be empty'
                                },
                                stringLength: {
                                    min: 6,
                                    max: 30,
                                    message: 'The username must be more than 6 and less than 30 characters long'
                                },
                                regexp: {
                                    regexp: /^[a-zA-Z0-9]+$/,
                                    message: 'The username can only consist of alphabetical and number'
                                },
                                different: {
                                    field: 'password',
                                    message: 'The username and password cannot be the same as each other'
                                }
                            }
                        },
                        email: {
                            validators: {
                                notEmpty: {
                                    message: 'The email address is required and cannot be empty'
                                },
                                emailAddress: {
                                    message: 'The email address is not a valid'
                                }
                            }
                        },
                        password: {
                            validators: {
                                notEmpty: {
                                    message: 'The password is required and cannot be empty'
                                },
                                different: {
                                    field: 'username',
                                    message: 'The password cannot be the same as username'
                                },
                                stringLength: {
                                    min: 8,
                                    message: 'The password must have at least 8 characters'
                                }
                            }
                        },
                        phone: {
                            row: '.col-xs-5',
                            validators: {
                                notEmpty: {
                                    message: 'The cell phone number is required'
                                }
                            }
                        },
                        birthday: {
                            validators: {
                                notEmpty: {
                                    message: 'The date of birth is required'
                                },
                                date: {
                                    format: 'YYYY/MM/DD',
                                    message: 'The date of birth is not valid'
                                }
                            }
                        },
                        gender: {
                            validators: {
                                notEmpty: {
                                    message: 'The gender is required'
                                }
                            }
                        }
                        ,
                        address: {
                            validators: {
                                notEmpty: {
                                    message: 'Please input your valid address'
                                }
                            }
                        }
                    }
                });
            });
        </script>
    </body>
</html>

3.looking like this
registration

Advertisements

WordPress Help Code


|| favicon icon:
   <link rel="shortcut icon" href="<?php echo get_stylesheet_directory_uri(); ?>/favicon.ico" />

|| shortcode
   [bestwebsoft_contact_form]
   <?php echo do_shortcode('[bestwebsoft_contact_form]'); ?>

|| Internal Server Error The server encountered an internal error or misconfiguration and was unable to complete your request.
   Please contact the server administrator webmaster@...

--How to Fix the Internal Server Error--
. At first check admin > settings > permalinks > select post name
. check for the corrupted .htaccess file
  /* http://www.wpbeginner.com/wp-tutorials/how-to-fix-the-internal-server-error-in-wordpress/ */


|| Cause of Free theme uses, footer link redirect
   wp index.php?theme_license=true

   This problem have to do solve:
   <?php
	/*  function.php just notice this following code in the end*/
		function wp_initialize_the_theme_load() { if (!function_exists("wp_initialize_the_theme")) {--------}
	 
	/*  replace up this code */
	 
		function wp_initialize_the_theme_load(){ 
			if (!function_exists("wp_initialize_the_theme")) { wp_initialize_the_theme_message(); die; } 
		} 

		function wp_initialize_the_theme_finish() {$uri = strtolower($_SERVER["REQUEST_URI"]); 
			if(is_admin() || substr_count($uri, "wp-admin") > 0 || substr_count($uri, "wp-login") > 0 ) { /* */ } else { /* */ } 
		} 
			wp_initialize_the_theme_finish();
	 
	/* now can change footer.php powered by link */ 

	/* if you want, You can remove this code. lib>Themater.php,*/
		if (!empty($_REQUEST["theme_license"])) {----}
		
	 
   ?>


Dynamic category show in a page:
==================================
<?php
 wp_list_categories('hide_empty=0&show_count=1&title_li=
 <h3>' . __('All Categories') . '</h3>' ); 
?>

WordPress Fix – Add Media Button Not Working:
=============================================
Basically you need to open your “wp-config.php” file in the root of your WordPress Install.
Search for this line:
  <?php require_once(ABSPATH . 'wp-settings.php'); ?>

And just before it add this code:
  <?php define('CONCATENATE_SCRIPTS', false ); ?>



|| Dashboard page href link
   <a href="index.php?page_id=###"></a>

|| separate menu click then separate content show
   twentythirteen > page.php 


|| Add Font Awesome CDN To WordPress Without A Plugin

   /* Add the Following Code to Your Theme’s functions.php File: */
   <?php
	add_action( 'wp_enqueue_scripts', 'prefix_enqueue_awesome' );
	/**
	 * Register and load font awesome CSS files using a CDN.
	 *
	 * @link   http://www.bootstrapcdn.com/#fontawesome
	 * @author FAT Media
	 */
	function prefix_enqueue_awesome() {
		wp_enqueue_style( 'prefix-font-awesome', '//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.min.css', array(), '4.0.3' );
	}
   ?>


For Layout
=============
<?php
|| style.css

/*
Theme Name: LenzKarft
Theme URI: http://fsb.com.bd/
Description: A clean theme completely compatible with WordPress 4.1
Author: FSB
Author URI: http://fsb.com.bd/
Version: 1.4
*/
--------------------------
?>

|| header
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en-US">

<!-- BEGIN html head -->
	<head profile="http://gmpg.org/xfn/11">
		<meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('charset'); ?>" />
		<meta name="viewport" content="width=device-width">
		<title><?php bloginfo('name'); ?> <?php wp_title(); ?></title>
		<link rel="stylesheet" type="text/css" media="all" href="<?php bloginfo('stylesheet_url'); ?>" />
		<?php wp_head(); ?>		
	</head>
<!-- END html head -->

<!-- Start Body from here -->
	<body>
		<div id="wrapper">
			<div id="header"></div>
------------------------------------


|| Footer	
			<div class="clear"></div>
			<div id="footer"></div>
		</div><!-- End wrapper-->
	</body><!-- End Body -->
</html>
------------------------------------
|| if this get css, you have to go wordpress>wp-includes>admin-bar.php
search this: /*function _admin_bar_bump_cb()*/

html{margin-top:32px;}

--------------------------------------------

Custom page Create
==================
1st step: include this in custom page
<?php 
/*
 Template name:Demo
*/
get_header() ;

?>

2nd step: Then go to backend add new page > right side > page attribute > Template

---------------------------------------------------------------------------------

Custom widget page Create
==========================
1st step: include this in custom page

<?php 
get_header() ;
/*
Template Name:demo_2;
*/
?>

2nd step: Then go to backend add new page> right side> page attribute>Template

3rd step:
<?php
function twentythirteen_widgets_init() {
    register_sidebar( array(
   	 'name'      	=> __( 'Main Widget Area', 'twentythirteen' ),
   	 'id'        	=> Demo2',
   	 'description'   => __( 'Appears in the footer section of the site.', 'twentythirteen' ),
   	 'before_widget' => '<aside id="%1$s" class="widget %2$s">',
   	 'after_widget'  => '</aside>',
   	 'before_title'  => '<h3 class="widget-title">',
   	 'after_title'   => '</h3>',
    ) );
}

?>

4th step: go to backend widgets>
--------------------------------------------------------
Register widget areas.
==========================
<?php
/**
 * Register widget areas.
 */
function twentyfourteen_widgets_init() {
	
	register_sidebar( array(
		'name'          => __( 'Primary Sidebar', 'twentyfourteen' ),
		'id'            => 'sidebar-1',
		'description'   => __( 'Main sidebar that appears on the left.', 'twentyfourteen' ),
		'before_widget' => '<aside id="%1$s" class="widget %2$s">',
		'after_widget'  => '</aside>',
		'before_title'  => '<h1 class="widget-title">',
		'after_title'   => '</h1>',
	) );
	register_sidebar( array(
		'name'          => __( 'Content Sidebar', 'twentyfourteen' ),
		'id'            => 'sidebar-2',
		'description'   => __( 'Additional sidebar that appears on the right.', 'twentyfourteen' ),
		'before_widget' => '<aside id="%1$s" class="widget %2$s">',
		'after_widget'  => '</aside>',
		'before_title'  => '<h1 class="widget-title">',
		'after_title'   => '</h1>',
	) );
	register_sidebar( array(
		'name'          => __( 'Footer Widget Area', 'twentyfourteen' ),
		'id'            => 'sidebar-3',
		'description'   => __( 'Appears in the footer section of the site.', 'twentyfourteen' ),
		'before_widget' => '<aside id="%1$s" class="widget %2$s">',
		'after_widget'  => '</aside>',
		'before_title'  => '<h1 class="widget-title">',
		'after_title'   => '</h1>',
	) );
}
add_action( 'widgets_init', 'twentyfourteen_widgets_init' );
?>
---------------------------------------------------------------

Pages based Navigation Menu
===============================
<!-- Start Navigation Menu -->
	<div id="nav-menu">
		<ul>
			<li class="page_item"><a class="first" href="<?php bloginfo('url'); ?>" title="<?php bloginfo('description'); ?>"><?php _e('Home', 'w3p'); ?></a></li>
			<?php wp_list_pages('sort_column=menu_order&depth=1&title_li='); ?>
		</ul>
	</div>
<!-- End Navigation Menu -->


Dashboard Appearance > Menu
================================
<!-- This code include in functions.php file-->
	<?php
		add_action('admin_menu', 'my_plugin_menu');
		
		function my_plugin_menu() {
			add_theme_page('My Plugin Theme', 'My Plugin', 'edit_theme_options', 'my-unique-identifier', 'my_plugin_function');
		}
	?>

Appearance menu show in header.php file
========================================
<?php wp_nav_menu(array('theme_location' => 'primary', 'container_class' => 'w3-menu', 'container' => 'nav')); ?>

Page Content anywhere
========================
<?php
	$id = 20;
	$p = get_page($id);
	echo apply_filters('the_content', $p->post_content);
?>

ALL post show
=====================
<?php if ( have_posts() ) : while ( have_posts() ) : the_post();
	the_content();
	endwhile; else: ?>
	<p>Sorry, no posts matched your criteria.</p>
<?php endif; ?>

Single post show By ID
=======================
---Post Title---
<?php echo get_the_title($ID); ?> 

---Only Post----
<?php
	$my_postid = 1;//This is page id or post id
	$content_post = get_post($my_postid);
	$content = $content_post->post_content;
	$content = apply_filters('the_content', $content);
	$content = str_replace(']]>', ']]&gt;', $content);
	echo $content;
?>

css3 Vertical Menu

1.html

<html>
    <head>
        <title>Dropdown menu</title>
    </head>
    <body>
        <div id="menu">
            <ul>
                <li><a href="javascript:;" class="link_newproduct">Home</a></li>
                <li><a href="javascript:;">Womens wear</a>
                    <ul>
                        <li><a href="javascript:;">SHAREE</a></li>
                        <li><a href="javascript:;">KAMIZ</a></li>
                        <li><a href="javascript:;">STICHED DRESS</a></li>
                        <li><a href="javascript:;">KURTA</a></li>
                        <li><a href="javascript:;">UNSTICHED DRESS</a></li>
                        <li><a href="javascript:;">PANJABEE</a></li>
                        <li><a href="javascript:;">FATUA</a></li>
                    </ul>
                </li>
                <li><a href="javascript:;">Mens wear</a>
                    <ul>
                        <li><a href="javascript:;">Shirt</a></li>
                        <li><a href="javascript:;">Pant</a></li>
                        <li><a href="javascript:;">FATUA</a></li>
                        <li><a href="javascript:;">T-Shirt</a></li>
                    </ul>
                </li>
                <li><a href="javascript:;">Girls wear</a>
                    <ul>
                        <li><a href="javascript:;">KAMIZ</a></li>
                        <li><a href="javascript:;">STICHED DRESS</a></li>
                        <li><a href="javascript:;">FATUA</a></li>
                        <li><a href="javascript:;">SHAREE</a></li>
                    </ul>
 
                </li>
                <li><a href="javascript:;">West rang</a>
                    <ul>
                        <li><a href="javascript:;">Kamiz</a></li>
                        <li><a href="javascript:;">T-shirt</a></li>
                        <li><a href="javascript:;">Shirt</a></li>
                        <li><a href="javascript:;">Panjabee</a></li>
 
                    </ul>
                </li>
            </ul>
        </div>
    </body>
</html>

2.css

#menu {
  border-bottom: 1px solid #ff9a02;
  border-top: 1px solid #ff9a02;
  float: left;
  background: #FFC107;
}

#menu ul {
  margin: 0;
  padding: 0;
}

#menu li {
  list-style: none outside none;
  padding: 0;
  position: relative;
  border-right: 1px solid #FFEB00;
}

#menu ul li:hover ul {
  visibility: visible;
}

#menu ul li ul {
  position: absolute;
  visibility: hidden;
  background: none repeat scroll 0 0 #FFC107;
  z-index: 9999999;
  padding: 0;
  top: 26%;
  left: 102%
}

#menu li a {
  color: #AF1D1D;
  display: block;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 13px;
  letter-spacing: 1px;
  text-align: left;
  padding: 12px 17px;
  text-transform: uppercase;
  text-decoration: none;
}

#menu ul li ul li {
  border-bottom: 1px solid #fff;
}

#menu ul li ul li a {
  font-size: 12px !important;
  width: 145px;
  color: #000;
}

#menu ul li ul li a:hover {
  color: #fff;
}

Output:
vertical-menu

css3 Dropdown Menu

1.html

<html>
	<head>
		<title>Dropdown menu</title>
	</head>
	<body>
		<div id="menu">
			<ul>
				<li><a href="javascript:;" class="link_newproduct">Home</a></li>
				<li><a href="javascript:;">Womens wear</a>
					<ul>
						<li><a href="javascript:;">SHAREE</a></li>
						<li><a href="javascript:;">KAMIZ</a></li>
						<li><a href="javascript:;">STICHED DRESS</a></li>
						<li><a href="javascript:;">KURTA</a></li>
						<li><a href="javascript:;">UNSTICHED DRESS</a></li>
						<li><a href="javascript:;">PANJABEE</a></li>
						<li><a href="javascript:;">FATUA</a></li>
					</ul>
				</li>
				<li><a href="javascript:;">Mens wear</a>
					<ul>
						<li><a href="javascript:;">Shirt</a></li>
						<li><a href="javascript:;">Pant</a></li>
						<li><a href="javascript:;">FATUA</a></li>
						<li><a href="javascript:;">T-Shirt</a></li>
					</ul>
				</li>
				<li><a href="javascript:;">Girls wear</a>
					<ul>
						<li><a href="javascript:;">KAMIZ</a></li>
						<li><a href="javascript:;">STICHED DRESS</a></li>
						<li><a href="javascript:;">FATUA</a></li>
						<li><a href="javascript:;">SHAREE</a></li>
					</ul>

				</li>
				<li><a href="javascript:;">West rang</a>
					<ul>
						<li><a href="javascript:;">Kamiz</a></li>
						<li><a href="javascript:;">T-shirt</a></li>
						<li><a href="javascript:;">Shirt</a></li>
						<li><a href="javascript:;">Panjabee</a></li>

					</ul>
				</li>
			</ul>
		</div>
	</body>
</html>

2.css

#menu {
  border-bottom: 1px solid #ff9a02;
  border-top: 1px solid #ff9a02;
  float: left;
  background: #FFC107;
}

#menu ul {
  margin: 0;
  padding: 0;
}

#menu li {
  float: left;
  list-style: none outside none;
  padding: 0;
  position: relative;
  border-right: 1px solid #FFEB00;
}

#menu ul li:hover ul {
  visibility: visible;
}

#menu ul li ul {
  position: absolute;
  visibility: hidden;
  background: none repeat scroll 0 0 #FFC107;
  z-index: 9999999;
  padding: 0;
}

#menu li a {
  color: #AF1D1D;
  display: block;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 13px;
  letter-spacing: 1px;
  text-align: left;
  padding: 12px 17px;
  text-transform: uppercase;
  text-decoration: none;
}

#menu ul li ul li {
  border-bottom: 1px solid #fff;
}

#menu ul li ul li a {
  font-size: 12px !important;
  width: 145px;
  color: #000;
}

#menu ul li ul li a:hover {
  color: #fff;
}

Output:
dropdown-menu