Monday, 11 January 2016

Setting various environments (development, production) based on the URL


<?php


    define('DEVELOPMENT', 'localhost');
    define('PRODUCTION', '');
    $message = "";
    switch ($_SERVER['SERVER_NAME']) {
      case DEVELOPMENT:
        // Condition for localhost server
        $localhost = "localhost";
        $username = "root";
        $password = "";
        $database = "test";
        break;
    default:
        // live server
        $localhost = "Enter live hostname";
        $username = "Enter live username";
        $password = "Enter live password";
        $database = "Enter live database name";
        break;
    }
$GLOBALS['connection'] = new mysqli($localhost, $username, $password, $database);

if($GLOBALS['connection'])
{
     echo "connected";
}
else{
     echo mysqli_error();
}


?>

Thursday, 7 January 2016

how to reduce server side validation code in php


You can do server side validation code in if...else condition also.
But below code will reduce your code in server side validation also gives result with comma(,).
Run this code and you see magic.
Here, validation will check only for four fields. Not for Phone number.

Example : First name, Middle name, Last name, Email is require.


// Database query
CREATE DATABASE `test` /*!40100 DEFAULT CHARACTER SET latin1 */

// Table query
CREATE TABLE `candidate1` (
 `id` int(11) NOT NULL AUTO_INCREMENT,
 `site_id` int(11) NOT NULL DEFAULT '0',
 `last_name` varchar(64) ,
 `first_name` varchar(64) ,
 `middle_name` varchar(32) ,
 `phone_home` varchar(40) ,
 `email1` varchar(128),

 PRIMARY KEY (`id`)
)

Form1.php
<?php
if(isset($_POST['job_form_submit']))
{
    $first_name = $_REQUEST['first_name'];
    $middle_name = $_REQUEST['middle_name'];
    $last_name = $_REQUEST['last_name'];
    $email1 = $_REQUEST['email'];
    $phone_home = $_REQUEST['phone_home'];

    $result = '';
    //Validations
    $fields = array('first_name'=>$first_name,'middle_name'=>$middle_name, 'last_name'=>$last_name, 'email'=>$email1);
    foreach($fields as $key => $val) {
      if(empty($val)){
          $result .= ucfirst (str_replace("_"," ",$key)) . ", ";
      }
     }
     if(empty($result)){
        // insert values in candidate table
        $insert = mysqli_query($conn, "insert into candidate(first_name, middle_name, last_name, email1, phone_home) values ('".$first_name."', '".$middle_name."', '".$last_name."', '".$email1."', '".$phone_home."')");       
        if ($insert) {
        echo "New record created successfully";
        } else {
            echo "Error: ".mysqli_error($conn);
        }
        $conn->close();
     }
     else{
        echo rtrim($result,", ")." is require.";
    }   
}

?>

<form name="" method="post" id="frm_job" action="">
  <!-- Start: First Name -->
  <fieldset class="form-group">
    <label for="firstname">First Name</label>
    <input type="text" name="first_name" value="" class="form-control" id="txt_firstname" placeholder="Enter First Name">
  </fieldset>
  <!-- End: First Name -->

  <!-- Start: Middle Name -->
  <fieldset class="form-group">
    <label for="middlename">Middle Name</label>
    <input type="text" name="middle_name" value="" class="form-control" id="txt_middlename" placeholder="Enter Middle Name">
  </fieldset>
  <!-- End: Middle Name -->
 
  <!-- Start: Last Name -->
  <fieldset class="form-group">
    <label for="lastname">Last Name</label>
    <input type="text" name="last_name" value=""class="form-control" id="txt_lastname" placeholder="Enter Last Name">
  </fieldset>
  <!-- End: Last Name -->
 
  <!-- Start: Email -->
  <fieldset class="form-group">
    <label for="email">Email</label>
    <input type="text" name="email" value="" class="form-control" id="txt_email" placeholder="Enter Email">
  </fieldset>
  <!-- End: Email -->
 
  <!-- Start: Home Phone -->
  <fieldset class="form-group">
    <label for="homephone">Home Phone</label>
    <input type="text" name="phone_home" value="" class="form-control" id="txt_homephone" placeholder="Enter Home Phone">
  </fieldset>
  <!-- End: Home Phone -->
 
  <button type="submit" value="submit" name="job_form_submit" class="btn btn-primary">Submit</button>
  <button type="reset" class="btn btn-default">Reset</button>
</form>

Saturday, 29 August 2015

Turn off error reporting

error_reporting(0);
//write this on top of the page

http://www.w3schools.com/php/func_error_reporting.asp

change color when u select TEXT

/* Mozilla based browsers */
::-moz-selection {
background-color: #FFA;
color: #000;
}

/* Works in Safari */
::selection {
background-color: #FFA;
color: #000;
}


http://css-tricks.com/overriding-the-default-text-selection-color-with-css/

decimal number settings

$total_of_product = $order_info['total'];
echo $total_db = number_format($total_of_product, 2, '.', '');

how to add FONT in wordpress

------------insert in style.css
@font-face {
font-family: 'MuseoSlab';
src: url('http://localhost:81/wordpress/fonts/Museo_Slab_500_2-webfont.eot');
src: url('http://localhost:81/wordpress/fonts/Museo_Slab_500_2-webfont.eot?#iefix') format('embedded-opentype'),
url('http://localhost:81/wordpress/fonts/Museo_Slab_500_2-webfont.woff') format('woff'),
url('http://localhost:81/wordpress/fonts/Museo_Slab_500_2-webfont.ttf') format('truetype'),
url('http://localhost:81/wordpress/fonts/Museo_Slab_500_2-webfont.svg#MuseoSlab') format('svg');
font-weight: normal;
font-style: normal;
}


