Jump to content


Photo

My Script Has A Few Bugs..


  • Please log in to reply
9 replies to this topic

#1 AbydosGater

AbydosGater
  • Members
  • PipPipPip
  • Advanced Member
  • 435 posts
  • LocationAlways at computer!

Posted 23 March 2006 - 06:57 PM

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...
<?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'    
    ?>

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 works

but 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"

  if (!isset($_GET['page'])) {
    $page = "index";
  } 


ok and there is something wrong with my last bit of security...

 if ($page != 'index' || $myvar != 'password' || $myvar != 'value3' || $myvar != 'value4')
    {
    $page = "index";
     };

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 Butler


IF 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!
www.abydosgaters.com

Current Project: Blog Application.. Undecided name.. Status: Coming along great.

#2 redbullmarky

redbullmarky
  • Staff Alumni
  • Advanced Member
  • 2,863 posts
  • LocationBedfordshire, England

Posted 23 March 2006 - 07:23 PM

[!--quoteo(post=357727:date=Mar 23 2006, 06:57 PM:name=AbydosGater)--][div class=\'quotetop\']QUOTE(AbydosGater @ Mar 23 2006, 06:57 PM) View Post[/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.
"you have to keep pissing in the wind to learn how to keep your shoes dry..."

I say old chap, that is rather amusing!

#3 AbydosGater

AbydosGater
  • Members
  • PipPipPip
  • Advanced Member
  • 435 posts
  • LocationAlways at computer!

Posted 23 March 2006 - 07:31 PM

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!
www.abydosgaters.com

Current Project: Blog Application.. Undecided name.. Status: Coming along great.

#4 redbullmarky

redbullmarky
  • Staff Alumni
  • Advanced Member
  • 2,863 posts
  • LocationBedfordshire, England

Posted 23 March 2006 - 07:34 PM

[!--quoteo(post=357743:date=Mar 23 2006, 07:31 PM:name=AbydosGater)--][div class=\'quotetop\']QUOTE(AbydosGater @ Mar 23 2006, 07:31 PM) View Post[/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.

"you have to keep pissing in the wind to learn how to keep your shoes dry..."

I say old chap, that is rather amusing!

#5 AbydosGater

AbydosGater
  • Members
  • PipPipPip
  • Advanced Member
  • 435 posts
  • LocationAlways at computer!

Posted 23 March 2006 - 07:53 PM

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?
www.abydosgaters.com

Current Project: Blog Application.. Undecided name.. Status: Coming along great.

#6 redbullmarky

redbullmarky
  • Staff Alumni
  • Advanced Member
  • 2,863 posts
  • LocationBedfordshire, England

Posted 23 March 2006 - 08:05 PM

[!--quoteo(post=357749:date=Mar 23 2006, 07:53 PM:name=AbydosGater)--][div class=\'quotetop\']QUOTE(AbydosGater @ Mar 23 2006, 07:53 PM) View Post[/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.
"you have to keep pissing in the wind to learn how to keep your shoes dry..."

I say old chap, that is rather amusing!

#7 AbydosGater

AbydosGater
  • Members
  • PipPipPip
  • Advanced Member
  • 435 posts
  • LocationAlways at computer!

Posted 23 March 2006 - 08:09 PM

Here is the entire source for the page...


<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>&nbsp;</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>&nbsp;</p>
<p>BLAH</p>
</body>
</html>

Anything else i can do?
www.abydosgaters.com

Current Project: Blog Application.. Undecided name.. Status: Coming along great.

#8 redbullmarky

redbullmarky
  • Staff Alumni
  • Advanced Member
  • 2,863 posts
  • LocationBedfordshire, England

Posted 23 March 2006 - 08:18 PM

[!--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:

<?php
$valid_pages = array('index', 'password', 'value3', 'value4');

$page = $_GET['page'];
if (in_array($page, $valid_pages))
{
   require($page.'.php');
}
else
{
   require('index.php');
}

ok, it's not perfect and will still need alot of checking/testing, etc, but it should get you on your way.

"you have to keep pissing in the wind to learn how to keep your shoes dry..."

I say old chap, that is rather amusing!

#9 AbydosGater

AbydosGater
  • Members
  • PipPipPip
  • Advanced Member
  • 435 posts
  • LocationAlways at computer!

Posted 23 March 2006 - 08:34 PM

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
www.abydosgaters.com

Current Project: Blog Application.. Undecided name.. Status: Coming along great.

#10 redbullmarky

redbullmarky
  • Staff Alumni
  • Advanced Member
  • 2,863 posts
  • LocationBedfordshire, England

Posted 23 March 2006 - 08:52 PM

[!--quoteo(post=357763:date=Mar 23 2006, 08:34 PM:name=AbydosGater)--][div class=\'quotetop\']QUOTE(AbydosGater @ Mar 23 2006, 08:34 PM) View Post[/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.
Cheers
Mark
"you have to keep pissing in the wind to learn how to keep your shoes dry..."

I say old chap, that is rather amusing!




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users