Archive | February, 2006

PHP : Make Directory

27 Feb

<?php
mkdir(“/path/to/my/dir”, 0777);
?>

http://sg.php.net/manual/en/function.mkdir.php

PHP : Delete a file, or a folder and its contents

27 Feb

<?php
/**
* Delete a file, or a folder and its contents
*
* @author Aidan Lister <aidan@php.net>
* @version 1.0.2
* @param string $dirname Directory to delete
* @return bool Returns TRUE on success, FALSE on failure
*/
function rmdirr($dirname)
{
// Sanity check
if (!file_exists($dirname)) {
return false;
}

// Simple delete for a file
if (is_file($dirname)) {
return unlink($dirname);
}

// Loop through the folder
$dir = dir($dirname);
while (false !== $entry = $dir->read()) {
// Skip pointers
if ($entry == ‘.’ || $entry == ‘..’) {
continue;
}

// Recurse
rmdirr(“$dirname/$entry”);
}

// Clean up
$dir->close();
return rmdir($dirname);
}

?>

http://aidan.dotgeek.org/lib/?file=function.rmdirr.php

DOS : Batch File Rename

27 Feb

The following batch script will rename the files from the current directory to their creation date and time, with the format YYMMDD-HHMM.extention (the extention will be mantained). The script not only on WinXP, but also in Win95Cmd.EXE, which is somekind of Win2000’s command interpreter emulator.

===== BATCH SCRIPT BEGIN =====
@echo off

if “%OS%”==”Windows_NT” goto OSOK
echo This program must be run in a NT system.
goto eof

:OSOK
if “%1″==”GoTo” goto %2
%comspec% /v /c %0 GoTo start
goto eof

:start
for %%? in (*.*) do (
for /F “tokens=1-6 delims=/-: ” %%A in (“%%~t?”) do (
set MM=%%A
set DD=%%B
set YYYY=%%C
set HH=%%D
set MI=%%E
set AP=%%F
if “!AP!”==”PM” set /A HH += 12
set YY=!YYYY:~-2!
REN %%~s? !YY!!MM!!DD!-!HH!!MI!%%~x?
)
)

:eof
===== BATCH SCRIPT END =====

Another script, which should work on Windows 2000.

===== BATCH SCRIPT BEGIN =====
@echo off
if “%1″==”GoTo” goto %2

ver |FIND “Microsoft Windows 2000” > nul
if not errorlevel=1 goto OSOK
echo This program must be run in Microsoft Windows 2000.
goto eof

:OSOK
%comspec% /v:on /c %0 GoTo start
goto eof

:start
for %%? in (*.*) do (
for /F “tokens=1-6 delims=/-: ” %%A in (“%%~t?”) do (
set MM=%%A
set DD=%%B
set YY=%%C
set HH=%%D
set MI=%%E
if “!MI:~-1!”==”p” set /A HH += 12
set MI=!MI:~0,-1!

:: To activate the script, remove “echo.{demo}” from next line
echo.{demo}REN %%~s? !YY!!MM!!DD!-!HH!!MI!%%~x?

)
)

:eof
===== BATCH SCRIPT END =====

Homepage Tips

10 Feb

HOMEPAGES MAKER TIPS

· Font sizes can be set explicitly. Different font sizes can be used on the same line as well.
Use text to enclose the text you want to change.
The tag used for the first example here is: FONT SIZE=1
FONT SIZE=1 (smallest) FONT SIZE=7 (largest)
· Special tags can be used to change the characteristics of what is displayed. Some of these are shown here.

1. Use BOLD to get the BOLD effect.

2. Use Italic to get the Italic effect.

3. The Emphasis element, coded as Emphasis, typically is the same as Italics, but could change in the future.

4. Other Character formatting elements include : Big – Big text (Same effect as )

5. Blinking – Blinking text (try not to use too much)

6. Small – Small text (Same as )

7. strukthrough – Text that has been struck through

8. strong – Text with strong attribute (Like bold )

9. Subscript – Shows as Subscript

10. Superscript – Shows as Superscript

11. Teletype – TypeType (or Teletype). ( has the same effect.)

