Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,173,811 members, 7,889,656 topics. Date: Sunday, 14 July 2024 at 05:29 PM

Guys Please Help Me Out Here. I Don't Know What Is Wrong - Webmasters - Nairaland

Nairaland Forum / Science/Technology / Webmasters / Guys Please Help Me Out Here. I Don't Know What Is Wrong (899 Views)

I Dont Know What Is Wrong With Whogohost My Website Server Is Going Down / What Is Wrong With Yahoo Mail? / Guys Please Check Out This Amazing Blog. I Think It Is The Best So Far (2) (3) (4)

(1) (Reply) (Go Down)

Guys Please Help Me Out Here. I Don't Know What Is Wrong by deco2come: 7:15pm On Jan 18, 2012
I have a website which I am currently working on. On the website, I don't know what is causing this issue. I noticed that when a user sign out and repeat a task( which can only work if the user is signed in), the website will repeat the task as if the user is sign in.

To make it more clear,

When a user visit the site and try to perform a task which is only possible if the user has signed in, the task won't work. If the user sign in and repeat the task, it will work. But the problem is this, if the user sign out and repeat the task again, the task will still perform again as if the user hasn't logged out. I check the sign out page and everything is fine. The session destroy is ok.

I did something like this, if the user is not logged in /session not set , echo A else echo B

The task will perform despite echo A.


Remember that the user cannot do anything until he/she logged the first time and then logged out, all the drama will start. Please help
Re: Guys Please Help Me Out Here. I Don't Know What Is Wrong by micodon(m): 7:29pm On Jan 18, 2012
i believe u re tracking ur user's login status via a session variable, Wat u need to do, is to destroy that session when the user clicks the logout link. Destroy session not unset session
Re: Guys Please Help Me Out Here. I Don't Know What Is Wrong by yawatide(f): 7:47pm On Jan 18, 2012
Here is the log out script I have been using since 2007 (just the actual script, no html of course)  cool




<?php
    session_start();
    $old_user = $_SESSION['valid_user'];

    //see if they were logged in
    unset($_SESSION);
    $result_dest = session_destroy();   
   
    if(!empty($old_user)) {
        if($result_dest) {
        //if they were logged in and are now logged out,
            echo '<p>You have been logged out.  For security reasons, please close your browser upon logout.  We are not responsible for any data corruption resulting from not following the rules!!</p><p>Feel free to <a href="login.php">log in</a> again or to visit other sections of our site.</p>';
        } else {
          //they were logged in and could not be logged out
            echo '<p>You Could not be logged out.</p>';
        }
    } else {
      //they weren't logged in but came to this page somehow,
        echo '<p>You were not logged in, and so have not been logged out.  Feel free to <a href="login.php">log in</a> or to visit other sections of our site.</p>';
    }
?>


Re: Guys Please Help Me Out Here. I Don't Know What Is Wrong by Nobody: 10:12pm On Jan 18, 2012
i know this sounds stupid did you call session_start() at the beginning i usually skip it because Zend does it for me, so am spoilt
Re: Guys Please Help Me Out Here. I Don't Know What Is Wrong by teemy(m): 11:28pm On Jan 18, 2012
My guess is you have an action page that upon loading performs a specific task. If from that say action.php page a user logs out and presses back on their browser, the action.php page still works without the user logging in while you do not want this for a non logged in user. Right?
Re: Guys Please Help Me Out Here. I Don't Know What Is Wrong by deco2come: 8:15am On Jan 19, 2012
Thank you guys for your info. The problem has been resolved.
Currently I am having another issue which is cracking my brain right now. I am trying to change my dynamic url to static url using .htaccess. I tried the methods I found on the net and it is not working on my server.

I tried up to 6 different methods I found on the net but none seem to be working for me. Others are giving positive comments and how successful those methods are working for them but I don't know why mine isn't working.

I contacted my web host support team, after trying for some time, they couldn't fix it. They admit not knowing if the problem is from my script or what.

I am considering leaving dynamic url like that but anytime I see my competitors website ranking top on search engine with nice static url, I don't feel happy with my dynamic url.

Anyone knows how I can solve the issue?
Re: Guys Please Help Me Out Here. I Don't Know What Is Wrong by Nobody: 8:58am On Jan 19, 2012
u can connect to me later on for a patch in case an actual solution cannot be found. If your .htaccess is not working, i will borrow you the technique i used for my site.
Some pages on my website like:
http://.net/portfolio.php
http://.net/aboutus.php
http://.net/services.php

are using that technique. It is a form of php-routing. Rather than using http://.net/?p=services and all that.

I was forced to develop this technique when i first loaded my site on windows server which does not have the apache rewrite, and i have not learnt
and did not try to use windows to attempt a rewrite.
Re: Guys Please Help Me Out Here. I Don't Know What Is Wrong by teemy(m): 10:07am On Jan 19, 2012
Following on dhtml's example your services.php could just have the actual location as an include file. E.g your services.php file contains just <?php include 'index.php?p=services'; ?>. Every other page bears same resemblance.
Re: Guys Please Help Me Out Here. I Don't Know What Is Wrong by deco2come: 10:14am On Jan 19, 2012
The website is pulling results from database and are there a lot of data e.g users name, services, products, items, streets, locations and all that stuffs. I watched videos on the routing but the problem is that each of them already know what the page name will be so they easily create the re-route part.
Re: Guys Please Help Me Out Here. I Don't Know What Is Wrong by Thatdave(m): 10:47am On Jan 19, 2012
your logout.php should read only 2 lines.
//session destroy()
//echo user is logged out or redirect
Re: Guys Please Help Me Out Here. I Don't Know What Is Wrong by Thatdave(m): 10:54am On Jan 19, 2012
deco2come:

The website is pulling results from database and are there a lot of data e.g users name, services, products, items, streets, locations and all that stuffs. I watched videos on the routing but the problem is that each of them already know what the page name will be so they easily create the re-route part.


use sessions to keep track of your user data so u can tweak ur url the way u will.

(1) (Reply)

Tory Burch Reva Scarf At Shopbop Review / How To Upload Phpmyadmin Database To The Control Panel. / New Blackberry Free Subcription Hack

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 22
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.