My Digital Story

What’s a small world…

Send your latest computer dynamic IP to email

I was away from my office PC last week when my Outlook email account reached 60 MB (ONLY).  So I no longer can receive or send any new mail from my Windows Mobile phone. Luckily Gmail is always there to save the day.

As usual, I logged in my PC into my company’s Workforce Portal (a generic name would be Virtual Private Network) which is using Juniper Network Connect. Through Workforce Portal we are virtually inside the office.

My intention was to remote into my office PC so that I could archive all the old mails ( Yes, my fault also for not using auto archive).  I launched the mstsc.exe (Remote Desktop Connection) at the Run/Start Menu and just clicked the connect on the IP address already shown there.  And then the nightmare came…It was no longer my IP address! I could not connect!

Not again…My office computer’s IP address was flushed again by the DHCP server!

So, after I start to find a solution on how can I keep myself update to the computer dynamic IP address which so that whenever I want to use the Remote Desktop, I will always know the current IP address.

I tried to find dedicated applications in the Internet for that, e.g IP Watcher, Dynamic IP Monitor but those are just not working as intended. The IP Watcher only email the external public IP (My company WAN IP address, or the Internet IP address).,while the Dynamic IP Monitor for whatever reasons give my internal IP address as 0.0.0.0 which is non-sense.

Out of desperation, I need to have my own solution.

IP address will only dynamically change when the PC start, so if I could make a MS-DOS command line script so that  at each boot,  the computer will send email containg its latest IP address to my Gmail account.

To accomplish that, I need to have an application that can send email with attachment from command line. To do that, all I need is this little piece of applicate, called SendEmail.

Download the file and extract it to your C: drive.
Open Notepad, write the following code:

ipconfig >C:\ipaddress.txt
SendEmail.exe -f FROMADRESS -t TOADDRESS -u SUBJECT -m MESSAGE -s SMTPSERVER -a C:\ipaddress.txt

Save the file as filename.bat maybe at C:\

Create this file shortcut in your Start Menu/Startup so that this script will launch each time when your PC boots.

The first command (ipconfig >C:\ipaddress.txt) is actually to copy your IP configuration into a file called ipaddress.txt in yout C:\

The next command is to send this attachment to your email using the SMTP server. So make sure you know the SMTP server IP address of its DNS name.

So, now each time my computer boot with a new IP address, I will have its IP address in my Gmail account. Now I can use the Remote Desktop from anywhere without worrying on the dynamic IP address anymore.

16/01/2009 Posted by abuhawa | Windows XP troubleshootings | , , , , | 6 Comments

Restrict phpMyAdmin access to only internal private IP address

I managed to configure my phpmyadmin to only allow access from within my network only (the private IP address range) e.g. 192.168.1.XXX.

This is important to ensure the security of your database, I just do not want people to guest all the password by entering into the phpmyadmin setting.

To do so, copy the following code to config.inc.php in the phpmyadmin folder:
//block root from logging in except from the private networks
$cfg['Servers'][$i]['AllowDeny']['order'] = 'deny,allow';
$cfg['Servers'][$i]['AllowDeny']['rules'] = array(
'deny root from all',
'allow root from localhost',
'allow root from 192.168.1.0/24',
);

The “0/24″ denotes wildcat (equivalent to * in Windows)
After that chmod 705 the file
Then restart your lightpd server using the following command:
sh /ffp/start/lighttpd.sh restart

now your phpmyadmin can only be accessed from your LAN network only.

07/01/2009 Posted by abuhawa | Networking, Uncategorized | | 6 Comments

How to install phpMyAdmin into fun_plug 0.5/ffp in DNS-323

I just completed the installation of the phpmyadmin into my DNS-323 NAS.  Before that I also installed the lighttpd with php and also mysql.

Since there is no proper tutorial available in English, I would to share. This guide was actually provided by WOLF-U.li however it is in German.

Here are the steps:

Download phpmyadmin from phpmyadmin website
Use Winrar to unzip (unzip twice) the file since the tar xvf just does not work since the downloaded file has duplicate gz.gz extension.
Rename the last unzipped file contain multiple files into “phpmyadmin”
Create a file named config.inc.php using Notepad++ which contains the following code:
/* Servers configuration */
$i = 0;
/* Server localhost */
$i++;
$cfg['Servers'][$i]['host'] = 'localhost';
$cfg['Servers'][$i]['extension'] = 'mysql';
$cfg['Servers'][$i]['connect_type'] = 'tcp';
$cfg['Servers'][$i]['compress'] = false;
$cfg['Servers'][$i]['auth_type'] = 'http';
?>

chmod 705 the above file to make it not world writable

Save the file into your newly created phpmyadmin folder

Place the phpmyadmin folder into your www/pages/ folder alongside your web index.php

Now  you need to uncomment mbstring.so by removing the ;  in the php.ini file located in ffp/etc:
extension=mbstring.so

Now you are done

You can open the phpmyadmin from your internet browser using http://<your DNS IP address>/phpmyadmin

Enter using your relevant ID and password, may be your root.

05/01/2009 Posted by abuhawa | Networking | , , , | 3 Comments