1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
jeka94
2 years ago
6

What code do I have to use in my php if i don’t want my $_SESSION[“variablex”] to destroy? But i already have a session_destroy(

) above the code that needs to be there. Or maybe there is an alternative?
So i want to destroy all my sessions EXCEPT $_SESSION[“variablex”]
Computers and Technology
1 answer:
Vesnalui [34]2 years ago
5 0

Answer:

See Explanation Below

Explanation:

Follow the steps below.

1. Start Session

2. Assign the session you want to preserve ( $_SESSION['variablex'] ) to a variable

3. Destroy all session (including the one you want, $_SESSION['variablex'])

4. Reassign the contents of the variable you created in (1) above to $_SESSION['variablex'].

The code is as follows (comments explain each line)

<?php

session_start(); // Start session

$variable = $_SESSION['variablex'] ; // assign $_SESSION['variablex'] to $variable

session_destroy(); // Destroy sessions

$_SESSION['variablex'] = $variable; // assign $variable back to $_SESSION['variablex'] to

// You can continue your code (if you have any), here

// End of solution

?>

You might be interested in
One of the main operations associated with the dictionary ADT is:
Digiron [165]
ITS B my friends and teacher helped
4 0
2 years ago
Write a python function genRandomVect that returns a random 1d numpy array of size (50,) where each element is an integer sample
SSSSS [86.1K]

Answer:

import numpy as np

def genRandomVect():

   arr = np.random.choice(range(100),size=(50,),replace=False)

   return arr

 

print("Random 1D numpy array where each element is an integer sampled from: [0, 100) ")

print( genRandomVect() )

Explanation:

  • Create a function to create a numpy array with random integers in range[0,100) with no duplicates
  • Use the random.choice to select random values from range[0,100)  and size attribute to take the size of the required array .
  • Finally return the numpy array.

6 0
3 years ago
Which of the following statements is False? A package passes through several MAC addresses to reach an IP address. IP addresses
oksano4ka [1.4K]
<span>The MAC address marks the final destination of the frames.

It marks the next destination.</span>
5 0
2 years ago
Write a generalized crypto-arithmetic program to handle any word problem (for example, am + pm = day, hello + world = prolog, et
grigory [225]
Avshcbvcgfhgcjhgdgjhh44357
5 0
3 years ago
An owner of a small publishing company allowed a friend who was starting a machine embroidery business to load the publishing co
klio [65]

Answer/Explanation:

Allowed or sanctioned by the Business Software Alliance. This is due to the fact that only one copy is to be transferred or transmitted.

3 0
3 years ago
Other questions:
  • Hard drives are usually self-contained, sealed devices. Why must the case for the hard drive remain sealed closed?
    8·1 answer
  • A URL suffix is called a domain name.
    11·1 answer
  • January 16, 2018 Q1: This question is worth 99 points and a brainliest. It is a one part question. Medium difficulty.
    5·2 answers
  • The expression 10,785(1.0275)x represents the amount of money in an investment account with interest that compounds annually for
    14·2 answers
  • A network slows down when a network card is locked in a perpetual mode
    12·2 answers
  • What makes someone an expert? What potential issues are there with this?
    10·2 answers
  • Write 4 types of viruses , explain them briefly.
    7·1 answer
  • computer hardware without software is useless while computer software without hardware is meaningless. explain what do you under
    13·1 answer
  • Thoughts on copyright?
    8·1 answer
  • In reference to operating systems, what is spooling? what does it stand for? chegg
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!