newb
Members-
Posts
454 -
Joined
-
Last visited
Everything posted by newb
-
Well, I've been working on a CMS for quite some time. How do you guys create yours? Any previews?
-
why r u including a non-local file...................................... anyway mazman is right
-
[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.
-
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.
-
how do you start converting ur photoshop layout to css.
-
np, dont forget to add a html form, thats just the php code.
-
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]
-
why not use sessions instead
-
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
-
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]
-
wouldnt die(); be more effective?
-
ok cool, how do i make the time minus 5 minutes so if their idle for 5 mins their ses gets deleted
-
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]
-
is this valid?: setcookie("PHPSESSID",$PHPSESSID,time()+3600);
-
cant i just set the phpsessid session cookie to expire somehow?
-
no didnt help. produces the same thing.
-
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.
-
[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?
-
[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
-
is it ok to use session_regenerate_id(); when logging out?
-
ok and how do you make sessions logout automatically after a certain period of time.
-
what about $_SESSION = array(); ? doesnt that create the same effect?
-
is it true that sessions only last and dont expire until the user closes their browser or logs out?