AbydosGater Posted March 23, 2006 Share Posted March 23, 2006 Ok, i made a quick page for testing my script...[a href=\"http://www.stargate.hostyw.com/testing.php\" target=\"_blank\"]HERE[/a]Within the table on this page is the following...[code]<?PHP //Checking page vars ) if none, making 'INDEX' if (!isset($_GET['page'])) { $page = "index"; } else { require($_GET['page'].".php"); print "this should work"; }; //End Checking page vars ) if none, making 'INDEX' ?>[/code]ok and this seams to work, kinda, if you go to [a href=\"http://www.stargate.hostyw.com/testing.php?page=index\" target=\"_blank\"]HERE[/a] it worksbut the lines of the IF statement are not working, when you go to the www.stargate.hostyw.com/testing.php file no vars in the url, you just get a page, not require, it does not make $page = "index"[code] if (!isset($_GET['page'])) { $page = "index"; } [/code]ok and there is something wrong with my last bit of security...[code] if ($page != 'index' || $myvar != 'password' || $myvar != 'value3' || $myvar != 'value4') { $page = "index"; };[/code]Because if you type in something stupid in the domain like, [a href=\"http://www.stargate.hostyw.com/testing.php?page=PIZZA\" target=\"_blank\"]THIS[/a]it just shows the html of the page, it does not reset to index!Can anyone see why these problems are occuring?Thank You So Much Andrew ButlerIF YOUR HAVING PROBLEMS UNDERSTANDING ME, PLEASE READ [a href=\"http://www.phpfreaks.com/forums/index.php?showtopic=88480\" target=\"_blank\"]This[/a] Its a pervious topic about this script! Quote Link to comment https://forums.phpfreaks.com/topic/5620-my-script-has-a-few-bugs/ Share on other sites More sharing options...
redbullmarky Posted March 23, 2006 Share Posted March 23, 2006 [!--quoteo(post=357727:date=Mar 23 2006, 06:57 PM:name=AbydosGater)--][div class=\'quotetop\']QUOTE(AbydosGater @ Mar 23 2006, 06:57 PM) [snapback]357727[/snapback][/div][div class=\'quotemain\'][!--quotec--]IF YOUR HAVING PROBLEMS UNDERSTANDING ME, PLEASE READ [/quote]without being rude, the only problem i have is posting a (possible) solution in your one topic only to find you've started another about exactly the same thing. Quote Link to comment https://forums.phpfreaks.com/topic/5620-my-script-has-a-few-bugs/#findComment-20090 Share on other sites More sharing options...
AbydosGater Posted March 23, 2006 Author Share Posted March 23, 2006 If you read the last post in my other topic it explains why i made a new topic, the other one was asking if there was a tutorial for something and got off track, so i started a new one for this script! as the other topic is answered, this is a new one!I appoligise but that is what i though was the best thing to do! Quote Link to comment https://forums.phpfreaks.com/topic/5620-my-script-has-a-few-bugs/#findComment-20093 Share on other sites More sharing options...
redbullmarky Posted March 23, 2006 Share Posted March 23, 2006 [!--quoteo(post=357743:date=Mar 23 2006, 07:31 PM:name=AbydosGater)--][div class=\'quotetop\']QUOTE(AbydosGater @ Mar 23 2006, 07:31 PM) [snapback]357743[/snapback][/div][div class=\'quotemain\'][!--quotec--]I appoligise but that is what i though was the best thing to do![/quote]fair comment. I ain't God around here so no need for apologies to me, but either way I posted a possible solution on your other topic. I'd cut/copy and paste, but repeating myself in two different places would make me a hypocrite lol(summary: swap your OR (||) for AND (&&) in your check youre having problems with. Quote Link to comment https://forums.phpfreaks.com/topic/5620-my-script-has-a-few-bugs/#findComment-20095 Share on other sites More sharing options...
AbydosGater Posted March 23, 2006 Author Share Posted March 23, 2006 Ok, I tryed it and now when i put in a value not listed, i just get an error message not the index!?Any other ideas? Quote Link to comment https://forums.phpfreaks.com/topic/5620-my-script-has-a-few-bugs/#findComment-20099 Share on other sites More sharing options...
redbullmarky Posted March 23, 2006 Share Posted March 23, 2006 [!--quoteo(post=357749:date=Mar 23 2006, 07:53 PM:name=AbydosGater)--][div class=\'quotetop\']QUOTE(AbydosGater @ Mar 23 2006, 07:53 PM) [snapback]357749[/snapback][/div][div class=\'quotemain\'][!--quotec--]Ok, I tryed it and now when i put in a value not listed, i just get an error message not the index!?Any other ideas?[/quote]do me a favour, post your full block of code (all in one piece) including all your changes. Quote Link to comment https://forums.phpfreaks.com/topic/5620-my-script-has-a-few-bugs/#findComment-20102 Share on other sites More sharing options...
AbydosGater Posted March 23, 2006 Author Share Posted March 23, 2006 Here is the entire source for the page...[code]<html><head><title>Testing Abydosgater's Paging Program</title><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"></head><body bgcolor="#990000" text="#FFFFFF" link="#FFFFFF" vlink="#FFFFFF" alink="#FF0000"><p>MY WEB CONTENT HERE</p><p> </p><p>BLAH</p><table width="100%" border="1" cellspacing="1" cellpadding="1"> <tr> <td height="512"> <p> <?PHP //Checking page vars ) if none, making 'INDEX' if (empty($_GET['page'])) { require("index.php"); } else { require($_GET['page'].".php"); print "this should work"; }; if ($page != 'index' && $page != 'password' && $page != 'value3' && $page != 'value4'){ $page = "index";}; //End Checking page vars ) if none, making 'INDEX' ?> </p></td> </tr></table><p> </p><p>BLAH</p></body></html>[/code]Anything else i can do? Quote Link to comment https://forums.phpfreaks.com/topic/5620-my-script-has-a-few-bugs/#findComment-20104 Share on other sites More sharing options...
redbullmarky Posted March 23, 2006 Share Posted March 23, 2006 [!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]Anything else i can do?[/quote]yep. youre including the check to make sure it's the right page, but youre not using the result to do anything. i'll ignore your HTML and just look at the PHP. sorry if i get carried away with anything:[code]<?php$valid_pages = array('index', 'password', 'value3', 'value4');$page = $_GET['page'];if (in_array($page, $valid_pages)){ require($page.'.php');}else{ require('index.php');}[/code]ok, it's not perfect and will still need alot of checking/testing, etc, but it should get you on your way. Quote Link to comment https://forums.phpfreaks.com/topic/5620-my-script-has-a-few-bugs/#findComment-20109 Share on other sites More sharing options...
AbydosGater Posted March 23, 2006 Author Share Posted March 23, 2006 GREAT,right this works,i am going to use it as the very basis for my script, with a few additions and modifications this is Exactly what i need,Thank You SOOOOO Much!You Were A Great Help Quote Link to comment https://forums.phpfreaks.com/topic/5620-my-script-has-a-few-bugs/#findComment-20112 Share on other sites More sharing options...
redbullmarky Posted March 23, 2006 Share Posted March 23, 2006 [!--quoteo(post=357763:date=Mar 23 2006, 08:34 PM:name=AbydosGater)--][div class=\'quotetop\']QUOTE(AbydosGater @ Mar 23 2006, 08:34 PM) [snapback]357763[/snapback][/div][div class=\'quotemain\'][!--quotec--]GREAT,right this works,i am going to use it as the very basis for my script, with a few additions and modifications this is Exactly what i need,Thank You SOOOOO Much!You Were A Great Help[/quote]hehe not a problem glad to help.CheersMark Quote Link to comment https://forums.phpfreaks.com/topic/5620-my-script-has-a-few-bugs/#findComment-20119 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.