http://www.fontspring.com/support/installing_webfonts/how-do-i-use-the-webfonts

download WORDPRESS paid themes in free OF COST

search in Google

free download nulled evolution theme for wordpress

--nulled is compulsory

--evolution is theme name

Other words are static


https://www.google.co.in/search?q=evolution+theame+for+wordpress&ie=utf-8&oe=utf-8&gws_rd=cr&ei=VKW8VO6SEsmj8AX5lIDQCw#q=free+download+nulled+evolution+theme+for+wordpress

Add various color in various pages WORDPRESS

--> Add this code in custom.js

function scan() {
var images = ['#fdc300','#d1d82f','#ffe47f','#73d1cc','#85c9f0'];
var inumber = Math.floor((Math.random()* images.length)+1);

var random_image = images[inumber-1];

//Do whatever you want with random_image
//alert( random_image ); //Shows the random image
$('#main-area').css('background-color', random_image);
}
$(document).ready( scan() );


http://akaapoint.fi/

install nulled phpfox from web (install in localhost)

http://www.my.foxsearch.in/phpfox-v3-7-7-build-2/

Run your site from http://localhost:81/Social_Web/DG-pf372/upload/ <---


Steps for install in localhost
1) check --> install folder <-- in DG-pf372\upload\..........
2) http://localhost:81/Social_Web/DG-pf372/upload/install/
3) Steps same as wordpress theme
4) go to path --> DG-pf372\upload\include\setting
Rename server.sett.php.new into server.sett.php & security.sett.php.new into security.sett.php
5) Continue other steps...
6) After completing all steps go to login page and login with email address and pwd which you given here...
7) RENAME -->install folder<-- path is DG-pf372\upload\include\setting\........

--> Enable chat module in phpfox
1) Go to http://localhost:81/Social_Web/DG-pf372/upload/index.php?do=/admincp/module/
2) Login with username and password, which you used in installation time....
3) Go to Admin CP --> Extension --> Manage Modules --> Search ""Im ""--> manage settings and First option """Set to True to enable the Instant Messenger to be part of the site wide footer bar."""Select True ---> Submit

CKeditor ++ for Wordpress

How to set height property for SPAN tag

-->display:inline-block<--


#contentbox {

display: inline-block;
    
border: 2px solid #e3e3e3;
    border-radius: 7px;
    font-family: Arial,Helvetica,sans-serif;
    font-size: 14px;
    height: 28px;
    margin-bottom: 6px;
    min-height: 37px;
    text-align: left;
    width: 458px;
}

Change theme in phpfox

Change theme in phpfox
1) Extensions --> Manage Theme
2) Right click on Default --> Manage Styles --> Make green button in Default section (on Right side)(Green=Active)

Offline Creadit Card details for testing

Credit Card Number : 4111111111111111 ( 4 and 1 in 15 times)
CVV : 123
Valid Through : select any month and year
Firstname : Terry
Lastname : C

check string from URL in php

$url = 'http://' . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'];


if (false !== strpos($url,'access_denied')) {
header('Location: http://prodygies.com/');
}

yiichat extension video for PHPYII framework

Friday, 11 April 2014

code is working in fiddle but not working in my system

If your code is not working in jsfiddle.net , then write your code in ready function, Like...

$(document).ready(function(){

// code here


});

Thursday, 10 April 2014

Hide 2 Textbox When clicking on 1 Radio box

 

radio_example.php

   <input type="radio" class="radioBtn" name="radioBtn" id="radio1" /> radio 1 &nbsp;
   <input type="radio" class="radioBtn" name="radioBtn" id="radio2" /> radio 2 &nbsp;
   <input type="radio" class="radioBtn" name="radioBtn" id="radio3" /> radio 3

   <br />
   <input type="text" class="textBox" id="text1" value="text 1" /> &nbsp;
   <input type="text" class="textBox" id="text2" value="text 2" /> &nbsp;
   <input type="text" class="textBox" id="text3" value="text 3" />


radio_js.js

$(".radioBtn").click(function()
     {
      //  $(".textBox").hide();
        if ($(this).attr("id") == "radio1") {
            $("#text1").show();
            $("#text2").css('display','none');
        } else if ($(this).attr("id") == "radio2") {
            $("#text2").show();
        } else if(($("#text1").hide()) && ($("#text2").hide()))
        {
             $("#text3").show();
        }
    });

Thursday, 29 August 2013




If
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

Is equal to
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26

Then
H+A+R+D+W+O+R+K =
8+1+18+4+23+15+18+11 =
98%...


K+N+O+W+L+E+D+G+E =
11+14+15+23+12+5+4+7+5 =
96%

L+O+V+E=
12+15+22+5=
54%

L+U+C+K =
12+21+3+11 =
47%

None of them makes 100%
Then what makes 100% ???

Is it Money?
NO !!!

Leadership?
NO !!!

Every problem has a solution,
only if we perhaps change our
"ATTITUDE".

It is OUR ATTITUDE towards Life and Work that makes
OUR Life 100% Successful..

A+T+T+I+T+U+D+E =
1+20+20+9+20+21+4+5 =
100%

Tuesday, 13 August 2013




The First Letter In Your Name
predicts your Character: ??
A― Romantic
B― Proud
C― Innocent
D― Lovable
E― Gud but Hurt full
F― Compassionate
G― Logical Minded
H― Leadership Potential
I― Helpful
J― Free- spirited
K― irritating
L― Funny
M― Emotional
N― Sensible
O― Supportive
P― Crazy 
Q―Unpredictable
R― Practical
S― Loving
T― Fake
U― Sensitive
V― Genius
W― Calm
X― Easy-Going
Y. Intelligent
Z― Jovial
Whats yours CoMmENT fast ?