Jump to content

newb

Members
  • Posts

    454
  • Joined

  • Last visited

Everything posted by newb

  1. i think he means javascript.
  2. how do i time out sessions. most users dont click the logout button so how do u time out the sessions based on inactivity.
  3. [code] <?php // *** Is the user already logged in? *** if ( $action == login || $action == '' ) { if(isset($_SESSION['username'])) { header ("Location: http://p16draft.net/modules.php?name=cpanel&action=profile"); } else { // Begin Login Code ?> [/code] thats my code. i keep getting this: [quote] Cannot modify header information - headers already sent by (output started at /home/xx/public_html/template/default/header.php:8) in /home/xx/public_html/modules/cpanel/index.php on line 41[/quote]
  4. anyone have an idea how to make usergroups work in sessions?
  5. ok great i removed the logged_in variable and it works almost perfectly except whenever someone goes to the &action=profile page and theyre not logged in, it just says this instead of giving them an error message denying their access and saying theyre not logged in: [quote] You are logged in, Your last log in was You registered asdf? works :DYour session id is: 3b2c7c1419be1c0626176260ae85831d Click here to logout [/quote] here's the new updated code by the way. can anyone please fix?? [code] <?php session_start(); $action = $_GET['action']; $date = date("F j, Y, g:i a");  // *** If the action is login or default? *** if ( $action == login || $action == '' ) { // Begin Login Code if(isset($_POST['login'])) {   $error = '';   $username = $_POST['username'];   $password = $_POST['password'];     if(!isset($username) || !isset($password))   {   $error .= 'A required field was left blank.<br />';   }   $password = md5($password);   if(get_magic_quotes_gpc())   {       $username = $username;       }       else       {       $username = addslashes($username);       }         $result = $libmysql->query("SELECT * FROM $table_users WHERE alias='$username' AND password='$password'");   $valid_login = mysql_num_rows($result);   if($valid_login == 0)   {       $error .= 'The supplied username and/or password was incorrect.<br />';       }           if($error == '')     {         $data = mysql_fetch_array($result);   $_SESSION['username'] = $data['username'];         $libmysql->query("UPDATE `$table_users` SET last_seen='$date' WHERE alias='$username'");           echo '<meta http-equiv="Refresh" Content="0; URL=modules.php?name=cpanel&action=profile">';           die();       }       else   {       echo 'The following errors were returned:<br />'.$error.'<br />';     } } // Echo Module Data   $query = $libmysql->query("SELECT * FROM $table_modules WHERE title='login'");       $row = $libmysql->fetch_array($query);   $data = $row['data'];   echo $data;   $libmysql->free_result($query);     // *** If the action is profile (user logged in)? *** } else if ( $action == profile ) { if(isset($_SESSION['username'])) { $ses_user = $_SESSION['username']; // Echo Module Data $query = $libmysql->query("SELECT * FROM $table_modules WHERE title='cpanel'");     $row = $libmysql->fetch_array($query);     $info = $row['data'];         $query2 = $libmysql->query("SELECT * FROM $table_users WHERE alias='$ses_user'");     $row2 = $libmysql->fetch_array($query2);     $signup_date = $row2['signup_date']; $last_seen = $row2['last_seen'];     $session_id = session_id();        $loginmsg = "You are logged in, $ses_user <br /><br />Your last log in was $last_seen <br /><br />You registered $signup_date<br /><br />";     echo $loginmsg;     echo "<br /><br />$info";     echo "Your session id is: $session_id";     echo "<br /><br /><br />";     echo "<a href='modules.php?name=cpanel&action=logout'>Click here to logout</a>";     $libmysql->free_result($query); } else {     echo "You aren't logged in.<br /><br />Please <a href='modules.php?name=signup'>register</a> or <a href='modules.php?name=login'>log in.</a>";     } // Logout Page } else if ( $action == logout ) { $_SESSION = array(); echo '<meta http-equiv="Refresh" Content="0; URL=index.php">'; echo 'You have been logged out, you are being redirected...'; die(); } ?> [/code]
  6. [quote author=radar link=topic=105680.msg422250#msg422250 date=1156578719] Though me personally -- since the $logged_in has nothing to do with the database or the session i would totally remove that and just check to see if the session variable is written.. if it is then redirect -- if not show the login form..  that'd be the easiest way to do it..  otherwise it may never work... [/quote] ok will try totally removing the $logged_in variable.
  7. nope doesnt work, i cleaned the code up a bit more. i echo'd the output of $logged_in variable and it gave me logged_in = 1, even when i went to &action=logout page. when i go to the &profile page it says this: [quote] You are logged in, Your last log in was You registered asdf? works :DYour session id is: 3b2c7c1419be1c0626176260ae85831d Click here to logout[/quote] its suppose to say you are logged in, username. your last login was today, u registered whatenver, etc... like that but its not.
  8. [code] <?php session_start(); $action = $_GET['action']; // *** If the action is login or default? *** if ( $action == login || $action == '' ) { if ($logged_in = 1) { echo $logged_in; echo '<meta http-equiv="Refresh" Content="5; URL=modules.php?name=cpanel&action=profile">'; } else if ($logged_in = 0) { // Begin Login Code if(isset($_POST['login'])) {   $error = '';   $username = $_POST['username'];   $password = $_POST['password'];     if(!isset($username) || !isset($password))   {   $error .= 'A required field was left blank.<br />';   }   $password = md5($password);   if(get_magic_quotes_gpc())   {       $username = $username;       }       else       {       $username = addslashes($username);       }         $result = $libmysql->query("SELECT * FROM $table_users WHERE alias='$username' AND password='$password'");   $valid_login = mysql_num_rows($result);   if($valid_login == 0)   {       $error .= 'The supplied username and/or password was incorrect.<br />';       }           if($error == '')     {         $data = mysql_fetch_array($result);   $_SESSION['username'] = $data['username'];         $libmysql->query("UPDATE `$table_users` SET last_seen='$date' WHERE alias='$username'");           $logged_in = 1;           echo '<meta http-equiv="Refresh" Content="0; URL=modules.php?name=cpanel&action=profile">';           die();       }       else   {       echo 'The following errors were returned:<br />'.$error.'<br />';     } } // Echo Module Data   $query = $libmysql->query("SELECT * FROM $table_modules WHERE title='login'");       $row = $libmysql->fetch_array($query);   $data = $row['data'];   echo $data;   $libmysql->free_result($query);   }    // *** If the action is profile (user logged in)? *** } else if ( $action == profile ) { if(isset($_SESSION['username']) || $logged_in = 1) { $ses_user = $_SESSION['username']; // Echo Module Data $query = $libmysql->query("SELECT * FROM $table_modules WHERE title='cpanel'");     $row = $libmysql->fetch_array($query);     $info = $row['data'];         $query2 = $libmysql->query("SELECT * FROM $table_users WHERE alias='$ses_user'");     $row2 = $libmysql->fetch_array($query2);     $signup_date = $row2['signup_date']; $last_seen = $row2['last_seen'];     $session_id = session_id();        $loginmsg = "You are logged in, $ses_user <br /><br />Your last log in was $last_seen <br /><br />You registered $signup_date<br /><br />";     echo $loginmsg;     echo "<br /><br />$info";     echo "Your session id is: $session_id";     echo "<br /><br /><br />";     echo "<a href='modules.php?name=cpanel&action=logout'>Click here to logout</a>";     $libmysql->free_result($query); } else {     echo "You aren't logged in.<br /><br />Please <a href='modules.php?name=signup'>register</a> or <a href='modules.php?name=login'>log in.</a>";     } // Logout Page } else if ( $action == logout ) { $logged_in = 0; $_SESSION = array(); echo '<meta http-equiv="Refresh" Content="0; URL=index.php">'; echo 'You have been logged out, you are being redirected...'; die(); } ?> [/code] can someone help me figure out why it does log in and out properly.
  9. not really. thats a broad question -.- kinda depends. just chmod the config file or something.
  10. [code] if (document.images) {   img01 = new Image();   img01.src = "images/buttons/0home.gif";   img012 = new Image();   img012.src = "images/buttons/1home.gif";     img02 = new Image();   img02.src = "images/buttons/0forum.gif";   img022 = new Image();   img022.src = "images/buttons/1forum.gif";     img03 = new Image();   img03.src = "images/buttons/0roster.gif";   img032 = new Image();   img032.src = "images/buttons/1roster.gif";     img04 = new Image();   img04.src = "images/buttons/0matches.gif";   img042 = new Image();   img042.src = "images/buttons/1matches.gif";     img05 = new Image();   img05.src = "images/buttons/0gallery.gif";   img052 = new Image();   img052.src = "images/buttons/1gallery.gif";     img06 = new Image();   img06.src = "images/buttons/0downloads.gif";   img062 = new Image();   img062.src = "images/buttons/1downloads.gif";   img07 = new Image();   img07.src = "images/buttons/0media.gif";   img072 = new Image();   img072.src = "images/buttons/1media.gif";     img08 = new Image();   img08.src = "images/buttons/0demos.gif";   img082 = new Image();   img082.src = "images/buttons/1demos.gif";   img09 = new Image();   img09.src = "images/buttons/0sponsors.gif";   img092 = new Image();   img092.src = "images/buttons/1sponsors.gif";     img10 = new Image();   img10.src = "images/buttons/0linkage.gif";   img102 = new Image();   img102.src = "images/buttons/1linkage.gif";   } function OnImage(name) { if (document.images) { fullname = eval(name + "2"); document[name].src = fullname.src; } } function OffImage(name) {   if (document.images) {     fullname = eval(name); if (fullname.complete) {       document[name].src = fullname.src; }   } } [/code] how do i convert that to php
  11. then how do u use a session to make a user login
  12. how do u log in members.
  13. i started with this <?php include ("file.php"); ?>
  14. how do you convert those to divs when u convert from tables to divs
  15. how do you learn how to make tableless div only websites?
  16. making a menu from a php database is ez. if thats what u want.
  17. [code=php:0] $url = $_POST['url']; if(!eregi("^(http://www.)",$url) || !eregi("^(http://)",$url)) { $url=str_replace($url,"http://$author_url",$url); } [/code]
  18. i was wondering how do i add http:// incase the user forgets to for forms?
  19. k asshole was just trying to help, someone told me u can only do them in bitwise so thats why i said that >_>. no need to be a cockfag about it. if it was that easy then next time fuck off and dont post for help.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.