Syed Jahanzaib Personal Blog to Share Knowledge !

October 28, 2011

Webmin / PHP base Mikrotik Control Panel

Filed under: Mikrotik Related — Tags: , , , , , — Syed Jahanzaib / Pinochio~:) @ 12:31 PM

Following are two good .simple and basic ways to control your Mikrotik Box via your browser as fronted using WEBMIN or PHP base pane at backend. Both are good in there own ways.

Easy to setup and quick to manage , using these method, you don’t have to login via winbox to access your mikrotik for basic management :)~
Just install them on any Linux base system, it can be your proxy or whatever Linux base pc on LAN you have.


WEMIN BASE CONTROL PANEL

Simply install WEBMIN from http://www.webmin.com and then follow the guide below.

http://wiki.mikrotik.com/wiki/Useful_Bash_Scripts

[By Mr. Mudassir Mirza @ http://www.diglinux.com/%5D

Snapshot of webmin configured with the mikrotik scripts functions.

(My Modified OnlineUsers.sh, for my personnel reference,
idea was taken from  Mr. Mudassir Mirza @ http://www.diglinux.com/%5D)

#!/bin/bash
# set -x
# for (( ; ; ))
# do
USER="admin"
MTIP="10.10.0.1"
PORT="22"
FPATH="/zaib"
DRL=zaib
FILE=$DRL
rm -fr $FPATH/$DRL.txt
ssh $USER@$MTIP -p $PORT / ppp active print file=$DRL
scp -P 22 $USER@$MTIP:$DRL.txt $FPATH/$DRL.txt
sed -i 's/MEJM-BFQK/secret/g' /zaib/zaib.txt
cat $FPATH/$DRL.txt
echo
echo
TTL=`cat $FPATH/$DRL.txt |sed '1,5d' | wc -l`
echo -e "\t\t\n Total Number of Active Users $TTL"

PHP BASE PANEL

Snapshot of PHP panel configured with the mikrotik scripts functions.

[By Mr. Mudassir Mirza @ http://www.diglinux.com/%5D


You must have LAMP base installation on your nix box. then follow the below guide.
[Note: it have some minor bugs, For example, when you tri to import mysql db via using manual command

mysql#\. /var/www/mtpanel/mtpanel.sql;

You may get following error.

ERROR:
Failed to open file '/var/www/mtpanel/mtpanel.sql;', error: 2

Use the following command instead.

mysql -u root -p123 --database mtpanel < mtpanel.sql

There is also an bug in live monitoring of specific user page, that can be corrected by editing it and remove refresh interval.

Warning: This page is accessible by every user, To password protect it, use the following guide to protect it with password.
https://aacable.wordpress.com/2011/11/05/howto-protect-a-web-folder-on-apache-with-password/

You can also remove some of its funcitons, for example i provided this panel for support personnel which have only specific functions available, Live Monitoring , Connected Users, Password Change.

Some information and instructions regarding this panel is well described and discussed at following links

http://wiki.mikrotik.com/wiki/Basic_php_ppp_scripts
http://forum.mikrotik.com/viewtopic.php?f=2&t=54948

Advertisements

October 27, 2011

MIKROTIK Policy Routing based on Client IP Address


 

 ~!!!~   Article  By  Syed Jahanzaib   ~!!!~

Recently at a local cable.network setup @ gulzar-e-hijri, an OP asked told me that he wanted to add an extra DSL line just for some specific users (VIP users who are paying some extra money for better speed, as the current single dsl is getting clogged by over subscribed users. He wanted to manage all users / link via single Mikrotik router-board.
I accomplished this task by adding 2nd DSL line with the Mikrotik BOX and few rules, and Alhamdolillah it worked fine :). I am just sharing basic logic on how i achieved it.

You can take this idea and modify it according to your requirement, either use this logic and mix it with hotspot or pppoe base setup. In this example, user MAC-IP was binded.

Let us assume that we have 2 Users lists.

DSL1_USERS_LIST = 192.168.2.6
DSL2_USERS_LIST = 192.168.2.7

 

DSL1 Router GW IP = 192.168.5.2
DSL2 Router GW IP = 192.168.6.2

Now we will route users through DSL-1 OR DSL-2 wan links based on there ip addresses.

To accomplish this task, the simple logic is …

  1. STEP#1: First we will create ADDRESS-LIST, and add our users in the list,
  2. STEP#2: Then We have to add two IP Firewall Mangle rules to mark the packets originated from user 1 and user2.
  3. STEP#3: Then we should specify two default routes (destination 0.0.0.0/0) with appropriate routing marks and gateways.
  4. STEP#4: Then simple add one NAT rule for local ip series and Action masquerade.

Code:

# Adding IP Address on interfaces like lan/wan
# IP for LAN User Network Connectivity

/ip address
add address=192.168.2.1/24 disabled=no interface=LAN network=192.168.2.0
# IP for WAN DSL Connectivity

add address=192.168.5.1/24 disabled=no interface=WAN1 network=192.168.5.0
add address=192.168.6.1/24 disabled=no interface=WAN2 network=192.168.6.0

# Create 2 Address lists and add ip as per required, you can add Range as well.
# I am adding just 2 ips only

/ip firewall address-list
add address=192.168.2.6 disabled=no list=DSL1_USERS_LIST
add address=192.168.2.7 disabled=no list=DSL2_USERS_LIST
# Marking Users connection coming from specific address lists
/ip firewall mangle
add action=mark-routing chain=prerouting disabled=no new-routing-mark=wan1_user passthrough=no src-address-list=DSL1_USERS_LIST
add action=mark-routing chain=prerouting disabled=no new-routing-mark=wan2_user passthrough=no src-address-list=DSL2_USERS_LIST
# Create Routes for above marked packets so each marked packets goes via specific wan link only
/ip route
add disabled=no distance=1 dst-address=0.0.0.0/0 gateway=192.168.5.2 routing-mark=wan1_user scope=30 target-scope=10
add disabled=no distance=2 dst-address=0.0.0.0/0 gateway=192.168.6.2 routing-mark=wan2_user scope=30 target-scope=10
# Finally create NAT rule so that users (ip range) internet can work
/ip firewall nat
add action=masquerade chain=srcnat disabled=no src-address=192.168.2.0/24

TESTING

From Client PC # 1 whose ip address is 192.168.2.6, run TRACEROUTE command

For example traceroute yahoo.com

 

Results


TESTING FROM DSL1_USERS_LIST = 192.168.2.6

Ethernet adapter Local Area Connection:

Connection-specific DNS Suffix  . :
Description . . . . . . . . . . . : Realtek RTL8139 Family PCI Fast Ethernet NIC
Physical Address. . . . . . . . . : 00-xx-xx-xx-xx-xx
Dhcp Enabled. . . . . . . . . . . : No
IP Address. . . . . . . . . . . . : 192.168.2.6
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Default Gateway . . . . . . . . . : 192.168.2.1
DNS Servers . . . . . . . . . . . : 192.168.2.1

C:\Documents and Settings\zaib>tracert yahoo.com

Tracing route to yahoo.com [209.191.122.70]
over a maximum of 30 hops

1     <1 ms     <1 ms     2 ms  192.168.2.1
2      2 ms      2 ms     3 ms  192.168.5.2
.
.


TESTING FROM DSL2_USERS_LIST = 192.168.2.7

Ethernet adapter Local Area Connection:
Connection-specific DNS Suffix  . :
Description . . . . . . . . . . . : Realtek RTL8139 Family PCI Fast Ethernet NIC
Physical Address. . . . . . . . . : 00-xx-xx-xx-xx-xx
Dhcp Enabled. . . . . . . . . . . : No
IP Address. . . . . . . . . . . . : 192.168.2.7
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Default Gateway . . . . . . . . . : 192.168.2.1
DNS Servers . . . . . . . . . . . : 192.168.2.1

C:\Documents and Settings\zaib>tracert yahoo.com

Tracing route to yahoo.com [209.191.122.70]
over a maximum of 30 hops

1     <1 ms     <1 ms     2 ms  192.168.2.1
2      2 ms      2 ms     3 ms  192.168.6.2
.
.


 

Regard’s
SYED JAHANZAIB

October 21, 2011

Howto Install SARG (Squid Analysis Report Generator) in Ubuntu

Filed under: Linux Related — Tags: , , , , — Syed Jahanzaib / Pinochio~:) @ 11:36 AM

Squid Analysis Report Generator (SARG) is a Squid proxy log analysis tool for Linux. SARG provides web based logfile analysis and divides traffic based on IP address. Traffic is then categorized by web site visited, traffic volume, and other useful statistics. It enables you to see your Squid users internet usage. SARG provides many statistics and informations about Squid users activities like times, bytes, sites, etc.

Installation in Ubuntu is relatively straight forward with a couple of commands

apt-get install sarg

After SARG installed, we need to modify some options in sarg.conf.
Issue the following command.

nano /etc/squid/sarg.conf

Now remove all lines and paste following lines in this file.

# sarg.conf
language English
access_log /var/log/squid/access.log
graphs yes
graph_days_bytes_bar_color orange
title "My Squid User Access Reports"
font_face Tahoma,Verdana,Arial
header_color darkblue
header_bgcolor blanchedalmond
font_size 9px
background_color white
text_color #000000
text_bgcolor lavender
title_color green
temporary_dir /tmp
output_dir /var/www/sarg
resolve_ip
user_ip yes
topuser_sort_field BYTES reverse
user_sort_field BYTES reverse
date_format u
lastlog 0
remove_temp_files yes
index yes
index_tree file
overwrite_report yes
records_without_userid ip
use_comma yes
mail_utility mailx
topsites_num 50
topsites_sort_order CONNECT D
index_sort_order D
max_elapsed 28800000
exclude_codes /etc/squid/sarg.exclude_codes
report_type topusers topsites sites_users users_sites date_time denied auth_failures site_user_time_date downloads
usertab /etc/squid/sarg.usertab
long_url no
date_time_by bytes
charset Latin1
show_successful_message yes
show_read_statistics yes
topuser_fields NUM DATE_TIME USERID CONNECT BYTES %BYTES IN-CACHE-OUT USED_TIME MILISEC %TIME TOTAL AVERAGE
user_report_fields CONNECT BYTES %BYTES IN-CACHE-OUT USED_TIME MILISEC %TIME TOTAL AVERAGE
topuser_num 0
site_user_time_date_type table
download_suffix "zip,arj,bzip,gz,ace,doc,iso,adt,bin,cab,com,dot,drv$,lha,lzh,mdb,mso,ppt,rtf,src,shs,sys,exe,dll,mp3,avi,mpg,mpeg"

Now save and exit.
Don’t forget to Create a dir Where SARG will create reports in /var/www/sarg
(You can change output dir syntax in sarg.conf)

mkdir /var/www/sarg

To run sarg, use the following command

sarg
/usr/sbin/sarg-reports daily

This will produce reports in /var/www/sarg , and to run sarg daily automatically , we can add the following syntax in /etc/crontab :

root@zaib-desktop:~# crontab -e

Now paste the following entry here at the end : –

@daily /usr/sbin/sarg-reports daily

Save and Exit.

Now open your browser and point to your proxy ip/sarg (Change the ip according to your setup)

http://192.168.2.1/sarg/

Some sample results.


More samples can be viewed at

http://sarg.sourceforge.net/squid-reports/2004Aug06-2004Sep13/index.html

  

Regard’s
SYED JAHANZAIB

October 15, 2011

Howto redirect audio/video or some contents to another proxy using SQUID


Howto redirect Audio/Video or some contents based on extensions to another proxy using SQUID

Assalam Va Alaekum,

Following guide will show you how to redirect some contents from Squid proxy server to another proxy server (possibly squid or ISA, whatever). This is one of the oldest tricks in the book. People who are engaged in Linux after late 90’s  knows about it very well. I used this scenario at my network in year 2003-2004 when I had SPEEDCAST IVS downlink of 256Kb and 64Kbs ISDN link. It was very useful at that time and user were really amazed with the browsing speed 🙂

Here is the test scenario, we have two proxy servers , proxy1 and proxy2.
PROXY1 is our master/parent proxy server connected with fast internet link and we want it to be reserved just for browsing and other important stuff, and we want that any request for .mp3 .exe .wmv .avi content must be redirect to PROXY2 server which is connected with lower bandwidth Link like satellite downlink or other.

Install 2 squid servers.

proxy1 = 192.168.2.1  [master/parent proxy]
proxy2 = 192.168.2.9 [for download redirected_content only]

Now on proxy1 (parent/master) , add following lines in /etc/squid/squid.conf

acl mynetwork src 0.0.0.0/0.0.0.0
acl redirect_content urlpath_regex -i \.MP3$ \.AVI$ \.WMV$ \.RM$ \.FLV$ \.ZIP$ \.RAR$ \.EXE$ \.mp3$ \.avi$ \wmv.$ \.rm$ \.flv$ \.zip$ \.rar$ \.exe$
cache_peer 192.168.2.9 parent 8080 3130
cache_peer_access 192.168.2.9 allow mynetwork redirect_content
never_direct allow redirect_content

All Done. Now test the setup. Set client browser proxy to use proxy1 and try to download anything (which is in redirect_content acl e.g rm or mp3 songs)
See the attached images.

apniisp- Testing Song Download from internet

apniisp- Testing Song Download from internet

Monitor Squid access log at proxy1 and proxy2, you will clearly see that only redirect_content are redirected to proxy2, rest of traffic is using proxy1 only.

parent-proxy1-tail-result

PARENT PROXY1 Squid Access Log

PROXY2 Squid Access Log

PROXY2 Squid Access Log

This way you can do load balancing on your proxy servers.

The biggest advantage of such load balancing is that user browsing will not be effected if 20-30 users are simultaneously downloading any media contents or your marked contents 🙂

Cheers,

Allah Hafiz

Regard’s
Syed Jahanzaib

October 12, 2011

LTSP : Thin Client Server on Ubuntu , One of my Favourite Project :)


“LINUX TERMINAL SERVER PROJECT”

Why I needed LTSP ?

Few months back, at my company, we were very low in hardware resources, my office pc harddisk turned out in to a grabage piece, and I was no other backup disk to install windows or linux.  Several outdated pcs in my office was having hardware software trouble too, so I was quite annoyed and fedup by the hardware / software / viruses  problems, Then I decided to give a try to Ubuntu LTSP, which I used 2 years back in a lab environment successfully. So I created LTSP Server in Ubuntu and connect all low hardware base pcs to boot via LTSP, this way I got rid of softwares / hardware / storage / management problems in very cheap way 😀 , this article explains how I achieved this at my office.

Introduction:

Linux Terminal Server Project (LTSP) provides a way for you to build a server and then add Old diskless computers to the server thus creating a huge savings for an organization. To the user, they will not recognize that the computer they are at is without a hard drive. They typically notice the fast speed at which the workstation runs and the features that are available. LTSP helps in improving Total Cost of Ownership (TCO) and also offers increased value over traditional computing solutions. The Linux thin clients are very reliable as viruses and tampering is non-existent. It is distributed under the GNU General Public License, which is free.

ADVANTAGES  OF  LTSP:

1. Cost – Diskless computers like old Pentium 2/3 base computers with 64 mb ram can be purchased new for about 1500-2000 Rs (or 15-20$) from Regal / Saddar Market and can be built from outdated computers for $0. This is a very interesting way to build a network from computers that others want to discard.

2. Central Management – Central Management alone will save an organization dramatically. You can expect virtually NO WORKSTATION maintenance with LTSP. Without a hard drive there is nothing to maintain except connections for monitor, network, keyboard and mouse. All management is done from the server.System maintenance is also easier when everything is on one computer, and upgrades are simpler, as is backing up. In fact, the only major disadvantage of such a system is that the server provides a single point of failure. If this breaks, the whole system goes down, so some sort of redundancy is needed here if downtime isn’t acceptable.

3. Heat Reduction – Computers create heat which leads to more power usage to reduce the heat. Many diskless systems are only using 15 watts of power and producing virtually not heat.

4. Power Reduction – Diskless computers may use as little as 15 watts of power compared to the 450 watts of a typical workstation. When you are looking at 200 computers in a school system is a significant savings.

5. Flexibility – You are not limited to just running diskless computers. You can set up a network that will allow diskless computers, computers with disks and Windows computers connecting via Samba. One server can do it all for you.

DISADVANTAGES OF LTSP:

1. Single Location of Failure – Since the whole network depends on the server up 24/7 that server must be robust and dependable. If the server is down everyone on the LTSP server is off line. You can create redundancy. I tried creating a LTSP Cluster which is very easy to setup and it is simple enough to rsync two servers so that you have a clone ready to go if you experience failure. I did run this LTSP server for about 3 monhts without having any downtime.

2. Server Cost – You must invest in a server that is robust, something in the line of dual Xeons with 4-8 GB of RAM if you have more then 50 diskless computers connected.

To install LTSP on Ubuntu

Login to terminal via root and issue the following command to install LTSP and SSH server.

sudo apt-get install ltsp-server-standalone openssh-server

Now Update DHCP file with your network configuration

nano /etc/dhcp3/dhcpd.conf

ddns-update-style none;
authoritative;
log-facility local7;
subnet 192.168.2.0 netmask 255.255.255.0 {
range 192.168.2.200 192.168.2.210;
option routers 192.168.2.1;
option domain-name-servers 192.168.2.1;
filename "/ltsp/i386/pxelinux.0";
default-lease-time 600;
max-lease-time 7200;
}

Now start DHCP server by

service dhcp3-server start]

You must see OK status for it, If you get Following error while starting <strong>DHCP</strong> server
<strong><span style="color: #ff0000;">Can't create PID file /var/run/dhcpd.pid: Permission denied.</span></strong>

Then issue the following command,

ln -s /var/run/dhcp3-server/dhcpd.pid /var/run/dhcpd.pid

Now create your Thin Client environment on the server with.
(This will take some time, so sit back, relax and have a cup of tea with EVERYDAY milk :p )

sudo ltsp-build-client

At the end, If you receive following error:
error: LTSP client installation ended abnormally”
then issue the following commands

sudo -s
su -
ltsp-build-client

Now update the sshkeys and lts image

sudo ltsp-update-sshkeys
sudo ltsp-update-image

Your LTSP server is ready. Now goto client side, and boot it from PXE enabled network card, usually f12 works , or use the bios option to boot from network card, Now when the client tries to PXE boot, it will get ip from dhcp server, and will get the tftp info and will then take you to the login screen, here you must provide valid user id password in order to login to the server.

In the following example, I created test machine in VM with very minimum hardware specs, for example 64Mb ram, No harddisk, as client boots via ltsp server.

Below are some screenshot of client booting via ltsp server.

Tips N Tricks for LTSP

HOWTO ASSIGN STATIC IPs with dhcpd.conf

The recommented way to assign static IPs is by appending host declarations to /etc/ltsp/dhcpd.conf:

host zaib-pc1 {
hardware ethernet 00:0c:29:f1:6d:3f;
fixed-address 192.168.2.203;
}

apt-get error <Meta-index file (malformed Release file?) >

If you receive error while updating apt-get <Meta-index file (malformed Release file?) > type error, Then edit /etc/apt/sources.list and remove ‘non-free‘ and ‘contrib‘ words in whole file by searching.

The valid components for Ubuntu are ‘main‘, ‘restricted‘, ‘universe‘ and ‘multiverse’. There is no ‘non-free‘ nor ‘contrib‘ that’s for debian. Update you sources.list accordingly and try performing the upgrade again.

HOWTO CUSTOMIZE LOGIN SCREEN:

Goto Folder /opt/ltsp/i386/usr/share/ldm/themes/ and edit bg.png to add your logo and info.

After you done editing your file, Dont forget to update ltsp image by issuing this command.

sudo ltsp-update-image

Some useful links for ltsp management:

http://lns.wikidot.com/issue-bug-urls
https://help.ubuntu.com/community/UbuntuLTSP

October 5, 2011

PHPmotion : Howto Create Your own Video Sharing Web Site like YouTube

Filed under: Linux Related — Tags: , — Syed Jahanzaib / Pinochio~:) @ 3:59 PM

 


