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
Write the class RoadSegmet. The class inherits from Transportation Class. The Class have a vector hourlySpeeds data field which
OLEGan [10]

Answer:

The length of time on the road segment is calculated by taking it's distance and dividing by the speed at the time of departure. This length of time is then added to the departureTime parameter to get the arrivalTime.

Define a RiverSegment class that inherits from the base TransportationClass from above. This class will have a vector<double> scheduledDepartureTimes data field that will keep track of the departure time (e.g. 10.5 represents the time 10:30) of all ferries on the river. You can assume these are sorted. Additionally, there is a _speed value that is the speed of the ferry at all times (ferries tend to be consistently slow). There is a setSpeed function to change the _speed value. Additionally, there is an addDepartureTime(double hour) function to add a departure time to the vector. Make sure the time are sorted

Computing the arrival time for the RiverSegment is a little more complicated since you need to wait for the next available departure time. Once you find the next available departure time (after the departure time passed in), you need to add the length of time on the river segment. This is done by dividing the _distance by the _speed. Add the time on the river to the departure time (from the vector of departure times) and this will give you the arrive time.

note: If there is no departure time scheduled for after your planned departure, you need to take the first available departure the following day. Our solution assumes the departure times are the same every day.

TransportationLink.h

#include <string>

using namespace std;

#ifndef __TRANSPORTATIONLINK_H__

#define __TRANSPORTATIONLINK_H__

const int HOURS_PER_DAY = 24;

const int MINS_PER_HOUR = 60;

const int MINS_PER_DAY = MINS_PER_HOUR * HOURS_PER_DAY; //24 * 60

class TransportationLink {

protected:

string _name;

double _distance;

public:

TransportationLink(const string &, double);

const string & getName() const;

double getDistance() const;

void setDistance(double);

// Passes in the departure time (as minute) and returns arrival time (as minute)

// For example:

// 8 am will be passed in as 480 (8 * 60)

// 2:30 pm will be passed in as 870 (14.5 * 60)

virtual unsigned computeArrivalTime(unsigned minute) const = 0;

};

5 0
3 years ago
What is the name of the technology that is typically implemented on switches to avoid Ethernet connectivity problems when the wr
Andrew [12]

Answer:  Medium Dependent Interface Crossover (MDIX)

Explanation:

The technology that is typically implemented on switches to avoid Ethernet connectivity problems is Medium Dependent Interface Crossover(MDIX) For switches with Auto (MDIX) the connection is configured automatically and a crossover or straight-through cable can be used to connect two switches. When this MDIX interface is connected it corrects the connectivity speed and the cabling for proper device functionality.

4 0
3 years ago
When the narrator of "EPIC 2015" describes the year 2015 as the "worst of
denpristay [2]

Answer:

A. computers will be replaced by new technology

3 0
3 years ago
In python, what is the difference between a dictionary and a set? How are they similar?
yuradex [85]

Answer:

"A set is an unordered collection. A dictionary is an unordered collection of data that stores data in key-value pairs."

Explanation:

Set =>

Collection of non-repetitive elements.

Unordered

Unindexed

No way to change items.

Dictionary =>

Collection of key-value pairs.

Unordered

Indexed

Mutable

4 0
2 years ago
The local area network software called a ____ server provides workstations with the authorization to access a particular printer
Oksana_A [137]

Answer:

I think Its a Wi-Fi

                         

6 0
3 years ago
Other questions:
  • Jason is creating a web page for his school's basketball team. He just finished creating his storyboard. Which tool should he us
    7·1 answer
  • Implement the function calcWordFrequencies() that uses a single prompt to read a list of words (separated by spaces). Then, the
    8·1 answer
  • In which of the following scenarios would you use the Redo function?
    12·1 answer
  • An app where you spin a wheel for coins and exchange for giftcards
    6·1 answer
  • What is the difference between the web and the internet?
    14·1 answer
  • Write a game that plays many rounds of Rock Paper Scissors. The user and computer will each choose between three items: rock (de
    8·1 answer
  • Why can videos be streamed from the cloud to a computer with no loss in
    5·2 answers
  • What happens if an email server cannot find a matching username or the mailbox is full
    14·2 answers
  • What do macOS and Windows use to prevent us from accidentally deleting files?
    15·1 answer
  • ____________ are designed to delete temporary files (such as deleted files still in the Recycle Bin, temporary Internet files, t
    10·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!