Category: Computer

Aug 14 2010

Guestbook #2

owh tak dapat tidur di malam minggu di bulan puasa yang esok tak tau lagi nak buat ape. owh..

apa dibawah ialah guestbook php + mysql yang dimod dari versi php + txt file yang tahun lepas. boleh tengok di sini untuk yang dulu.

<?php
$con = mysql_connect(“localhost”,”guestbook_user”,”password”); //ubah ikut kesusaian
mysql_select_db(“guestbook”, $con); //ubah nama db jika berkenaan.
if (!$con)
{
die(‘Could not connect: ‘ . mysql_error());
}
if (!isset($_POST[‘SubmitForm’])) {
} else {
echo “<span class=’mid’>”;
echo “Terima KasihΒ  =)”;
echo “<br>”;
echo “<br>”;
$nama = $_POST[‘nama’];
$msj = $_POST[‘msj’];

$tag = array(“<“, “>”);
$nama = str_replace($tag, “_”, $nama);
$msj = str_replace($tag, “_”, $msj);

$masa = “(“.date(“F j, Y, g:i a”).”)”;

$nama = mysql_real_escape_string($nama);
$msj = mysql_real_escape_string($msj);
$masa = mysql_real_escape_string($masa);

mysql_query(“INSERT INTO entry (masa, nama, msj) VALUES (‘$masa’,’$nama’,’$msj’)”);

}
?>
</p>
<center>
<form action'”.$_SERVER[‘PHP_SELF’].”‘ method=”POST”>
<span>Tinggalkan mesej/ucapan anda disini:</span><br>
<table>
<tr>
<td><span>Name</span>::</td>
<td><input type=”text” name=”nama”></td>
</tr>
<tr>
<td>Message: </td>
<td><textarea name=”msj”></textarea></td>
</tr>

</table>
<input type=”submit” name=”SubmitForm” value=”Send”>
</form><span>
– – – – – – – – – – – <br>
<?php
$entry = mysql_query(“SELECT * FROM entry”);

while($row = mysql_fetch_array($entry))
{
echo $row[‘nama’] . $row[‘masa’];
echo “<br />”;
echo $row[‘msj’];
echo “<br />”;
echo “———-“;
echo “<br />”;
echo “<br />”;
}
mysql_close($con);
?>
</center>

untuk yang ni, instead of simpan msj dalam txt file, msj semuanya disimpan dalam MySQL db. code sedikit pendek, tapi memerlukan MySQL server untuk berfungsi.

utk db, bleh dump ape yang ad dibawah:

CREATE TABLE IF NOT EXISTS `entry` (
`no` int(11) NOT NULL AUTO_INCREMENT,
`masa` text NOT NULL,
`nama` text NOT NULL,
`msj` text NOT NULL,
PRIMARY KEY (`no`)
) ENGINE=MyISAMΒ  DEFAULT CHARSET=latin1 AUTO_INCREMENT=11 ;

INSERT INTO `entry` (`no`, `masa`, `nama`, `msj`) VALUES
(10, ‘(August 13, 2010, 7:10 pm)’, ‘gsbgse’, ‘brstbrtsn’),
(4, ‘(August 13, 2010, 6:59 pm)’, ‘aebgerbewt’, ‘hbtwbryn’),
(5, ‘(August 13, 2010, 7:00 pm)’, ‘faeger’, ‘gergwe4h35’),
(6, ‘(August 13, 2010, 7:01 pm)’, ‘faeger’, ‘gergwe4h35’),
(7, ‘(August 13, 2010, 7:01 pm)’, ‘gaergera’, ‘gergreh3’),
(8, ‘(August 13, 2010, 7:01 pm)’, ‘fwef3qwrhgw354’, ‘gbw45gw34hgw354th’),
(9, ‘(August 13, 2010, 7:08 pm)’, ‘gseb’, ‘esbb’);

db kat atas ni dh ada testing data yang tah paper. feel free to create a new one, fresh one.

camne nak guna? pastikan httpserver (eg: apache) dan MySQL up and running.