PHPmotion is a free-to-use video sharing content management system, written in PHP and using MySQL databases.  The software provides the average person the ability to have their own video sharing website. It will allow you to create and run your very own Video Sharing website, Music Sharing Site, Picture Sharing Site. With very little knowledge required, you can now have a website just like youtube.com , dailymotion.com, veoh, hi5 and best of all, its 100% free to download and use

PHPmotion supports many different video formats.

The following is a list of some features that are included with PHPMotion.

  • Uploading, managing, and deletion of videos and audio files
  • Embedding of videos from youtube
  • Create photo galleries
  • Built in blogging tools
  • Creation and management of groups and member profiles
  • Internal email messaging

Requirements

PHP motion software requires a Linux base server as its base OS. I used UBUNTU 10.4as an example in this article.

After many hours and 2 days of endless googling, I have compiled and used the following list of software packages and file configurations to successfully install PHP Motion on Ubuntu server. There are several common audio-video-graphic conversion and playback software packages that need to be installed to support PHPmotion . Additionally, there are a few files that need to be configured on the Ubuntu web server to enable the scripts to run properly. To install software simply start up a command line terminal and type the commands listed in red.

sudo apt-get update
sudo apt-get install php5-cli
apt-get install apache2
sudo apt-get install php5-cli
apt-get install php5-mysql libapache2-mod-php5
sudo apt-get install mplayer
sudo apt-get install mencoder
sudo apt-get install flvtool2
sudo apt-get install ubuntu-restricted-extras
sudo apt-get install build-essential
sudo apt-get install ffmpeg
apt-get install apache2 php5 php5-gd
sudo apt-get install php5-curl
a2enmod rewrite
/etc/init.d/apache2 force-reload
/etc/init.d/apache2 restart

