My PHP website

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • aviraldg
    New Member
    • Sep 2007
    • 21

    My PHP website

    I built a website using php ... but there is a problem .. the post variable pg is always=='"".. can some one correct the problem(s)?

    We do not want an extra load on the server, so I disabled the download link - moderator
    Last edited by ronverdonk; Feb 24 '08, 11:30 PM. Reason: disabled download link
  • Markus
    Recognized Expert Expert
    • Jun 2007
    • 6092

    #2
    Originally posted by aviraldg
    I built a website using php ... but there is a problem .. the post variable pg is always=='"".. can some one correct the problem(s)?
    Download zip containing source files
    It's easier if you post the relevant code, using the code tags in this forum.

    Be more clear on your problem, also.

    Comment

    • aviraldg
      New Member
      • Sep 2007
      • 21

      #3
      It's too huge to be posted here...

      Comment

      • Markus
        Recognized Expert Expert
        • Jun 2007
        • 6092

        #4
        Originally posted by aviraldg
        It's too huge to be posted here...
        If so, why do you think people will take the time to look through such a huge zip when you give such a limited question?

        Comment

        • ronverdonk
          Recognized Expert Specialist
          • Jul 2006
          • 4259

          #5
          You should be able to show some code, i.e. the form (if there is one) with the 'pg' named field in it, or the url processing code, and the code processing the 'pg'.

          And do not forget to show that code within the appropriate code tags!

          Ronald

          Comment

          • aviraldg
            New Member
            • Sep 2007
            • 21

            #6
            Extra server load ? That file was hosted on my own site ...
            any way .. my website , the one which i'm having prolems with is at http://triway.x10hosting.com/ so you can ckeck it out if you want ...
            "The Files"(Complete Listing)
            ---------
            index.php
            [PHP]<html>
            <head>
            <title>
            <?php
            if($_get[pg])
            {
            echo "Triway Software - " + $_get[pg];
            }
            else
            {
            echo "Triway Software - Homepage";
            }
            ?>
            </title>
            <link rel="stylesheet " type="text/css" href="<?php require 'php/styleget.php'; ?>">
            <script language="JavaS cript" type="Text/JavaScript">
            <!--
            function info()
            {
            }
            -->
            </script>
            </head>
            <body>

            <span class="head">
            <h1>
            <?php
            if ($_get[pg]!=0)
            {
            echo "Triway Software - " + $_get[pg];
            }
            else
            {
            echo "Triway Software - Homepage";
            }
            ?>
            </h1>
            </span>

            <span class="bar">
            <span class="subhead" >NaviBar</span>
            <hr />
            <?php require "php/navgen.php"; ?>

            </span>

            <span class="main">
            <?php
            $errurl=substr_ count($_get[pg],".");
            $errurl=$errurl +substr_count($ _get[pg],"/");
            $errurl=$errurl +substr_count($ _get[pg],"\\");
            if ($errurl>0)
            {
            echo "Terminal error ! V[".errurl."]";
            }
            else
            {
            require "php/contentgen.php" ;
            }
            ?>

            </span>

            <span class="foot">
            &copy; Aviral Dasgupta 2007<?php require "php/infogen.php"; ?>

            </span>

            </body>
            </html>[/PHP]

            php/contentgen.php

            [PHP]<?php
            $path=$_GET["pg"];
            if ($path==0)
            {
            $path="home";
            }

            if (file_exists("t xt/".strtolower($p ath)))
            {

            ############### ## File Content Retrieve ############### #

            require "txt/".$path;

            }
            else
            {
            echo "Terminal error ! P[".$path."]";
            }
            ?>[/PHP]

            I don't think that the rest of the files deserve listing...
            Now the problem that I'm having is that visiting http://triway.x10hosting.com/index.p...&style=default
            still shows the homepage...and even if pg is set in the URL , the code doesn't have it ...

            Comment

            • Markus
              Recognized Expert Expert
              • Jun 2007
              • 6092

              #7
              Wrap your array indeces in single quotes
              and capitalise get
              [php]
              $_GET['something'];
              [/php]

              Comment

              • aviraldg
                New Member
                • Sep 2007
                • 21

                #8
                It's still not working... even with the $_get["pg"]s changed to $_GET['PG'].Please ... I really need help.

                Comment

                • Markus
                  Recognized Expert Expert
                  • Jun 2007
                  • 6092

                  #9
                  Originally posted by aviraldg
                  It's still not working... even with the $_get["pg"]s changed to $_GET['PG'].Please ... I really need help.
                  The 'PG' doesn't need to be capitalised.

                  Comment

                  • harshmaul
                    Recognized Expert Contributor
                    • Jul 2007
                    • 490

                    #10
                    Heres the problem what i found.

                    You are comparing the get value with a number, any string casted to a number returns 0.

                    So the path is getting set to home.

                    You need to do something like this......

                    [PHP]if (IsSet($_GET['pg'])){
                    //The rest of code goes here
                    }[/PHP]

                    Hode that helped!

                    Comment

                    • aviraldg
                      New Member
                      • Sep 2007
                      • 21

                      #11
                      Thanks ! That did it ! ( That was a hard-to-find-error and I didn't know that "XXX"!=0)

                      Comment

                      Working...