Jump to content

newb

Members
  • Posts

    454
  • Joined

  • Last visited

Everything posted by newb

  1. Well, I've been working on a CMS for quite some time. How do you guys create yours? Any previews?
  2. why r u including a non-local file...................................... anyway mazman is right
  3. [code] <?php if ((in_array("$action", $pages)) && (!file_exists($cppath)) { echo 'page being worked on'; } ?> [/code] Error: [quote] Parse error: syntax error, unexpected '{' in /xx/index.php on line 21 [/quote] why does it give me parse error.
  4. newb

    newb css question

    ok avoid absolute and relative positioning, got it. so what kind of posintiong do i use? and what do u mean learn css? that not helping,  ok, u have designed webpage in Illustrator or Photoshop, but how do u make css/xhtml webpage of it? If I use tables it is easy - just slice it in Photohop or Imageready and you get almost finished website. it generates the code and stuf for you.
  5. how do you start converting ur photoshop layout to css.
  6. np, dont forget to add a html form, thats just the php code.
  7. yes you can. sessions are much easier to use then cookies. here's my code, it should work for u: [code] <?php session_start(); if(isset($_SESSION['username'])) { $ses_user = $_SESSION['username']; echo "You are already logged in, $ses_user. Redirecting to User CP..."; echo "<meta http-equiv='refresh' content='3;url=http://mysite.com/index.php?name=usercp'>"; } else { // 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 username='$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'];           echo '<meta http-equiv="Refresh" Content="0; URL=http://mysite.com/index.php?name=usercp">';           die();       }       else   {       echo 'The following errors were returned:<br />'.$error.'<br />';     } } ?> [/code] then for the usercp: [code] <?php if(isset($_SESSION['username'])) { echo "Welcome to the userCP $ses_user. You are logged in"; } else {     echo "You aren't logged in.<br /><br />Please <a href='mysite.com/index.php?name=signup'>register</a> or <a href='mysite.com/index.php?name=usercp'>log in.</a>";     } ?> [/code]
  8. go read some tuts first. cant just ask for snippets of code without providing some of your own and expect help.. http://www.w3schools.com/php/php_forms.asp
  9. try this [code] <?php if (isSet ($HTTP_COOKIE_VARS["login"]) ) {   echo '<meta http-equiv="Refresh" Content="0; URL=http://www.mysite.net/admin.php">'; // if cookies are set redirect user to the admin panel } else { echo '<meta http-equiv="Refresh" Content="0; URL=http://www.mysite.net/log.php">'; } ?> [/code]
  10. wouldnt die(); be more effective?
  11. ok cool, how do i make the time minus 5 minutes so if their idle for 5 mins their ses gets deleted
  12. ok, [code]<?php     if($error == '')     {         $data = mysql_fetch_array($result);   $_SESSION['username'] = $data['username'];         $libmysql->query("UPDATE `$table_users` SET last_seen='$date', logged_in = '1' WHERE alias='$ses_user'");           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 />';     } } ?> [/code]
  13. is this valid?: setcookie("PHPSESSID",$PHPSESSID,time()+3600);
  14. cant i just set the phpsessid session cookie to expire somehow?
  15. no didnt help. produces the same thing.
  16. i dont think it works. here's my code: [code] <?php session_start(); // Session Definitions $ses_user = $_SESSION['username']; $session_id = session_id();  $now = time(); if ( $_SESSION['username']+(60*60)<time() ) { $query = mysql_query("UPDATE `$table_users` SET last_action = $now, logged_in = '0' WHERE alias='$ses_user'"); session_unset(); session_destroy(); $_SESSION = array(); echo "You have been logged out due to inactivity. <br /><a href='modules.php?name=cpanel'>Log back in</a> - <a href='index.php'>Go to index</a>"; } else { $_SESSION['username']=time(); } ?> [/code] it just echo's this at the very top left of the page: [quote]You have been logged out due to inactivity. Log back in - Go to index[/quote] any idea why? [b]edit[/b] oh and even with the right username and password information, i cant login.
  17. [code=php:0] <?php session_start(); if ( $_SESSION['birth']+(60*60)<time() ) { $query = mysql_query("UPDATE `$table_users` SET last_action = $now AND logged_in = 0 WHERE alias='$ses_user'"); session_destroy(); die("Please log in again"); } else { $_SESSION['birth']=time(); } ?> [/code] can that work?
  18. [quote author=Orio link=topic=105855.msg422975#msg422975 date=1156714749] If you want to make the session expire, let's say, if someone is idling for a hour do this- On every page add: [code]<?php session_start(); if($_SESSION['birth']+(60*60)<time()){ session_destroy(); die("Please log in again"); }else{ $_SESSION['birth']=time(); } ?>[/code] If someone refreshes the window after more than one hour of idling he's out. Orio. [/quote] thanks will try that :D
  19. is it ok to use session_regenerate_id(); when logging out?
  20. ok and how do you make sessions logout automatically after a certain period of time.
  21. what about $_SESSION = array(); ? doesnt that create the same effect?
  22. is it true that sessions only last and dont expire until the user closes their browser or logs out?
×
×
  • 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.