Now you have to Install Phpshield manually which is a required component:

Download phpshield from here
(OR http://phpshield.com/loaders/phpshield.loaders.linux.zip)

After download unzip it and copy the file phpshield.5.2.lin in to /usr/lib/php5/20060613+lfs folder

Now you need to edit the php.ini file using the following command

nano /etc/php5/apache2/php.ini

Add the following line at the end of the file

extension=phpshield.5.2.lin

SAVE and EXIT the file

Now you need to restart apache server using the following command

/etc/init.d/apache2 restart

PHPSHIELD Installation Complete, Now moving further.

Its time to Download PHPmotion

Download it from http://www.phpmotion.com/content/view/1/180/
Now Create a temp folder in / and copy phpmotion.zip in /temp

mkdir /temp
cd /temp

Now UNZIP it . . .

unzip phpmotion.zip

Now copy it to your web root folder.

mv phpmotion /var/www/

(Make sure  .htaccess file is also copied correctly in /var/www/phpmotion/)

Now Edit /var/www/phpmotion/.htaccess and add your path.

RewriteBase /phpmotion

Now Edit  /etc/php5/apache2/php.ini and change this directive.

enable_dl = On

Now change permission for phpmotion root folder.

chmod 777 -R /var/www/phpmotion

Now copy all files from /var/www/phpmotion/cgi-bin to /usr/lib/cgi-bin by issuing following command

cp -R /var/www/phpmotion/cgi-bin /usr/lib/cgi-bin

Now edit /var/www/phpmotion/cgi-bin/uu_default_config.pm  and change the following to match the sub directory.

 temp_dir                 => $ENV{'DOCUMENT_ROOT'} . '/phpmotion/temp/',
 upload_dir               => $ENV{'DOCUMENT_ROOT'} . '/phpmotion/uploads$
 redirect_url             => '/phpmotion/uploader_finished.php',
 path_to_upload           => '/phpmotion/uploads/avi/',

CREATE MYSQL DATABASE FOR PHPMOTION

Create database for phpmotion by issuing following commands.

mysql -u root -p123
create database phpmotion;
grant all privileges on phpmotion.* to 'root'@'localhost';
quit;

Basic Setup Complete, Its time to HIT the Setup . . .

Now open Your Browser, then access http://192.168.2.1/setup ,  then follow the setup process and skip FTP Questions. Make sure you are not missing any dependencies before continuing the setup.

After setup finishes smoothly, Remove / Rename setup directory, example

mv /var/www/phpmotion/setup /var/www/phpmotion/old_setup

NOW YOU CAN ACCESS YOUR NEWLY INSTALLED BY POINTING YOUR BROWSER TO HTTP://192.168.2.1/phpmotion

Common Problems Workarounds:

CAPTCHA IMAGE DOES NOT SHOW IN USER REGISTRATION FORM

Solve CAPTCHA image which is not appearing in registration form, by fixing font’s path (copy the DoradoHeadline.ttf in /var/www/phpmotion/includes/)
Edit /var/www/includes/captcha.php

nano /var/www/includes/captcha.php

var $font = ‘/var/www/phpmotion/includes/DoradoHeadline.ttf’;

(More to come . . To Be Continued . . . )

Alhamdolillah !

Regard’s
Syed Jahanzaib

October 4, 2011

Howto Embed Media File in HTML Page

Filed under: Microsoft Related — Tags: , , , , , — Syed Jahanzaib / Pinochio~:) @ 2:19 PM

