Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    PHP


SuperbHosting.net have generously sponsored dedicated servers to ensure a reliable and scalable dedicated hosting solution for BigResource.com.





Two Sessions: Session A By A Program Destroys Session B By A Program


I have two separate programs that I want to use together on a website
Program A starts first and calls session_start(). Program B is started by the user clicking on a link and it also calls session_start(). The session started by program B blows away the session started by program...




View Complete Forum Thread with Replies

Related Forum Messages:
Why A Session-based Program Behaves Different On Different Computers
I mean not about cookie.
Does it have something to do with operating system or browser plugin?

View Replies !
Php Session Problems When Working With A Windows Client Program
I am currently involved in a project that involves a windows client
program written in delphi and a web application written in php. I
have made several php pages for the delphi program to do requests via
the http component from INDY. the problems I am having are:

1) the first request from delphi app to php web app is the
authenication. In which user sends username + password to the php app.
If authenication is valid, a session is started and the sid is
returned to the client. All subsequent requests from delphi app to
php web app will have this sid as one of the arguments in the POST
form request (this is one of the function in the INDY component for
delphi). Even the sid is passed to the subsequent pages, the session
global array is still undefined. However if I open up a web browser
and create my own string request to the login page then the next page,
the global array would be defined (using var_dump + echo to see the
array) what is the problem?

2) does the above problem has anything to do with the http referer
field?

3) this problem that I am having has been asked before on google
group, but somehow the person who asked it didnt' put down the
solution for it. (this only involves the web only) when I login on a
page and return with a session id, then I log out.. the user is
redirected to the login page again. However if the user login again
(with a different login account), he would be presented with the same
session ID as before. a different sesson id is presented only if the
user restart the browser. why is that happening?

View Replies !
PHP Running Exec() Windows Program Very Slow In Comparison To UNIX Equivalent Program
Does anyone have an explanation or solution for the following.
I have a PHP script that uses exec() to call a program to do certain
calculations.

The UNIX version of this program I call runs in about 4 to 5 seconds.
When I run the same PHP script using exec() to call the Windows equivalent
of this same program on my Windows desktop, it takes about 32 seconds....

View Replies !
Session Destroys Only A Page Later?
This is the code that I'm using to check if someone is logged in or not.  This code is on every page because there is a login or logout button on every page.

if (!isset($_SESSION['user'])){
echo '<a href="login.php">LOGIN</a>';
}else{
echo '<a href="logout.php">LOGOUT</a>';
}

In the flow of my php document this checking if the user is logged in happens after the actual login or logout script.  Because of this, I assumed that as soon as someone logs in, the code would reflect the change.  For some reason, on the page that logs me in, the code still thinks that the session is not set yet and therefore I still see the login option.  Same thing with logout.  It takes for me to click on another page for the code to finally change.  Any ideas what is going on?

View Replies !
Refreshing Or Navigation Away Destroys The User Session
I searched the forums and after a day and a half of researching I need your help. I'm having weird session issues on my testing environment. I have a login that stores a 'User' object in a session. Once a user is logged in, they're redirected.

For testing purposes I outputted the session ( print_r($_SESSION); ) into the footer so it's viewable from all pages. After the redirect from the login page any refreshing or navigation away destroys the user session. Code:

View Replies !
Sessions? External Program / External Program
I am trying ac ouple of days now to learn some things on SESSIONS,but I think I am not getting it very clearly. I have a PHP page tha contains a form.

Users enter data in the form, which are then written in a file (the file is created at the time a user enters some data) The file is then given as an input to an external program The external program runs and gives some results which are then stored in another file (that is created when the external program finishes) What I want to do is to somehow create these files and, when the user exits from the browser, then both files that refer to this user, will be deleted. Code:

View Replies !
How To Call *.exe Program From Php Program
I have a php program, and from that program I wanna call C program that counts number of visitors on my page.

This is a piece of my program:

View Replies !
Warning: Session_start() [function.session-start]: Cannot Send Session Cookie - Problems With The Session Variables.
I am have a form on the page registration.html the content is posted to a page called registration.php Although the database is getting populated, i am having problems with the session variables. I get the following errors:

Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at /usr/shared/web/intocore/registration.php:10) in /usr/shared/web/intocore/registration.php on line 41 Code:

View Replies !
Session Problem: Session Exists, But Session Variables Don't Lasts
I have some troubles with session variables. I can easily create a session,
but the variable I append to global session array ( $_SESSION) lasts only
until the end of current function.

I prepared an example that can demonstrate the problem (see code bellow):
The program flow is this:
(1) It starts with "session_start()" and displays "login_form()".
(2) When user enters his username and password, it goes to "login()"
function which sets $_SESSION variables.
(3) This function also "Echoes" session_id and user name to the screen.
(4) Then it goes to "MyProgram()" function. It only "Echoes" the same
variables to the screen.

Strange is, that the session_id is the same in (3) and (4), but the user
name ($_SESSION["username"]) is only in (3), but not in (4). By other
words - $_SESSION["username"] variable filled up by "login()" function is
immediately cleared.

I don't know why.

There must be something missing, but after 3 days of watching it, I can not
find a problem here.

===========================================
<?
Function login($uzivatel, $heslo)
{
$_SESSION["username"] = $uzivatel;
$_SESSION["pass"] = $heslo;
$U_Name=$_SESSION['username'];
echo "Login username: $U_Name<BR>";
echo "Login session ID: ";
echo session_id();
echo "<BR>";
}

Function login_form()
{
echo ("<DIV ALIGN='center'>
<H1>Test</H1>
<P>Please enter your username and password:</P>
<form action='test.php' method='get'>
<INPUT TYPE='HIDDEN' NAME='login' VALUE=TRUE>
<TABLE BORDER=&#390;'>
<TR>
<TD ALIGN='right'><U>U</U>ser name:</TD>
<TD><INPUT NAME='uzivatel' SIZE=25 ACCESSKEY='U' TYPE='TEXT'></TD>
</TR>
<TR>
<TD align='right'><U>P</U>assword:</TD>
<TD><INPUT NAME='heslo' SIZE=25 ACCESSKEY='P' TYPE='PASSWORD'></TD>
</TR>
<TR>
<TD COLSPAN=2 ALIGN='RIGHT'><INPUT NAME='OK' ACCESSKEY='O' TYPE='SUBMIT'
VALUE='OK' TABINDEX=3></TD>
</TR>
</TABLE>
</FORM></DIV></HTML>");
}

Function MyProgram()
{
$U_Name=$_SESSION['username'];
echo "Program username: $U_Name<BR>";
echo "Program session ID: ";
echo session_id();
echo "<BR>";
}

{
session_start();
if ($_SESSION['username']):
MyProgram();
else:
{
if (!$login):
login_form(0);
else:
login($uzivatel, $heslo);
MyProgram();
endif;
}
endif;
}
?>
===========================================

View Replies !
Sessions - Two With Same Session ID As The Same Time
I just had a brainwave. I leave a session cookie on someone's machine so
that I recognise them (with their session ID in the cookie) when they come
back, I also offer them the option to have an email sent to their email
address with a link that sets the session ID to the one in the emailed link
so that they can open their account from another computer.

Now, my question is, can you have two users on different computers be on the
website at the same time with the same session ID?

View Replies !
Sessions: It Don't Carry The Session To The Other Page
I have a problem with sessions, the session is created on the check page(check.php) sucessfully but it don't pass the session to the next page. PHP Code:

View Replies !
How To Delete All Sessions (session Files)?
What line(s) of PHP code can I use to delete ALL existing session files? I tried:

$_SESSION = array();
session_destroy();

......but those two lines appear to only delete the session file that was created for the current session.

View Replies !
Sessions Timing Out Even Though Session.cookie_lifetime Is 0
I'm running two version of php, 4.3.1 on my development box and 4.2.2 within production. What's strange is that for some reason, my session is being cleared after a specified time period. It looks like half an hour or so. So looking at php.net, I see the following:

session.gc_maxlifetime integer
session.gc_maxlifetime specifies the number of seconds after which data will be seen as 'garbage' and cleaned up.

session.cookie_lifetime integer
session.cookie_lifetime specifies the lifetime of the cookie in seconds which is sent to the browser. The value 0 means "until the browser is closed." Defaults to 0.See also session_get_cookie_params() and session_set_cookie_params().

To me, session.gc_maxlifetime simply indicates when files will be cleaned up after a session is finished. My understanding is that session.cookie_lifetime determines when a session times out.

As I'm writing this, I was performing a test. I simply logged in, identified which session file was mine (in the /tmp directory) and watched it. In this case, it looks like it took about 35 minutes, but sure enough, the session file was erased. Again, this doesn't happen on my dev machine, the code base is the same and to confirm that somehow my code wasn't the culprit, I just logged in and did nothing!

View Replies !
How To Use Sessions In And Give Session Timeouts
I am building a website using the PHP 5 and MySQL .I have set up all the required database ready and the PHP pages are linked with the database.I am able to traverse through my pages by querying through the database and inserting and retrieving the stored data from MySQL database.

Now i am trying to use sessions in my website so that i can limit the users access and implement session timeouts say if the user is not using the web page for 5 minutes then the session  is timed out and he is again asked to relogin.

View Replies !
Can I At Least Read The Session Files For All Sessions?
Right now, I am attempting to see how many users are "signed on" to my system. Since this is, at best, rather tenuous in a WEB environment, I thought to read the active session variables and see how many sessions there were.

View Replies !
Http Session And Https Sessions
I have a site that uses both http and https. I have the login on the http side and once I go to checkout items (in the https side) I get re-directed to the login page (which is supposed to happen when someone isn't logged on). I only get redirected in FF and Opera, IE works fine...go figure. Anyways ... how can I use the same session information on both sides?

View Replies !
PHP Used As A CGI Program
Manual for odbc_pconnect states: "Persistent connections have no effect if PHP is used as a CGI program." As I have just installed PHP on a PC with an Apache server, how does one tell if it is used as a CGI program, and if so, how does one confiure it not to be?

View Replies !
C Program And PHP
I have written this function in a C program, using Visual Studio. The
PHP script executes fine, but the output is not displayed. I have
been racking my brains for hours trying to figure this one out. The
output from the php program should print to a file called 'out.txt'.
The file is successfully created, but with no content. I am pretty
sure it's the way PHP returns the results. Does anyone have any
ideas? Any help would be most appreciated.

int passCode(void)
{
FILE *phpFile, *out;
size_t len;
char buffer[1000];

phpFile = popen("php -f testing1.php", "r");
if (phpFile)
{
out = fopen("out.txt", "w");
len = fread(buffer, 1, sizeof(buffer), phpFile);
fprintf(out, buffer);
fclose(out);

pclose(phpFile);

return 1;
}
else
{
return 0;
}
}

View Replies !
How To Use ? And : In A Program
in the program below, what is the meaning/use of
the question mark (?gcd) and the colon (:$a) after the return statement?

<?
$x=32;
$y=80;
function gcd($a, $b)
{ return ($b>0)?gcd($b,$a%$b):$a;}
$val=gcd($x, $y);
print "The greatest common denominator of $x and $y is $val";
?>

This recursive program is used to find the greatest common denominator of 2
numbers.

View Replies !
How To Program OOP
I use OOP for a PHP Application Framework I am programming. I have one base class which includes all the necessary functions and variables which all the other classes use. So what I originally did was that I made an instance of the base class and passed it to the other classes. Now someone insisted that this is not the way to do it.

so I used 'extends base' to make the base class available to the other classes. Afterwards it worked fine, but it didn't make the code smaller nor did it result in faster speed. I used the benchmarking script from PEAR. So I wonder whats the difference between those two solutions, both work fine. Are there some tools to analyse how much memory a script uses?

View Replies !
Run A Program.
I am using

system('GPA.exe ' . $filename);

to run a program GPA.exe

this program do the following things. ../GPA.exe filename.txt and will generate another file. HOWEVER, the problem is, there is no new file generated and I doesn't get an exception. I don't know why. Can somebody give me a clue?

View Replies !
Sig Program
I ran across a very cool little program today that I think I can reproduce for something I need on my site using PHP.

http://www.danasoft.com/customsig.php

How do they give the URL a .jpg extension and still be able to have it run a PHP script and send a JPG back to the browser?

View Replies !
Non-PHP-program To PHP/cgi
I read a POST-request from a Web-client over a socket and will pass this request to a PHP/cgi-Modul, to get PHP's generated HTML-stream. The request contains formular parameter and the data from an uploaded file. I copy the parameter-names and the values and pass them to PHP. This works fine, but I don't know how to tell PHP, it may read the data from the uploaded file.

View Replies !
PHP Program
I have a client that pretty much needs an admin program for their site. They are a local radio station. They want to be able to create forms within their website admin so they don't have to copy and paste code. They have no programming experience. NONE. They also want to be able to access their database to view content submitted. They send out birthday e-cards and all that junk. So does anyone know of a program that can do this?  They have a thing like this in iHTML, but it's gettin spammed all to hell and they want a more secure route.

View Replies !
Arrays In Sessions - Products Stored In A Session
i have id's of products stored in a session that is created when the customer clicks add to cart. Code:

View Replies !
Is There A Way To Optimize My Program?
My Program is about parsing website through their url, My program is working properly but everytime it enters URL with so many sub URL (i mean thousand) my program seem to stop responding. Can you suggest something to this problem. somebody told me that i use the sleep() fucntion to not force my script to run successively, to give a pause to my program. Any thing more you can suggest? i'm not after the speed of execution but what im after is that he finish his job no matter how much time it takes....

View Replies !
What Program Do U Write Your Php In ?
what program do u write your php in ? i just use notepad are there programs that would speed it up and make things easier ?

View Replies !
Run Program Automatically
I want to create the option for my clients to create their own e-mail address. When I do this in Telnet, I have to run the command 'vadduser' It then asks me for a username, I want to assign this automatically. (1,2,3,4 etc etc)

It then asks me for a password, I want this to be something the user has already given in a form (before the script was run). It then has to be retyped. Those two things can be done automatically. It then asks if I want to assign a disk quota (YES) and then asks for the number of megabytes (1) That's it. Are there any examples available of how to do this?

View Replies !
Php Email Program
Does anyone know of a php or even cold fusion based script out there for
accessing email that can be customized? Right now I use SquirrelMail
which is great, however, you can't really customize it to tie in with
your web site. Is there something out there that is very flexible that
I could make fit right into my site which is pretty reliable in terms of
web email?

View Replies !
Should I Use A One Php Program Or Multiple
I have taken over a php web site. Once you login you are given six menu
choices. Each option is or can be independant of the others. They each
modify the same database but in different ways.

On clicking the menu buttons the program calls php functions to do the
action. Thus the user stays inside a large program.

I was expecting the menu to provide links rather than function calls.
1) Is there a reason to stay inside a large program through function
calls rather than linking to separate pages?

2) Am I correct that providing a <a href=... link would isolate the
functionality and call a new program?