copy the code, paste kedalam .php file.

create database nama guestbook (kalau nak guna nama lain pun boleh, tapi pastikan ubah db pada msql_select_db. da create db, boleh dump sql kat atas. ataupun create sendiri table.

do comments kalau ada bug, comments, critics n etc.

selamat testing2 dan selamat berpuasa =)

—–

and for unknown reason, I smileeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee =)

Jan 18 2010

Fishing hosted on Yahoo!’s ?

i get this from adam

http://www.cimbankclicks.com/ibk/

very-very sebijik. don’t get confuse, the original one is: https://www.cimbclicks.com.my/ibk/

so, i try:

ooo.. i have to login. ok, i’ll.

locked? need TAC? ouch! ok, i’ll!

i hope i manage to get in.

error? (see the address bar). i keep trying for many times, same result. ERROR.

knowing http://www.cimbankclicks.com/

i start with “root” address. removing the ibk/

opsss.. yahoo!? wth are you doing here?

i test with some random “word”

it’s yahoo.(look like the “dead” geocities error page, very similar =D).

source: http://www.robtex.com/dns/cimbankclicks.com.html#shared

yahoo!?Β  *san.yahoo.com?

yahoo!

—————————-

fishing can’t be anywhere. you need to go to pool, sea or any place that have fish. unless you are thinking of human-fishing. in this case, it’s phishing. it can be anywhere on the net. might be on your server (if any) or my server (i don’t have any).

happy surfing, don’t get into phishing πŸ™‚

Dec 10 2009

MySQL backup using PHP

salam and good (late) evening.

thinking of having a database backup for this blog, i plan to run a cron job on this hosting. i have several choice, to run sh, cgi, perl or php. i choose to try php.

some googling bring me to this site: http://davidwalsh.name/backup-mysql-database-php

i mod the script a bit, only a small change.

<?php
backup_tables(‘localhost’,’db_usename’,’db_password’,’db_name’);

/* backup the db OR just a table */
function backup_tables($host,$user,$pass,$name,$tables = ‘*’)
{

$link = mysql_connect($host,$user,$pass);
mysql_select_db($name,$link);

//get all of the tables
if($tables == ‘*’)
{
$tables = array();
$result = mysql_query(‘SHOW TABLES’);
while($row = mysql_fetch_row($result))
{
$tables[] = $row[0];
}
}
else
{
$tables = is_array($tables) ? $tables : explode(‘,’,$tables);
}

//cycle through
foreach($tables as $table)
{
$result = mysql_query(‘SELECT * FROM ‘.$table);
$num_fields = mysql_num_fields($result);

//$return.= ‘DROP TABLE ‘.$table.’;’;Β  ##i don’t want this as i can manually remove existing table during restoring the backup
$row2 = mysql_fetch_row(mysql_query(‘SHOW CREATE TABLE ‘.$table));
$return.= “\n\n”.$row2[1].”;\n\n”;

for ($i = 0; $i < $num_fields; $i++)
{
while($row = mysql_fetch_row($result))
{
$return.= ‘INSERT INTO ‘.$table.’ VALUES(‘;
for($j=0; $j<$num_fields; $j++)
{
$row[$j] = addslashes($row[$j]);
$row[$j] = ereg_replace(“\n”,”\\n”,$row[$j]);
if (isset($row[$j])) { $return.= ‘”‘.$row[$j].'”‘ ; } else { $return.= ‘””‘; }
if ($j<($num_fields-1)) { $return.= ‘,’; }
}
$return.= “);\n”;
}
}
$return.=”\n\n\n”;
}

//save file – i use this name as for me.
$timed = date(DATE_RFC822);
$aa = array(‘ ‘,’:’,’+’,’,’);
$timed = str_replace($aa,’_’,$timed);
$path = ‘/home2/sesteria/public_html/aalim/blog/’;
$filename= $timed . ‘.sql’;
//echo $filename;
//$handle = fopen(‘db-backup-‘.time().’-‘.(md5(implode(‘,’,$tables))).’.sql’,’w+’);

//i want to know
$to = “aalim@aalim.net”;
$subject = “Backup for today done – ” . date(DATE_RFC822);
$body = $filename;
mail($to, $subject, $body);

$handle = fopen($filename,’w+’);
fwrite($handle,$return);
fclose($handle);

mysql_close($link); //i add this
}

?>

To use this, copy into a text editor, and save as backup.php (you can choose your own filename).

Run this script via browser by accessing the page. eg: http://aalim.net/backup.php

A .sql file will be created in the same directory of this script.

The other way to execute is, via shell by using this command:

php /home/aalim/blog/backup.php

A .sql file will be created in the directory where you execute the command. (pwd will tell you where you are)

terima kasih =)