You can stream any local media file / live stream via Firefox Browser.
For example you can create a list of Video Files and link it on your web site, So when user click on the video link, instead of downloading, it will play directly via browser. This is just an idea, you can create exciting web pages with this logic. It is highly recommended to install VLC media player in Full Installation mode at Client.

 

To play Video via VLC plugin, Use the following code.

<embed type="application/x-vlc-plugin" name="VLC" autoplay="yes" loop="yes" volume="100" width="640" height="480" target="d:\1.flv">


(Replace 1.flv with your media file)

To play Video via Windows Media Player – WMP  plugin, Use the following code.

<object classid="clsid:22D6F312-B0F6-11D0-94AB-0080C74C7E95" width="640"

height="480"codebase="http://www.microsoft.com/Windows/MediaPlayer/">
<param name="Filename" value="d:\1.flv">
<param name="AutoStart" value="true">
<param name="ShowControls" value="true">
<param name="BufferingTime" value="2">
<param name="ShowStatusBar" value="true">
<param name="AutoSize" value="true">
<param name="InvokeURLs" value="false">
<embed src="d:\1.flv" type="application/x-mplayer2" autostart="1" enabled="1" showstatusbar="1"
showdisplay="1" showcontrols="1" pluginspage="http://www.microsoft.com/Windows/MediaPlayer/"
CODEBASE="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,0,0,0"
width="480" height="360"></embed>
</object>

