Sunday, December 21, 2008

PHP > Sample Class Login with secure session

This class can be used to prevent security attacks known as session hijacking and session fixation.

When a session is initialized the class computes a fingerprint string that takes in account the browser user agent string, the user agent IP address or part of it and a secret word. If the fingerprint value changes, it is very likely that the session was hijacked and it should no longer be accepted.

To prevent session fixation attacks the calls the PHP session_regenerate_id() function so the session identifier changes everytime the session is checked.

Download : secureSession.zip [ mirror ]

Reference : www.phpclasses.org

Read More...

PHP > Sample Guest Book With Spam Filter

This class can automatically classify text messages to determine whether or not their are considered to be spam.

It can build a knowledge base of known text expressions that can be looked up later to evaluate a factor that expresses the probability of a given text to be spam.

This class could be used in Web mail applications or even in less obvious applications like forums and guest books, acting like an semi-automatic moderator.

Download : SpamFilter.zip [ mirror ]

Other Popular Guestbooks
This method takes all of the POST content, creates a single string, and runs it through SLV. It also removes your host name from the input in case you are passing on a variable such as a thank you page. I have implemented it on several popular guestbooks. I have not tested the code though, it may need some tweaks.

Reference :
- www.phpclasses.org
- www.linksleeve.org

Read More...

Sample 3D Programming With VB

