This online hash generator will quickly generate MD5, SHA1 and SHA256 hashes.
Not much more to say.
Technology, primarily Information Technology
This online hash generator will quickly generate MD5, SHA1 and SHA256 hashes.
Not much more to say.
An auto-incremented column can become a little cluttered if records are deleted from the table, and you may wish to delete the slack of the sequence in your id column for instance doesn't bear any relationship to the number of records in the table.
Before doing anything about that to a primary key, bear in mind that there are those who say that a primary key should never, ever be changed. Do you really need to re-number your primary key?
If you really want to do it, read the caveat below before proceeding.
CAVEAT: I haven't actually tested this!
First, be safe and backup your database.
Next copy your table:
CREATE TABLE mytable2 SELECT * FROM mytable1 |
Now run the following commands, modified as necessary for your situation, on the copy:
ALTER TABLE mytable2 DROP mycolumn;
ALTER TABLE mytable2 ADD mycolumn int(6) NOT NULL AUTO_INCREMENT PRIMARY KEY FIRST;
Have a look at the new table. Browse the records. Do you like what you see? Run as many tests as are appropriate to your situation. More is better than less.
If you're satisfied, it's time to disable mytable1 and make mytable two current.
Rename mytable1 to mytable1_old, then rename mytable2 to mytable1.
Keep a close an eye on the situation. If you're not happy, you can revert to mytable1_old or even restore the backup.
It's easy to overlook security when we write PHP code, yet failure to write code with security in mind can result in catastrophe.
Rather than write the book myself, this is one of those cases where we should just reference some good material written by others.
IP addresses can't readily be sorted numerically because they are strings and the periods in the dotted-quad format common to IP addresses confuses things. For instance, in a sorted list, 143.16.20.11 will sort before 23.45.1.78 even though what you really want is to sort by the first octet (23 & 143), then by the second octed (16 & 45) and so on.
PHP and MySQL provide functions to convert IP addresses to sortable format.
Two functions are provided for use in MySQL query. When your IP addresses are stored in a database, you can pull them ready to sort.
INET_ATON() Returns the numeric value of an IP address
INET_NTOA() Returns the IP address converted from a numeric value
Remember that if you need both representations you can pull the value twice in the same query, i.e.
SELECT ip AS ip_dotted_quat,INET_ATON(ip) as ip_sortable FROM mytable
This provides a clean set of data for your PHP or other scripting code to work with.
You have similar options in PHP.
ip2long("127.0.0.1") converts the IP to a long integer.
long2ip() converts the long integer back to a dotted-quad IP address.
The online PHP manual suggests using the two in combination to validate an IP as shown here
<?php
// make sure IPs are valid. also converts a non-complete IP into
// a proper dotted quad as explained below.
$ip = long2ip(ip2long("127.0.0.1")); //Â "127.0.0.1"
$ip = long2ip(ip2long("10.0.0")); //Â "10.0.0.0"
$ip = long2ip(ip2long("10.0.256")); //Â "10.0.1.0"
?>
Jake Ludington has written a great article on using Remote Desktop at this URL. This Windows utility allows you to connect to your desktop from anywhere on the Internet. Configured properly, it is quite secure.
http://www.jakeludington.com/ask_jake/20051122_how_to_use_remote_desktop_connection_rdc.html