(Replace 1.flv with your media file)

RESULT

Embeded File Played Via Firefox Browser

Embeded File Played Via Firefox Browser

October 3, 2011

Howto Create FTP / HTTP base Media Sharing Server in Windows 2003 Server + HFS HTTP SERVER

Filed under: Microsoft Related — Tags: , , , , , , , — Syed Jahanzaib / Pinochio~:) @ 3:28 PM

What is  File Server

A File Server is basically a computer that is dedicatory used to store and share digital information / Media Files / Songs / Videos / Documents that can be accessed by other computers that are connected to the network. For your home / office / Internet Network, any computer can be a file server if you want it to be.

Advantages of a file server

  • A file server can act as a backup storage for your important documents and files. If your computer crashed, you can recover lost files from the file server easily.
  • It also acts as a central location to share files between multiple computers. This way everybody knows where to find and store a shared file.

Following is an guide on howto create FTP / HTTP base sharing server for your local / public network.

For example, If you have a server with windows 2003 server and you want to share softwares/vdo folder or whole sharing drive that can be accessed via browser only , then you must add IIS web/ftp service to your server.

Note:In this article I used Windows 2003 R2 , My Ip Address is 192.168.2.5  , You have to change this according to your Network.

FTP BASE SHARING IN IIS

First we need to add http/ftp service. Please follow the steps.

  1. Click Start, point to Control Panel, and then click Add or Remove Programs.
  2. Click Add/Remove Windows Components.
  3. In the Components list, click Application Server, Select Internet Information Services (IIS),  and then click Details.
  4. Click to select the following check boxes (if they are not already selected):
    Common Files
    File Transfer Protocol (FTP) Service
    Internet Information Services Manager
    World Wide Web Services
  5. Click to select the check boxes next to any other IIS-related service or subcomponent that you want to install, and then click OK.
  6. Click Next.
  7. When you are prompted, insert the Windows Server 2003 CD-ROM into the computer’s CD-ROM or DVD-ROM drive or provide a path to the location of the files, and then click OK.
  8. Click Finish.