Make sure to CHMOD 777 the directory to allow a new file to be created. (You might not need 777)

Dec 02 2009

lupa

membuang masa nak menyelesaikan

… failed to open stream: Permission denied in …

yang mana rupanya hanyalah sebab register_globals yang aku off sebelum ni.

haishhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh

noob.

Mar 23 2009

welcoming address

it’s something to be proud of.. but, the truth is this is the beginning..

all the best Project Tango, f.n0rd, k0r.cr3w, Infinity and d.o.t

Sep 21 2008

Creating a fake file

Salam and good day.

You are to create a 1Mb file. A fake file.

1-Get you scientific calculator (or anything), convert 1000000 into hexadecimal.
you will have F4240. make it 8 bit. so that, it is 000F4240. Remember. Remember. Remember this.

2- Run cmd. Go to start>run. Type cmd. A “black box” appeared. For me, i’ll have this:

Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

C:\Documents and Settings\aalim>

That shows your current directory. Up to you to move ahead or backoff. :). I choose to move forward. type cd Desktop

C:\Documents and Settings\aalim>cd Desktop

And now i’ll have:

C:\Documents and Settings\aalim\Desktop>

3-Now, type debug aalim.txt. i choose want the fake file to be aalim.txt. just replace aalim.txt with whatever you want. yourday.3gp perhaps?

You will have something like this:

C:\Documents and Settings\aalim\Desktop>debug aalim.txt
File not found

4-Type RCX, and enter. Then type 4240, enter (the last 4 digit of the hexadecimal value).

5-Type RBX, and enter. Then type 000F, enter (the first 4 digit of the hexadecimal value).

6-Almost there. Type w, enter.

7-Type q, enter.

8-You are done.

it still consume your disk space πŸ™‚

//ps: aku rasa nk makan nekbak~ argh~!!!!!

Sep 20 2008

OS from USB

i have a laptop. masa beli, spec mmg tiptop. πŸ™‚ typical acer, rosak dvd-drive.

last month, upgrade harddisk. kasi “besar” sket. since dvd-drive rosak, tak boleh la nk install windows cara normal. kena buat sedikit abnormal.

tapi, disni bukan saya nk cerita macam mana nk install guna usb, tapi nk share je web yang ada tutorial cara nk install guna usb πŸ™‚

http://www.vandomburg.net/installing-windows-xp-from-usb/

itu untuk window. untuk linux pn ada πŸ™‚
sebagai contoh, Fedora.

http://fedoraproject.org/wiki/FedoraLiveCD/USBHowTo#Using_Windows

all the best πŸ™‚

Apr 20 2008

fishing…

ish2.. got this phishing site from chaah’s

[singlepic=144,250,center]

menarik kerja mamat ni..

dh orang isi, dia hntr email username n passwd kpd dia… owh.. ini emailnya:

maulannaz_zamrudz@yahoo.com.my

wow.. malaysian tu…(i guess it from the .my)

tak tahu apa nak jadi. sebelum ni saya ad dapat virus dari dalam thumbdrive kawan saya. namanya v3-force.exe

mula-mula tu rasa cam waaa hebatnya virus ni sebab saya x jumpa ape2 running process yg boleh dikaitkan ngan process neh, selain v3-force.exe yg bilamana dikill, akan run balik.

