Jump to content

Page Swapping HELP


everlifefree

Recommended Posts

Alright I am new at the whole page swapping thing so if anyone could help that be great. Below is the code I tried to use to get the job done but it didn't exactly work. What I'd like to do it look in the database "users" to see if the table "is_premium has a 1 in it. If it does than I want it to redirect to a different page. But if it has a 0 in it just continue to the page it was headed towards. Oh and it also has to take into account the "&id=#" on the url so that it knows whos profile to show. The page swapping is really just change the options and layout.

 

     //premium Profile ////////////////////////////////////////////////////////////////
if (isset($_GET["id"])) 
	$is_premium_check = myF(myQ("
		SELECT * 
		FROM `[x]users` 
		WHERE `is_premium` = '1'
		AND `id`='".$_GET["id"]."' 
		ORDER BY 'id'
	"));

	$tpl -> Zone("premium", "redirect");
	_fnc("reload", 0, "?L=users.premium&id='".$_GET["id"]."'");
}

Link to comment
https://forums.phpfreaks.com/topic/97261-page-swapping-help/
Share on other sites

To be perfectly honest you won't get an answer because your code is using classes and functions which I'm assuming are part of someone elses code.  Look into what _fnc() does or you could replace that line entirely with:

 

header("Location: ?L=users.premium&id=".$_GET['id']);

 

That'll only work if there isn't any text output to the browser before hand.

Link to comment
https://forums.phpfreaks.com/topic/97261-page-swapping-help/#findComment-497748
Share on other sites

SCRATCH ALL THE ABOVE!! I'm trying to use this now and the redirect is all working fine expect I can't get it to pull up the different pages for different variables or what ever. Whether is has "is_rave" mark with a 1 or not it still just pulls up the last option. Any help now that I've really changed it?

 

//Profile Switching////////////////////////////////////////////////////////////////
	$rave_check = myF(myQ("
		SELECT * 
		FROM `[x]users` 
		WHERE `id`='".$_GET["id"]."'
		AND `is_rave` = '1'
		ORDER BY `id` DESC
	"));

$tpl -> AssignArray(array(
	"check.rave" => $rave_check["id"],
));

	$artist_check = myF(myQ("
		SELECT * 
		FROM `[x]users` 
		WHERE `id`='".$_GET["id"]."'
		AND `is_artist` = '1'
		ORDER BY `id` DESC
	"));

$tpl -> AssignArray(array(
	"check.artist" => $artist_check["id"],
));

	$club_check = myF(myQ("
		SELECT * 
		FROM `[x]users` 
		WHERE `id`='".$_GET["id"]."'
		AND `is_club` = '1'
		ORDER BY `id` DESC
	"));

$tpl -> AssignArray(array(
	"check.club" => $club_check["id"],
));


    if($rave_check=="'".$_GET["id"]."'")
      {
       header("Location: http://spadespace.com/?L=users.rave&id=".$_GET["id"]."");
       // exit the page to make sure nothing further is added to the headers.
       exit;
       }
     elseif($artist_check=="'".$_GET["id"]."'")
   {
    header("Location: http://spadespace.com/?L=users.artist&id=".$_GET["id"]."");
    // exit the page to make sure nothing further is added to the headers.
    exit;
       }
     elseif($club_check=="'".$_GET["id"]."'")
   {
    header("Location: http://spadespace.com/?L=users.club&id=".$_GET["id"]."");
    // exit the page to make sure nothing further is added to the headers.
    exit;
       }
     else
   {
    header("Location: http://spadespace.com/?L=users.profile1&id=".$_GET["id"]."");
    // exit the page to make sure nothing further is added to the headers.
    exit;
       }

Link to comment
https://forums.phpfreaks.com/topic/97261-page-swapping-help/#findComment-497862
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.