Simple Effective Encryption And Decryption With PHP

Simple Effective Encryption And Decryption With PHP

As a PHP developer I was searching for encryption/decryption process to improve security of the application. The requirement was very simple. I was passing an “ID” in URL and get that ID to another page using $_GET. Now, my client didn’t want to see the actual ID on URL. So, I started searching for PHP encryption functions on www.php.net.

After trying several functions, I was not getting what I wanted because most of the time I was facing hard time to decrypt the value I passed. Then I found base64_encode() and base64_decode() functions which is very easy to use in my case. When I did little searching about this, I have found some of the threads that says it is not very effective and some one can easily mess around if he wants. Then also I decided to use these functions and just make ID value complicated. So, here what I did.

My previous url was : www.example.com?id=4 (This is without encryption and I don’t want that)

Now if I use simple base64_encode that would be like

www.example.com?id=4 would be something like

www.example.com?id=NA==

This is very easy to decrypt and one can easy understand that this is base64_encode(). So let’s make it little complicated.

If , I take any double number say for example “525325.24” and multiply it with the ID so the code would be

$u_id=(double)$_GET[‘id’] * 525325.24; (Do multiplication)

$id=base64_encode($u_id);

So, now the www.example.com?id=MjEwMTMwMC45Ng== (I think which is quite OK and hard to predict)

Now for decryption you need to do

$u_id=base64_decode($_GET[‘id’]);

$id=(double)$u_id / 525325.24; (Do Division);

and you will get the ID= “4″ in this case.

If some one try to decode it with regular process he never get the actual ID value. Because whatever he gets would be something like“2101300.96″ multiplied doubled value so according to me it is completely secure encryption/description process. Below is the full example.

=====================================================================

“encrypt.php”

<?php
function encrypt($sData){
$id=(double)$sData*525325.24;
return base64_encode($id);
}

function decrypt($sData){
$url_id=base64_decode($sData);
$id=(double)$url_id/525325.24;
return $id;
}
?>

=======================================================================

“xxx.php”

include “encrypt.php”

your php code {

…….

……….

<td><a href=http://anonymouse.org/cgi-bin/anon-www.cgi/http://staroneweb.co.in/simple-effective-encryptiondecryption-with-php/”editxxx.php?id=<?php echo encrypt($rows[‘id’]);?>”>EDIT</a></td>

}

========================================================================

“editxxx.php”

include “encrypt.php”

your php code {

if(isset($_GET[‘id’])) {

$id=decrypt($_GET[‘id’]);
}

………………..

………………..

}

=========================================================================

There might be better and efficient methods than this but I found it useful so I posted. You can leave your comments.

Website Traffic – 10 Point Action Plan To Drive Traffic To Your Website

Website Traffic – 10 Point Action Plan To Drive Traffic To Your Website

If you have just launched or are thinking of developing a new online business the chances are that you are looking for ways to promote your website. Not every strategy will be relevant for your business but try following our 10 point action plan for success:

1. Pay per Click Advertising

If you have just launched a new online business the chances are that very few people know about it. Therefore to get people visiting your website instantly try pay per click advertising. Within 15 minutes you could have potential customers visiting your website.

2. Submit your Website to Online Directories

This is part of a longer term strategy aimed at creating incoming links, which will help form the foundation of your search engine optimisation strategy. Take a look at our list of online directories.

3. Search Engine Optimisation

Many people launch a new website without carefully optimising their website for important keywords. The result is that this task is left for a couple of months, at which time the website is optimised, with subsequent results not occurring many further months down the line. Get started immediately with optimising your website.

4. Create Buzz

Are you launching an innovative business or one with a slight twist on what has gone before? Consider getting bloggers to write about your new business – the most popular place to do this is at PayPerPost.

5. Submit an Online Press Release

One of the most cost-effective ways for new businesses to generate awareness is through PR. Try writing a press release, and remember to distribute it online as well as offline.

6. Classified Ad Postings

There are many free classified websites which receive tens of thousands of hits each day. Posting an ad is almost always free and can bring in highly targeted traffic or be used as a lead generation tool. See our list of free classified advertising websites.

7. Start Social Networking

Develop a presence in one or more of the social networking websites. For example, if you have a business-to-business service consider building a profile in Academy, whereas if you have a product or service for the consumer market MySpace can work well.

8. Increase your Conversion Rate

This is one of the most neglected forms of online marketing. Once your website has been up-and-running for a while you should have statistics regarding the number of unique visitors and be able to calculate how many of those go on to register and eventually make a purchase.