12. Underlined text - Underlined text (doesn't show up in all browsers).

· The tag can also be used to set text colors. (You can include both the SIZE and COLOR parameters in the tag if you want.) Red will set the word Red to red (or any other color). You can set adjacent characters to different colors if you want.

·


gives a simple rule, shown shaded. You can show the bar solid with NOSHADE specified (


) You can show the bar wider (


) And wider without shading
(


) You can also center the ruler (or position it to the left or right) and limit
the width of the ruler (


)

· You can center the text (...text...) Text can be centered in a table cell or in a following paragraph, such as this one.

· Additional paragraphs can be added (separated from the previous paragraph here by the line break tag (
), which starts a new paragraph, but without a blank line.

· The paragraph tag

starts a new line here, but adds a single blank line first. The text, however, will remain centered until the closing tag.

· If you do nothing, text will be justified to the left, like this paragraph. By enclosing the text in

...text...

, you can force the paragraph to be right aligned (next to a photograph or in a table). Left alignment is the default. Just enter text without any special tags to get left justified text.

· A block of text can be indented from a preceding and following paragraph (left justified, but indented on both the right and left) by using the

...text...

tags.
This allows you to add some information, set off from the remainder of the text. Both margins are
indented, as well as having a blank line before and after the text. This will add some special phasis
or break up the text for easier reading by the viewer. Normally, one or more spaces in the source are
condensed to one space by the browser.

· If you want to actually have more than one space, say to look like a tab, you can insert the special symbol for a non-breaking space (where more than one will not be reduced to a single space),   (you need to enter all six characters!). Thus, by including 6 of these at the start of the next paragraph, we get the following: This paragraph now appears to have been tabbed over when
started. Following sentences (and paragraphs) adhere to the normal rules for spaces.

· Aligning text in columns or with images and icons A two column table can be used to align text in columns, leave a blank space to the right, or line up text and images.
The following HTML is used to create the tables below. BORDER=0 is used for the right table. The
table will automatically assign enough space to accommodate the height and width of the graphics
and text in any row or column.

Image to the left, borders turned on
Another image

· Using a table to indent text. The following HTML will create a two column table, with the first column taking 25% of the space (which will not be filled) and a second table which will contain headings, text, and a list. If you are using Internet Explorer or Netscape 3.0, you will see the background for this table data being white.

Table to create left margin (this is the table header)

This is a header ....

What follows is a list of things about tables.

  1. Table data can ....
  2. Table data represents ....
  3. Table rows can contain ....
  4. Table data in any row ....
  5. Images or text may be ....

· This line starts at the left margin of the page, preceding the table statements below. If you were using tables to format your page for a background that had a left border, then you could put your lunks in the left column, ober the border, and the rest of your page at the right, with all your text, images, and other tables within the right column, similar to the example below.

n - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

· Putting a table within a table. When a table is used to format a page, you may want to have a table in that larger table. Here we have a table that is three columns wide by three rows long, without the borders showing. In it we have a smaller five column by three row table, with borders, that spans the last two columns of the larger table. Here is the HTML to create the following tables.

Tables are fun Tables are quite useful
Tables are the best way
to lay out a page in an
ordered manner.

Number of
cells
Cols = 1 Cols = 2 Cols = 3 Cols = 4
Rows = 1 1 2 3 4
Rows = 2 2 4 6 8

· And here is what you see with the HTML shown. By using tables, you can place text or images wherever you want them on the page. What is shown is a table with BORDER=0 to make text and another table appear on the page where we want it to be.

n - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Free Move

9 Feb

<SCRIPT language=JavaScript1.2>

/*
Roaming Cursor script (By Kurt at kurt.grigg@virgin.net)
Modified and permission granted to Dynamic Drive to feature script in archive
For full source, usage terms, and 100’s more DHTML scripts, visit http://dynamicdrive.com
*/

//specify path to cursor image
var cursorpath=”cursor.gif”

if (document.layers)
{document.write(“<LAYER NAME=’PoInTeRs’ LEFT=10 TOP=10><img src='”+cursorpath+”‘ width=17 height=22></LAYER>”)}
else if (document.all){document.write(“<div id=’pOiNtErS’ style=’position:absolute;top:10px;left:10px;width:17px;height:22px;z-index:50′><img src='”+cursorpath+”‘ width=17 height=22></div>”)}

count=-1;
move=1;

function Curve(){
abc=new Array(0,1,1,1,2,3,4,0,6,-1,-1,-1,-2,-3,-4,0,-6)
for (i=0; i < abc.length; i++)
{var C=Math.round(Math.random()*[i])}
howbend=abc[C];
setTimeout(‘Curve()’,1900);
return howbend;
}
ypos=10;
xpos=10;

degree = 60;
function MoveRandom(){
PathBend=degree+=howbend;//ok!
y = 4*Math.sin(PathBend*Math.PI/180);
x = 6*Math.cos(PathBend*Math.PI/180);
if (document.layers){
ypos+=y;
xpos+=x;
document.PoInTeRs.top=ypos+window.pageYOffset;
document.PoInTeRs.left=xpos+window.pageXOffset;
}
else if (document.all){
ypos+=y;
xpos+=x;
document.all.pOiNtErS.style.top=ypos+document.body.scrollTop;
document.all.pOiNtErS.style.left=xpos+document.body.scrollLeft;
}
T=setTimeout(‘MoveRandom()’,50);
}
function edges(){
if (document.layers){
if (document.PoInTeRs.left >= window.innerWidth-40+window.pageXOffset)degree=Math.round(Math.random()*45+157.5);
if (document.PoInTeRs.top >= window.innerHeight-30+window.pageYOffset)degree=Math.round(Math.random()*45-112.5);
if (document.PoInTeRs.top <= 2+window.pageYOffset) degree = Math.round(Math.random()*45+67.5);//OK!
if (document.PoInTeRs.left <= 2+window.pageXOffset) degree = Math.round(Math.random()*45-22.5);//OK!
}
else if (document.all)
{
if (document.all.pOiNtErS.style.pixelLeft >= document.body.offsetWidth-45+document.body.scrollLeft)degree=Math.round(Math.random()*45+157.5);
if (document.all.pOiNtErS.style.pixelTop >= document.body.offsetHeight-35+document.body.scrollTop)degree=Math.round(Math.random()*45-112.5);
if (document.all.pOiNtErS.style.pixelTop <= 2+document.body.scrollTop) degree = Math.round(Math.random()*45+67.5);//OK!
if (document.all.pOiNtErS.style.pixelLeft <= 2+document.body.scrollLeft) degree = Math.round(Math.random()*45-22.5);//OK!
}
setTimeout(‘edges()’,100);
}
function starteffect(){
Curve();
MoveRandom();// onUnload=”opener.gO()”
edges();
}

if (document.all||document.layers)
window.onload=starteffect
</SCRIPT>

free-movehtm.txt

Color Changer 2

8 Feb

<!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.0 Transitional//EN”>
<!– saved from url=(0061)http://www.espressographics.com/gif/archive/text/goldbar.html –>
<HTML><HEAD><TITLE>GIF89a</TITLE>
<META http-equiv=Content-Type content=”text/html; charset=windows-1252″>
<META content=”MSHTML 6.00.2722.900″ name=GENERATOR></HEAD>
<BODY text=#ffffff vLink=#000000 link=#00008b bgColor=#000000>
<CENTER><IMG src=”GIF89a_files/goldbar.gif” vspace=5>
<P><FONT face=”Verdana, Geneva, Arial” size=2>If you want to see what the
animated gif will look like with a different colored background, just click on a
button:</FONT>
<P>
<FORM><INPUT onclick=”document.bgColor=’#FF0000′” type=button value=red> <INPUT onclick=”document.bgColor=’#FF00CC'” type=button value=pink> <INPUT onclick=”document.bgColor=’#fa8072′” type=button value=salmon> <INPUT onclick=”document.bgColor=’#FF6600′” type=button value=orange> <INPUT onclick=”document.bgColor=’#006600′” type=button value=green> <INPUT onclick=”document.bgColor=’#FFFF00′” type=button value=yellow> <INPUT onclick=”document.bgColor=’#000066′” type=button value=blue> <INPUT onclick=”document.bgColor=’#99CCFF'” type=button value=azure> <INPUT onclick=”document.bgColor=’#660099′” type=button value=purple> <INPUT onclick=”document.bgColor=’#dda0dd'” type=button value=lavender> <INPUT onclick=”document.bgColor=’#FFFFFF'” type=button value=white> <INPUT onclick=”document.bgColor=’#000000′” type=button value=black>
</FORM></CENTER></P></BODY></HTML>

color-changer-2htm.txt

Mouse Pointer 2 : Clock

8 Feb

<HTML><HEAD><TITLE>clock</TITLE>
<META content=”text/html; charset=windows-1252″ http-equiv=Content-Type><!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.0 Transitional//EN”>
<SCRIPT src=”https://putraworks.files.wordpress.com/2007/02/clockjs.txt”></SCRIPT&gt;

<STYLE>.crap {
COLOR: white; CURSOR: default; FONT-FAMILY: verdana; FONT-SIZE: 10px; TEXT-ALIGN: center; WIDTH: 30px
}
</STYLE>

<META content=”MSHTML 5.00.2314.1000″ name=GENERATOR></HEAD>
<BODY bgColor=black onmousemove=setMove() onselectstart=dont() text=white>
<!–<form><input></form>–>
<DIV class=crap id=yo0
style=”LEFT: 135px; POSITION: absolute; TOP: 135px; Z-INDEX: 2″><IMG alt=””
border=0 height=128 src=”https://putraworks.files.wordpress.com/2007/02/ring.gif&#8221; width=128></DIV>
<DIV class=crap id=yo1
style=”LEFT: 200px; POSITION: absolute; TOP: 200px; Z-INDEX: 4″>12</DIV>
<DIV class=crap id=yo2
style=”LEFT: 200px; POSITION: absolute; TOP: 200px; Z-INDEX: 5″>1</DIV>
<DIV class=crap id=yo3
style=”LEFT: 200px; POSITION: absolute; TOP: 200px; Z-INDEX: 6″>2</DIV>
<DIV class=crap id=yo4
style=”LEFT: 200px; POSITION: absolute; TOP: 200px; Z-INDEX: 7″>3</DIV>
<DIV class=crap id=yo5
style=”LEFT: 200px; POSITION: absolute; TOP: 200px; Z-INDEX: 8″>4</DIV>
<DIV class=crap id=yo6
style=”LEFT: 200px; POSITION: absolute; TOP: 200px; Z-INDEX: 9″>5</DIV>
<DIV class=crap id=yo7
style=”LEFT: 200px; POSITION: absolute; TOP: 200px; Z-INDEX: 10″>6</DIV>
<DIV class=crap id=yo8
style=”LEFT: 200px; POSITION: absolute; TOP: 200px; Z-INDEX: 11″>7</DIV>
<DIV class=crap id=yo9
style=”LEFT: 200px; POSITION: absolute; TOP: 200px; Z-INDEX: 12″>8</DIV>
<DIV class=crap id=yo10
style=”LEFT: 200px; POSITION: absolute; TOP: 200px; Z-INDEX: 13″>9</DIV>
<DIV class=crap id=yo11
style=”LEFT: 200px; POSITION: absolute; TOP: 200px; Z-INDEX: 14″>10</DIV>
<DIV class=crap id=yo12
style=”LEFT: 200px; POSITION: absolute; TOP: 200px; Z-INDEX: 15″>11</DIV>
<DIV class=crap id=yo13
style=”LEFT: 200px; POSITION: absolute; TOP: 200px; Z-INDEX: 16″><IMG alt=””
border=0 height=5 src=”https://putraworks.files.wordpress.com/2007/02/plupp.gif&#8221; width=5></DIV>
<DIV class=crap id=yo14
style=”LEFT: 200px; POSITION: absolute; TOP: 200px; Z-INDEX: 17″><IMG alt=””
border=0 height=5 src=”https://putraworks.files.wordpress.com/2007/02/plupp.gif&#8221; width=5></DIV>
<DIV class=crap id=yo15
style=”LEFT: 200px; POSITION: absolute; TOP: 200px; Z-INDEX: 18″><IMG alt=””
border=0 height=5 src=”https://putraworks.files.wordpress.com/2007/02/plupp.gif&#8221; width=5></DIV>
<DIV class=crap id=yo16
style=”LEFT: 200px; POSITION: absolute; TOP: 200px; Z-INDEX: 19″><IMG alt=””
border=0 height=5 src=”https://putraworks.files.wordpress.com/2007/02/plupp1.gif&#8221; width=5></DIV>
<DIV class=crap id=yo17
style=”LEFT: 200px; POSITION: absolute; TOP: 200px; Z-INDEX: 20″><IMG alt=””
border=0 height=5 src=”https://putraworks.files.wordpress.com/2007/02/plupp1.gif&#8221; width=5></DIV>
<DIV class=crap id=yo18
style=”LEFT: 200px; POSITION: absolute; TOP: 200px; Z-INDEX: 21″><IMG alt=””
border=0 height=5 src=”https://putraworks.files.wordpress.com/2007/02/plupp1.gif&#8221; width=5></DIV>
<DIV class=crap id=yo19
style=”LEFT: 200px; POSITION: absolute; TOP: 200px; Z-INDEX: 22″><IMG alt=””
border=0 height=5 src=”https://putraworks.files.wordpress.com/2007/02/plupp0.gif&#8221; width=5></DIV>
<DIV class=crap id=yo20
style=”LEFT: 200px; POSITION: absolute; TOP: 200px; Z-INDEX: 23″><IMG alt=””
border=0 height=5 src=”https://putraworks.files.wordpress.com/2007/02/plupp0.gif&#8221; width=5></DIV>
<DIV class=crap id=yo21
style=”LEFT: 200px; POSITION: absolute; TOP: 200px; Z-INDEX: 24″><IMG alt=””
border=0 height=5 src=”https://putraworks.files.wordpress.com/2007/02/plupp0.gif&#8221; width=5></DIV>

<SCRIPT langage=”javascript”>

yo (“0”, -65, -65)

yo (“1”, -15, -58)

yo (“2”, 10, -51)

yo (“3”, 28, -33)

yo (“4”, 35, -8)

yo (“5”, 28, 17)

yo (“6”, 10, 35)

yo (“7”, -15, 42)

yo (“8”, -40, 35)

yo (“9”, -58, 17)

yo (“10”, -65, -8)

yo (“11”, -58, -33)

yo (“12”, -40, -51)

yo (“13”, -15, 0)

yo (“14”, -15, 0)

yo (“15”, -15, 0)

yo (“16”, -15, 0)

yo (“17”, -15, 0)

yo (“18”, -15, 0)

yo (“19”, -15, 0)

yo (“20”, -15, 0)

yo (“21”, -15, 0)

plupp()

setInterval (“plupp()”, 200)

setInterval (“move()”, 30)

if (!ie) {

document.captureEvents (Event.MOUSEMOVE)

document.onMouseMove = setMove

}

</SCRIPT>
</BODY></HTML>

clock.js:

oDivs = new Array()

iDivs = 0

ie = document.all ? true : false

function yo (s, x, y) {

if (ie) oDivs[iDivs] = new Array (eval(‘yo’+s).style, iXTo, iYTo, x, y)

else oDivs[iDivs] = new Array (eval(‘document.yo’+s), iXTo, iYTo, x, y)

iDivs++

}

iXTo = 200

iYTo = 200

function setMove(e) {

if (ie) {

iXTo = event.x

iYTo = event.y

}

else {

iXTo = e.pageX

iYTo = e.pageY

}

//document.forms[0].elements[0].value = iXTo+”, “+iYTo

}

function move() {

x = iXTo

y = iYTo

for (i=0; i<iDivs; i++) {

oDivs[i][1] = oDivs[i][1] * 0.5 + x * 0.5

oDivs[i][2] = oDivs[i][2] * 0.5 + y * 0.5

oDivs[i][0].left = oDivs[i][1] + oDivs[i][3]

oDivs[i][0].top = oDivs[i][2] + oDivs[i][4]

x = oDivs[i][1]

y = oDivs[i][2]

}

}

function dont () {

event.returnValue = false

}

iLastS = -1

function plupp () {

time = new Date ()

iS = time.getSeconds()

if (iS != iLastS) {

iLastS = iS

iS = 2 * 3.1415 * time.getSeconds() / 60

iM = 2 * 3.1415 * time.getMinutes() / 60

iH = 2 * 3.1415 * time.getHours() / 12 + 31.415 * parseInt (time.getMinutes() / 5) / 720

for (i=13;i<16;i++) {

oDivs[i][3] = Math.sin(iS) * (45 – (i-13)*16) – 15

oDivs[i][4] = -Math.cos(iS) * (45 – (i-13)*16) – 3

}

for (i=16;i<19;i++) {

oDivs[i][3] = Math.sin(iM) * (37 – (i-16)*10) – 15

oDivs[i][4] = -Math.cos(iM) * (37 – (i-16)*10) – 3

}

for (i=19;i<22;i++) {

oDivs[i][3] = Math.sin(iH) * (27 – (i-19)*7) – 15

oDivs[i][4] = -Math.cos(iH) * (27 – (i-19)*7) – 3

}

}

}

clockjs.txt

Demo:
clockhtm.txt