Wednesday, December 15, 2010

Wamp + MSSQL

I've tried a lot of things just to connect MSSQL with PHP and I've come up with this solution. Parts of this tutorial has been gathered from other forums.

1. Download and install the following files from http://www.wampserver.com/en/
- wampserver2.0i
- apache 2.2.8 (Add On)
 - php 5.2.6 (Add On)

2. ntwdblib.dll (version 2000.80.194.0)
- download from http://webzila.com/dll/1/ntwdblib.zip or if it's not available anymore you can contact me and I'll send you the copy.
- stop all Wamp Services and SQL Server service
- copy and replace this file to 
1. ie: C:\wamp\bin\php\php5.2.6 
2. ie: C:\wamp\bin\apache\apache2.2.8\bin 
3. ie: C:\Windows\System32\ 

4. Enable apache and php version from wamp server

5. Activate php_mssql from PHP extensions

6. Configure SQL Server to accept TCP connections and Named Pipes through the SQL server configuration manager. 

7. Configure SQL Server for Mixed mode authentication and remember the password you set for sa 

8. Start the SQL Server Service 

9. Enable mssql.secure_connection = On (can be found at php.ini)
- Note that if you are not using NT authentication then you can turn it Off.

10. Start WampServer

11. Enable PHP 5.2.6 and Apache 2.2.8

12. Test connection
$conn = mssql_connect('SQLSERVER','USER','PASSWORD'); 
if ($conn){
echo 'Connected';
}

Thursday, July 29, 2010

Restrict Server FTP

Server default firewalls are often hackable.
To be able to protect your server is to set some restrictions.
Restricting yung FTP would be one of those...

First of all you need a telnet/ssh client.
Open source telnet and SSH Client for Windows and Unix platforms is available in the internet...

In this simple tutorial I'll be using puTTY.
And here's how you do it....

1. Open PuTTY.exe
2. Type in the server's ip in the Host Name field.
3. Input 49182 in the Port field.
4. Click Open button

A black screen window will popup asking for login details...
You should have login details, otherwise ask for the server admin.

5. Input login details.

After successful login you should see [yourusername@server~]$ in the command prompt

6. type in su -
7. Enter administrator's password
8. Go to etc/csf folder, to do this type in cd /etc/csf
9. Backup csf.conf file, type in cp csf.conf csf.backup1.conf
10. Open csf.conf in editor, type in nano csf.conf
11. Search for TCP_IN and TCP_OUT by pressing CTRL+V (Next Page).
12. Delete 21 in the line TCP_IN = "21,25,53,80,443" (this are sample ports).
13. Delete 21 in the line TCP_OUT = "21,25,53,80,443" (this are sample ports).
14. Press CTRL+X and then press y to save the changes made.
15. And lastly, restart the csf by typing the command csf -r

Done! :)

Sunday, July 4, 2010

Dimming Background + Message Box with jQuery

Click here to show demo message box
Click here to view demo site
Download Tutorial here password: dakowd_xyneodrew
x
This is a demo popup message box with background
dimming capability + IE6 support using jQuery.

Try to scroll down and you'll notice that the dimmed
background will resize itself so that it consistently
hovering the entire page.

While scrolling, jQuery scroll effect is triggered to
make the popup message box maintain its default
position...

Download Tutorial here
password: kowd_xyneodrew
da kowd

Tuesday, May 18, 2010

WAMP SERVER 2 (https SSL configuration)

#Let’s assume that your wamp's version is 2.0h and is installed on drive C:
STEP1 . ADDING AN ENVIRONMENT VARIABLE (OPENSSL_CONF)
Go to Control Panel > System > Advanced > Environment Variables
OR
Right Click on My Computer > Properties > Advanced > Environment Variables

Add a
new system variable OPENSSL_CONF:

Variable name:
OPENSSL_CONF
Variable value:
C:\wamp\bin\apache\apache2.2.11\conf\openssl.cnf

Log out > log in

Go to
command prompt and type in:

set | more

Make sure you see the following line among the environment variables:
OPENSSL_CONF= C:\wamp\bin\apache\apache2.2.11\conf\openssl.cnf

STEP2. GENERATING KEY
Go to
command prompt and type in:
cd\
cd wamp\bin\apache\apache2.2.11\bin
openssl req -new > webserver.csr