See the attached image

Howto add IIS FTP / HTTP service in Win2003

Howto add IIS FTP / HTTP service in Win2003

You have now installed the IIS and FTP services but before you can start using your new FTP/HTTP service, you must configure it or add the desired folder / drive. To configure the FTP Service follow these steps.

Howto Add Folder in FTP/IIS

Howto Add Folder in FTP/IIS

(You can Add single folder or whole drive , as per your requirements)

Your Folder/Drive is ready to be access by user. Now Open your browser and type

ftp://192.168.2.5

or goto START / RUN and type

ftp://192.168.2.5

and you will see its result something like below image.


HTTP BASE SHARING IN IIS

As we have already installed IIS in the start, We can create Virtual Folders base HTTP sharing server. Please follow the steps shown in images below to create virtual folder that can be access via http://192.168.2.5/videos


Your Virtual Folder is ready to be access by user. Now Open your browser and type

http://192.168.2.5/videos

or goto START / RUN and type

http://192.168.2.5/videos

and you will see its result something like below image.

Alternate Easy Method to Create HTTP File Sharing Server using HFS HTTP Serve

Recently I was in need of a simple file sharing server which does not requires dedicated installation or any other components, I came across HFS HTTP File Sharing Server, which is a standalone file , Using it, you can create http file sharing server in seconds. [For more enhanced guide, please visit http://www.techmalaya.com/2008/02/16/home-network-file-server-setup/ ]

# Create a folder named “hfs” on any disk drive, for example C:\hfs
# Download HFS HTTP SERVER  from following link

http://www.dovedove.it/hfs/hfs279.exe

Double click hfs.exe to execute the program. You will see the following

Select YES.

Now Adjust Few settings to make it adjust with your network environment. See the below images.


Now from Browser open http://yourip and you will something below

Now its time to add any folder, you can DRAG n DROP any folder you wish to share with the general public,or Right click on any folder and you will be presented with the option ADD TO HFS, a popup windows be opened , select Real Folder, and click on OK.

Now open the http://yourip again and you will see the shared folder.

Your Files are ready to be Explored 🙂

You can also protect your folder by User ID / Password. Just Rright click on your folder (in HFS) and set user/pass , and then type your id password, so next time when any user will try to open this folder, he will be asked for credentials.

You can also use multiple Skins/Templates supported by HFS.

You can  play Songs / Videos  / image preview directly via Browser using this hfs server, for this purpose yo have to install RAWR Template Theme from

http://www.rejetto.com/forum/index.php/topic,5456.0.html

After importing Template , You can directly Play several Media Files via Browser, Sample is attached.

[Make sure your clients have VLC Media Player installed.]

Comments are Welcome !

Regard’s
SYED JAHANZAIB

%d bloggers like this: