Hello,
I have a page, from which i want to access a page which opens up another page which opens another page which loads about 5 seconds.
Here's an "access tree" to understand it easier:
index.php
- update.php?stage=1
- - payment.php?id=2&amount=1
- - - (this link goes to e-gold payment system. It loads about 3-5 seconds because of high e-gold website traffic)
- - update.php?stage=2
- - - payment.php?id=1&amount=2
- - - - (this link also goes to e-gold payment system. It loads about 3-5 seconds)
- - - update.php?stage=3
...... and so on........
all i want to do is to open update.php?stage=1 page in index page without anyone being able to see what is happening in those pages. I mean without viewing those pages, or at least hiding them. Also, as you see, this script updates users list, so sometimes it may take a while to complete. It may take about 5-20 seconds depending on how much pages will be loading.
I tried to do it with frames (one is almost invisible), but when i close my browser, everything stops. I don't want this to happen, because people won't be on the same page for 20 or more seconds. They will go to other page or close their browsers.
Any ideas how to keep update.php script running without any interruption?
Thanks,
Arunas
safe url open
Moderator: General Moderators
Code: Select all
ignore_user_abort();this doesn't seem to help me, or i don't know how to use it
Here's a part of my code:
this should open 2 urls and execute them. But somehow this doesn't happen. Also, this is that update.php?stage=1 page. There is a link in index.php page to update.php?stage=1 but index.php redirects to other page once update.php?stage=1 is open (i use <iframe> to open it)
Here's a part of my code:
Code: Select all
if ($_GET['stage'] == 1) {
if ($ar['stage1'] == $need1) {
ignore_user_abort();
$sql = "SELECT id FROM `users` WHERE stage = 1 ORDER BY id ASC LIMIT 1";
$result = mysql_query($sql);
$re = mysql_fetch_array($result);
$id = $re['id'];
$sql = "UPDATE `users` SET stage = stage + 1 WHERE id = $id";
$result = mysql_query($sql);
$sql = "UPDATE `basic` SET stage1 = 1";
$result = mysql_query($sql);
$sql = "SELECT stage2 FROM `basic` WHERE id = 1";
$result = mysql_query($sql);
$res = mysql_fetch_array($result);
$postdata = "stage=1";
$uri = "/cycler/update.php";
$url215 = "http://localhost";
$da = fsockopen($url215);
if (!$da) {
echo "$errstr (Error $errno)<br/>\n";
echo $da;
}
else {
$salida ="POST $uri HTTP/1.1\r\n";
$salida.="Host: $host\r\n";
$salida.="User-Agent: PHP Script\r\n";
$salida.="Content-Type: application/x-www-form-urlencoded\r\n";
$salida.="Content-Length: ".strlen($postdata)."\r\n";
$salida.="Connection: close\r\n\r\n";
$salida.=$postdata;
fwrite($da, $salida);
}
$postdata = "id=$id&amount=$bonus1";
$uri = "/cycler/payment.php";
$url215 = "http://localhost";
$da = fsockopen($url215);
if (!$da) {
echo "$errstr (Error $errno)<br/>\n";
echo $da;
}
else {
$salida ="POST $uri HTTP/1.1\r\n";
$salida.="Host: $host\r\n";
$salida.="User-Agent: PHP Script\r\n";
$salida.="Content-Type: application/x-www-form-urlencoded\r\n";
$salida.="Content-Length: ".strlen($postdata)."\r\n";
$salida.="Connection: close\r\n\r\n";
$salida.=$postdata;
fwrite($da, $salida);
}
}
else {
$sql = "UPDATE `basic` SET stage1 = stage1 + 1";
$result = mysql_query($sql);
}
}