The command runs and prompts you to enter a
PEM pass phrase and verify it. Write down the phrase because you will need it later. It will then ask you to enter information that will be incorporated into your certificate request. When the command finishes, it has created several files, including privkey.pem, in C:\wamp\bin\apache\apache2.2.11\bin.

STEP 3. REMOVING PASSPHRASE
Run the following command:
openssl rsa -in privkey.pem -out webserver.key

You will be
prompted for the pass phrase from the previous step.
The RSA key is written and the file webserver.key is now available in the folder.


STEP 4. CONVERTING INTO SIGNED CERTIFICATE
Run the following command to create a certificate which expires after one year:

openssl x509 -in webserver.csr -out webserver.cert -req -signkey webserver.key -days 365


STEP 5. STORING CERTIFICATE FILES
Create a folder
C:\wamp\OpenSSL with the following subfolders:

certs
crl
newcerts
private


Copy the following files from
C:\wamp\bin\apache\Apache2.2.11\bin to C:\wamp\OpenSSL\certs:

webserver.cert
webserver.csr
webserver.key


Copy the following files from
C:\wamp\bin\apache\Apache2.2.11\bin to C:\wamp\OpenSSL\private:

.rnd
privkey.pem


STEP 6. CREATING ERROR LOG FILES
Create 2 text files on C:/wamp/logs
1. ssl_ErrorLog.txt
2. ssl_TransferLog.txt
STEP 7. MODIFING HTTPD-SSL.CONF
Go to C:\wamp\bin\apache\Apache2.2.11\conf\extra
Make a backup copy of the file httpd-ssl.conf and rename to httpd-ssl.conf.old
Using any text editor, open the file httpd-ssl.conf
Change the following lines, adjusting the email address and the paths to your settings:

SSLSessionCache
"shmcb:C:/wamp/logs"

SSLMutex default

# General setup for the virtual host
DocumentRoot "C:/wamp/www"
ServerName localhost:443

ServerAdmin
myemailaddress@domain.com
ErrorLog "C:/wamp/logs/ssl_ ErrorLog.txt"
TransferLog "
C:/wamp/logs/ssl_TransferLog.txt"

SSLCertificateFile "
C:/wamp/OpenSSL/certs/webserver.cert"

SSLCertificateKeyFile "C:/wamp/OpenSSL/certs/webserver.key"

SSLCARevocationPath "C:/wamp/OpenSSL/crl"

C:/wamp/bin/apache/Apache2.2.11/cgi-bin">

CustomLog "C:/wamp/logs/ssl_request.log" \

"%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b"

STEP 8. MODIFIND OPENSSL.CNF
Make a
backup copy of the file openssl.cnf from C:\wamp\bin\apache\Apache2.2.11\conf.
Click and drag the file openssl.cnf into notepad (or other text editor) so you can edit it.

STEP 9. Modify the base directory:
dir = C:/wamp/OpenSSL # Where everything is kept

STEP 10. MODIFING HTTPD.CONF
Make a backup copy of the file httpd.conf from C:\wamp\bin\apache\Apache2.2.11\conf.
Open the file httpd.conf and change the following lines:

# Secure (SSL/TLS) connections
#Include conf/extra/httpd-ssl.conf
Include conf/extra/httpd-ssl.conf
LoadModule rewrite_module modules/mod_rewrite.so
LoadModule ssl_module modules/mod_ssl.so

STEP 11. TESTING HTTPS


Go to command prompt and run the followinf command:
httpd –t
You should see syntax is OK. If not, then you may have miss some of the steps above.

If OK, restart Apache then check that port 443 is open by running the following in the command prompt:

netstat -an | more
If tha port is not open, then you may have miss some of the steps above.
You can now test the https connection from your browser.

Tuesday, March 30, 2010

Dual Yahoo Messenger Login

1. Go to Start
2. Select "Run..."
3. Type 'regedit' on the box and click OK button
4. Navigate to HKEY_CURRENT_USER > Software > Yahoo > Pager > Test
5. On the right pane, right-click and create a 'DWORD Value' and name it 'Plural'
6. After creating a DWORD Value (Plural), double-click in it and assign a decimal value of 1.
7. Close your windows registry. You can now run and login on multiple YM accounts!.

ENJOY!