Thursday, December 11, 2014

Register Confirm Using Mail

create 4 page

1. login.php
2. register.php
3. verify.php
4. Confirm.php






$name = trim(mysql_escape_string($_POST['name']));
$email = trim(mysql_escape_string($_POST['email']));
$passwords = trim(mysql_escape_string($_POST['pwd']));
$password = md5($passwords);

$query_verify_email = "SELECT * FROM register WHERE email ='$email' and isactive = 1";
$verified_email = mysqli_query($con,$query_verify_email);
if (!$verified_email) {
echo ' System Error';
if (mysqli_num_rows($verified_email) == 0) {
// Generate a unique code:
$hash = md5(uniqid(rand(), true));
$query_create_user = "INSERT INTO `register` ( `name`, `email`, `password`, `hash`) VALUES ( '$name', '$email', '$password', '$hash')";
$created_user = mysqli_query($con,$query_create_user);
if (!$created_user) {
echo 'Query Failed ';

if (mysqli_affected_rows($con) == 1) { //If the Insert Query was successfull.

$subject = 'Activate Your Email';

$headers = "From: \r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
$url= BASE_PATH . '/verify.php?email=' . urlencode($email) . "&key=$hash";

$message ='<p>To activate your account please click on Activate buttton</p>';
$message.='<table cellspacing="0" cellpadding="0"> <tr>';
$message .= '<td align="center" width="300" height="40" bgcolor="#000091" style="-webkit-border-radius: 5px; -moz-border-radius: 5px; border-radius: 5px;

color: #ffffff; display: block;">';

$message .= '<a href="'.$url.'" style="color: #ffffff; font-size:16px; font-weight: bold; font-family: Helvetica, Arial, sans-serif; text-decoration: none;

line-height:40px; width:100%; display:inline-block">Click to Activate</a>';
$message .= '</td> </tr> </table>';

mail($email, $subject, $message, $headers);

echo '<div>A confirmation email
has been sent to <b>'. $email.' </b> Please click on the Activate Button to Activate your account </div>';
} else { // If it did not run OK.
echo '<div>You could not be registered due to a system
error. We apologize for any
echo '<div>Email already registered</div>';}



$email = trim(mysql_escape_string($_GET['email']));

$key = trim(mysql_escape_string($_GET['key']));

$query_verify_email = "SELECT * FROM register WHERE email ='$email' and isactive = 1";
$result_verify_email = mysqli_query($con,$query_verify_email);

if (mysqli_num_rows($result_verify_email) == 1)
echo '<div>Your Account already exists. Please <a href="login.html">Login Here</a></div>';


if (isset($email) && isset($key))


mysqli_query($con, "UPDATE register SET isactive=1 WHERE email ='".$email."' AND hash='".$key."' ") or die(mysql_error());

if (mysqli_affected_rows($con) == 1)
echo '<div>Your Account has been activated. Please <a href="login.html">Login Here</a></div>';

} else
echo '<div>Account couldnot be activated.</div>';



Read more....

Sunday, November 30, 2014

Difference between MyISAM and InnoDB.

difference between MyISAM and InnoDB.

The main differences between InnoDB and MyISAM are support for "referential integrity" and "transactions".
If you need the database to enforce foreign key constraints, or you need the database to support then you would choose the InnoDB engine, since these features are absent from the MyISAM engine.
Those are the two biggest differences. Another big difference is concurrency. With MyISAM, a DML statement will obtain an exclusive lock on the table, and while that lock is held, no other session can perform a SELECT or a DML operation on the table.
Those two specific engines you asked about (InnoDB and MyISAM) have different design goals. MySQL also has other storage engines, with their own design goals.
So, in choosing between InnoDB and MyISAM, the first step is in determining if you need the features provided by InnoDB. If not, then MyISAM is up for consideration.
A more detailed discussion of differences is rather impractical (in this forum) absent a more detailed discussion of the problem space... how the application will use the database, how many tables, size of the tables, the transaction load, volumes of select, insert, updates, concurrency requirements, replication features, etc.

1.    MYISAM supports Table-level Locking
2.    MyISAM designed for need of speed
3.    MyISAM does not support foreign keys hence we call MySQL with MYISAM is DBMS
4.    MyISAM stores its tables, data and indexes in diskspace using separate three different files. (tablename.FRM, tablename.MYD, tablename.MYI)
5.    MYISAM not supports transaction. You cannot commit and rollback with MYISAM. Once you issue a command it’s done.
6.    MYISAM supports fulltext search
7.    You can use MyISAM, if the table is more static with lots of select and less update and delete.

1.    InnoDB supports Row-level Locking
2.    InnoDB designed for maximum performance when processing high volume of data
3.    InnoDB support foreign keys hence we call MySQL with InnoDB is RDBMS
4.    InnoDB stores its tables and indexes in a tablespace
5.    InnoDB supports transaction. You can commit and rollback with InnoDB


How to convert all tables from MyISAM into InnoDB?


      // connectivity with your database here first



        WHERE TABLE_SCHEMA = 'your_database_name'

        AND ENGINE <> 'InnoDB'";

    $rs = mysql_query($sql);

    while($row = mysql_fetch_array($rs))


        $tbl = $row[0];

        $sql = "ALTER TABLE $tbl ENGINE=INNODB";




Read more....

Monday, November 24, 2014

IP store in a File

keep IP  from visitors and place them on a file.

$file = fopen("ip.txt","a");
echo fwrite($file,$ip);
this store in a file as name ip.txt
the second parameter can use "w" if you want only write mode 
"a" stands for append mode .
Read more....


<pre class="brush: csharp">// Comment
public class Testing {
public Testing() {
public void Method() {
/* Another Comment
on multiple lines */
int x = 9;
Read more....

Upgrade Apache in Linux server

Upgrade Apache in Linux server

After the installation you have to enable SSL in httpd.conf. and generate server.crt and server.key file. Below the complete procedure :

1. Download Apache

cd /usr/src
tar xvf httpd-2.4.7.tar.gz

2. Download APR and APR-Util
cd /usr/src
tar xvf apr-1.4.6.tar.gz
tar xvf apr-util-1.5.3.tar.gz
Now put the APR and APR-Util you downloaded into your apache source files.
mv apr-1.4.6 /usr/src/httpd-2.4.7/srclib/apr
mv apr-util-1.5.3 /usr/src/httpd-2.4.7/srclib/apr-util

cd /usr/src/httpd-2.4.7
./configure --enable-so --enable-ssl --with-mpm=prefork --with-included-apr
make install
4. Enable SSL in httpd.conf
Apache configuration file httpd.conf is located under /usr/local/apache2/conf.
nano /usr/local/apache2/conf/httpd.conf
Uncomment the httpd-ssl.conf Include line and the LoadModule ssl_module line in the /usr/local/apache2/conf/httpd.conf file :
# LoadModule ssl_module modules/
# Include conf/extra/httpd-ssl.conf
View the httpd-ssl.conf to review all the default SSL configurations. For most cases, you don’t need to modify anything in this file.
nano /usr/local/apache2/conf/extra/httpd-ssl.conf
The SSL certificate and key are required before we start the Apache. The server.crt and server.key file mentioned in the httpd-ssl.conf needs to be created before we move forward.
cd /usr/local/apache2/conf/extra
egrep 'server.crt|server.key' httpd-ssl.conf

SSLCertificateFile "/usr/local/apache2/conf/server.crt"
SSLCertificateKeyFile "/usr/local/apache2/conf/server.key"
5. Generate server.crt and server.key file
First, Generate the server.key using openssl.
cd /usr/src
openssl genrsa -des3 -out server.key 1024
The above command will ask for the password. Make sure to remember this password. You need this while starting your Apache later.
Next, generate a certificate request file (server.csr) using the above server.key file.
openssl req -new -key server.key -out server.csr
Finally, generate a self signed ssl certificate (server.crt) using the above server.key and server.csr file.
openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt
Copy the server.key and server.crt file to appropriate Apache configuration directory location.
cp server.key /usr/local/apache2/conf/
cp server.crt /usr/local/apache2/conf/
6. Start Apache
/usr/local/apache2/bin/apachectl start
If you are getting the below error message :
AH00526: Syntax error on line 51 of /usr/local/apache2/conf/extra/httpd-ssl.conf:
Invalid command 'SSLCipherSuite', perhaps misspelled or defined by a module not included in the server configuration
Make sure to uncomment the line shown below in httpd.conf :
vi /usr/local/apache2/conf/httpd.conf

# LoadModule socache_shmcb_module modules/
Finally, this will prompt you to enter the password for your private key before starting up the apache. Verify that the Apache httpd process is running in the background.
ps -ef | grep http
You should see something like that :
root 29529 1 0 13:08 ? 00:00:00 /usr/local/apache2/bin/httpd -k start
charly 29530 29529 0 13:08 ? 00:00:00 /usr/local/apache2/bin/httpd -k start
charly 29531 29529 0 13:08 ? 00:00:00 /usr/local/apache2/bin/httpd -k start
charly 29532 29529 0 13:08 ? 00:00:00 /usr/local/apache2/bin/httpd -k start
root 29616 18260 0 13:09 pts/0 00:00:00 grep http
By default Apache SSL runs on 443 port. Open a web browser and verify that you can access your Apache using https://{your-ip-address}

Read more....

Monday, October 13, 2014

wamp server not work

wamp server not work but server is online my wamp server 2.4



1.Quit your skype and then again restart your wamp

Problem Not solved ? 


step 2

Solution for MSVCR100.dll is missing when WAMP server install

This MSVCR100.dll is missing when WAMP server install problem mostly happen when you install new ‘Operating system’. It’s a general problem but its soved easily  follow the next steps
Step 1.
That MSVCR100.dll file is one part of Microsoft Visual C++. IF this component is missing means, ‘Apache Server’ won’t run. So, download following exe file and just install that. It’s enough for MSVCR100.dll is missing when WAMP server install problem.
For Windows 32 bit OS:
Microsoft Visual C++ 2008 SP1 Redistributable Package (x86)

Microsoft Visual C++ 2010 SP1 Redistributable Package (x86)

Here just select your Language and click ‘Download’ Button. You will get ‘vcredist_x86.exe’ file. Just Download that file and install as usual( double click ).
windows 64

restart PC and check
If the problem is not solved yet the follow step 3


3 changeWampServer port

Sometimes wamp server

WampServer is a Windows web development environment. It allows you to createweb applications with Apache2, PHP and a MySQL database. This post basically explain how to change WampServer Port. The reason we need to changeWampServer port to avoid the same port used for IIS (Internet Information Services) or Xampp which results in failure of installation or running the application perfectly.

Here is steps taken to change the port for WampServer

1. After installation, left click the wamp icon
2. Go to “apache” and choose “httpd.conf”
3. Find the word “Listen 80″ 
4. Replace with “Listen 8080″.

Take note that 8080 is an example of port number. Feel free to pick any number to be the port number for WampServer.

5. Save the file and restart the application

6. Use http://localhost:8080 to access the WampServer

Thank You

Read more....
Related Posts Plugin for WordPress, Blogger...