Get browser properties without browscap in php

There are several methods to get browser properties. php get_browser function is very useful as it return many browser properties.but In for get_browser to work, your browscap configuration setting in php.ini must point to the correct location of the browscap.ini file on your system. Continue reading “Get browser properties without browscap in php”

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

Key Default value Description
show_password true Whether you want to show the password field in preview
extratext ‘Do You Want To submit’ Extra text before confirmation buttons
yes yes Button Label for yes button
no no Button Label for no button
title Please preview Title 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