Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

reset a session?

Featured Replies

So I was wondering for password check if it's possible to reset a session?

For when one get redirected to another website the session will either,

A: Be Destroyed.

B: Be Reseted.

 

I have treid the session_destroy function but nothing that can bring it out.

It namely fully destroys it with no reset.

 

if($mysqlnumrows!=1)
{ 
$_SESSION['check']=$_SESSION['check']+1;
if(!isset($_SESSION['check']))
{echo "";}
if ($_SESSION['check']==5);
{
die("Treid to many times");
}

 

Anyway for explanation;

I want once the $_SESSION reach 5 it will redirect the person to another page.

Once redirected and return to the inlog page the $_SESSION must be 0 again.

 

How do I accomplish this?

if ($_SESSION['check']==5);
{
$_SESSION['check'] = 0;
die("Treid to many times");
}

if(!isset($_SESSION['check'])){
//It's dangerous to go alone! Take this.
$_SESSION['check'] == 0;
}
if($mysqlnumrows != 1){ 
$_SESSION['check']++;
}

if ($_SESSION['check'] >= 5){
die("Your mission is a failure");
}

Edited by Spitfire

if(!isset($_SESSION['check'])){
//It's dangerous to go alone! Take this.
$_SESSION['check'] == 0;
}
if($mysqlnumrows != 1){ 
$_SESSION['check']++;
}

if ($_SESSION['check'] >= 5){
die("Your mission is a failure");
}

 

mmm should this

$_SESSION['check'] == 0;

not be this

$_SESSION['check'] = 0;

  • Author

It´s fun to see like all of those is not realy working as intended.

 

This however correctly works:

if($mysqlnumrows != 1)
{
$_SESSION['check'] == 1; 
$_SESSION['check']++;
echo $_SESSION['check'];
}

if ($_SESSION['check'] ==5)
{
header:("Location:http://localhost/admin/failed.php");
unset($_SESSION['check']);
}
}

 

It unset the session once it reached 5 and starts up again.

However you might notice the header location I added.

For some reason the header location just does not seem to work stand alone if I post it any where else.

 

Any though on it to get it to work?

Edited by kensha

  • Author

Alright so I found it out thanks by google and I will post the working solution for you guys.

 

the full default header location won't work when there is a tag in the current document.

For example:

<html>
<?php
header:("Location:http://localhost/admin/failed.php");
?>
</html>

 

However once you specify a variable for the url itself then the code would work.

For example:

<?php
$URL="../index.php"; 
header ("Location: $URL"); 
?>

Alright so I found it out thanks by google and I will post the working solution for you guys.

 

the full default header location won't work when there is a tag in the current document.

For example:

<html>
<?php
header:("Location:http://localhost/admin/failed.php");
?>
</html>

 

However once you specify a variable for the url itself then the code would work.

For example:

<?php
$URL="../index.php"; 
header ("Location: $URL"); 
?>

 

For future reference you cannot change the page location if there has already been any output to the browser. That includes white space.

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.