Ideally I'm just looking to have the variable set and retrieved when the page is loaded or refreshed.
Just thought of a potentially much simpler way. PHP has a built-in facility which lets you carry around variables between PHP calls. You might just be able to cram it into the $SESSION variable, which PHP stores either on the server or on the user machine with cookies.
Hello all,
i have a infile.txt text file which contains such variables:
aaa 123
asds 1323
asdsd 13434
lkjlkj 324324
23432 lkjlkj
24324 ljlkj
3j4lk 234kj3
and i want to pass them to my script such as:
./myscript $1 $2
where $1 is the first value in the first row and $2 is the second... (2 Replies)
Hi..
I am passing a variable in my shell function. I need to access it for an isql comand in the shell script.
However the isql o/p gives no results if i pass a variable in the command. The isql command works perfectly fine if i hardcore the table name.
My script is :
... (0 Replies)
nawk '($1 ~ "1000") && ($1 ~ "5665" ) { sub ($6,"89");flag =1;print }' old.txt >> new.txt I want to set a flag in awk , if the both conditions are met. I want to pass this flag to shell Can anyone please help me on this (1 Reply)
I noticed my script is not passing the value of variable alert to the rsh command. I need some assistance, please. This is a solaris environement. Thanks! :confused:
#!/bin/sh
echo -n "Alert number:"
read alert
rsh rhost_name 'egrep $alert /opt/var/log/*.logs' (2 Replies)
Hi,
I need to pass a gnuplot value to a shell script. I have a main shell script (Main.sh) that has a bunch of gnuplot commands. Main.sh calls another gnuplot script (Child.gnu). A part of the code in Child.gnu is as follows:
sp '</data/src/scripts/results/plot_data.sh $col' u (A):2:3 w pm3d... (8 Replies)
Hello,
I have two files File1 & File2.
File1
76 135
136 200
250 345
....
File2
1 24
1 35
1 36
1 72
....
I want to get all the values form File2 corresponding to the range in File 1 and feed it to a program. Is the code below right? Can I pass shell variables to awk in this... (2 Replies)
Hi.
I need to parse file and assign some values to variables, right now i do like below
MYHOMEDIR=`awk '/Home/ {print $NF}' output.txt`
MYSHELL=`awk '/Shell/ {print $NF}' output.txt`
PRGRP=`awk '/Primary/ {print $NF}' output.txt`
SECGRP=`awk '/Second/ {print $NF}' output.txt`
In this... (10 Replies)
Hi All,
Iam trying to pass global shell variables and is not working
Main script is like below
CYEAR=`date +"%y"`
CFYEAR=`date +"%Y"`
CMONTH=`date +"%m"`
if
then
PMONTH=12
PYEAR=`expr $CYEAR - 1`
PFYEAR=`expr $CFYEAR - 1`
else
PMONTH=`expr... (6 Replies)
ok so I have a file on a website. this file is a plain text file
i need to be able to update the contents of this file from any internet enabled unix box.
does anyone have ideas on how it can be done, without using scp/ftp?
i know wget can be used to download the file:
wget... (3 Replies)
Discussion started by: SkySmart
3 Replies
LEARN ABOUT PHP
session_start
SESSION_START(3) 1 SESSION_START(3)session_start - Start new or resume existing sessionSYNOPSIS
bool session_start (void )
DESCRIPTION session_start(3) creates a session or resumes the current one based on a session identifier passed via a GET or POST request, or passed via
a cookie.
When session_start(3) is called or when a session auto starts, PHP will call the open and read session save handlers. These will either be
a built-in save handler provided by default or by PHP extensions (such as SQLite or Memcached); or can be custom handler as defined by ses-
sion_set_save_handler(3). The read callback will retrieve any existing session data (stored in a special serialized format) and will be
unserialized and used to automatically populate the $_SESSION superglobal when the read callback returns the saved session data back to PHP
session handling.
To use a named session, call session_name(3) before calling session_start(3).
When session.use_trans_sid is enabled, the session_start(3) function will register an internal output handler for URL rewriting.
If a user uses ob_gzhandler or similar with ob_start(3), the function order is important for proper output. For example, ob_gzhandler must
be registered before starting the session.
RETURN VALUES
This function returns TRUE if a session was successfully started, otherwise FALSE.
CHANGELOG
+--------+---------------------------------------------------+
|Version | |
| | |
| | Description |
| | |
+--------+---------------------------------------------------+
| 5.3.0 | |
| | |
| | If a session fails to start, then FALSE is |
| | returned. Previously TRUE was returned. |
| | |
| 4.3.3 | |
| | |
| | As of PHP 4.3.3, calling session_start(3) after |
| | the session was previously started will result in |
| | an error of level E_NOTICE. Also, the second ses- |
| | sion start will simply be ignored. |
| | |
+--------+---------------------------------------------------+
EXAMPLES
Example #1
A session example: page1.php
<?php
// page1.php
session_start();
echo 'Welcome to page #1';
$_SESSION['favcolor'] = 'green';
$_SESSION['animal'] = 'cat';
$_SESSION['time'] = time();
// Works if session cookie was accepted
echo '<br /><a href="page2.php">page 2</a>';
// Or maybe pass along the session id, if needed
echo '<br /><a href="page2.php?' . SID . '">page 2</a>';
?>
After viewing page1.php, the second page page2.php will magically contain the session data. Read the session reference for information on
propagating session ids as it, for example, explains what the constant SID is all about.
Example #2
A session example: page2.php
<?php
// page2.php
session_start();
echo 'Welcome to page #2<br />';
echo $_SESSION['favcolor']; // green
echo $_SESSION['animal']; // cat
echo date('Y m d H:i:s', $_SESSION['time']);
// You may want to use SID here, like we did in page1.php
echo '<br /><a href="page1.php">page 1</a>';
?>
NOTES
Note
To use cookie-based sessions, session_start(3) must be called before outputing anything to the browser.
Note
Use of zlib.output_compression is recommended instead of ob_gzhandler(3)
Note
This function sends out several HTTP headers depending on the configuration. See session_cache_limiter(3) to customize these head-
ers.
SEE ALSO
$_SESSION, The session.auto_start configuration directive , session_id(3).
PHP Documentation Group SESSION_START(3)