The current program is spagettii code and somewhat buggy. There are
side effects that depend on what function was called before. I am
hoping that passing the hidden input parameters is all the connectivity
I need.

View Replies !
Chat Program
Is it possible to create a chat program by using PHP. Or is it only possible by JAVA?

View Replies !
Survey Program -
I want to migrate a survey program to web application and have selected
PHP to use a on the server end along with apache and firebird rdms. As
developing a web application is much different than a standard app I
have some questions:

1) The survey has 50 questions with answers being 1-10. Is it best to
store all 50 questions and corresponding answers in a javascript array
and then up all in a batch update? The downside to this approach is the
user could lose all responses to survey questions if the client computer
web browser crashed.

2) After authenticating the user, how do I keep track of the rating
session to guard it from hacking? Do I just store the username in a
javascript variable since there is really no constant connection to the
server?

View Replies !
PHP Program Packaging
I'm going to be doing a program for an elderly couple who owns a horse ranch, and wants some software to keep track of all their horses, owners, doctors, etc. I'm going to be writing the program in PHP using a MySQL database.

I set up one like this for my work and it runs off of Apache on our server. I need this program to be a stand-alone install, without installing MySQL, PHP, and Apache seperately. How could I go about integrating it all into one package?

View Replies !
Standalone Program
I'm going to be doing a program for an elderly couple who owns a horse ranch, and wants some software to keep track of all their horses, owners, doctors, etc. I'm going to be writing the program in PHP using a MySQL database.