barula saya perasan v3-force.exe tu mirc aje rupanya. ish2.. shame on me. punyalah sengal. semua code yg dikatakan virus tu ada dalam remote mirc tu aje. ish2.. what a… well, that was another great invention from malaysian πŸ˜€ begitu tegar scripter itu.

later i’ll talk about this “virus” or perhaps friend of mine will do that in his blog.

Apr 15 2008

utpchat.net renewed

sorry for the incovenience…

tunnel.utpchat.net is now back, up and running..

p/s: actually the tunnel server is up and running all the time, cumanya domain tu expired πŸ™‚

Mar 25 2008

vnc

Virtual Network Computing. It is more or less the same with Remote Desktop. VNC enables you to virtually have a physical access to other workstation. The client, VNC viewer used to connect to VNC server which is running on the workstation/server that you would like to connect.

There are several VNC exist out there: TightVNC, RealVNC & Ultra VNC.

To setup a VNC, you only need to run the VNC server on the workstation. Configure the password. Changing the port is optional. By default, VNC use 5900 as its port. And also 5800 – can be used to view from web browser with java enabled.

To connect to the workstation, have the VNC viewer with you, run it. Enter the workstation IP or domain or etc2, when prompted for password, do what you should do. And u are connected.

Well, that the so-so part. The not that so-so part.

Fastpush can be used to install a VNC on workstation virtually. This can be done without been noticed by the workstation’s owner. VNC’s password is stored in registry and encrypted. Using some tools, you can have it in plain text. There are VNC client that allow you to have an access to the workstations files and folders. Thus, you can copy, delete, paste or bla bla bla with the workstations dir. VNC authentication can be “sniff” through a network and plain text, unencrypted of the password can be read by the “sniffer”. Not that different with telnet. VNC server can be used either by mac, nix or win box to connect to any mac, nix or win box.

yet, another share. sedih. terkilan. pilu. harapan palsu.

Feb 05 2008

proxy #1

salam and good day.

 

i would like to share my web proxy. provided by http://www.freeproxytemplates.com/

http://tc.aalim.net

why web proxy? post regarding proxy before this might helps you.

to ease you. it’s help in browsing sites that you can’t that cause by firewall restriction. after all, it’s still depend on how the firewall is being config to filter you web content, what kind of firewall is that. anyway, just give a try. no one know and one never know if today is your day.

this web proxy is hosted at 000webhost.com
i give you both, PHP-proxy and CGI-proxy. What’s the difference? what if i don’t know. Google.

good luck.

Jan 29 2008

the mask

why proxy? bcoz i dun want to talk bout friends, hope, love, work, food and bla bla bla..

what is proxy? this is what uncle Google said (btw, logo google arini adalah bersempena ulang tahun k-50 lego. teringat plak zaman kecik aku main lego. masa tu x der pun lego yg ad tayar2. seingat aku bentuk kuboid tu je la…)

proxy?
i’ll answer based on my own understanding. well, this post not really meant to tell you about proxy. it’s kinda note for me. proxy is a 3rd-party that you use to access something. instead of directly access google.com, you use proxy to access it. so that, the google will accept you as the proxy not as real you.


why do you proxy? to be invisible. don’t want to be tracked. becoz you want to do something illegal. eg: bypass network box.

you will use proxy when you want to use. it’s available anywhere. if not, you can make it available. it’s either you know or don’t know (something you can learn if you want to).

proxy… web proxy, http proxy, sock proxy and etc2… every single type have its own role. some can be the same. some might not. depend on where you want to use them. why use this and why use that? i dun really know. what i do, try A, if fails, try B, if fail try C, and the list goes on (might stop at e. f, ask the others)

how to proxy? set up your own or just “take and use”. well, to take of course you have to find (unless you already know where is it). google helps a lot. to use? very depend on where to use. mIRC, dc++, firefox have its own way to config to be able to use with proxy. creating your own? is it a must?

that’s all. i really2 ngantuk. u can ask me about anything i typed here (with lots of typo, grammar error, bla bla bla)

good luck.