preview form before submit jquery plugin

preview form before submit is a common idea. idea of making such a plugin comes in my mind when i was working on a cake project and client ask me to do it.developer needs such a plugin most of the time and don’t like to write the same code in php js or jquery again and again.

preview before submit

What is it ?

previewForm is a tool for displaying form content before it goes to the server for processing.This plugin provides users to confirm the data before they are going to sumit it.
It was built using the jQuery library. Licensed under both MIT and GPL licenses

Demo

Feature

  • Preview the value of textbox.
  • Preview the value of selectbox.
  • Preview the value of radiobox and checkbox.
  • Preview password field if option selected.

Example

Example 1 With password preview.

Example 2 with password disable.

How to Use

 

1. First, make sure you are using valid DOCTYPE and correct form structure.

Your form must contain for tag of label with corresponding id of the field.
sample is
clip_image002

2. Include jQuery and previewForm JS files.

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.10/jquery.min.js"></script>

<script type="text/javascript" src=”previewForm / previewForm.js"></script>

 

3. Add previewForm CSS file

4. Fire plugin using jQuery selector

<script type="text/javascript">
$(document).ready(function() {
	$('#myform').previewForm({ show_password : false });
});
</script>

 

API & Options

KeyDefault valueDescription
show_passwordtrueWhether you want to show the password field in preview
extratext‘Do You Want To submit’Extra text before confirmation buttons
yesyesButton Label for yes button
nonoButton Label for no button
titlePlease previewTitle of preview dialog

Demo

Download

reset wordpress admin password

forget wordpress admin password. no worry , there is a simple way how to reset wordpress admin password.

cms don’t use plain text to store the password. WordPress stores its password using md5 encryption in mysql database.
Here is some simple steps to reset wordpress admin password from phpmyadmin .

Continue reading “reset wordpress admin password”

Reset drupal 7 admin password

One of my developer left the drupal project in middle, he didn’t told me the drupal admin password.After long search i get the code to reset drupal 7 admin password.This trick will works if you have access to ftp and database of your server.

well in previous version of drupal you can easy reset the password using md5 hash but in drupal 7 it use salted sha512 hash, so to get salted sha512 hash of your password you need to follow some steps

Steps To Reset Drupal 7 admin password

  1. Create a reset.php with your text editor or developer ide.Place the content write below in it.
    <?php define('DRUPAL_ROOT', getcwd());
     require_once DRUPAL_ROOT . '/includes/bootstrap.inc';
     drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
     require_once 'includes/password.inc';
     echo user_hash_password('my_new_password');
    die();
    menu_execute_active_handler(); ?>

    Replace the “my_new_password” with the password you want to set.

  2. Upload this file in root of your drupal project.
  3. Access this file from browser.You will get the hash of your password.
    Copy the password hash.
  4. Open phpmyadmin. Goto your drupal database.

    if you don’t know what database your drupal is using then open configuration file at sites/default /settings.php
    and find database name in $databases variable.

    After that either execute the following query[sql]UPDATE users SET pass = md5(‘password hash’) WHERE uid = 1;[/sql]or proceed further.

  5. Click on the users table.
    edit the admin row.

  6. Paste the password hash in pass field.

Now Login With Your New Password

4 ways to import large file in phpmyadmin

In phpmyadmin either by wamp , lamp , mamp or cpanel is always a time consuming and tedious, in this post i will share 4 ways to import large file in phpmyadmin or in mysql
you may get the following errors while uploading large file in phpmyadmin

Fatal error: Maximum execution time of 30 seconds exceeded

Fatal error: Allowed memory size of —– bytes exhausted

let us resolve this issue and duscuss the ways to import large files in mysql with cpanel, wamp and lamp.

4 ways to import large file in phpmyadmin with

  1. By editing php.ini
  2. Using php script BigDump
  3. Use of Command Line SSH to upload sql
  4. Using split and compress Method

1. Use of php.ini to large database import

This method will work on wamp, xamp , manp and lamp

  • find your php.ini file
  • goto the line upload_max_filesize
  • set its value to 500M (for 500 mb)
  • Now got the line post_max_size
  • Set its value to 500M
  • Now goto the line max_execution_time
  • Set its value to 300 or 500

to import large sql in cpanel , if your server allow to edit the php.ini you can do the above method

2. Using BigDump php script

