HTTP Authentications using PHP

Fadıl

The HTTP Authentication hooks in PHP are only available when it is running as an Apache module and is hence not available in the CGI version. In an Apache module PHP script, it is possible to use the Header() function to send an “Authentication Required” message to the client browser causing it to pop up a Username/Password input window. Once the user has filled in a username and a password, the URL containing the PHP script will be called again with the variables, $PHP_AUTH_USER, $PHP_AUTH_PW and $PHP_AUTH_TYPE set to the user name, password and authentication type respectively.

Cisco IOS Commands

Fadıl

Privileged Mode

enable – get to privileged mode
disable– get to user mode
enable password <password_here> – sets privileged mode password
enable secret <password_here>– sets encrypted privileged mode password

Setting Passwords

enable secret <password_here> – s et encrypted password for privileged access enable password <password_here>– set password for privileged access (used when there is no enable secret and when using older software) Set password for console access:

    (config)#line console 0
    (config-line)#login 
    (config-line)#password <password_here>

Set password for virtual terminal (telnet) access(password must be set to access the router through telnet):

How to SMTP Over an SSH Tunnel?

Fadıl

Spammers would sniff it out fairly quickly, and proceed to hammer it. To get around this, I decided to set up an SSH tunnel from a port on my laptop to port 25 on the mail server. It was a fairly easy task, and well worth it in the long run. The remainder of this article will explain how I set things up.

Set up the Tunnel

The first thing I decided was to establish the tunnel as a non-root user. Since the tunnel was going to exist for solely mail relaying purposes, I created a relay user on both my laptop and the server in question. I also ran ssh-keygen(1) and gave the relay user an empty passphrase. If you’re overly paranoid, you can use a passphrase and then use ssh-agent(1). The way I figure is if someone gets into my laptop, I have more things to worry about than them sending mail through my relay.

How to Locking And Unlocking User Accounts in Linux?

Fadıl

There may come a time when you need to disable a users login to your Linux box… without deleting there account and still allowing them to receive the email. To do this you must login as “root” and at the command prompt type:

<root@techsoftcenter>:/#"passwd -l username"

(Without the quotes of course) This will lock the users account denying them access to login. You may be thinking “well how do I unlock it now?”, well there’s a command for that too =) At the command prompt type:

Email Validation In PHP

Fadıl

Ever have those annoying spammers sign up for something with their email addy and always make up some donkey crap? Well, here is a script that will allow you to block some of that.

We are going to create this script as a function.

//->Email validation script

function validate_email($email) { 
if (eregi("([a-zA-Z0-9._-]+@[a-zA-Z0-9._-]+.[a-zA-Z0-9._-]+)", $email)) return 1; 
else return 0; 
} 
?>

Now time for an example with the function included.

$email = "[email protected]" 
if (validate_email($email)) print "E-mail Address Approved"; 
else print "Nice Try Spammer";

If there are any problems with the script just let me know.