When you want to store information in a session use $_SESSION – this is where you store and retrive session data .
Example
<?php
session_start();
$_SESSION[‘phpcodez_views’] = 1; // store data
echo $_SESSION[‘phpcodez_views’]; //retrieve data
?>
When you want to store information in a session use $_SESSION – this is where you store and retrive session data .
Example
<?php
session_start();
$_SESSION[‘phpcodez_views’] = 1; // store data
echo $_SESSION[‘phpcodez_views’]; //retrieve data
?>
Before you begin storing information in PHP session , you must start the session and it must be mentioned at the very beggining of your code .
<?php session_start(); // start PHP session! ?>
Session variables are used to store values that are required across multiple web pages .
A website can not remember anything about the users those who have already visited the site since the HTTP request does not have state . But at time , it is necessary to remember some details(eg should understand if a user is logged in or not ) . In such case we can use session that enable the website to store the information for later use .
Paste the following code into your .htaccess file
<ifModule mod_php4.c>
php_value zlib.output_compression 16386
</ifModule>
Paste the below given code into your .htaccess file
RewriteEngine on
RewriteCond %{HTTP_REFERER} ^http(s)?://(www.)?phpcodezz.com.*$ [NC]
RewriteRule .* phpcodez.com [L]
Paste the below given code into your .htaccess file
RewriteEngine on
RewriteCond %{HTTP:Accept-Language} (en) [NC]
RewriteRule .* http://en.phpcodez.com [R,L]
Paste the below given code into your .htaccess file
RewriteEngine on
RewriteCond %{HTTP_USER_AGENT} iPhone
RewriteRule .* http://iphone.phpcodez.com/ [R]
$args = array(
‘post_type’ => ‘attachment’,
‘numberposts’ => null,
‘post_status’ => null,
‘post_parent’ => $post->ID
);
$pczAttachments = get_posts($args);
if ($pczAttachments) {
foreach ($pczAttachments as $values) {
echo apply_filters(‘the_title’, $values->post_title);
the_attachment_link($values->ID, false);
}
}
Add the below given code in to your functions.php
global $wpdb;
$templateQry = “select meta_key from $wpdb->postmeta where meta_key like ‘_wp_page_template’ and meta_value like ‘Template1′”;
$result = $wpdb->query($templateQry);
if ($result) {
echo “page Template1 is active”
} else {
echo “page Template1 is not active”
}