<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2titles.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemtitles.css"?><!-- generator="Joomla! 1.5 - Open Source Content Management" --><rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0">
	<channel>
		<title>Minitek - PHP Tutorials</title>
		<description>Joomla Development - Extensions - Templates &amp;amp; Tutorials</description>
		<link>http://www.minitek.gr</link>
		<lastBuildDate>Sat, 18 May 2013 18:41:57 +0000</lastBuildDate>
		<generator>Joomla! 1.5 - Open Source Content Management</generator>
		<language>en-gb</language>
		<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/Minitek-PhpTutorials" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="minitek-phptutorials" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><feedburner:feedFlare xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" href="http://add.my.yahoo.com/rss?url=http%3A%2F%2Ffeeds.feedburner.com%2FMinitek-PhpTutorials" src="http://us.i1.yimg.com/us.yimg.com/i/us/my/addtomyyahoo4.gif">Subscribe with My Yahoo!</feedburner:feedFlare><feedburner:feedFlare xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" href="http://www.newsgator.com/ngs/subscriber/subext.aspx?url=http%3A%2F%2Ffeeds.feedburner.com%2FMinitek-PhpTutorials" src="http://www.newsgator.com/images/ngsub1.gif">Subscribe with NewsGator</feedburner:feedFlare><feedburner:feedFlare xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" href="http://feeds.my.aol.com/add.jsp?url=http%3A%2F%2Ffeeds.feedburner.com%2FMinitek-PhpTutorials" src="http://o.aolcdn.com/favorites.my.aol.com/webmaster/ffclient/webroot/locale/en-US/images/myAOLButtonSmall.gif">Subscribe with My AOL</feedburner:feedFlare><feedburner:feedFlare xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" href="http://www.bloglines.com/sub/http://feeds.feedburner.com/Minitek-PhpTutorials" src="http://www.bloglines.com/images/sub_modern11.gif">Subscribe with Bloglines</feedburner:feedFlare><feedburner:feedFlare xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" href="http://www.netvibes.com/subscribe.php?url=http%3A%2F%2Ffeeds.feedburner.com%2FMinitek-PhpTutorials" src="http://www.netvibes.com/img/add2netvibes.gif">Subscribe with Netvibes</feedburner:feedFlare><feedburner:feedFlare xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" href="http://fusion.google.com/add?feedurl=http%3A%2F%2Ffeeds.feedburner.com%2FMinitek-PhpTutorials" src="http://buttons.googlesyndication.com/fusion/add.gif">Subscribe with Google</feedburner:feedFlare><feedburner:feedFlare xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" href="http://www.pageflakes.com/subscribe.aspx?url=http%3A%2F%2Ffeeds.feedburner.com%2FMinitek-PhpTutorials" src="http://www.pageflakes.com/ImageFile.ashx?instanceId=Static_4&amp;fileName=ATP_blu_91x17.gif">Subscribe with Pageflakes</feedburner:feedFlare><feedburner:feedFlare xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" href="http://www.plusmo.com/add?url=http%3A%2F%2Ffeeds.feedburner.com%2FMinitek-PhpTutorials" src="http://plusmo.com/res/graphics/fbplusmo.gif">Subscribe with Plusmo</feedburner:feedFlare><feedburner:feedFlare xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" href="http://www.thefreedictionary.com/_/hp/AddRSS.aspx?http%3A%2F%2Ffeeds.feedburner.com%2FMinitek-PhpTutorials" src="http://img.tfd.com/hp/addToTheFreeDictionary.gif">Subscribe with The Free Dictionary</feedburner:feedFlare><feedburner:feedFlare xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" href="http://www.bitty.com/manual/?contenttype=rssfeed&amp;contentvalue=http%3A%2F%2Ffeeds.feedburner.com%2FMinitek-PhpTutorials" src="http://www.bitty.com/img/bittychicklet_91x17.gif">Subscribe with Bitty Browser</feedburner:feedFlare><feedburner:feedFlare xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" href="http://www.live.com/?add=http%3A%2F%2Ffeeds.feedburner.com%2FMinitek-PhpTutorials" src="http://tkfiles.storage.msn.com/x1piYkpqHC_35nIp1gLE68-wvzLZO8iXl_JMledmJQXP-XTBOLfmQv4zhj4MhcWEJh_GtoBIiAl1Mjh-ndp9k47If7hTaFno0mxW9_i3p_5qQw">Subscribe with Live.com</feedburner:feedFlare><feedburner:feedFlare xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" href="http://mix.excite.eu/add?feedurl=http%3A%2F%2Ffeeds.feedburner.com%2FMinitek-PhpTutorials" src="http://image.excite.co.uk/mix/addtomix.gif">Subscribe with Excite MIX</feedburner:feedFlare><feedburner:feedFlare xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" href="http://www.webwag.com/wwgthis.php?url=http%3A%2F%2Ffeeds.feedburner.com%2FMinitek-PhpTutorials" src="http://www.webwag.com/images/wwgthis.gif">Subscribe with Webwag</feedburner:feedFlare><feedburner:feedFlare xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" href="http://www.podcastready.com/oneclick_bookmark.php?url=http%3A%2F%2Ffeeds.feedburner.com%2FMinitek-PhpTutorials" src="http://www.podcastready.com/images/podcastready_button.gif">Subscribe with Podcast Ready</feedburner:feedFlare><feedburner:feedFlare xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" href="http://www.wikio.com/subscribe?url=http%3A%2F%2Ffeeds.feedburner.com%2FMinitek-PhpTutorials" src="http://www.wikio.com/shared/img/add2wikio.gif">Subscribe with Wikio</feedburner:feedFlare><feedburner:feedFlare xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" href="http://www.dailyrotation.com/index.php?feed=http%3A%2F%2Ffeeds.feedburner.com%2FMinitek-PhpTutorials" src="http://www.dailyrotation.com/rss-dr2.gif">Subscribe with Daily Rotation</feedburner:feedFlare><item>
			<title>How to block direct access to php file called by ajax function</title>
			<link>http://www.minitek.gr/tutorials/php-tutorials/php-scripts-tutorials/item/252-how-to-block-direct-access-to-php-file-called-by-ajax-function.html</link>
			<guid>http://www.minitek.gr/tutorials/php-tutorials/php-scripts-tutorials/item/252-how-to-block-direct-access-to-php-file-called-by-ajax-function.html</guid>
			<description><![CDATA[<div class="K2FeedImage"><img src="http://www.minitek.gr//media/k2/items/cache/5fd45095a868b007b05013834dba7a95_S.jpg" alt="How to block direct access to php file called by ajax function" /></div><div class="K2FeedIntroText">In php you can emulate an ajax request by inserting a proper header.<br /><br />

With this header you can prevent users from directly accessing php pages that are meant only for ajax calls.</div><div class="K2FeedFullText"><br />
It must be noted however that this is just a basic security step and it does not guarantee that a malicious user can not find a way to access the php file. This means that you should always make sure that your php code is secure.<br />

{code class="brush:php" }
// No direct access to this file
define('IS_AJAX', isset($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest');
if(!IS_AJAX) {die('Restricted access');}
{/code}
<br /><br />

{loadposition contentlinks}
<br /><br /></div>]]></description>
			<category>PHP Scripts</category>
			<pubDate>Thu, 22 Mar 2012 13:40:34 +0000</pubDate>
		</item>
		<item>
			<title>How to strip specific words from a string with php</title>
			<link>http://www.minitek.gr/tutorials/php-tutorials/php-scripts-tutorials/item/247-how-to-strip-specific-words-from-a-string-with-php.html</link>
			<guid>http://www.minitek.gr/tutorials/php-tutorials/php-scripts-tutorials/item/247-how-to-strip-specific-words-from-a-string-with-php.html</guid>
			<description><![CDATA[<div class="K2FeedImage"><img src="http://www.minitek.gr//media/k2/items/cache/b320775de3c297425b69dccc362220a9_S.jpg" alt="How to strip specific words from a string with php" /></div><div class="K2FeedIntroText">With this simple php script you can remove any specified words from a string. This is very useful when you need to filter input to strip forbidden words.</div><div class="K2FeedFullText">

<h3>Example</h3><br />

{code clas="brush:php" }
//strip specific words
$string = 'Nice useful handy bad ugly great';
$wordlist = array("bad", "ugly");
foreach ($wordlist as &$word) {
  $word = '/\b' . preg_quote($word, '/') . '\b/';
}					
$string = preg_replace($wordlist, '', $string);
{/code}

<br /><br />
{loadposition contentlinks}
<br /><br /></div>]]></description>
			<category>PHP Scripts</category>
			<pubDate>Wed, 22 Feb 2012 11:46:42 +0000</pubDate>
		</item>
		<item>
			<title>How to shorten a text without cutting words in half in php</title>
			<link>http://www.minitek.gr/tutorials/php-tutorials/php-scripts-tutorials/item/237-how-to-shorten-a-text-without-cutting-words-in-half-in-php.html</link>
			<guid>http://www.minitek.gr/tutorials/php-tutorials/php-scripts-tutorials/item/237-how-to-shorten-a-text-without-cutting-words-in-half-in-php.html</guid>
			<description><![CDATA[<div class="K2FeedImage"><img src="http://www.minitek.gr//media/k2/items/cache/84ac056b57dd032fcf18a346d4a81feb_S.jpg" alt="How to shorten a text without cutting words in half in php" /></div><div class="K2FeedIntroText">You can use this php script to shorten a text string into a specific number of words without cutting words in half and add three dots to the end of the string.</div><div class="K2FeedFullText"><br />

{code class="brush:php" }
// trim string - Change length according to your needs
$trim_length = 180;
$strip_string = true;
$dots = true;
if ($strip_string) {
  $input = strip_tags(preg_replace('`\[[^\]]*\]`','',$string));
}
//String already shorter than trim length
if (strlen($input) <= $trim_length) {
  return $input;
}
//find last space within given length of string
$last_space = strrpos(substr($input, 0, $trim_length), ' ');
$trim_string = substr($input, 0, $last_space); 
//add dots (...)
if ($dots) {
  $trim_string .= '...';
}
{/code}
<br /><br />

{loadposition contentlinks}
<br /><br /></div>]]></description>
			<category>PHP Scripts</category>
			<pubDate>Tue, 10 Jan 2012 13:45:52 +0000</pubDate>
		</item>
		<item>
			<title>How to get the current page url in PHP and Joomla</title>
			<link>http://www.minitek.gr/tutorials/php-tutorials/item/96-how-to-get-the-current-page-url-in-php-joomla.html</link>
			<guid>http://www.minitek.gr/tutorials/php-tutorials/item/96-how-to-get-the-current-page-url-in-php-joomla.html</guid>
			<description><![CDATA[<div class="K2FeedImage"><img src="http://www.minitek.gr//media/k2/items/cache/ea457adccaa9e569cff05de9b4f3b04d_S.jpg" alt="How to get the current page url in PHP and Joomla" /></div><div class="K2FeedIntroText">When developing in php, you often need to grab the current page url (the one in the address bar) to use in a script.<br />
This is very common when developing widgets as the Facebook like button or even when you simply need to display the current url in a page. <br /><br />

This is one of the most common ways to get the current page url in php:<br />

{code class="brush:php" }
<?php
 $pageURL = 'http';
 if ($_SERVER["HTTPS"] == "on") {$pageURL .= "s";}
 $pageURL .= "://";
 if ($_SERVER["SERVER_PORT"] != "80") {
  $pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
 } else {
  $pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
 }
 echo $pageURL;
?>
{/code}
<br />
In Joomla, there is a much faster way to get the page url by using the Joomla API:<br />

{code class="brush:php" }
$pageURL = JURI::base();
echo $pageURL;
{/code}
This will get the base url. For example, if the full url is <strong>http://www.yoursite.com/index.php?option=com_content&view=article&id=1&Itemid=9</strong>, <strong>JURI::base()</strong> will fetch <strong>http://www.yoursite.com</strong>.<br /><br />
If you need the current absolute path url you must use this:<br />

{code class="brush:php" }
$pageURL = JURI::current();
echo $pageURL;
{/code}
or you can fetch the full url with this:<br />

{code class="brush:php" }
$uri = & JFactory::getURI();
$pageURL = $uri->toString();
echo $pageURL;
{/code}

<br /><br />
{loadposition contentlinks}
<br /><br /></div>]]></description>
			<category>PHP Tutorials</category>
			<pubDate>Tue, 09 Aug 2011 10:41:40 +0000</pubDate>
		</item>
		<item>
			<title>The 6 most important security settings in php.ini</title>
			<link>http://www.minitek.gr/tutorials/php-tutorials/item/56-the-6-most-important-security-settings-in-phpini.html</link>
			<guid>http://www.minitek.gr/tutorials/php-tutorials/item/56-the-6-most-important-security-settings-in-phpini.html</guid>
			<description><![CDATA[<div class="K2FeedImage"><img src="http://www.minitek.gr//media/k2/items/cache/d3b3799d6611d677944f5f86a500beb3_S.jpg" alt="The 6 most important security settings in php.ini" /></div><div class="K2FeedIntroText">The <strong>php.ini</strong> is a PHP configuration file that controls some important PHP settings. This means that with this file you can change the behavior of your PHP server.<br /><br />
Whenever someone visits your website, the PHP interpreter reads the <strong>php.ini</strong> file and behaves accordingly.<br /><br />
The settings below will help making your website more secure. There are other files also that help preventing malicious attacks to your site, like <strong>.htaccess</strong> and <strong>globals.php</strong>, but <strong>php.ini</strong> is a good starting point for everyone that takes security seriously. Some extensions may not work with the suggested settings therefore you should reconsider if you really need these extensions.<br /><br />
<h4>1. register_globals = off (or = 0)</h4>
If this is left <strong>on</strong>, an attacker might use this to insert request variables from HTML forms with the intention to break your website.<br />
<em>In PHP5, its default state is set to <strong>off</strong> and as of PHP6 it has been removed.</em>
<h4>2. allow_url_fopen = off</h4>
The preferred setting is default. This function will treat remote files as if they were local files on the server, leaving some open space to malicious attacks.
<h4>3. magic_quotes_gpc</h4>
This is <strong>on</strong> by default. Its main purpose is to escape all variables that are sent to the database, neutralizing malicious loaded scripts. You should never turn this <strong>off</strong>.<br />
<em>This setting has been removed in PHP6</strong>.</em>
<h4>4. expose_php = off</h4>
The default value is <strong>on</strong>. This setting will prevent malicious users from finding out the PHP version you are using as well as 3rd party PHP extensions. By setting this to <strong>off</strong>, it reduces the amount of exposed information.
<h4>5. safe_mode = off</h4>
You should leave this in its default state (off). If you turn it on, some features will be disabled [chmod(), exec(), system() and more].<br />
<em>As of PHP6 it has been removed.</em>
<h4>6. session.use_trans_sid = off</h4>
It prevents or lowers the possibility of a session fixation attack.
<br />
<br />
<br />
{loadposition contentlinks}
<br /><br /></div>]]></description>
			<category>PHP Tutorials</category>
			<pubDate>Fri, 01 Jul 2011 07:09:34 +0000</pubDate>
		</item>
		<item>
			<title>How to get the file extension in PHP</title>
			<link>http://www.minitek.gr/tutorials/php-tutorials/item/45-how-to-get-the-file-extension-in-php.html</link>
			<guid>http://www.minitek.gr/tutorials/php-tutorials/item/45-how-to-get-the-file-extension-in-php.html</guid>
			<description><![CDATA[<div class="K2FeedImage"><img src="http://www.minitek.gr//media/k2/items/cache/37a06e4a72d6cb27621f1ed829bbee81_S.jpg" alt="How to get the file extension in PHP" /></div><div class="K2FeedIntroText">There are many ways to get a file extension using php. Below is a list of the most frequently used methods to do this. In this tutorial we will be using the functions <strong>strrpos, strlen, substr, strrchr, explode, end, preg_replace</strong> and <strong>pathinfo</strong>. You can learn more about these functions on <a href="http://www.php.net" target="_blank" rel="nofollow">http://www.php.net</a>.<br /><br />
<h4>1. "strrpos/strlen/substr" method</h4>
{code class="brush:php" }
$i = strrpos($file_name,".");
if (!$i) { return ""; } 
$l = strlen($file_name) - $i;
$extension = substr($file_name,$i+1,$l);
{/code}
<h4>2. "substr/strrchr" method</h4> 
{code class="brush:php" }
$extension = substr(strrchr($file_name, '.'), 1);
{/code}
<h4>3. "explode/end" method</h4>
{code class="brush:php" }
$extension = end(explode('.', $file_name));
{/code}
<h4>4. "substr/strrpos" method</h4>
{code class="brush:php" }
$extension = substr($file_name, strrpos($file_name, '.') + 1);
{/code}
<h4>5. "preg_replace" method</h4>
{code class="brush:php" }
$extension = preg_replace('/^.*\.([^.]+)$/D', '$1', $file_name);
{/code}
<h4>6. "pathinfo" method</h4>
{code class="brush:php" }
$extension = pathinfo($file_name, PATHINFO_EXTENSION);
{/code}
<br /><br />
{loadposition contentlinks}
<br /><br /></div>]]></description>
			<category>PHP Tutorials</category>
			<pubDate>Wed, 15 Jun 2011 22:38:28 +0000</pubDate>
		</item>
		<item>
			<title>How to limit text characters in Joomla</title>
			<link>http://www.minitek.gr/tutorials/php-tutorials/item/27-how-to-limit-text-characters-in-joomla.html</link>
			<guid>http://www.minitek.gr/tutorials/php-tutorials/item/27-how-to-limit-text-characters-in-joomla.html</guid>
			<description><![CDATA[<div class="K2FeedImage"><img src="http://www.minitek.gr//media/k2/items/cache/787ae9ec9023a82f5aa7e4c1a64f73cb_S.jpg" alt="How to limit text characters in Joomla" /></div><div class="K2FeedIntroText">Today I will show you how to limit the text characters inside a php file in Joomla.<br /> 
For this purpose, we will be using the <strong>substr()</strong> php function.<br />
The <strong>substr()</strong> function returns only a part of a string.<br /><br />

Suppose we have the following text string
{code class="brush:php;" }
$text = 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.';
{/code}
We want to limit the displayed characters to 50. For this we just use the <strong>substr()</strong> function like this
{code class="brush:php;" }
$short_text = substr($text, 0, 50);
echo $short_text;
echo "...";
{/code}
The function will limit the characters to 50, counting from character 0. The resulting string is
{code class="brush:php;" }
Lorem ipsum dolor sit amet, consectetur adipisicin...
{/code}</div>]]></description>
			<category>PHP Tutorials</category>
			<pubDate>Mon, 02 May 2011 10:11:57 +0000</pubDate>
		</item>
		<item>
			<title>How to convert a multi-dimensional Array into an Object</title>
			<link>http://www.minitek.gr/tutorials/php-tutorials/item/16-how-to-convert-a-multi-dimensional-array-into-an-object.html</link>
			<guid>http://www.minitek.gr/tutorials/php-tutorials/item/16-how-to-convert-a-multi-dimensional-array-into-an-object.html</guid>
			<description><![CDATA[<div class="K2FeedImage"><img src="http://www.minitek.gr//media/k2/items/cache/c9b002fe1bb0320831a8ae78670fdb6f_S.jpg" alt="How to convert a multi-dimensional Array into an Object" /></div><div class="K2FeedIntroText">In this tutorial I will show you a very useful function to convert any multi-dimensional Array to a multi-dimensional Object. For this purpose we will be using the default PHP Object stdClass(). The stdClass() even though is not so well documented, is widely used by the Zend Framework.
Here is the code
{code class="brush:php;" }
function convertArrayToObject($myarray) {
$return = new stdClass();
foreach ($myarray as $key => $value) {
if (is_array($value)) {
$return->$key = convertArrayToObject($value);
}
else {
$return->$key = $value;
}
}
return $return;
} 
{/code}
<br />
Now you can use the function like this
{code class="brush:php;" }
$newObject = convertArrayToObject($myarray); 
{/code}<br />
and to see the resulting object
{code class="brush:php;" }print_r($newObject);{/code}
<br />
{loadposition contentlinks}
<br /><br /></div>]]></description>
			<category>PHP Tutorials</category>
			<pubDate>Thu, 14 Apr 2011 00:03:44 +0000</pubDate>
		</item>
		<item>
			<title>How to redirect a page with PHP</title>
			<link>http://www.minitek.gr/tutorials/php-tutorials/item/15-how-to-redirect-a-page-with-php.html</link>
			<guid>http://www.minitek.gr/tutorials/php-tutorials/item/15-how-to-redirect-a-page-with-php.html</guid>
			<description><![CDATA[<div class="K2FeedImage"><img src="http://www.minitek.gr//media/k2/items/cache/fc1da7257992fc36032e11db3df7a664_S.jpg" alt="How to redirect a page with PHP" /></div><div class="K2FeedIntroText"><p>In this tutorial I will show you how you can easily redirect a PHP page. We will be using the <strong>header()</strong> function.</p>
<p>If any output is sent before the redirection is executed you will get this warning message stating that you can not modify header information.</p>
{codecitation class="brush:php;" }Warning: Cannot modify header information - headers already sent by{/codecitation}
<p>However, we can bypass this issue by using PHP output buffering.</p>
<p>Here is the code:</p>
{codecitation class="brush:php;" }
ob_start();
header("Location: http://www.yourdomain.com/redirectpage.php");
ob_flush();
{/codecitation}<br />
{loadposition contentlinks}</div>]]></description>
			<category>PHP Tutorials</category>
			<pubDate>Tue, 12 Apr 2011 11:10:49 +0000</pubDate>
		</item>
	</channel>
</rss>