If you want to take part in one of the most incredible computer gaming experiences available, Genesis Entertainment L.C. is currently working on Realms of Time, a state-of-the-art RPG designed to revolutionize the gaming world. If you or anyone you know has experience in C++ or excellent skills in VB graphic or text programming, or if you just want to hear the details of this incredible project, contact me at the e-mail address listed below. Beta testers will be needed at some point in the future (NOT NOW, though, so don't ask for now!), so if you want to be on the list of candidates, contact me with a PROFESSIONAL resume detailing your experience.

Also, and most importantly, we are looking for a talented 3D Graphics designer to help us with the many characters, both human and non-human, that will be needed for our game. We are currently working on producing our own, but because our immediate focus is on scripting out the details of the storyline and building peripheral programs (like the map, magic, item, and character editors), we don't have a lot of time to spend on our graphics. We are specifically looking for two types of 3D Graphics - characters (humans, monsters, etc.) that are similar to the style of Diablo characters (i.e. very nicely done at a small size, so huge amounts of close-up details aren't necessary), and 3D CG movies (we are aiming for CG graphics similar to those in Final Fantasy 7, and hopefully Final Fantasy 8, although those kind of graphics are most likely far out of our (or anyone but SquareSoft's) reach) with the same creatures mentioned above, except life-size and totally realistic. If you or anyone you know may be interested, contact the Realms of Time production team at realmsoftime@usa.net.

Download Sample with Source Code Here [ mirror ]

Read More...

How to empty Recycle bin with Delphi

Code :

Procedure EmptyRecycleBin ;
Const
SHERB_NOCONFIRMATION = $00000001 ;
SHERB_NOPROGRESSUI= $00000002 ;
SHERB_NOSOUND= $00000004 ;
Type
TSHEmptyRecycleBin = function (Wnd : HWND;
pszRootPath : PChar;
dwFlags : DWORD
) : HRESULT; stdcall ;
Var
SHEmptyRecycleBin : TSHEmptyRecycleBin;
LibHandle : THandle;
Begin
LibHandle := LoadLibrary(PChar('Shell32.dll')) ;
if LibHandle <> 0 then
@SHEmptyRecycleBin := GetProcAddress(LibHandle, 'SHEmptyRecycleBinA')
else
begin
MessageBox(GetActiveWindow,PChar('Gagal melakukan loading Shell32.dll.'),'Error',24);
Exit;
end;
if @SHEmptyRecycleBin <> nil then
SHEmptyRecycleBin(GetActiveWindow,
nil,
SHERB_NOCONFIRMATION or SHERB_NOPROGRESSUI or SHERB_NOSOUND);
FreeLibrary(LibHandle);
@SHEmptyRecycleBin := nil ;
end;

Read More...

Delphi > Procedure Disable Ctrl Alt Del

procedure DisableCtrlAltDel(BDisable:Boolean);
const
VAL_DisableTaskMgr='DisableTaskMgr';
var
MyW: Word;
begin
if Win32Platform = VER_PLATFORM_WIN32_NT then
Begin
with Tregistry.Create do try
RootKey:=HKEY_CURRENT_USER;
OpenKey(RegSystemKey,TRUE);
IF Bdisable=true then
WriteInteger(VAL_DisableTaskMgr,1)
else
DeleteValue(VAL_DisableTaskMgr);
CloseKey;
finally
Free;
end;
end
else
begin
// hanya untuk windows 95 / NT 4.0
if BDisable then
begin
{Disable ALT-TAB}
SystemParametersInfo( SPI_SETFASTTASKSWITCH, 1, @Myw, 0);
{Disable CTRL-ALT-DEL}
SystemParametersInfo( SPI_SCREENSAVERRUNNING, 1, @Myw, 0);
end
else
begin
{Enable ALT-TAB}
SystemParametersInfo( SPI_SETFASTTASKSWITCH, 0, @Myw, 0);
{Enable CTRL-ALT-DEL}
SystemParametersInfo( SPI_SCREENSAVERRUNNING, 0, @Myw, 0);
end;
end;
end;

Read More...

Friday, December 5, 2008

VB > Function Disconnect from the internet


Public Const RAS_MAXENTRYNAME As Integer = 256
Public Const RAS_MAXDEVICETYPE As Integer = 16
Public Const RAS_MAXDEVICENAME As Integer = 128
Public Const RAS_RASCONNSIZE As Integer = 412

Public Type RasEntryName
dwSize As Long
szEntryName(RAS_MAXENTRYNAME) As Byte
End Type

Public Type RasConn
dwSize As Long
hRasConn As Long
szEntryName(RAS_MAXENTRYNAME) As Byte
szDeviceType(RAS_MAXDEVICETYPE) As Byte
szDeviceName(RAS_MAXDEVICENAME) As Byte
End Type

Public Declare Function RasEnumConnections Lib _
"rasapi32.dll" Alias "RasEnumConnectionsA" (lpRasConn As _
Any, lpcb As Long, lpcConnections As Long) As Long

Public Declare Function RasHangUp Lib "rasapi32.dll" Alias _
"RasHangUpA" (ByVal hRasConn As Long) As Long

Public gstrISPName As String
Public ReturnCode As Long

Public Sub HangUp()
Dim i As Long
Dim lpRasConn(255) As RasConn
Dim lpcb As Long
Dim lpcConnections As Long
Dim hRasConn As Long
lpRasConn(0).dwSize = RAS_RASCONNSIZE
lpcb = RAS_MAXENTRYNAME * lpRasConn(0).dwSize
lpcConnections = 0
ReturnCode = RasEnumConnections(lpRasConn(0), lpcb, _
lpcConnections)

If ReturnCode = ERROR_SUCCESS Then
For i = 0 To lpcConnections - 1
If Trim(ByteToString(lpRasConn(i).szEntryName)) _
= Trim(gstrISPName) Then
hRasConn = lpRasConn(i).hRasConn
ReturnCode = RasHangUp(ByVal hRasConn)
End If
Next i
End If

End Sub

Public Function ByteToString(bytString() As Byte) As String
Dim i As Integer
ByteToString = ""
i = 0
While bytString(i) = 0&
ByteToString = ByteToString & Chr(bytString(i))
i = i + 1
Wend
End Function

Read More...

VB : Check an e-mail address for validity


Function IsValidEmail(sEMail As String) As Boolean
' original by Brad Murray
' optimized by Rob Hofker, email: rob@eurocamp.nl,
'23 august 2000

Dim sInvalidChars As String
Dim bTemp As Boolean
Dim i As Integer
Dim sTemp As String

' Disallowed characters
sInvalidChars = "!#$%^&*()=+{}[]|\;:'/?>,< "

' Check that there is at least one '@'
bTemp = InStr(sEMail, "@") <= 0
If bTemp Then GoTo exit_function

' Check that there is at least one '.'
bTemp = InStr(sEMail, ".") <= 0
If bTemp Then GoTo exit_function

' and that the length is at least six (a@a.ca)
bTemp = Len(sEMail) < 6
If bTemp Then GoTo exit_function

' Check that there is only one '@'
i = InStr(sEMail, "@")
sTemp = Mid(sEMail, i + 1)
bTemp = InStr(sTemp, "@") > 0

If bTemp Then GoTo exit_function
'extra checks
' AFTER '@' space is not allowed
bTemp = InStr(sTemp, " ") > 0
If bTemp Then GoTo exit_function

' Check that there is one dot AFTER '@'
bTemp = InStr(sTemp, ".") = 0
If bTemp Then GoTo exit_function

' Check if there's a quote (")
bTemp = InStr(sEMail, Chr(34)) > 0
If bTemp Then GoTo exit_function


' Check if there's any other disallowed chars
' optimize a little if sEmail longer than sInvalidChars
' check the other way around
If Len(sEMail) > Len(sInvalidChars) Then
For i = 1 To Len(sInvalidChars)
If InStr(sEMail, Mid(sInvalidChars, i, 1)) > 0 _
Then bTemp = True
If bTemp Then Exit For
Next
Else
For i = 1 To Len(sEMail)
If InStr(sInvalidChars, Mid(sEMail, i, 1)) > 0 _
Then bTemp = True
If bTemp Then Exit For
Next
End If
If bTemp Then GoTo exit_function

' extra check
' no two consecutive dots
bTemp = InStr(sEMail, "..") > 0
If bTemp Then GoTo exit_function

exit_function:
' if any of the above are true, invalid e-mail
IsValidEmail = Not bTemp

End Function

Read More...

Latest Comments

About Me

My photo
Makassar, Sulawesi Selatan, Indonesia

Guest Book


ShoutMix chat widget

Script Sense ©Template Blogger Green by Dicas Blogger.

TOPO