Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at /home/content/f/e/r/ferasferas1/html/scriptslibrary/libraries/joomla/database/database.php:2) in /home/content/f/e/r/ferasferas1/html/scriptslibrary/libraries/joomla/session/session.php on line 423

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/content/f/e/r/ferasferas1/html/scriptslibrary/libraries/joomla/database/database.php:2) in /home/content/f/e/r/ferasferas1/html/scriptslibrary/libraries/joomla/session/session.php on line 423

Warning: Cannot modify header information - headers already sent by (output started at /home/content/f/e/r/ferasferas1/html/scriptslibrary/libraries/joomla/database/database.php:2) in /home/content/f/e/r/ferasferas1/html/scriptslibrary/libraries/joomla/session/session.php on line 426
PHP - The Scripts Library Community Free programming tutorial and source code for beginners and professional http://www.scriptslibrary.net/php Mon, 06 Sep 2010 20:08:37 +0000 Joomla! 1.5 - Open Source Content Management en-gb Remove characters from a string except numbers and letters http://www.scriptslibrary.net/php/124-remove-characters-from-a-string-except-numbers-and-letters http://www.scriptslibrary.net/php/124-remove-characters-from-a-string-except-numbers-and-letters

{CODE brush: php;}
<?php

$string = "remove *unwanted !character% from my string 1212&&";
$clean_string= ereg_replace("[^A-Za-z0-9]", "", $string);
echo $clean_string

?>
{/CODE}]]>
ferasc@hotmail.com (Feras) PHP Snippets Sat, 05 Dec 2009 01:34:19 +0000
PHP Function to Prevent SQL injection http://www.scriptslibrary.net/php/120-php-function-to-prevent-sql-injection http://www.scriptslibrary.net/php/120-php-function-to-prevent-sql-injection ferasc@hotmail.com (Feras) PHP Snippets Fri, 27 Nov 2009 03:06:22 +0000 Remove Empty Members from an Array in PHP http://www.scriptslibrary.net/php/91-remove-empty-members-from-an-array-in-php http://www.scriptslibrary.net/php/91-remove-empty-members-from-an-array-in-php ]]> ferasc@hotmail.com (Feras) PHP Snippets Fri, 19 Jun 2009 06:53:34 +0000 Prevent SQL Injection with PHP and MySQL http://www.scriptslibrary.net/php/86-prevent-sql-injection-with-php-and-mysql http://www.scriptslibrary.net/php/86-prevent-sql-injection-with-php-and-mysql
SQL injection is a well-known way to attack used to get, insert, delete or update data from a particular database. Without security, your data is on high risk and might get lost or changed. This kind of attack is done thought the user input in the browser, POST and GET. Before you publish your website, you have to test it against SQL injection attacks to prevent any future failure.
]]>
ferasc@hotmail.com (Feras) PHP Snippets Tue, 16 Jun 2009 23:30:23 +0000
Encrypting Password using md5() function http://www.scriptslibrary.net/php/85-encrypting-password-using-md5-function http://www.scriptslibrary.net/php/85-encrypting-password-using-md5-function PHP provide a variety of function to get our source secure. This simple article shows how to use the md5() function to encrypt data, especially passwords in the database.
The code is easy:
]]>
ferasc@hotmail.com (Feras) PHP Snippets Tue, 16 Jun 2009 22:58:52 +0000
Create login page in PHP http://www.scriptslibrary.net/php/84-create-login-page-in-php http://www.scriptslibrary.net/php/84-create-login-page-in-php In this tutorial, I will explain step by step how to create a login page in PHP.

Create a table Users in your mySQL database.
{CODE brush: sql;}
CREATE TABLE `Users` (
`id` int(4) NOT NULL auto_increment,
`user_name` varchar(100) NOT NULL default '',
`password` varchar(100) NOT NULL default '',
PRIMARY KEY (`id`)
) TYPE=MyISAM AUTO_INCREMENT=1 ; {/CODE}
For testing purpose, run the following sql query to inset a row into the database:
{CODE brush: sql;} INSERT INTO `Users` VALUES (1, 'feras', 'pass'); {/CODE}
]]>
ferasc@hotmail.com (Feras) PHP Snippets Tue, 16 Jun 2009 21:57:54 +0000
How To Use .htaccess to Prevent Apache HTTPD Directory Listing http://www.scriptslibrary.net/php/63-how-to-use-htaccess-to-prevent-apache-httpd-directory-listing http://www.scriptslibrary.net/php/63-how-to-use-htaccess-to-prevent-apache-httpd-directory-listing Normal 0

 

Apache HTTPD servers are configured by default to display directory listing, when index files like index.htm or index.html of index.php etc. are not present in the directory. This can expose sensitive information to prying eyes and are often indexed by search engines. This can compromise your data by making it visible to unintended audience. The solution is simple. You can add a line to your .htaccess file (create the file if not present) to prevent directory listing for that directory and its sub-directories:
IndexIgnore *

The * matches all files in the directory. You can also restrict only a subset of file from being displayed. For example if you would want the directory content to be listed but not include the images in the listings then you should use this command:
IndexIgnore *.png *.gif *.jpg

This would return a list of all files not ending in .png, .jpg or .gif, but would still list .txt, .html, etc.

On the other hand if your server is setup to prevent directory listing, but you want to list the directories by default, then add the following in your .htaccess file:
Options +Indexes

]]>
ferasc@hotmail.com (Feras) PHP Snippets Sun, 28 Sep 2008 03:43:55 +0000
How to run php code embedded in html pages http://www.scriptslibrary.net/php/62-how-to-run-php-code-embedded-in-html-pages http://www.scriptslibrary.net/php/62-how-to-run-php-code-embedded-in-html-pages how to test php support in a Apache server) and .htaccess enabled. In the root directory of your html files create a file named .htaccess (DOThtaccess). ]]> info@scriptslibrary.net (Administrator) PHP Snippets Sun, 28 Sep 2008 03:34:54 +0000 How To Test PHP Support In Apache HTTP Server http://www.scriptslibrary.net/php/61-how-to-test-php-support-in-apache-http-server http://www.scriptslibrary.net/php/61-how-to-test-php-support-in-apache-http-server This is the easiest way to get and test php support in a apache web server. First, create a file in your htdocs directory (ask the location from your web hosting provider if you are not sure named test.php. Second, Open the file in your favorite text editor and add the line:

{CODE brush: php;}
<? php phpinfo() ?>
{/CODE}
Finally, Save the file and open it using your browser: http://host_name/test.php
That's it! Now you can see a page with php information and get all abilities that your server can handle. PHP support is required if you want to run lots of web applications like Joomla, for example. Demand PHP support from your web-hosting provider if it is not already enabled.]]>
ferasc@hotmail.com (Feras) PHP Snippets Sun, 28 Sep 2008 03:32:20 +0000
Google Safe 301 Redirect Using PHP http://www.scriptslibrary.net/php/60-google-safe-301-redirect-using-php http://www.scriptslibrary.net/php/60-google-safe-301-redirect-using-php When you want to redirect, make sure you are doing it in the right way. Google penalizes websites that being redirected to many other locations. Many webmasters tries to cheat on Google by redirecting good optimized pages or website to bad ones However, the following method a safe for Google redirection, as well as all search engines behind. Put the following code into the page you want it to redirect to another:
{CODE brush: vb;}
header("HTTP/1.1 301 Moved Permanently");
header("Location: http://www.newdomain.com/newurl.htm");
exit();
{/CODE}
That's it!]]>
info@scriptslibrary.net (Administrator) PHP Snippets Sun, 28 Sep 2008 03:29:49 +0000