Checking if someone is online with ICQ in PHP

<?php
        // ***
        // ICQ tjek funktion
        // ***
        function icq_test($uin) {
                $arr = file( "http://online.mirabilis.com/scripts/online.dll?icq=$uin&img=1");
                    $len = strlen($arr[1]);
                    if ($len == 96) {
                        return  "<b><font color=\"#00FF00\">Online</font></b>";
                } elseif ($len == 83) {
                        return  "<b><font color=\"#FF4040\">Offline</font></b>";
                } elseif ($len == 1) {
                        return  "<b><font color=\"#FF4040\">Offline</font></b>";
                } else {
                        return  "Status ukendt";
                }
        }
?

 

Udgivet i Knowledge Base, Old Base, PHP, Programmering | Skriv en kommentar

Sessions i php

session_start();

if ( $_SESSION[“nick”] != “”)

Udgivet i Knowledge Base, Old Base, PHP, Programmering | Skriv en kommentar

Mål bandwidth troughput

http://freshmeat.net/redir/iperf/30604/url_tgz/iperf-1.7.0-source.tar.gz

root@chilibeans:~/iperf-1.7.0# iperf -s -c localhost
------------------------------------------------------------
Server listening on TCP port 5001
TCP window size: 64.0 KByte (default)
------------------------------------------------------------
[  6] local 127.0.0.1 port 5001 connected with 127.0.0.1 port 1952

[ ID] Interval       Transfer     Bandwidth
[  6]  0.0-10.0 sec   482 MBytes   404 Mbits/sec




root@chilibeans:~# iperf -c localhost
------------------------------------------------------------
Client connecting to localhost, TCP port 5001
TCP window size: 64.0 KByte (default)
------------------------------------------------------------
[  5] local 127.0.0.1 port 1952 connected with 127.0.0.1 port 5001
[ ID] Interval       Transfer     Bandwidth
[  5]  0.0-10.0 sec   482 MBytes   404 Mbits/sec

 

Udgivet i Knowledge Base, Networking, Old Base | Skriv en kommentar

Configuring TCP/IP Client on Linux

The interface

eth0           : The interface want to configure
10.1.1.2       : The IP of the interface
255.255.255.0  : The netmask of the interface
 
ifconfig eth0 10.1.1.2 netmask 255.255.255.0 up

The gateway

10.1.1.1       : Name of gateway

route add default gateway 10.1.1.1

The DNS

10.1.1.1       : The DNS server

echo nameserver 10.1.1.1 > /etc/resolv.conf



Now your net should be running!
Udgivet i Knowledge Base, Linux | Skriv en kommentar

Keeping up2date with deamons

Apache

http://httpd.apache.org/lists.html#http-announce

Udgivet i Apache, Knowledge Base, Links, Old Base | Skriv en kommentar

DECSystem 5100 running ultrix password recovery

i mounted /usr and got access to ‘vi’ and also ‘passwd’ changed the root pass and logged in. Here is a short guide on how to do when or if the problem arises for somebody else:

How to recover root password on Utrix 4.4 or DECsystem 5100, proberly works on other systems as well.

Boot the system, when the fsck begins (harddisk checking) press ctrl+c (might be names ‘code’ instead of ‘ctrl’ if your on a vt420 terminal)

You will now be granted with a root promt in singelmode, now type ‘mount /usr’ and then ‘passwd’ you will now be asked for the password you want to set to be roots, type it in, afterwards it will ask you to repeat, do that to.

Now type reboot and log in with your new password.

Udgivet i Knowledge Base, Old Base, Retro hardware | Skriv en kommentar

SQL Queries

Insert data:

insert into TabelName (`Var1`, `Var2`, `Var2`) values ('Content1','Content2','Content2');

Delete data:
delete from TabelName where Var1='Content1';

Update data:
update Tabelname set Var1='More Content' where Var1='Content1';

Queries:
select * from Tablename;
  Show all rows from Tablename

select * from Tablename where Var1='Content';
  Show all rows from Tablename where Var1 contais "Content"

select Var1,Var2 from Tablename where ID<20;
  Show Var1 and Var2 from Tablename with ID lower than 20

select distinct Var1 from TabelName 
  Show all values of Var1 from tablenames except clones

select title from content  where title like "%crac%" and type="dictionary";
   Show all values of content where title containts the letter 'crac' and type is 'dictionary'
Udgivet i Knowledge Base | Skriv en kommentar

Aabne sockets i freebsd

peanut# lsof | grep IPv4
syslogd    245  root    5u  IPv4 0xc2799b94        0t0     UDP *:syslog
sshd       398  root    4u  IPv4 0xc27b5a70        0t0     TCP *:ssh (LISTEN)
sendmail   403  root    3u  IPv4 0xc27b55b8        0t0     TCP *:smtp (LISTEN)
sendmail   403  root    5u  IPv4 0xc27b535c        0t0     TCP *:submission (LISTEN)
gaim       602  mike    6u  IPv4 0xc27b6100        0t0     TCP peanut.unifix.org:49187->baym-sb69.msgr.hotmail.com:1863 (ESTABLISHED)
gaim       602  mike    7u  IPv4 0xc27b5100        0t0     TCP peanut.unifix.org:49188->baym-sb43.msgr.hotmail.com:1863 (ESTABLISHED)
gaim       602  mike   12u  IPv4 0xc27b6ccc        0t0     TCP peanut.unifix.org:49172->baym-cs178.msgr.hotmail.com:1863 (ESTABLISHED)
xchat      604  mike    6u  IPv4 0xc27b5814        0t0     TCP peanut.unifix.org:49174->brunner.freenode.net:ircd (ESTABLISHED)
xchat      604  mike   10u  IPv4 0xc2a9b35c        0t0     TCP peanut.unifix.org:49173->irc1.port80.se:ircd (ESTABLISHED)
ssh        607  mike    3u  IPv4 0xc2a9b5b8        0t0     TCP peanut.unifix.org:49175->unifix.org:ssh (ESTABLISHED)
ssh        718  mike    3u  IPv4 0xc27b6a70        0t0     TCP peanut.unifix.org:49180->unifix.org:ssh (ESTABLISHED)

 

Udgivet i FreeBSD, Knowledge Base, Networking, Old Base | Skriv en kommentar

Add linux /proc in freebsd

Add to /etc/fstab:

linproc /compat/linux/proc linprocfs rw 0 0

Udgivet i FreeBSD, Knowledge Base, Linux, Old Base | Skriv en kommentar

Debug Tools

strace <command> ¸ viser loebende hvad programmet laver


ldd viser lib-deps:
root@chilibeans:~/openssh-3.7p1# ldd /usr/local/sbin/sshd
        libutil.so.1 => /lib/libutil.so.1 (0x7002e000)
        libz.so.1 => /usr/lib/libz.so.1 (0x70040000)
        libnsl.so.1 => /lib/libnsl.so.1 (0x70060000)
        libcrypto.so.0 => /usr/lib/libcrypto.so.0 (0x70086000)
        libcrypt.so.1 => /lib/libcrypt.so.1 (0x7018a000)
        libc.so.6 => /lib/libc.so.6 (0x701c8000)
        /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x70000000)


nm - list symbols from object files
root@chilibeans:~/openssh-3.7p1# nm /lib/libc-2.2.3.so | grep setresuid
00000000000db898 t __setresuid
00000000000db898 W setresuid


Show you a list op open ports and which programs binded.
netstat -tupan

 

Udgivet i Knowledge Base, Old Base, Programmering | Skriv en kommentar