Note: Please refer my previous post for inserting an image into MYSQL Database. http://www.marskarthik.com/blog/?p=652

$sql = “select * from `mytable`.`picture` LIMIT 1″;
$result = mysql_query($sql) or die(‘Bad query!’.mysql_error());
while($row = mysql_fetch_array($result,MYSQL_ASSOC)){
$db_img = $row['IMAGE'];
}
$db_img = base64_decode($db_img); //print_r($db_img );
$db_img = imagecreatefromstring($db_img);
if ($db_img !== false) {
imagegif($db_img);
}
imagedestroy($db_img);

You need to first create a table with the mysql code as shown below

CREATE TABLE `mytable`.`mypicture` (
`ID` INT( 5 ) NOT NULL AUTO_INCREMENT PRIMARY KEY ,
`IMAGE` BLOB NOT NULL
) ENGINE = MYISAM CHARACTER SET utf8 COLLATE utf8_general_ci;

First you will have code for connecting to mysql with username and password. Then here comes the php code for inserting image.

$handle = fopen(“mylogo.gif”, “rb”);
$img = fread($handle, filesize(‘mylogo.gif’));
fclose($handle);
$img = base64_encode($img);
$sql = “INSERT INTO `mytable`.`picture`(`IMAGE`) VALUES (‘$img’)”;
mysql_query($sql) or die(‘Bad Query’);
echo “Success!!!!”;

Note: Below code is used to find the Workgroup of a windows system on your network provided your web server runs on a windows machine. This code use windows “nbtstat” command to get this information.

< ?php

function ip2wgroup($ip)
{
$out = trim(shell_exec(“nbtstat -A $ip”));
$str1=”<20> UNIQUE Registered”;
$str2=”<1E> GROUP Registered”;
$str3=”<00> GROUP Registered”;
$x1=strpos($out,$str1);
$x2=strpos($out,$str2);
$x3=strpos($out,$str3);
if(($x2-$x1)< =50)
{
$len=strlen($str1);
$value=substr($out,$x1+$len,$x2-($x1+$len));
$value=trim($value);
}
else
{
$len=strlen($str1);
$value=substr($out,$x1+$len,$x3-($x1+$len));
$value=trim($value);
}
return($value);
}

echo ip2wgroup(“192.168.1.100″);
?>

Note: Below code is used to find the Hostname/Computername of a windows system on your network provided your web server runs on a windows machine. This code use windows “nbtstat” command to get this information.

< ?php

function ip2host($ip)
{
$out = trim(shell_exec(“nbtstat -A $ip”));
$str1=”———————————————”;
$str2=”<00> UNIQUE Registered”;
$x1=strpos($out,$str1);
$x2=strpos($out,$str2);
$len=strlen($str1);
$value=substr($out,$x1+$len,$x2-($x1+$len));
$value=trim($value);
return($value);
}

echo ip2host(“192.168.1.100″);

?>

Note: Below code is used to find the MAC address of a windows system on your network provided your web server runs on a windows machine. This code use windows “nbtstat” command to get this information.


< ?php

function ip2mac($ip)
{
$out = trim(shell_exec(“nbtstat -A $ip”));
$length=strlen($out);
$mac=”";
for ($i=17; $i>=1; $i–)
{
$mac= $mac . $out[$length-$i];
}
return($mac);
}

echo ip2mac(“192.168.1.100″);

?>


< ?php
function randpass()
{
$len=6;// Set the length of password
$passwd = “”;
$mypasschar = “1b2c3d45f6g7h89j!k@#m^n

q[r]s{t}(v)wxyz”;//List of possible password characters
$temp = 0;
while ($temp < $len)
{
$char = substr($mypasschar, mt_rand(0, strlen($mypasschar)-1), 1);
if (!strstr($passwd, $char)) //Finding duplicate character
{
$passwd .= $char;
$temp++;
}
}
return $passwd;
}

echo randpass();

?>

Swine Flu
Aaaatchooo! and that’s it!!!!!!

Read the PDF from the link below for knowing about Swine Flu and how to prevent yourself from Swine Flu.

Swine-Flu-INFLUENZA.pdf

1. Get the files you want to store and put them all on your desktop or a new folder
2. Select them all, right click and choose “Add to archive…”
3. In the field “Archive name” type in anything you want, such as “archive.rar”
4. Choose either ZIP or RAR as the archive format. RAR is highly recommended.
5. Press “OK”
6. Choose an image you want to be displayed when the JPG is opened normally, and place it in the same directory.
7. Open CMD, navigate to the directory and type the following (without quotes):
8. copy /b YOURIMAGE.ext + YOURARCHIVE.ext OUTPUT.ext
9. If done correctly, you should be able to view your normal JPG, and open it with WinRAR to the see contents of the RAR file you added.

Note: Use only PNG, GIF or JPG, do not use BMP as they take up too much space. WinZIP cannot open RAR, so if you are giving the file to a user who does not have WinRAR, choose ZIP as the archive. The display image (YOURIMAGE.ext) must be the same as the output extension (Cannot use JPG and output to PNG or vice versa)

« Previous PageNext Page »