Tuesday, 14 June 2016

how to set password to particular file in the directory

Hi guys it's very simple password protect to particular file in the directory

The below code is used to protect the directory


.htaccess
==========

AuthUserFile /home/ashok/www/api/appchat/report/.htpasswd
AuthType Basic
AuthName "Ashok Only Allowed Valid User"
<Files "userreport.php">
  Require valid-user
</Files>


Here /home/ashok/www/api/appchat/report/ ======> this is file full path
.htpasswd  ======> this is htpassword file

/home/ashok/www/api/appchat/report/.htpasswd  =========> this is htpassword path with file name
userreport.php ====> that particular file name


.htpasswd
=============
together:$apr1$zcGzQRY2$n788sV7DbBEpR2t13bwnS/

together ====>user name (together)
$apr1$zcGzQRY2$n788sV7DbBEpR2t13bwnS/ ======> encrypted password(together)
username:encrypted password


The below path is used to generate .htpasswd username and password

http://www.htaccesstools.com/htpasswd-generator/

Thank you All..

how to set password to directory

Hi guys it's very simple password protect to directory

The below code is used to protect the directory


.htaccess
==========

AuthUserFile /home/ashok/www/api/appchat/report/.htpasswd
AuthType Basic
AuthName "Ashok Only Allowed Valid User"
  Require valid-user


Here /home/ashok/www/api/appchat/report/ ======> this is file full path
.htpasswd  ======> this is htpassword file

/home/ashok/www/api/appchat/report/.htpasswd  =========> this is htpassword path with file name


.htpasswd
=============
together:$apr1$zcGzQRY2$n788sV7DbBEpR2t13bwnS/

together ====>user name (together)
$apr1$zcGzQRY2$n788sV7DbBEpR2t13bwnS/ ======> encrypted password(together)
username:encrypted password


The below path is used to generate .htpasswd username and password

http://www.htaccesstools.com/htpasswd-generator/

Thank you All..

Thursday, 3 September 2015

How to track if Email open or not using php?

It is very simple Email open or not using php

We can set one image in hidden field

The image SRC should be go to our website

The mail should be stored in our database

For Example

<img src="www.get2data.com/mailupdate.php?uid=102&mailid=112">

Thursday, 14 May 2015

How to get real ip address of a client in case client using proxy server ?

function getRealIPAddr()
{
if (!empty($_SERVER['HTTP_CLIENT_IP']))   //check ip from share internet
{
$ip=$_SERVER['HTTP_CLIENT_IP'];
}
elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR']))   //to check ip is pass from proxy
{
$ip=$_SERVER['HTTP_X_FORWARDED_FOR'];
}
else
{
$ip=$_SERVER['REMOTE_ADDR'];
}
return $ip;
}

How to view Docuement via Google ?


function google_docview($file_path,$file_name)
{
$file_location=$file_path.$file_name;
echo '<iframe  src="https://docs.google.com/gview?url='.$file_location.'&amp;embedded=true" style="width:100%; height:800px; text-align:center;" frameborder="0"></iframe>';
}

Example
/*
$file_path="sscet.comli.com/L_NOTES/";
$file_name="_1378281542_notes.docx";
google_docview($file_path,$file_name);
*/

Tuesday, 28 April 2015

Difference between On Delete Cascade & On Update Cascade in mysql

My Parent Table
CREATE TABLE parent (
    id INT NOT NULL,
    PRIMARY KEY (id)
) ENGINE=INNODB;
1)

CREATE TABLE child (
    id INT, 
    parent_id INT,
    INDEX par_ind (parent_id),
    FOREIGN KEY (parent_id) 
        REFERENCES parent(id)
        ON DELETE CASCADE
) ENGINE=INNODB;

2)

CREATE TABLE child (
    id INT, 
    parent_id INT,
    INDEX par_ind (parent_id),
    FOREIGN KEY (parent_id) 
        REFERENCES parent(id)
        ON UPDATE CASCADE
) ENGINE=INNODB;

3)

CREATE TABLE child (
        id INT, 
        parent_id INT,
        INDEX par_ind (parent_id),
        FOREIGN KEY (parent_id) 
            REFERENCES parent(id)
            ON UPDATE CASCADE ON DELETE CASCADE
    ) ENGINE=INNODB;

What do these queries (1,2 & 3) mean?? Are they same???

1) means that if the parent is deleted, the child is also deleted 

2) means that if the parent primary key is changed, the child value will also change to reflect that - again in my opinion, not a great idea. If you're changing PRIMARY KEYs with any regularity (or even at all), there's something wrong with your design.

3) Means that if you update or delete the parent, the change is cascaded to the child.

Saturday, 18 April 2015

what is the use of time_sleep_until() function in php ?

The time_sleep_until() function delays execution of the current script until the specified time.

Syntax
time_sleep_until(timestamp)

Example 

Delay the execution of the current script until 10 seconds:

<?php
// wake up ten seconds from now
time_sleep_until(time()+10);
?>