<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[session_start]]></title><description><![CDATA[<p dir="auto">chi mi aiuta a risolvere questi errori?:(<br />
<strong>Notice</strong>:  Undefined index:  username in <strong>y:\home\login\www\index.php</strong> on line <strong>88</strong><br />
<strong>Notice</strong>:  Undefined index:  username in <strong>y:\home\login\www\index.php</strong> on line <strong>93</strong></p>
<p dir="auto"><strong>Warning</strong>:  Cannot modify header information - headers already sent by (output started at y:\home\login\www\index.php:88) in <strong>y:\home\login\www\index.php</strong> on line <strong>143</strong></p>
<p dir="auto"><strong>il codice è:</strong><br />
<strong>&lt;?php</strong></p>
<p dir="auto"><strong>define('INCLUDE_CHECK',true);</strong></p>
<p dir="auto"><strong>require 'connect.php';</strong><br />
<strong>require 'functions.php';</strong><br />
<strong>// Those two files can be included only if INCLUDE_CHECK is defined</strong></p>
<p dir="auto"><strong>session_start();</strong></p>
<p dir="auto"><strong>session_name('tzLogin');</strong><br />
<strong>// Starting the session</strong></p>
<p dir="auto"><strong>session_set_cookie_params(2<em>7</em>24<em>60</em>60);</strong><br />
<strong>// Making the cookie live for 2 weeks</strong></p>
<p dir="auto"><strong>if(isset($_SESSION['id']) &amp;&amp; !isset($_COOKIE['tzRemember']) &amp;&amp; !isset($_SESSION['rememberMe']))</strong><br />
<strong>{</strong><br />
<strong>// If you are logged in, but you don't have the tzRemember cookie (browser restart)</strong><br />
<strong>// and you have not checked the rememberMe checkbox:</strong></p>
<pre><code>**$_SESSION = array();**
**session_destroy();**

**// Destroy the session**
</code></pre>
<p dir="auto"><strong>}</strong></p>
<p dir="auto"><strong>if(isset($_GET['logoff']))</strong><br />
<strong>{</strong><br />
<strong>$_SESSION = array();</strong><br />
<strong>session_destroy();</strong></p>
<pre><code>**header("Location: index.php");**
**exit;**
</code></pre>
<p dir="auto"><strong>}</strong></p>
<p dir="auto"><strong>if(isset($_POST['submit']) &amp;&amp; $_POST['submit']=='Login')</strong><br />
<strong>{</strong><br />
<strong>// Checking whether the Login form has been submitted</strong></p>
<pre><code>**$err = array();**
**// Will hold our errors**


**if(!$_POST['username'] || !$_POST['password'])**
    **$err[] = 'All the fields must be filled in!';**

**if(!count($err))**
**{**
    **$_POST['username'] = mysql_real_escape_string($_POST['username']);**
    **$_POST['password'] = mysql_real_escape_string($_POST['password']);**
    **$_POST['rememberMe'] = (int)$_POST['rememberMe'];**
    
    **// Escaping all input data**

    **$row = mysql_fetch_assoc(mysql_query("SELECT id,usr FROM tz_members WHERE usr='{$_POST['username']}' AND pass='".md5($_POST['password'])."'"));**

    **if($row['usr'])**
    **{**
        **// If everything is OK login**
        
        **$_SESSION['usr']=$row['usr'];**
        **$_SESSION['id'] = $row['id'];**
        **$_SESSION['rememberMe'] = $_POST['rememberMe'];**
        
        **// Store some data in the session**
        
        **setcookie('tzRemember',$_POST['rememberMe']);**
    **}**
    **else $err[]='Wrong username and/or password!';**
**}**

**if($err)**
**$_SESSION['msg']['login-err'] = implode('&lt;br /&gt;',$err);**
**// Save the error messages in the session**

**header("Location: index.php");**
**exit;**
</code></pre>
<p dir="auto"><strong>}</strong><br />
<strong>else if(isset($_POST['submit']) &amp;&amp; $_POST['submit']=='Register')</strong><br />
<strong>{</strong><br />
<strong>// If the Register form has been submitted</strong></p>
<pre><code>**$err = array();**

**if(strlen($_POST['username'])&lt;4 || strlen($_POST['username'])&gt;32)**
**{**
    **$err[]='Your username must be between 3 and 32 characters!';**
**}**

**if(preg_match('/[^a-z0-9\-\_\.]+/i',$_POST['username']))**
**{**
    **$err[]='Your username contains invalid characters!';**
**}**

**if(!checkEmail($_POST['email']))**
**{**
    **$err[]='Your email is not valid!';**
**}**

**if(!count($err))**
**{**
    **// If there are no errors**
    
    **$pass = substr(md5($_SERVER['REMOTE_ADDR'].microtime().rand(1,100000)),0,6);**
    **// Generate a random password**
    
    **$_POST['email'] = mysql_real_escape_string($_POST['email']);**
    **$_POST['username'] = mysql_real_escape_string($_POST['username']);**
    **// Escape the input data**
    
    
    **mysql_query("    INSERT INTO tz_members(usr,pass,email,regIP,dt)**
                    **VALUES(**
                    
                        **'".$_POST['username']."',**
                        **'".md5($pass)."',**
                        **'".$_POST['email']."',**
                        **'".$_SERVER['REMOTE_ADDR']."',**
                        **NOW()**
                        
                    **)");**
    
    **if(mysql_affected_rows($link)==1)**
    **{**
        **send_mail(    'dimoncic@mail.ru',**
                    **$_POST['email'],**
                    **'Registration System Demo - Your New Password',**
                    **'Your password is: '.$pass);**

        **$_SESSION['msg']['reg-success']='We sent you an email with your new password!';**
    **}**
    **else $err[]='This username is already taken!';**
**}**

**if(count($err))**
**{**
    **$_SESSION['msg']['reg-err'] = implode('&lt;br /&gt;',$err);**
**}**    

**header("Location: index.php");**
**exit;**
</code></pre>
<p dir="auto"><strong>}</strong></p>
<p dir="auto"><strong>$script = '';</strong></p>
<p dir="auto"><strong>if($_SESSION['msg'])</strong><br />
<strong>{</strong><br />
<strong>// The script below shows the sliding panel on page load</strong></p>
<pre><code>**$script = '**
**&lt;script type="text/javascript"&gt;**

    **$(function(){**
    
        **$("div#panel").show();**
        **$("#toggle a").toggle();**
    **});**

**&lt;/script&gt;';**
</code></pre>
<p dir="auto"><strong>}</strong><br />
<strong>?&gt;</strong></p>
]]></description><link>https://dev.connect.gt/topic/118499/session_start</link><generator>RSS for Node</generator><lastBuildDate>Sun, 29 Nov 2026 01:15:13 GMT</lastBuildDate><atom:link href="https://dev.connect.gt/topic/118499.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 05 Jan 2010 14:09:52 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to session_start on Sat, 10 Sep 2011 07:12:39 GMT]]></title><description><![CDATA[<p dir="auto">Per il cookie: ricorri al cookie di sessione incorporando SID nella tua istruzione e se non puoi utilizzare il cookie nella macchina dell'utente in quanto non presente.<br />
Devi quindi usare $_COOKIE per verificare se tutti i valori che vuoi verificarne l'esiostenza nel cookie sulla macchina del tuo utente.<br />
Vedi il manuale online di PHP.</p>
]]></description><link>https://dev.connect.gt/post/883184</link><guid isPermaLink="true">https://dev.connect.gt/post/883184</guid><dc:creator><![CDATA[antoniog2]]></dc:creator><pubDate>Sat, 10 Sep 2011 07:12:39 GMT</pubDate></item><item><title><![CDATA[Reply to session_start on Sat, 10 Sep 2011 07:07:09 GMT]]></title><description><![CDATA[<p dir="auto">Perchè fai riavviare il browser per settare il cookie?<br />
L'utente potrebbe considerarla una operazione malevola da parte di un cracker. Ma è una tua scelta. Io mostrerei una popup che richiede i dati da inserire nel cookie, per esempio.<br />
Forse fai eseguire session_destroy() prima di header("Location: index.php")</p>
]]></description><link>https://dev.connect.gt/post/883185</link><guid isPermaLink="true">https://dev.connect.gt/post/883185</guid><dc:creator><![CDATA[antoniog2]]></dc:creator><pubDate>Sat, 10 Sep 2011 07:07:09 GMT</pubDate></item></channel></rss>