<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>sessions in php Archives -</title>
	<atom:link href="https://mitindia.in/tag/sessions-in-php/feed/" rel="self" type="application/rss+xml" />
	<link>https://mitindia.in/tag/sessions-in-php/</link>
	<description></description>
	<lastBuildDate>Mon, 11 Jul 2016 06:12:07 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>

<image>
	<url>https://mitindia.in/wp-content/uploads/2023/03/cropped-android-chrome-512x512-1-32x32.png</url>
	<title>sessions in php Archives -</title>
	<link>https://mitindia.in/tag/sessions-in-php/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>PHP-Login page and sessions</title>
		<link>https://mitindia.in/php-login-page-and-sessions/</link>
		
		<dc:creator><![CDATA[SKB]]></dc:creator>
		<pubDate>Thu, 30 Jun 2016 08:19:32 +0000</pubDate>
				<category><![CDATA[PHP-MySQL]]></category>
		<category><![CDATA[sessions in php]]></category>
		<guid isPermaLink="false">http://www.mitindia.in/?p=197</guid>

					<description><![CDATA[<p>PHP Session Variables 1. Login page program using PHP and MySQL DB  a) first create a html page as following. &#60;html&#62; &#60;body &#62; &#60;form method="post" action="userLogin.php" &#62; &#60;table border="1" &#62; &#60;tr&#62; &#60;td&#62; &#60;B&#62;User-Id&#60;/B&#62; &#60;/td&#62; &#60;td&#62;&#60;input type="text" name="userid"&#62; &#60;/tr&#62; &#60;tr&#62; &#60;td&#62;&#60;B&#62;Password&#60;/B&#62;&#60;/td&#62; &#60;td&#62;&#60;input name="password" type="password"&#62;&#60;/input&#62;&#60;/td&#62; &#60;/tr&#62; &#60;tr&#62; &#60;td&#62;&#60;input type="submit" value="Submit"&#62; &#60;td&#62;&#60;input type="reset" value="Reset"&#62; &#60;/tr&#62; &#60;/table&#62; &#60;/form&#62; &#60;/body&#62; [&#8230;]</p>
<p>The post <a href="https://mitindia.in/php-login-page-and-sessions/">PHP-Login page and sessions</a> appeared first on <a href="https://mitindia.in"></a>.</p>
]]></description>
										<content:encoded><![CDATA[<h1>PHP Session Variables</h1>
<div><strong><span style="color: #000080;">1. Login page program using PHP and MySQL DB </span></strong></div>
<p>a) first create a html page as following.</p>
<pre>&lt;html&gt;
&lt;body &gt;
&lt;form method="post" action="userLogin.php" &gt;
&lt;table border="1" &gt;
&lt;tr&gt;
&lt;td&gt;
&lt;B&gt;User-Id&lt;/B&gt;
&lt;/td&gt;
&lt;td&gt;&lt;input type="text" name="userid"&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;B&gt;Password&lt;/B&gt;&lt;/td&gt;
&lt;td&gt;&lt;input name="password" type="password"&gt;&lt;/input&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;input type="submit" value="Submit"&gt;
&lt;td&gt;&lt;input type="reset" value="Reset"&gt;
&lt;/tr&gt;
&lt;/table&gt;
&lt;/form&gt;
&lt;/body&gt;
&lt;/html&gt;</pre>
<p>b) now create page called &#8220;userLogin.php&#8221; as following code.</p>
<pre>&lt;?php
$f_usr= $_POST["userid"];
$f_pswd= $_POST["password"];
$con=mysql_connect("localhost","root","");
if(!$con)
{
die('Connection Failed'.mysql_error());
}
mysql_select_db("mars_db",$con);
$result=mysql_query("select * from users");
while($row=mysql_fetch_array($result))
{
if(($row["usernm"]==$f_usr) &amp;&amp; ($row["password"]==$f_pswd))
{
echo "Welcome";
}
}
?&gt;</pre>
<p><strong><span style="color: #993300;">2. Program on Session Variables</span></strong></p>
<pre>&lt;?php
error_reporting(E_ALL ^ E_NOTICE);
session_start();
if (!$_SESSION['count'])
$_SESSION['count'] = 0;
if ($_GET['count'] == 'yes')
$_SESSION['count'] = $_SESSION['count'] + 1;
echo "&lt;h1&gt;".$_SESSION['count']."&lt;/h1&gt;";
?&gt;
&lt;a href="session.php?count=yes"&gt;Click here to count&lt;/a&gt;</pre>
<p><strong><span style="color: #993300;">3. Destroying Sessions using PHP</span></strong></p>
<pre>&lt;?php // start the session
session_start();
header("Cache-control: private"); //IE 6 Fix
$_SESSION = array();
session_destroy();
echo "&lt;strong&gt;Step 5 - Destroy This Session &lt;/strong&gt;&lt;br /&gt;"; if($_SESSION['name'])
{  echo "The session is still active"; }
else
{    echo "Ok, the session is no longer active! &lt;br /&gt;";
echo "&lt;a href=\"page1.php\"&gt;&lt;&lt; Go Back Step 1&lt;/a&gt;";
}
?&gt;</pre>
<p>&nbsp;</p>
<p><a class="a2a_button_whatsapp" href="https://www.addtoany.com/add_to/whatsapp?linkurl=https%3A%2F%2Fmitindia.in%2Fphp-login-page-and-sessions%2F&amp;linkname=PHP-Login%20page%20and%20sessions" title="WhatsApp" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_facebook" href="https://www.addtoany.com/add_to/facebook?linkurl=https%3A%2F%2Fmitindia.in%2Fphp-login-page-and-sessions%2F&amp;linkname=PHP-Login%20page%20and%20sessions" title="Facebook" rel="nofollow noopener" target="_blank"></a><a class="a2a_dd addtoany_share_save addtoany_share" href="https://www.addtoany.com/share#url=https%3A%2F%2Fmitindia.in%2Fphp-login-page-and-sessions%2F&#038;title=PHP-Login%20page%20and%20sessions" data-a2a-url="https://mitindia.in/php-login-page-and-sessions/" data-a2a-title="PHP-Login page and sessions"><img src="https://static.addtoany.com/buttons/favicon.png" alt="Share"></a></p><p>The post <a href="https://mitindia.in/php-login-page-and-sessions/">PHP-Login page and sessions</a> appeared first on <a href="https://mitindia.in"></a>.</p>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
