Redirect met pagina ertussen
Code (php)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
<?php
ob_start();
require("config.php");
require("global.php");
$i = $_SERVER['QUERY_STRING'];
if (preg_match("/^[0-9a-z]{6}$/", $i)) {
db_connect();
$suffix = $i{0};
$result = mysql_query("SELECT url FROM url_{$suffix} WHERE short_url = '$i'") or die(mysql_error());
if (mysql_num_rows($result)) {
$row = mysql_fetch_row($result);
header("Location: ".stripslashes($row[0]));
exit;
}
}
header("Location: http://".$config['domain']);
ob_end_flush();
?>
ob_start();
require("config.php");
require("global.php");
$i = $_SERVER['QUERY_STRING'];
if (preg_match("/^[0-9a-z]{6}$/", $i)) {
db_connect();
$suffix = $i{0};
$result = mysql_query("SELECT url FROM url_{$suffix} WHERE short_url = '$i'") or die(mysql_error());
if (mysql_num_rows($result)) {
$row = mysql_fetch_row($result);
header("Location: ".stripslashes($row[0]));
exit;
}
}
header("Location: http://".$config['domain']);
ob_end_flush();
?>
Code (php)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
<?php
ob_start();
require("config.php");
require("global.php");
$i = $_SERVER['QUERY_STRING'];
if (preg_match("/^[0-9a-z]{6}$/", $i)) {
db_connect();
$suffix = $i{0};
$result = mysql_query("SELECT url FROM url_{$suffix} WHERE short_url = '$i'") or die(mysql_error());
if (mysql_num_rows($result)) {
$row = mysql_fetch_row($result);
header("Location: ".stripslashes($row[0]));
exit;
}
}
header("Refresh: 5; URL=http://".$config['domain']);
echo 'blalbla en naar 5 seconden word je doorverwezen naar de pagina.';
ob_end_flush();
?>
ob_start();
require("config.php");
require("global.php");
$i = $_SERVER['QUERY_STRING'];
if (preg_match("/^[0-9a-z]{6}$/", $i)) {
db_connect();
$suffix = $i{0};
$result = mysql_query("SELECT url FROM url_{$suffix} WHERE short_url = '$i'") or die(mysql_error());
if (mysql_num_rows($result)) {
$row = mysql_fetch_row($result);
header("Location: ".stripslashes($row[0]));
exit;
}
}
header("Refresh: 5; URL=http://".$config['domain']);
echo 'blalbla en naar 5 seconden word je doorverwezen naar de pagina.';
ob_end_flush();
?>
Asje.
ik word direct doorgestuurd en geen 5 seconden wachten
Code (php)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
<?php
ob_start();
require("config.php");
require("global.php");
$i = $_SERVER['QUERY_STRING'];
if (preg_match("/^[0-9a-z]{6}$/", $i)) {
db_connect();
$suffix = $i{0};
$result = mysql_query("SELECT url FROM url_{$suffix} WHERE short_url = '$i'") or die(mysql_error());
if (mysql_num_rows($result)) {
$row = mysql_fetch_row($result);
header("Refresh: 5; URL=".stripslashes($row[0]));
echo 'blabla';
}
} else {
header("Location: http://".$config['domain']);
}
ob_end_flush();
?>
ob_start();
require("config.php");
require("global.php");
$i = $_SERVER['QUERY_STRING'];
if (preg_match("/^[0-9a-z]{6}$/", $i)) {
db_connect();
$suffix = $i{0};
$result = mysql_query("SELECT url FROM url_{$suffix} WHERE short_url = '$i'") or die(mysql_error());
if (mysql_num_rows($result)) {
$row = mysql_fetch_row($result);
header("Refresh: 5; URL=".stripslashes($row[0]));
echo 'blabla';
}
} else {
header("Location: http://".$config['domain']);
}
ob_end_flush();
?>
Zo is het ook mooier zonder die exit:)
Gewijzigd op 01/01/1970 01:00:00 door Mebus Hackintosh
Bedankt voor je snelle antwoord. Het werkt :) Bedankt!