everlifefree Posted March 21, 2008 Share Posted March 21, 2008 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"]."'"); } Quote Link to comment https://forums.phpfreaks.com/topic/97261-page-swapping-help/ Share on other sites More sharing options...
everlifefree Posted March 21, 2008 Author Share Posted March 21, 2008 Anyone?? Quote Link to comment https://forums.phpfreaks.com/topic/97261-page-swapping-help/#findComment-497703 Share on other sites More sharing options...
PHP Monkeh Posted March 21, 2008 Share Posted March 21, 2008 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. Quote Link to comment https://forums.phpfreaks.com/topic/97261-page-swapping-help/#findComment-497748 Share on other sites More sharing options...
everlifefree Posted March 21, 2008 Author Share Posted March 21, 2008 the _fnc or the header will only work?? Quote Link to comment https://forums.phpfreaks.com/topic/97261-page-swapping-help/#findComment-497809 Share on other sites More sharing options...
everlifefree Posted March 21, 2008 Author Share Posted March 21, 2008 If I can't have it the way I wrote it I'm fine I just need it to swap pages and use '".$_GET["id"]."' and "is_rave=1" to decide whether to use different page Quote Link to comment https://forums.phpfreaks.com/topic/97261-page-swapping-help/#findComment-497833 Share on other sites More sharing options...
everlifefree Posted March 21, 2008 Author Share Posted March 21, 2008 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; } Quote Link to comment https://forums.phpfreaks.com/topic/97261-page-swapping-help/#findComment-497862 Share on other sites More sharing options...
everlifefree Posted March 23, 2008 Author Share Posted March 23, 2008 Anyone?? Quote Link to comment https://forums.phpfreaks.com/topic/97261-page-swapping-help/#findComment-498661 Share on other sites More sharing options...
PHP Monkeh Posted March 26, 2008 Share Posted March 26, 2008 Try changing the if statements to this: if($rave_check == $_GET['id']) I didn't try and understand the rest of your code to see if $rave_check was getting a value or not, but I'm sure you understand it Quote Link to comment https://forums.phpfreaks.com/topic/97261-page-swapping-help/#findComment-501121 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.