In this method you have to upload the dump sql file in server via ftp (like filezila).

  • Create a directory db_upload in your webserver
  • Upload you large dump via filezilla
  • Upload bigdump.php  via filezilla to the db_upload  directory
  • Run the bigdump.php from your browser via URL like http://www.mydomain.com/db_upload/bigdump.php
  • Wait for the script execution, do not close the browser .
  • If Timeout errors occur, adjust the $linepersession setting in this file.

More info and Download Available at here

3. Using Command Line to import database in cpanel

you can use putty for remote ssh access, after login type the following command to import the files directly into the mysql

mysql -u {DB-USER-NAME} -h {MySQL-SERVER-HOST-NAME} -p {DB-NAME} < {db.file.sql path}

remember in this case your file should be inside the server, you can upload it via filezilla

 

4. Using SQL Dump Splitter

If your max upload size is larger then your sql dump then how to Import large file in phpmyadmin ?
The answer is easy “spilt the dump file”

But in this large file how can you split and from where to split.

Well solution of problem is simple  Dump Splitter , this tool that split your sql dump files into sub files.

All you need to do is to import the file to this application, process it and then follow the instruction created by this application .

import large file phpmyadmin

This application divides your files into no. Of chunks you want.

Also this application generate an instruction file that will tell you which file you need to import first.

i.e. the file with table structure must be imported first.

Suppose the size of your sql dump file is 80MB and your server allow you to upload only 20MB at a time then.

Steps to Use SQL Dump Splitter

  1. Run sql dump splitter .
  2. Browse and select your file .
  3. Set the max upload size in this case select 19MB.
  4. Select your destination directory and execute.

After that file generate the 6 files in your destination directory 5 with max upload size i.e. 19MB.

And one help file this Readme file,
Read me file tell you out of these 5 files which one must be uploaded first.
(which one is table structure file.)

Extra tip : You can set size of chunk 40 mb and then compress the output files with zip archive

So this is simple trick to Import large file in phpmyadmin if your max upload size less then file.

Download

Login with facebook and google php script

Login with Facebook and Google is not so much tricky .In this post we will discuss about facebook and google login in php with OAuth2 and at the end of the post you can download the utility( Login with Facebook and Google php script ).login with facebook and google php script free

while i was working on this project i encountered with some errors like:

  • Fatal error: Uncaught exception ‘Google_AuthException’ with message ‘Error fetching OAuth2 access token, message: ‘invalid_grant’
  • Page is not redirect properly during facebook login.

well “Fatal error: Uncaught exception ‘Google_AuthException’” this error was nothing but confliction of google OAuth with facebook login To resolve this we use a two way switch method.
when user login with facebook then we lock Google login and when user login with google then we lock Facebook login.

before Login with Facebook and Google You need to do some task at developer account of facebook and google

At Facebook End

  • Login your facebook.
  • Go To : Facebook Apps.
  • Now create a new apps there, in section Website with Facebook login enter the url where you want the data of Facebook user.
    login with facebook free php script

Now note api key and secret.

At Google end

  • login your google account
  • Go to manage domain
  • Add and verify your domain.after verification your domain will be active.
  • Go to google console.
  • In API Access Menu Create a client id.
  • Now check on web application , Enter your Doman and callback Uri where you want the data of google user.
    login with google phpscript free

Now note api key and secret.

How To Use login with Facebook and Google KIT

  • Open the facebook.config.php
  • Paste your apps id and secret.
require_once dirname(dirname(__FILE__)).'/facebook/facebook.php';

$facebook = new Facebook(array(

'appId' =>'your apps ID',

'secret' => 'App Secret',

'cookie' => true ,

));

?>
  • For google Login open google.config.php
  • paste your site_name,oauth2_client_id,oauth2_client_secret and oauth2_redirect_uri.
global $apiConfig;
$apiConfig = array(

'site_name' => 'enter your domain name',
'oauth2_client_id' => 'client id',
'oauth2_client_secret' => 'client secret',
'oauth2_redirect_uri' => 'redirect uri',
'use_objects' => false,

for local database setup
edit config.php

$host = "your host";
$data_b ="your database name";
$db_user ="db username";
$db_pwd ="db password";

this Login with facebook and google php script is free and can be integrated with mvc system easily.
Now download for free happy coding.

Live DemoDownload