473,412 Members | 2,262 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,412 software developers and data experts.

How to logout alert message ??

52
HELLO ,All
ANYONE know how to do the alert message for logout.Example "Yes" OR "NO"
in the message box.
Expand|Select|Wrap|Line Numbers
  1.   <td><?php if(isset($_SESSION['MM_Username'])) 
  2.             { 
  3.         ?>
  4.            <strong><a href="../logout.php">Logout</a></strong>
  5.            <?php        
  6.             }    
  7.          ?> 
Jul 2 '07 #1
6 7002
Hi,
php is not a language for client-side scripting (as jscript and so on...) but a server side one...You'd need to use javascript and do something like that (pseudocode, then you can edit it whit the things you need)

<script type="text/javascript">
<!--
var answer = confirm ("Do you really want to log out mate?")
if (answer)
<?
//your php code
?>
else
<?
//other php code
?>
// -->
</script>

Feel free to correct my answer, please...Hope to have been useful
Jul 2 '07 #2
kovik
1,044 Expert 1GB
Take note that you cannot access server-side code from the client-side.
Jul 2 '07 #3
chaos
52
Take note that you cannot access server-side code from the client-side.
This mean that the code given by luke14free cant be used ??
Jul 2 '07 #4
kovik
1,044 Expert 1GB
This mean that the code given by luke14free cant be used ??
It can be used, but not to initialize server side code. You'd have to generate JavaScript.
Jul 2 '07 #5
chaos
52
It can be used, but not to initialize server side code. You'd have to generate JavaScript.
Can i do onclick method on the link
Expand|Select|Wrap|Line Numbers
  1. <a href="../logout.php" onclick="logout()" >Logout</a>
Then on the top of it do this
Expand|Select|Wrap|Line Numbers
  1. <script language="javascript" type="text/javascript">
  2. function logout()
  3. {
  4.        var answer = confirm ("Do you really want to log out mate?")
  5.           if (answer)
  6.           <?
  7.           //your php code
  8.           ?>
  9.           else
  10.           <?
  11.           //other php code
  12.           ?>
  13. }
  14. </script>
  15.  
Jul 2 '07 #6
kovik
1,044 Expert 1GB
Yes. Though, I'm not a fan of inline event handling.
Jul 2 '07 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Phil Powell | last post by:
class LoginSessionGenerator extends MethodGenerator { function LoginSessionGenerator() {} /** * Logout * * @access public */ function &logout() { // STATIC VOID METHOD
4
by: Chris Stegeman | last post by:
Hello there, On my site people have to log in and automatically start a session. An authorized login grants access to other pages and MySQL data. However when the user waits to long, the server...
2
by: Jon Natwick | last post by:
I'm trying to add a dynamically created logout link on my pages. The link to the logout page will show if the user is logged in. I put a placeholder on the aspx page and then dynamically create...
6
by: Kevin Yu | last post by:
is it possible to for user to click a logout button to logout and when the user want to get into the system again, the user have to login again? Kevin
10
by: chaos | last post by:
How to do logout alert message when i press on the logout image <a href="../logout.php" target="_top" onClick="return logout()"...
1
by: shrik | last post by:
hi everybody. I have following problem. There are two pages. index.jsp and main.jsp in my application Index.jsp contains logging interface in . It submits password and userid to loginform bean. ...
3
by: kpg* | last post by:
Hi all, I want to perform the same action the the loginstatus control does to logout a user programatically, but I can't seem to find a 'logout' method in any of the membership classes. The...
1
by: Kandiman | last post by:
Hiya, i made a asp page, and one of my divs (as a include) is as below. the problem is if the main page is resubmitted, i get logged out again?... heres the code.. i think its on the value=true...
10
by: DavidPr | last post by:
When I logout as one user and log in under a different user, it opens with the last user's information. User 1 - Unsername: Davey Jones User 2 - Unsername: David Smith I log out from Davey...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.