Page 1 of 2 12 LastLast
Results 1 to 10 of 19
  1. #1
    Join Date
    Mar 2005
    Location
    Dog House
    Posts
    1,000
    Tokens
    0

    Latest Awards:

    Default Php Error [2] - Help Again?

    HeHe Error :

    Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /home2/extreme/public_html/login/login.php:1) in /home2/extreme/public_html/login/login.php on line 19

    Any ideas? as register / aadmin list work fine :s
    just logout / index any ideas?

    Thankies.
    Whitecorn.

  2. #2
    Join Date
    Apr 2005
    Location
    North Carolina, USA
    Posts
    4,535
    Tokens
    0

    Latest Awards:

    Default

    What is this for?

  3. #3
    Join Date
    Jun 2005
    Posts
    4,795
    Tokens
    0

    Latest Awards:

    Default

    Hold on ill think for a bit

  4. #4
    Join Date
    Mar 2005
    Location
    Dog House
    Posts
    1,000
    Tokens
    0

    Latest Awards:

    Default

    Its for somthing ROFL! duh :0 and i hate php

  5. #5
    Join Date
    Aug 2004
    Location
    UK
    Posts
    11,283
    Tokens
    2,031

    Latest Awards:

    Default

    headerr alreay set errors are cuased by wight space accoring to that on first line, so theres probly a space at the very start of the documnet just removbe that and it *shoudl* fix it

  6. #6
    Join Date
    Jun 2005
    Posts
    4,795
    Tokens
    0

    Latest Awards:

    Default

    Sorted:

    PHP Code:
    <?php
    $logoutGoTo 
    "link/to/your/page/you/want/after/logout.php";
    session_start();
    unset(
    $_SESSION['username session name here']);
    unset(
    $_SESSION['group name session here - delete if not needed']);
    if (
    $logoutGoTo != "") {header("Location: $logoutGoTo");
    session_unregister('user name session name here');
    session_unregister('group name session here - delete if not needed');

    exit;
    }
    ?>
    put in .php file and link to it

    Thats for logout let me think for protected pages

    Ok protected pages:

    PHP Code:
    <?php
    session_start
    ();
    $authorizedUsers "";
    $donotCheckaccess "true";

    // *** Restrict Access To Page: Grant or deny access to this page
    function isAuthorized($strUsers$strGroups$UserName$UserGroup) { 
      
    // For security, start by assuming the visitor is NOT authorized. 
      
    $isValid False

      
    // When a visitor has logged into this site, the Session variable Username set equal to their username. 
      // Therefore, we know that a user is NOT logged in if that Session variable is blank. 
      
    if (!empty($UserName)) { 
        
    // Besides being logged in, you may restrict access to only certain users based on an ID established when they login. 
        // Parse the strings into arrays. 
        
    $arrUsers Explode(","$strUsers); 
        
    $arrGroups Explode(","$strGroups); 
        if (
    in_array($UserName$arrUsers)) { 
          
    $isValid true
        } 
        
    // Or, you may restrict access to only certain users based on their username. 
        
    if (in_array($UserGroup$arrGroups)) { 
          
    $isValid true
        } 
        if ((
    $strUsers == "") && true) { 
          
    $isValid true
        } 
      } 
      return 
    $isValid
    }

    restrictGoTo "access/denied/page/here.php";
    if (!((isset(
    $_SESSION['Username'])) && (isAuthorized("",$authorizedUsers$_SESSION['username session name here'], $_SESSION['usergroup name session here - delete if not needed'])))) {   
      
    $qsChar "?";
      
    $referrer $_SERVER['PHP_SELF'];
      if (
    strpos($MM_restrictGoTo"?")) $MM_qsChar "&";
      if (isset(
    $QUERY_STRING) && strlen($QUERY_STRING) > 0
      
    $referrer .= "?" $QUERY_STRING;
      
    $restrictGoTo $restrictGoTo$qsChar "accesscheck=" urlencode($referrer);
      
    header("Location: "$restrictGoTo); 
      exit;
    }
    ?>
    Last edited by Tomm; 04-08-2005 at 05:40 PM.

  7. #7
    Join Date
    Mar 2005
    Location
    Dog House
    Posts
    1,000
    Tokens
    0

    Latest Awards:

    Default

    ok Mentor i checked and i couldnt find any gaps at the start :s and Tom i have a logout script a simple one but it should do ;P

    PHP Code:
    <style type="text/css">
    body,td,th {
        font-family: Verdana;
        font-size: 9px;
    }
    body {
        background-image: url(/images/index_r2_c4.png);
    }
    </style><center>
    <?php
    // set your infomation.
    $dbhost='localhost';
    $dbusername='extreme_*****';
    $dbuserpass='*****';
    $dbname='extreme_*****';
    session_start();

    // connect to the mysql database server.
    mysql_connect ($dbhost$dbusername$dbuserpass);
    mysql_select_db($dbname) or die('Cannot select database');
    ?>
    <strong>User Cpanel Index. </strong>
    <p>
      <?
    if (isset($_SESSION['s_username'])) {
    echo 
    "Welcome to my site! Your are logged in as ".$_SESSION['s_username'].", thanks for visiting!";
    }else{
    echo 
    "You are not logged in you log in <a href='login.php'>here</a> or register <a href='register.php'>here</a>.";
    echo 
    $_SESSION['s_username'];
    }
    ?>
      <br />
      <a href="logout.php">Logout</a>
    </p>
    </center>

  8. #8
    Join Date
    Jun 2005
    Posts
    4,795
    Tokens
    0

    Latest Awards:

    Default

    you put it in the body tags! lol

    Put this before ANY CODE:

    PHP Code:
    <?php
    // set your infomation.
    $dbhost='localhost';
    $dbusername='extreme_*****';
    $dbuserpass='*****';
    $dbname='extreme_*****';
    session_start();

    // connect to the mysql database server.
    mysql_connect ($dbhost$dbusername$dbuserpass);
    mysql_select_db($dbname) or die('Cannot select database');
    ?>

  9. #9
    Join Date
    Mar 2005
    Location
    Dog House
    Posts
    1,000
    Tokens
    0

    Latest Awards:

    Default

    Opps Silly meh Works now lmao! Easy mistake yet costs you alot

  10. #10
    Join Date
    Mar 2005
    Location
    Dog House
    Posts
    1,000
    Tokens
    0

    Latest Awards:

    Default

    Bump ^_^ Need more help

    Ok i sorted that above out Wooteh
    I tested it, it all works FINE! But... when a eror comes 'Username has aready been sued' it comes up in top left hand corner of iframe over my text any way of moving it?

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •