Click here to Skip to main content
15,889,281 members
Home / Discussions / Linux, Apache, MySQL, PHP
   

Linux, Apache, MySQL, PHP

 
AnswerRe: how can i split an object into chunks and send them ? Pin
Richard MacCutchan27-Oct-13 2:06
mveRichard MacCutchan27-Oct-13 2:06 
GeneralRe: how can i split an object into chunks and send them ? Pin
kleymanx9027-Oct-13 19:53
kleymanx9027-Oct-13 19:53 
GeneralRe: how can i split an object into chunks and send them ? Pin
Richard MacCutchan27-Oct-13 22:40
mveRichard MacCutchan27-Oct-13 22:40 
GeneralRe: how can i split an object into chunks and send them ? Pin
Albert Holguin14-Nov-13 8:40
professionalAlbert Holguin14-Nov-13 8:40 
AnswerRe: how can i split an object into chunks and send them ? Pin
Albert Holguin14-Nov-13 8:38
professionalAlbert Holguin14-Nov-13 8:38 
QuestionPHP CODES TO DISPLAY SLIDING IMAGES Pin
Member 1034654419-Oct-13 11:12
Member 1034654419-Oct-13 11:12 
AnswerRe: PHP CODES TO DISPLAY SLIDING IMAGES Pin
Peter Leow4-Nov-13 1:52
professionalPeter Leow4-Nov-13 1:52 
QuestionAvailable username on all pages after login Pin
msz90013-Oct-13 6:03
msz90013-Oct-13 6:03 
HY!
i have an issue in php session. the issue is that the session work fine in index page but the username can't show in other pages.

lohin.php code

PHP
<?php session_start();
 include './header.php';
include 'connection.php';
if(isset($_POST) && count($_POST)>0) {
    $user = $_POST['username'];
    $pass = $_POST['password'];

    $sSQL = "SELECT * FROM ulog WHERE User_Name ='".$user."' AND Password = '".$pass."'";

    $result = mysql_query($sSQL) or die(mysql_error());
    $row=mysql_num_rows($result);
    if($row==1)
        {
        // Set username session variable
            $_SESSION['username'] = $_POST['username'];
            // Jump to secured page
            header('Location:index.php');
                }
}

    else
    {
        header("location:login.html");
    }



?>


index.php code

PHP
<?php session_start();
include './header.php';
    // Check, if username session is NOT set then this page will jump to login page
    if (!isset($_SESSION['username']))
        {
            header('Location:login.html');
        }
 ?>
 <div id="welcome">
 <h4> Welcome <?php echo $_SESSION['username']; ?> <a href="logout.php">Logout</h4></a></p>
</div>
<div id="content">
<p>Learn to Design and Develop Website.<br />
 Learn Programing From Tutorial's teaches you the fundamentals of web development and not just programming. You will learn how to create amazing websites through programming and design tutorials. The web development tutorials on your left are designed for you to move through them in order to have an overall understanding of web design and development.</p>
</div>
<?php include './footer.php'; ?>


the code i use in other pages which is not working is..

PHP
<?php session_start();
include 'login.php';
    // Check, if username session is NOT set then this page will jump to login page
    if (!isset($_SESSION['username']))
        {
            header('Location:login.html');
        }
 ?>


the above code is used in other pages but it is not working..
what type of code i need to access username in all pages..
AnswerRe: Available username on all pages after login Pin
Ringunger24-Oct-13 21:11
Ringunger24-Oct-13 21:11 
QuestionHow to Play multiple Videos in single player page ? Pin
mAzeem228-Oct-13 22:49
mAzeem228-Oct-13 22:49 
Questionphp search form having 2 input fields and single submit button Pin
marshalericson8-Oct-13 7:59
marshalericson8-Oct-13 7:59 
Questionphp Pin
BipinVekariya25-Sep-13 2:12
BipinVekariya25-Sep-13 2:12 
QuestionPHP call to mysqli_query returns null (as expected) but I don't seem to be able to detect it Pin
Jonathan Davies9-Sep-13 6:22
Jonathan Davies9-Sep-13 6:22 
QuestionMYSQL to XML using PHP Pin
wolf7777726-Aug-13 22:27
wolf7777726-Aug-13 22:27 
QuestionUsing .net webservice data in php Pin
Andile.M20-Aug-13 0:35
Andile.M20-Aug-13 0:35 
QuestionIntitialize a session variable after onclick event is fired Pin
pandu web dev11-Aug-13 23:16
pandu web dev11-Aug-13 23:16 
AnswerRe: Intitialize a session variable after onclick event is fired Pin
Kaivan Alimohammadi23-Aug-13 10:25
Kaivan Alimohammadi23-Aug-13 10:25 
GeneralRe: Intitialize a session variable after onclick event is fired Pin
pandu web dev26-Aug-13 3:28
pandu web dev26-Aug-13 3:28 
QuestionContact form - Bootstrap Error Validation Pin
bigcdh4-Aug-13 8:13
bigcdh4-Aug-13 8:13 
AnswerRe: Contact form - Bootstrap Error Validation Pin
Peter_in_27808-Aug-13 15:42
professionalPeter_in_27808-Aug-13 15:42 
AnswerRe: Contact form - Bootstrap Error Validation Pin
vbmike23-Aug-13 9:12
vbmike23-Aug-13 9:12 
GeneralRe: Contact form - Bootstrap Error Validation Pin
bigcdh23-Aug-13 9:22
bigcdh23-Aug-13 9:22 
QuestionPHP find all occurrences of string in file Pin
MicahC5-Jul-13 6:44
MicahC5-Jul-13 6:44 
AnswerRe: PHP find all occurrences of string in file Pin
Graham Breach5-Jul-13 21:20
Graham Breach5-Jul-13 21:20 
GeneralRe: PHP find all occurrences of string in file Pin
MicahC7-Jul-13 19:52
MicahC7-Jul-13 19:52 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.