To make your current marketing efforts more effective you need to convert more visitors into customers.

9. Launch an Affiliate Program

After your first couple of months in business you should have a good idea of your customer acquisition cost. This knowledge, along with having increased the conversion rate of your website, means that you can launch an affiliate programme with generous yet affordable payouts.

10. Low Cost Viral Techniques

Finally, try experimenting with various low cost viral marketing techniques. These marketing ideas could be anything from sending an e-voucher to all your current customers that they can also forward onto friends and colleagues, or providing a discount at the end of the buying process if they send your website to 5 friends.
taken from(http://www.marketingminefield.co.uk/articles/10-point-plan-drive-traffic-to-website.html)

How To Fix The WordPress Internal Server Error

How To Fix The WordPress Internal Server Error

Well, when my site was hacked and then some how I restored it but I got the “Internal server Error” when I clicked on any link. Here I found the solution of it.

This is the kind of message you will see if you have an Internal Server Error :

Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator, [email protected] and inform them of the time the error occurred, and anything you might have done that may have caused the error.

More information about this error may be available in the server error log.

Additionally, a 500 Internal Server Error error was encountered while trying to use an Error Document to handle the request

9 times out of 10, this is a simple htaccess problem and is easily resolved. For whatever reason, the .htaccess file can become corrupt (perhaps due to a plugin however many things could cause it). So all you have to do is correct your .htaccess file and you should be able to see your site again.

How To Fix The WordPress Internal Server Error

Here is what you need to do :

Back up your current .htaccess file.

Delete all of the information from your .htaccess file and save it i.e. upload a blank .htaccess file.

Your blog should now be usable again so go into the admin area and set your permalink structure again.

Open your new working .htaccess file in an editor. Now copy over all the non WordPress .htaccecss information from your old backed up .htaccess file eg. any search engine htaccess information, ip blocks etc basically everything Non-WordPress that you added before.

If you find that adding all the code from the previous .htaccess file is causing an Internal Server Error again then remove it all and enter the information back to the working .htaccess file line by line to see what is causing the problem.

Bear in mind, this might not resolve every Internal Server Error you get though if you suddenly get this error on your WordPress blog, this is the first thing I recommend doing before contacting your host or looking for an alternative solution.

Taken from (http://www.bloggingtips.com/2009/07/05/fix-wordpress-internal-server-error/)

Sms Gateway Integration In Codeigniter

Sms Gateway Integration In Codeigniter

In  CodeIgniter  It is very easy to integrate SMS facility to your application. Since SMS gateway follows different methods, here are some steps to get an idea that how you can do it.

Controller:

1.     Create Controller

2.     Now you can create a function let’s say sendSms() . In that function you can apply the following code.  Here to test you can sent the static values to check whether functions are working or not.  The commented part is the dynamic values.

3.     Write the below code to send message.

$this->load->model (‘modelname’, “sms”);

$message=’ I am xyz’;

$mobile=9999999999;

// If Mobile No and Message are  Dynamic  so write   below the line.

//$message=$this->input->post(‘Message’);

// $mobile = $this->input->post(‘mobileno’);

$this->sms->smssend($mobile,$message);

Model:

1.     Create Model.

<?php if ( ! defined(‘BASEPATH’)) exit(‘No direct script access allowed’);

class modelname extends CI_Model {

public function smssend($mobile,$message)

{

$request=’username=username &pass=123456&senderid=Usersenderid              &dest_mobileno=’.$mobile.’&message=’.$message.’&response=Y’;

$ch = curl_init(‘www.smsjust.com/blank/sms/user/urlsms.php’);

curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

curl_setopt($ch, CURLOPT_POST, true);

curl_setopt($ch, CURLOPT_POSTFIELDS, $request);

$resuponce=curl_exec($ch);

curl_close($ch);

return $resuponce;

}

}

How To Make Diamond Shape Image With Css?

How To Make Diamond Shape Image With Css?

Some times as a web designer it is very important to display our images uniquely.

Now let’s see how to display image in diamond shape? And this is the solution.

This is the code below

<div class=”square”>

<div class=”pic”>

<img src=”diamond.jpg”>

</div>

</div>

First set the image with 2 classes “square” AND “pic”

Next step is rotate the square class with -45 degree like this

.square{

transform: rotate(-45deg);

width: 105px;

height: 105px;

margin: 24px;

border: 2px solid red;

overflow: hidden;

}

Then rotate the pic class with 45 degree and all we set like this

.pic{

transform: rotate(45deg);

overflow: hidden;

width: 140px;

height: 140px;

margin: -18px;

}