Search Results

Search found 718 results on 29 pages for 'logout'.

Page 7/29 | < Previous Page | 3 4 5 6 7 8 9 10 11 12 13 14  | Next Page >

  • Online & Offline in Web Chat Application

    - by Mohammed Safeer
    I stuck amidst developing a chat web application using php for client side app. I used comet for chat application. And use technique of updating database when someone logout. Thus display offline on other side user. My problem is if someone close browser without logout, how the other side user know the person goes offline. How can i set online and offline icon in a php webchat application, when someone close chat window without logout? Is web sockets in php solve this problem? welcome all suggestions.

    Read the article

  • Cookie won't unset

    - by Jordan Satok
    OK, I'm stumped, and have been staring at this for hours. I'm setting a cookie at /access/login.php with the following code: setcookie('username', $username, time() + 604800, '/'); When I try to logout, which is located at /access/logout.php (and rewritten to /access/logout), the cookie won't seem to unset. I've tried the following: setcookie('username', false, time()-3600, '/'); setcookie('username', '', time()-3600, '/'); setcookie('username', '', 1, '/'); I've also tried to directly hit /access/logout.php, but it's not working. Nothing shows up in the php logs. Any suggestions? I'm not sure if I'm missing something, or what's going on, but it's been hours of staring at this code and trying to debug.

    Read the article

  • simply way to add another webapp framework to my project.

    - by zjm1126
    one webapp project has many url and i have to change this: ('/addTopic', AddTopic), ('/delTopic', DeleteTopic), ('/addPost', AddPost), ('/delPost', DeletePost), to this: ('/tribes/addTopic', AddTopic), ('/tribes/delTopic', DeleteTopic), ('/tribes/addPost', AddPost), ('/tribes/delPost', DeletePost), but ,if i add this to my project ,i have to change the url in every py file or html file , in django it can be this : urlpatterns = patterns('', (r'^articles/2003/$', 'news.views.special_case_2003')), ) it is easy to add the url of 'news' to my peoject, but does webapp has this ? thanks updated: (1) my main page url is : ('/', MainPage), ('/sign', Guestbook), (2) the url of a webapp project that i want to add is : ('/', MainPage), ('/logout', LogoutPage), ('/login_response', LoginHandler), and i want to change (1) to this: ('/', MainPage), ('/sign', Guestbook), ('/aa/', p2.MainPage), ('/aa/logout', p2.LogoutPage), ('/aa/login_response', p2.LoginHandler), so i have to change so many url like / to /aa/ , or change /logout to /aa/logout in py file and html file , that is a hard work so any simple way to do this ?

    Read the article

  • How to properly log out of facebook

    - by Gublooo
    This is a repeated question and I have followed both the suggestions provided in these StackOverflow links: How to log-out users using FaceBook connect in php and zend Trouble logging out of a FaceBook connect site and destroying sessions The issue is - the code works 90% of the time. Thats the weird part. Out of the 100 times I've logged in and out - I've experienced this problem 5-6 times and 2 of my beta test users have reported the same issue. So when it works- if u click the logout link - u get the facebook popup saying - you being logged out - when it does'nt work - absolutely nothing happens - the page does not refresh - it just sits on that page doing nothing. This is the javascript code that gets called on clicking logout function logout() { FB.Connect.get_status().waitUntilReady(function(status) { switch(status) { case FB.ConnectState.connected: FB.Connect.logoutAndRedirect("http://www.example.com/login/logout"); break; case FB.ConnectState.userNotLoggedIn: window.location = "http://www.example.com/login/logout"; break; } }); return false; } This is the php code: $this-_auth-clearIdentity(); $face = Zend_Registry::get('facebook'); $fb = new Facebook($face['appapikey'], $face['appsecret']); //$fb-clear_cookie_state(); $fb-expire_session(); Anyone experienced such sporadic issues. Thanks

    Read the article

  • New to C# and trying to use a global variable

    - by Andrew G. Johnson
    Is it possible to use global variables in C#? I'm coming from mainly a PHP background so variables are either accessible everywhere or just a global definition away. My main issue is I have a User class that I built myself to wrap around the current users table on my company's database. I am defining it in the MasterPage but can't seem to access it from the actual pages (I don't know if there's a better word to describe them but they are the pages that inherit the styles and format from the MasterPage) Any general tips or implementation practices for me? EDIT: here's some code snippets of what I'm trying to do: Site.master.cs public partial class SiteMaster : System.Web.UI.MasterPage { public User user = new User(); } logout.aspx <%@ Page Title="" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeFile="logout.aspx.cs" Inherits="logout" %> <%@ MasterType virtualPath="~/Site.master"%> logout.aspx.cs public partial class _Default : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { User user = Master.user; } }

    Read the article

  • Regex javascript to match href

    - by zx
    Hello, <u class="logout" href="/logout.php?h=970c9836674709e6dcdaadd094622fc5&t=1273295318" target="_top">Logout</u> That above is what I want to search for. I want to get h= and t= from that URL, or just get the entire url in href="" How would I do this with regex?

    Read the article

  • php not redirecting

    - by NSchulze
    I'm trying to write the logout of a website. When I do this I want the page to redirect to the login page. I think I'm doing it the correct way, but can't get the right result. Could you guys point me in the right direction? Relevant Code: <button onclick="logout()">Logout</button> function logout() { var xmlhttp; if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp=new XMLHttpRequest(); } else {// code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4 && xmlhttp.status==200) { document.location=xmlhttp.responseText; } } xmlhttp.open("GET","logout.php",true); xmlhttp.send(); } <?php session_destroy(); header("Location:http://localhost:8888/loginns.html"); mysql_close($con); ?> Thanks!

    Read the article

  • facebook php-sdk not logging out

    - by Meisam Mulla
    I'm having a hard time getting this to work. I use the following to generate the logout url: $logout = "https://www.facebook.com/logout.php?next=" . urlencode('http://' . $_SERVER['SERVER_NAME'] . $_SERVER['PHP_SELF']) . "&access_token=" . $facebook->getAccessToken(); Which generates the correct (worked with the last version) url: https://www.facebook.com/logout.php?next=http%3A%2F%2F...&access_token=AA....ZD However this does not actually log the user out. I tried using $facebook->getLogoutUrl(array('next' => 'myurl')) which generates pretty much the same url. This also did not work. I am lost as to why its not logging the user out. I actually tried manually putting the address into the address bar but it redirects me to the Facebook homepage.

    Read the article

  • How Does Rails 3's "data-method='delete'" Degrade Gracefully?

    - by viatropos
    Rails 3 does some cool stuff to make Javascript unobtrusive, so they've done things like this: = link_to "Logout", user_session_path, :method => :delete ..converts to <a href="/logout" data-method="delete" rel="nofollow">Logout</a> But it just occurred to me.. When I turn off javascript the method isn't DELETE anymore, it's GET as expected. So are there plans to, or is there some way to, allow these data- attributes to degrade gracefully, so that link still is a DELETE request?

    Read the article

  • PHP MySQL Select multiple tables

    - by Jordan Pagaduan
    Is it posibble to select 3 tables at a time in 1 database? Table 1: employee -- employee_id -- first_name -- last_name -- middle_name -- birthdate -- address -- gender -- image -- salary Table 2: logs -- log_id -- full_name -- employee_id -- date -- time -- status Table 2: logout -- log_id -- full_name -- employee_id -- date -- time -- status I wanted to get the value of employee table where $id of selected. Then the $id also get the value of log.time, log.date, logout.time, and logout.date. I already try using UNION but nothing happens.

    Read the article

  • User authentication in Django. Problems with is_authenticated

    - by tim
    I have one problem with users menu. So, I want, that authenticated user can see his/her profile page and logout (links) in menu. It works (when I logging in) on index page: index, page1, profile, logout ,but, if I go to the, for example, page1 I can see in menu: index, page1, login, not profile and logout. How to fix it? in urls: url(r'^accounts/login/$', 'django.contrib.auth.views.login' ), url(r'^accounts/logout/$', 'django.contrib.auth.views.logout_then_login' ), url(r'^accounts/profile/$', 'my_app.views.profile' ), in views: def profile(request): if not request.user.is_authenticated(): return HttpResponseRedirect("/accounts/login/") else: user = request.user.is_authenticated() return render_to_response('profile.html',locals()) Part of index.html: {% if user.is_authenticated or request.user.is_authenticated %} <li><a href="/accounts/profile/">Profile</a></li> <li><a href="/accounts/logout/">logout</a></li> {% else %} <li><a href="/accounts/login/">login</a></li> {% endif %} login.html: {% extends "index.html" %} {% load url from future %} {% block application %} {% if form.errors %} <p>Try one more time</p> {% endif %} <form method="post" action="{% url 'django.contrib.auth.views.login' %}"> {% csrf_token %} <table> <tr> <td>{{ form.username.label_tag }}</td> <td>{{ form.username }}</td> </tr> <tr> <td>{{ form.password.label_tag }}</td> <td>{{ form.password }}</td> </tr> </table> <input type="submit" value="Login" /> <input type="hidden" name="next" value="{{ next }}" /> </form> {% endblock %} profile.html: {% extends "index.html" %} {% block application %} {% if request.user.is_authenticated %} <p>Welcome, {{ request.user.username }}. Thanks for logging in.</p> {% else %} <p>Welcome, new user. Please log in.</p> {% endif %} {% endblock %}

    Read the article

  • Change post form data function into curl

    - by QLiu
    Hello Guys, In the old way in our website, when users clicks “logout” button. It runs a post form function; which will pass parameters (logout, sn) to external sites to execute “logout” function. Like: I do not want the users jump to the external site, therefore, i use curl to post data. (because we are in different domain, i guess Ajax request doesnot work ) Post the same data to execute logout function in external site. // create cURL resource $URL = "http://bswi.development.intra.local/"; //Initl curl $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $URL); // Load in the destination URL curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC); //Normal HTTP request, not SSL curl_setopt($ch, CURLOPT_POSTFIELDS, "logout=1"); // receive server response ... curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_exec ($ch); echo $content; curl_close ($ch); Do u think i am going in the right direction?

    Read the article

  • Google App Engine: Difficulty with Users API (or maybe just a Python syntax problem)

    - by Rosarch
    I have a simple GAE app that includes a login/logout link. This app is running on the dev server at the moment. The base page handler gets the current user, and creates a login/logout url appropriately. It then puts this information into a _template_data dictionary, for convenience of subclasses. class BasePage(webapp.RequestHandler): _user = users.get_current_user() _login_logout_link = None if _user: _login_logout_link = users.create_logout_url('/') else: _login_logout_link = users.create_login_url('/') _template_data = {} _template_data['login_logout_link'] = _login_logout_link _template_data['user'] = _user def render(self, templateName, templateData): path = os.path.join(os.path.dirname(__file__), 'Static/Templates/%s.html' % templateName) self.response.out.write(template.render(path, templateData)) Here is one such subclass: class MainPage(BasePage): def get(self): self.render('start', self._template_data) The login/logout link is displayed fine, and going to the correct devserver login/logout page. However, it seems to have no effect - the server still seems to think the user is logged out. What am I doing wrong here?

    Read the article

  • Issue in event.PreventDefault()

    - by Prathiba
    I'm using twitter bootstrap in my application. i gave e.preventDefault for link button in $(document).reday(), but it is not working. Here is my code: Master page: <a id="lnkLogout" href="javascript:void(0);" onclick="PageLogout();"><i class="icon-off"> </i>Logout</a> <script type="text/javascript" language="javascript"> $(document).ready(function () { $('#lnkLogout').click(function (e) { e.preventDefault(); }); }); function PageLogout() { //Code for logout from the application.... } </script> SampleDefaultPage.aspx : <div class="row-fluid"> <div class="form-horizontal"> <h4 class="header blue bolder smaller"> Contact</h4> <div class="control-group"> <label for="form-field-email" class="control-label"> Email</label> <div class="controls"> <input type="text" style="width:200px;" data-val="true" data-val-required="Mobile Number is required." id="txtEmail"> <div class="space-3"> </div> <span data-valmsg-replace="true" data-valmsg-for="txtEmail" class="field-validation-valid text-warning red"></span> </div> </div> <div class="control-group"> <label for="form-field-website" class="control-label"> Phone Number</label> <div class="controls"> <input type="text" style="width:200px;" id="txtPhno"> </div> </div> </div> I have given txtEmail as mandatory field. if i left that field blank and click on Logout button in Master page, it says txtEmail is required. i dint do any validation in Logout onclick event. I have given preventDefault for Logout link. But still facing an issue. I should be able to logout even though txtEmail is left blank. Thank you all in advance for your response.

    Read the article

  • Xubuntu 13.10 64bit - Slow and buggy "log out" process?

    - by MrKatSwordfish
    I'm a Windows convert who has done only a little bit of dabbling in Ubuntu in the past (back in Dapper Drake a few years back). A lot has changes since then, and I've been yearning to jump back into linux again! So, having just bought a new SSD, I felt that this would be as good of a time as any to set up a dual-boot system again. I've messed around with Ubuntu 13.10 a bit, and while Unity has its issues, I think that it still needs some time to develop. I looked into XFCE and liked it a lot, so I went with Xubuntu. I've installed Xubuntu, and for the most part it's running smoothly and it a pleasure to work with. The customization is great and the minimalistic look and feel is really nice! But here's my problem, whenever I select the "Log Out" option from either the application menu, or the user profiles menu, my PC comes to a crawl, and the dialog box with all the options (shut down, restart, log out, etc.) takes maybe a minute or more to appear. I click the log out button, my PC is brought to a snail's pace, and I have to wait for what seems like an eternity for the logout options to appear! If i try to open something else (even a terminal window) while it's loading the logout options, that other program won't finish loading until the logout screen finally appears. Keep in mind, this is a pretty much vanilla install of Xubuntu 13.10 64bit, on a PC with an intel i7, an SSD, 6gb DDR3 RAM, and a new AMD 7770 gpu (drivers haven't been installed yet, though). Everything else runs fast, most applications open near-instantly! It must be an issue with how the logout options screen initializes or something, but I'm not sure exactly how I can fix it.. Edit - Extra Info: This problem is very consistent when using the "Log Out" buttons in Xubuntu. However, I've found that I'm able to reboot and shutdown much more quickly by going through the "Switch User" screen, and using the reboot or shutdown buttons on that screen. I'm nearly certain that it has something to do with the little Log Out options screen that appears when I select Log Out from the menu, and not the actual process of shutting down.. So what should I do? I really like XFCE so far, and I've never tried a non-ubuntu based distro before, but should I just switch to something else? Is there any known fix for this issue? Are there any work-arounds for logging out/shutting down/rebooting via the terminal so that I can avoid this irritating bug? Is there any that I can monitor the progress of the log out via terminal, allowing me to see which parts are causing the slow-down? What is the best way to report this bug to someone?

    Read the article

  • systray-whitelist changes are only temporary (how do i make them permenant?)

    - by Ed Sweeney
    I am writing a Qt C++ app. The notifications from trayIcon->showMessage(title, message) show up fine after I run the following command and logout/login: gsettings set com.canonical.Unity.Panel systray-whitelist "['all']" But after a few minutes the notifications don’t display any more and I have to repeat the gsettings logout/login. How can I get unity to play my messages without this fooling around when my user installs my app? Thanks for any help!

    Read the article

  • Server stops responding, can't find issue?

    - by Corey W
    I've had a pretty basic server up and running CentOS with webserver/database, and have noticed that it has locked up a few times in the middle of the night. It seems to happen randomly. When it locks up I can ssh in, (although it seems to hang once connected), but can't access cpanel/whm and have to reboot the server to get everything back up. Checking the messages log I see the below like clockwork every 5minutes 1 second, and then it just stops logging anything until I reboot. I can't seem to find any log showing any issue? Is there somewhere I can check to try to figure out what is happening? Could this be caused by CPU being maxed? Nov 17 08:01:35 s1 pure-ftpd: (__cpanel__service__auth__ftpd__Q13SKrtaCJCHjBezTfU8Iqmsi@127.0.0.1) [INFO] Logout. Nov 17 08:06:36 s1 pure-ftpd: ([email protected]) [INFO] New connection from 127.0.0.1 Nov 17 08:06:36 s1 pure-ftpd: ([email protected]) [INFO] __cpanel__service__auth__ftpd__mxidFBSnQXmR0QzqSxlqrXLIH0CmJ0GPh9bZ5V3 is now l ogged in Nov 17 08:06:37 s1 pure-ftpd: (__cpanel__service__auth__ftpd__mxidBDaCgnqSxlqrXLIH0CmJ0GPh9bZ5V3@127.0.0.1) [INFO] Logout. Nov 17 08:11:37 s1 pure-ftpd: ([email protected]) [INFO] New connection from 127.0.0.1 Nov 17 08:11:38 s1 pure-ftpd: ([email protected]) [INFO] __cpanel__service__auth__ftpd__T4B7F71acf1dsdJSeJHdqKNcbOdpzNnN_GttgcM is now l ogged in Nov 17 08:11:38 s1 pure-ftpd: (__cpanel__service__auth__ftpd__T4B7F71acf1KNcbOdpzNnN_GttgcM@127.0.0.1) [INFO] Logout. Nov 17 08:16:38 s1 pure-ftpd: ([email protected]) [INFO] New connection from 127.0.0.1 Nov 17 08:16:38 s1 pure-ftpd: ([email protected]) [INFO] __cpanel__service__auth__ftpd__W5C1RzumtaNwe4cU8Lt1 is now logged in Nov 17 08:16:38 s1 pure-ftpd: ([email protected]) [INFO] Logout. Nov 17 09:10:58 s1 kernel: imklog 4.6.2, log source = /proc/kmsg started. Nov 17 09:10:58 s1 rsyslogd: [origin software="rsyslogd" swVersion="4.6.2" x-pid="1094" x-info="http://www.rsyslog.com"] (re)start Nov 17 09:10:58 s1 kernel: Initializing cgroup subsys cpuset

    Read the article

  • Logging Remote Server Access via Remote Desktop

    - by Nate Bross
    The objective here is to start a simple .NET application I've written which captures some environment variables (time, username, computername, etc) upon login. This .NET application subscribes to the Windows "User logout" event. Upon launch, the application captures the above variables, and creates a record in my database, upon logout (which I'm capturing) I update another field in the same record, with the logout time. The above is working exactly as I would like, when I launch the binary, it makes its initial log entry, then waits for the logout event and updates the same record. Restrictions, the .NET binary should be able to live on a share point (\server\share\myapp\v1) so I can update the application to (\server\share\myapp\v2) and simply update the GPO/Logon script. My initial thought was to use the \domaincontroller\sysvol\ directory to store the binary and then update all user accounts to include a call to my application. Can you see any flaws in this approach? My question is this: First, is there anything wrong with my idea above? Second, if so, what is the best way (through group policy or otherwise) to ensure this application launches whenever a session is started on a server?

    Read the article

  • Logging Remote Desktop to Servers via Logon Script or GPO or What?

    - by Nate Bross
    The objective here is to start a simple .NET application I've written which captures some environment variables (time, username, computername, etc) upon login. This .NET application subscribes to the Windows "User logout" event. Upon launch, the application captures the above variables, and creates a record in my database, upon logout (which I'm capturing) I update another field in the same record, with the logout time. The above is working exactly as I would like, when I launch the binary, it makes its initial log entry, then waits for the logout event and updates the same record. Restrictions, the .NET binary should be able to live on a share point (\server\share\myapp\v1) so I can update the application to (\server\share\myapp\v2) and simply update the GPO/Logon script. My initial thought was to use the \domaincontroller\sysvol\ directory to store the binary and then update all user accounts to include a call to my application. Can you see any flaws in this approach? My question is this: First, is there anything wrong with my idea above? Second, if so, what is the best way (through group policy or otherwise) to ensure this application launches whenever a session is started on a server?

    Read the article

  • Screen becomes black after pressing dash or alt-tab

    - by cegerxwin
    I did an upgrade from 11.04 to 11.10. Unity 3d becomes a black screen after pressing the dash-button or after pressing alt-tab to switch between open windows. I can see the panel on the top(lock,sound,..) and the panel on the left (launcher) but the rest is black. It looks like a maximised black window. The open Windows are active but I cant see them. I logout by pressing logout in the right top corner and pressing enter (because logout is default focused on the dialogue screen) and leave unity3d. Unity3d worked with 11.04 very good. If I press the dash button the dash looks like an 16-Bit or 8-Bit window and buttons for maximise, minimise and close are displayed and looks inverted. I have rebooted my notebook just now and log in to Unity 3D and tested some features of Unity and everything works well. The black thing is only a layer. I can use my desktop but cant see anything because of the layer, but everything works. It seems so, that a layer appear when pressing dash or alt-tab and does not disappear when close dash or choose a running app with alt-tab. you will see the necessary info related video problems: Unity support: /usr/lib/nux/unity_support_test -p OpenGL vendor string: X.Org R300 Project OpenGL renderer string: Gallium 0.4 on ATI RC410 OpenGL version string: 2.1 Mesa 7.11-devel Not software rendered: yes Not blacklisted: yes GLX fbconfig: yes GLX texture from pixmap: yes GL npot or rect textures: yes GL vertex program: yes GL fragment program: yes GL vertex buffer object: yes GL framebuffer object: yes GL version is 1.4+: yes Unity 3D supported: yes xorg glxinfo lspci -nn | grep VGA 01:05.0 VGA compatible controller [0300]: ATI Technologies Inc RC410 [Radeon Xpress 200M] [1002:5a62]

    Read the article

  • MacOS X 10.6 Portable Home Directory sync fails due to FileSync agent crashing

    - by tegbains
    On one of our cleanly installed MacPro machines running MacOS X 10.6.6 connected to our MacOS X 10.6.6 Server, syncing data using Portable Home Directories fails. It seems to be due to the filesync agent crashing during the home sync. We get -41 and -8026 errors, which we are suspecting are indicating that there is too much data or filesync agent can't read the files. The user is the owner of the files and can read/write to all of the files. < Logout 0:: [11/02/04 13:10:42.751] Error -41 copying /Volumes/RCAUsers/earlpeng/Library/Mail/Mailboxes/email from old imac./Attachments/12081/2.2. (source = NO) < Logout 0:: [11/02/04 13:10:42.758] Error -8062 copying /Volumes/RCAUsers/earlpeng/Library/Mail/Mailboxes/email from old imac./Attachments/12081/2.2/[email protected]. (source = NO) < Logout 1:: [11/02/04 13:10:42.758] -[DeepCopyContext deepCopyError:sourceError:sourceRef:]: error = -8062, wasSource = NO: return shouldContinue = NO

    Read the article

  • MacOS X 10.6 Portable Home Directory sync fails due to FileSync agent crashing

    - by tegbains
    On one of our cleanly installed MacPro machines running MacOS X 10.6.6 connected to our MacOS X 10.6.6 Server, syncing data using Portable Home Directories fails. It seems to be due to the filesync agent crashing during the home sync. We get -41 and -8026 errors, which we are suspecting are indicating that there is too much data or filesync agent can't read the files. The user is the owner of the files and can read/write to all of the files. < Logout 0:: [11/02/04 13:10:42.751] Error -41 copying /Volumes/RCAUsers/earlpeng/Library/Mail/Mailboxes/email from old imac./Attachments/12081/2.2. (source = NO) < Logout 0:: [11/02/04 13:10:42.758] Error -8062 copying /Volumes/RCAUsers/earlpeng/Library/Mail/Mailboxes/email from old imac./Attachments/12081/2.2/[email protected]. (source = NO) < Logout 1:: [11/02/04 13:10:42.758] -[DeepCopyContext deepCopyError:sourceError:sourceRef:]: error = -8062, wasSource = NO: return shouldContinue = NO

    Read the article

  • PHP Frontpage/Page controller

    - by atno
    I using the following as Frontpage/Page Controller(s) and it's working ok so far, except two problems I'm facing which as you can see are the $pages array and the switch, which are actually much much longer as the one I've pasted here. Everytime there is a need for a new page controller I have to add it to $pages array and to switch which makes that list very long. How would you overcome this problem and do you see any other improvement on this code? loadLogic() in page controllers it is used to get functions under pages/controllername/logic/function.php. Frontpage Controller - index.php: include 'common/common.php'; if(!isset($_GET['p']) OR $_GET['p'] == ''){ $_GET['p'] = 'home'; header('Location: index.php?p=home'); } $pages = array('home','register','login','logout','page1','page2','page3'); $_GET['p'] = trim($_GET['p']); if(isset($_GET['p'])){ if(in_array($_GET['p'], $pages)){ switch ($_GET['p']) { case 'home': include 'home.php'; break; case 'register': include 'register.php'; break; case 'login': include 'login.php'; break; case 'logout': include 'logout.php'; break; case 'page1': include 'page1.php'; break; case 'page2': include 'page2.php'; break; case 'page3': include 'page3.php'; break; } }else{ echo '404!'; } } Page Controller - {home,register,login,logout,page1,page2,page3}.php: include 'tpl/common/header.php'; contentStart(); if(isset($_SESSION['logged'])){ loadLogic('dashboard'); }else{ loadLogic('nologin'); } //Display login form in logic page instead links // if(!isset($_SESSION['logged'])){ contentEnd(); loadLogic('nologinForm'); }else{ contentEnd(); include'tpl/common/rcol.php'; } include 'tpl/common/footer.php'; function loadLogic(): function loadLogic($logic) { $path = dirname(__DIR__) . '/pages'; $controller = preg_split('/&/',$_SERVER['QUERY_STRING']); $controller = trim($controller[0],"p="); $logicPath = 'logic'; $logic = $logic . '.php'; $err = 0; $logicFullPath = $path.'/'.$controller.'/'.$logicPath.'/'.$logic; if($err == '0'){ include "$logicFullPath"; } } Folder Structure: projectName | ---> common | ---> pages | | | --->home | | | --->register | | | --->login | | | --->logout | | | --->page1 | | | --->page2 | | | --->page3 | ---> tpl | | | ---> common | --> home.php | --> register.php | --> login.php | --> logout.php | --> page1.php | --> page2.php | --> page3.php

    Read the article

  • session management: problem displaying username in the header

    - by aeonsleo
    hi, I am working on a simple login and logout module for my website without any security. I am using wamp on a windows xp machine. I am creating session when a user submits the login informaton it redirects to a process.php file which creates the session variables and starts session. Now if the login is successful user is redirected to the welcome page which includes a header file(which displays the header involving signin logout help options) The problem is the header is not changing the signin link to logout as the user logs successfully. The below code is from process.php which initiates a login. $username = $_POST['username']; $password = $_POST['password']; //echo "{$username}:{$password}"; $connection = mysql_connect("localhost","root",""); if(!$connection) { die("Database Connection Failed".mysql_error()); } $db_select = mysql_select_db("tester",$connection); if(!$db_select) { die("Database Selection Failed".mysql_error()); } $result = mysql_query("SELECT * FROM user",$connection); if(!$result) { die("Database Selection Failed".mysql_error()); } $q = "SELECT * FROM user " ."WHERE Name='".$username."' AND Password='".$password. "' "; // Run query $r = mysql_query($q); if ( $obj = @mysql_fetch_object($r) ) { session_start(); // Login good, create session variables $_SESSION["valid_id"] = session_id(); $_SESSION["valid_user"] = $_POST["username"]; $_SESSION["valid_time"] = time(); Header('Location: welcome.php'); The following code is from header.php which is included in welcome.php </div> <div id = "userdetail"> <?php if(isset($_SESSION["valid_user"])) { echo($_SESSION["valid_user"]." " ); echo("<a href=logout.php>Logout</a>"); } else { echo("<a href = login.php>Sign In</a>"); } ?> | Help | Search <input type = "text" name = "searchbox" value = "" /> </div> </div>

    Read the article

< Previous Page | 3 4 5 6 7 8 9 10 11 12 13 14  | Next Page >