I set up one like this for my work and it runs off of Apache on our server. I need this program to be a stand-alone install, without installing MySQL, PHP, and Apache seperately. How could I go about integrating it all into one package?

View Replies !
Program Flow
I had some bad experience with code organization and script
functionality in writing my php based applications. And as the applications
get bigger in scale it gets even worse. Therefore, I am trying to build a
general schema for data flow in a php/mysql application.

What I has in mind is to design a three major units. To handle the
input, processing and data access. Plus another unit to generate the output.

What I have now is one script that resolves the operation to be done
according to the parameters send to it and the call the processing unit to
do the rest of the job. However, as I add more functionality to the system
this dispatcher script gets bigger and bigger...

1. How can I arrange my program/data flow in an efficient and easily
maintainable way?

2. And how should I implement the output generation unit to be
completely seperate from the others (I have lots of forms and outputs I have
to show the user when necessary)?

View Replies !
Calling A C Program From Php.
I need to call a c program from a php. I also need to pass a string to it and have it return an array or string. I was thinking about calling it like its cgi script, but I'm not to sure how to do that. I haven't figured the variable passing because I'm just
trying to get it to run first. These are allthe things I tried. Code:

View Replies !
Calendar Program (help)
I have been solving algorithms with php, just to get practice. But my
new company
asked to do the following program in php, msql within 6 hours which I
have got stuck.
The task is as follows:

task:

"make a calendar using php and mysql where user can insert some
messages
and then see the day event."

I thought of doing a calendar on the browser where, in each cell there
is a button.
If button is clicked then a new textbox that imputes some message from
the user
and stores it in the mysql.

I don't know weather the above idea is possible.

Can any one give me a idea to approach the above problem?
Any link for UI in php? Is php event driven?

View Replies !
How To Run Program In Php(Matlab)
I am trying to run a matlab script.(This script you can run from the command line  by command 'matlab -r scriptname'). But when I use this command inside a system or exec I don't get any output, nor does the matlab opens and executes as it does in case of command line. Code:

View Replies !
Connecting To A Program
i wanna try get php to execute a command to a process/application running on a linux box(same computer). the application that is running is called asterisk.

asterisk uses a CLI, how i normally do this is:
Open a terminal
type in: asterisk -r <--- connects to the CLI
           reload <----- reloads the config files
           exit <-- exits the terminal/CLI

View Replies !
Creating .exe From PHP Program
I have developed a PHP application which is currently running online.  It regularly interacts with mySQL.  I would like to use something like Roadsend to create a .exe which can be run locally and offline.  However, I'm not sure how this .exe would interact with mySQL.  Does anyone have any experience with Roadsend or similar, that might be able to help me with this?

View Replies !
Program Execution
I am using php to write inputs I receive from browser into a text file.Than I use shell_exec() to execute a program on server that writes those inputs from the text file and write its output to another text file. Now after my program has written its output I want to read this text file from php and send it back to the browser.

View Replies !
Lauch A Program
I want to lunch wmplayer and play a file on the server (my pc). I tried exec() and it didn't work. I'm guessing that it needs to create the window but the problem is how do I do it. What is the command to do it.

View Replies !
Day Of The Week Program
I am trying to write a program that will give me the day of the week without using the date function. I input the date and it's supposed to spit out the name of the day of the week. Here is what I have so far. I don't know quite what to do next. Code:

View Replies !
Executing A Program
I am trying to run a console application which needs to keep running even after the php script has finished executing. I also need the PID or some sort of handle I can use to kill the program at a later stage.

View Replies !
Can Php Interact With A C Program?
A coworker asked me if he could develop a php front end that would ultimately end up interacting with a program he had written in c (c++ or whatever).



View Replies !
Program Clog
I am developing a web crawler which collects info from more than 50,0000 pages. but i am afraid this is going to clog the rental web server if I run it every single day. Is it possible to stop the web hosting server because of my program?

View Replies !
Mail Program
I am looking for a mail program I can setup on my site to offer visitors free e-mail from my domain. Hivemail went out of business. Everyone.net is an ASP solution. Can anyone recommend another program to use?

View Replies !
Looking For A Pay To Upload PHP Program
Anyway, I'm looking for a PHP program that has the user pay to upload certain files to a server. I'd like to make it so the person has to pay before it will allow them to go to the upload page. I'm looking for one that is flexible and will allow me to change the look of it to fit my website. Also, if possible, I would like it to only allow certain file types for upload.

Anyway, if anyone knows of any script, or template, or whatever, that fits this description PLEASE let me know. I've been searching for something like this straight for the past couple of days and have yet to find anything.

View Replies !
Cannot Get The Program To Run At All Through Exec
I downloaded the program called Snapshotter which allows you to take screenshots of webpages through the command-line. Server is Win2k3/XP (live/local). I cannot get the program to run at all through exec

while the same directory/permissions for ffmpeg run fine. I cannot even get it to spit out the default output you get if you run it without arguments. exec("dir") works fine, but exec("c:lahSnapshotter") doesnt return anything. Registered the path in the PATH environment and still no luck, yet exec("c:lahffmpeg") works fine and returns data.

View Replies !
E-commerce Program
I'm looking for an e-commerce program for my site in PHP. I want to purchase something, top of the line, then do some customizations. Cost isn't really an issue. Which cart would be my best option?

View Replies !
Initiating A Program
Is it possible to start a program and, in effect, detatch it from php and let it run in the background.

E.g. I could start a small bash script running, that would make an iso file from a dir, then mail the user on completion. I clearly don't want to have php sitting around doing nothing while this is happening.

View Replies !
Using Server Program
Is there any way to use a program on the server to display data? For example, I want to use Crystal Reports on the Intranet server to display data. So when the user clicks a link on the web page Crystal Reports should open either as standalone or in the web browser. Is this possible?

View Replies !

Copyright © 2005-08 www.BigResource.com, All rights reserved