SitePoint Sponsor

User Tag List

Results 1 to 24 of 24
  1. #1
    SitePoint Member
    Join Date
    Dec 2012
    Posts
    22
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)

    Need help with PHP session

    I am working on a PHP page which can be reached through logging in another index page. This PHP page then starts a session and it displays data from MySQL onto a table.

    I am trying to add a filter dropdown box, which can query certain data form table depending on the item selected. This requires the page to get refreshed and come up with certain data from the table.

    But once I select an option, the PHP page goes white and nothing comes up. But when I goto this page straightaway without logging in, and by commenting out the session commands like "session_start()" and all, the page can display the data based upon the selection in the dropdown box.

    So can anyone tell me how to stop this issue, or if you think there is something wrong with the way I found out the cause of the issue, then please notify that as well. Please let me know if you need more details.

  2. #2
    Non-Member
    Join Date
    Oct 2007
    Posts
    363
    Mentioned
    11 Post(s)
    Tagged
    0 Thread(s)
    Can you paste your source code?

  3. #3
    SitePoint Member
    Join Date
    Dec 2012
    Posts
    22
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    After logging in through index page, the user is shown a page with dropdown box having three items. Based on the selection the appropriate PHP page is displayed. This page that shows the dropdown box for selection has the code in short as follows:

    PHP Code:
    if ($selected_view == 'A')
        include 
    'A.php';
    else if (
    $selected_view == 'B')
        include 
    'B.php';
    else if(
    $selected_view == 'C')
        include 
    'C.php'
    I am currently working on the C one, so when I select the C it goes to the PHP page having the following code in short:
    PHP Code:
    <?php
    session_start
    ();
    if ( 
    $_SESSION['usertype'] == 'Admin')
    //the following variables hold the firstname and lastname of the logged in user. This can be used to append with the notes the user adds
    {
    $user $_SESSION['firstname']." ".$_SESSION['lastname'];
    ....

    My code that I added for adding the dropdown box is as follows: Note-> this code is a simple one and it worked when I created a sample PHP page and ran it:
    HTML Code:
    <script language="JavaScript" type="text/JavaScript">
    function formSubmit()
    {
    document.getElementById("report_filter").submit();
    }
    </script>
    
    <form method="post" id="report_filter" action="" >
        <select name="try" onchange="formSubmit();">
        <option value="all">           All         </option>
        <option value="Windows">       Windows     </option>
        <option value="Win 2008">      Win 2008    </option>
        <option value="Win 7">         Win 7       </option>
        <option value="Win Vista">     Win Vista   </option>
        <option value ="Linux">        Linux       </option>
        <option value = "Win 7/Linux"> Win 7/Linux </option>
        </select>
    </form>
    Since I am in the beginning stage, I am just echoing the option that I select in the dropdown box as follows:
    PHP Code:
    <?php

    // I just echo "none" in the beginning, and after a selection is made in te dropdown it should display "ok <the item selected>"

    if(!(isset($_POST["try"])))
         echo 
    "none";
    else
         echo 
    "ok ".$_POST["try"];
    But when I make a selection the page goes white and blank.

    So I commented out the "session_start();" and other session related commands I saw and ran this page by directly going to it in the browser, instead of navigating through the index page.

    In that case, when I make a selection in the dropdown the "ok <item>" is getting displayed.


    Please let me know if you need more information/code.
    Last edited by ServerStorm; Jan 11, 2013 at 11:42. Reason: Added code tags so it is read more easily

  4. #4
    Non-Member
    Join Date
    Oct 2007
    Posts
    363
    Mentioned
    11 Post(s)
    Tagged
    0 Thread(s)
    Can you go to this site and paste the entire contents of each file used here: http://pastebin.com/

    Then post the link back here? Remember to select php syntax highlighting.

  5. #5
    From space with love silver trophy
    SpacePhoenix's Avatar
    Join Date
    May 2007
    Location
    Poole, UK
    Posts
    4,909
    Mentioned
    96 Post(s)
    Tagged
    0 Thread(s)
    Are any errors being recorded in PHP's error log?
    Community Team Advisor
    Forum Guidelines: Posting FAQ Signatures FAQ Self Promotion FAQ
    Help the Mods: What's Fluff? Report Fluff/Spam to a Moderator

  6. #6
    SitePoint Mentor bronze trophy
    John_Betong's Avatar
    Join Date
    Aug 2005
    Location
    City of Angels
    Posts
    1,580
    Mentioned
    63 Post(s)
    Tagged
    3 Thread(s)
    session-start() should be the very first line in index.php

  7. #7
    SitePoint Member
    Join Date
    Dec 2012
    Posts
    22
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Hi,

    The index.html is in the link:

    http://pastebin.com/xkRGVvgR


    In index.html the login happens, and then this leads to login_authentication.php whose code is in the link:

    http://pastebin.com/xkRGVvgR


    This then leads to admin_select.php whose code is in:

    http://pastebin.com/xdt0wvP4


    After this the nav_admin.php comes and its code is in link:

    http://pastebin.com/qY91DxzW


    Then finally the code I am working on comes up, and its in the link:

    http://pastebin.com/QvDrgLWx



    Please let me know if you need any more info.


    Thanks

  8. #8
    SitePoint Member
    Join Date
    Dec 2012
    Posts
    22
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    I dont know exactly how to see the error log, can you please tell me how to see it

  9. #9
    SitePoint Member
    Join Date
    Dec 2012
    Posts
    22
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by John_Betong View Post
    session-start() should be the very first line in index.php
    session-start() is in the start of the page I am working on. But I have pasted all my code in the links as I mentioned in a comment here. Can you tell me in which code the "session-start()" should be there?

  10. #10
    SitePoint Mentor bronze trophy
    John_Betong's Avatar
    Join Date
    Aug 2005
    Location
    City of Angels
    Posts
    1,580
    Mentioned
    63 Post(s)
    Tagged
    3 Thread(s)
    Quote Originally Posted by learner101 View Post
    I don't know exactly how to see the error log, can you please tell me how to see it
    Try renaming your "index.html" file to "index.php" then put these lines at the start of the file:

    // index.php
    PHP Code:
    <?php /* index.php */
      
    session_start();
      
    error_reporting(-1);
      
    ini_set('display_errors',1);
      
    ini_set('error_log''.\__________ERROR_LOG.PHP');
      include 
    'THIS-IS-A-TEST-TO-SEE-IF-THE-_____ERROR_LOG_____.PHP IS WORKING';
    ?>
    Use "http://php.net/manual/en/index.php" to "search for " each function.

    Use "http://validator.w3.org/" to validate your files.


    Please note that the doctype is your friend and guide to minimise browser conflicts.
    All browsers are coded differently but all follow the w3.org standards. BIG problems arise when the errors and warnings occur because the coding team does not have standards to follow. No doubt heated discussions have eventually decided on how the coder's browser should handle the discrepancies. Also no doubt a time consuming long series of tests also occur to guess a best match.

  11. #11
    SitePoint Member
    Join Date
    Dec 2012
    Posts
    22
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Thanks for the info. But the code that I am working on is actually "admin_c1.php". That is where I am having problem with session.

    The index.html is the first page that will appear as soon as the user types the website address.

    So I just want to know if you are telling me to add these lines for error in "index.html" or "admin_c1.php"?

  12. #12
    SitePoint Mentor bronze trophy
    John_Betong's Avatar
    Join Date
    Aug 2005
    Location
    City of Angels
    Posts
    1,580
    Mentioned
    63 Post(s)
    Tagged
    3 Thread(s)
    Quote Originally Posted by learner101 View Post
    Thanks for the info. But the code that I am working on is actually "admin_c1.php". That is where I am having problem with session.

    The index.html is the first page that will appear as soon as the user types the website address.

    So I just want to know if you are telling me to add these lines for error in "index.html" or "admin_c1.php"?

    I included the script at the top of "admin_c1.php" and the following errors were shown:

    // admin_c1.php
    PHP Code:


    Parse error
    syntax errorunexpected '*' in E:\xamp-lite\xampp\htdocs\godaddy\ci_john\downloads\sp-a\learner101\admin_c1.php on line 771 
    The faulty script:
    PHP Code:
     // line 769
         
    $host="***";
         
    $username=****;
         
    $password=****;
         
    $database=****;
         
    $connection=mysql_connect(***,***<***); 
         
    mysql_connect($host,$username,$password);
         @
    mysql_select_db($database) or die( "Unable to select database");
    // line 777 
    Once you have rectified the script test the MySQL connection success using: mysql_error()
    Last edited by John_Betong; Jan 10, 2013 at 19:25. Reason: spelling: not my fortay

  13. #13
    SitePoint Member
    Join Date
    Dec 2012
    Posts
    22
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Is this showing error in the mysql connections? I actually put '*' in the hostname, username and password, since I was running this in my localhost. If you really want to test it you can include the sql credentials of a sql db which is in your laptop

  14. #14
    SitePoint Mentor bronze trophy
    John_Betong's Avatar
    Join Date
    Aug 2005
    Location
    City of Angels
    Posts
    1,580
    Mentioned
    63 Post(s)
    Tagged
    3 Thread(s)
    Quote Originally Posted by learner101 View Post
    Is this showing error in the mysql connections? I actually put '*' in the hostname, username and password, since I was running this in my localhost. If you really want to test it you can include the sql credentials of a sql db which is in your laptop
    OK I tested the script and had to modify to remove errors, etc, so made the following changes:

    PHP Code:
    // remmed the following lines at the bottom of the script because easier to test then exit; on failure
    /*  
    # < ?php
    # } // line 984 approximately
    # else
    # echo "You are not authorized to use this website. Try to obtain the necessary rights to use it!";
    */

    // added these lines at the top of the script
    <?php /* admin_c1.php */
        
    session_start();
        
    error_reporting(-1);
        
    ini_set('display_errors',1);
        
    ini_set('error_log''.\__________ERROR_LOG.PHP');
        
        
    // include 'THIS-IS-A-TEST-TO-SEE-IF-THE-_____ERROR_LOG_____.PHP IS WORKING';

      // the following variables hold the firstname and lastname of the logged in user. 
      // This can be used to append with the notes the user adds
      // $_SESSION['usertype']     = 'admin';
      // $_SESSION['firstname']    = 'John';
      // $_SESSION['lastname']    = 'Betong';

      
    if ( ! isset($_SESSION['usertype']) )
      {
        echo 
    "You are not authorized to use this website. Try to obtain the necessary rights to use it!";
        exit;
      }    
      
    $user $_SESSION['firstname']." ".$_SESSION['lastname'];
      require 
    'connect_sql.php'
      
    $recent_ID_query mysql_query("SELECT MAX(ID) FROM c1_report");
      ...
      ...
      ...

  15. #15
    SitePoint Member
    Join Date
    Dec 2012
    Posts
    22
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    I did as you said but I couldnt find out the error log file.

    The following is the code I used as you mentioned:

    PHP Code:
    <?php

      session_start
    ();
      
    display_errors On;
      
    error_reporting(E_ALL);
      
    ini_set('display_errors',1);
      
    ini_set("log_errors"1);
      
    ini_set('error_log'dirname(__FILE__) .'\ERROR_LOG.PHP');

    if ( ! isset(
    $_SESSION['usertype']) =='LG Admin'
      { 
        echo 
    "You are not authorized to use this website. Try to obtain the necessary rights to use it!"
        exit; 
      }     

    //session_start();
    //if ( $_SESSION['usertype'] == 'LG Admin')
    //if(true)
    //the following variables hold the firstname and lastname of the logged in user. This can be used to append with the notes the user adds
    //{
    $user $_SESSION['firstname']." ".$_SESSION['lastname'];
    require 
    'connect_sql.php'
    $recent_ID_query mysql_query("SELECT MAX(ID) FROM centrify_report");
    ..
    I then went to php.ini and I removed the ';' in front of the lines:

    Code:
     display_errors
       Default Value: On
       Development Value: On
       Production Value: On
    
     error_reporting
       Default Value: E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED
       Development Value: E_ALL
       Production Value: E_ALL & ~E_DEPRECATED & ~E_STRICT
    
     log_errors
       Default Value: On
       Development Value: On
       Production Value: On
    
     track_errors
       Default Value: On
       Development Value: On
       Production Value: On
    
    error_log = php_errors.log

    Can you tell me how to generate the error log?


    Thanks
    Last edited by ServerStorm; Feb 1, 2013 at 21:28. Reason: wrap code in [code][\code] or [php][/php] or [html][/html]

  16. #16
    SitePoint Mentor bronze trophy
    John_Betong's Avatar
    Join Date
    Aug 2005
    Location
    City of Angels
    Posts
    1,580
    Mentioned
    63 Post(s)
    Tagged
    3 Thread(s)
    @learner101 ;

    Please learn how to wrap your scripts in PHP brackets.



    In order to get your error_log file working try this:

    // file "Test.php"
    PHP Code:
    <?php /* admin_TEST.php */
      
    echo __FILE__;

    // PREVENT ERRORS FROM SHOWING A BLANK SCREEN
      
    /* # gradually move this line down until errors appear 
      
      require '_function_show_setup.php';
      _show_setup();

    */  

    die;
    // file: "'_function_show_setup.php"
    PHP Code:
    <?php /* _function_show_setup.php */ 
    function _show_setup()
    {
      
    defined('jj') ?: define('jj','<br />'); # John's shortcut 

      
    $xx 'background-color:#ee0; color:#900; padding:1em; border:dotted 4px #f00';
      echo 
    "<dir style='$xx'>";
          echo 
    jj
            
    '<b>function __get_setup()</b>'jj;
        
          echo 
    jj
            isset(
    $_SESSION) ? 'SESSION ALREADY STARTED' session_start();
          echo 
    jj,
            
    __DIR__
          echo 
    jj,
            
    __FILE__
          echo 
    jj
            
    error_reporting(E_ALL);
          echo 
    jj
            
    ini_set('display_errors',1);
          echo 
    jj
            
    ini_set("log_errors"1);
          echo 
    jj
            
    $error_log ini_set('error_log'dirname(__FILE__) .'\ERROR_LOG.PHP');
          echo 
    jj
            
    $error_log ini_set('error_log'dirname(__FILE__) .'\ERROR_LOG.PHP');
          
          include 
    'asdf.php';
          
          
    $xx 'background-color:#eee; color:#090; padding:1em; border:dotted 4px #f00';
          echo 
    "<pre style='$xx'>";
            
    highlight_file($error_log);
          echo 
    '</pre>';
      echo 
    '</div>';    
    }
    Last edited by John_Betong; Jan 11, 2013 at 21:03. Reason: spellin: not my fortay

  17. #17
    SitePoint Member
    Join Date
    Dec 2012
    Posts
    22
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    I did the following but I think I dont fully understand your advice here. Please correct me if what I did is wrong.

    I added the code:

    require '_function_show_setup.php';
    _show_setup();
    die;

    under the code:

    <form method="post" id="report_filter" action="" >
    <select name="try" onchange="formSubmit();">
    <option value="all"> All </option>
    <option value="Windows"> Windows </option>
    <option value="Win 2008"> Win 2008 </option>
    <option value="Win 7"> Win 7 </option>
    <option value="Win Vista"> Win Vista </option>
    <option value ="Linux"> Linux </option>
    <option value = "Win 7/Linux"> Win 7/Linux </option>
    </select>
    </form>
    </td>
    </tr>



    <?php


    if(!(isset($_POST["try"])))
    echo "none";
    else
    echo "ok ".$_POST["try"];
    ...
    ?>
    When I select the combo box option the page goes white instead of echoing the option selected, so I thought this is where I am supposed to paste the code. Is this correct?

    After doing that I saw the yellow box appearing in my page as the picture I have attached here. Please let me know what I did wrong here.


    Thanks

  18. #18
    SitePoint Mentor bronze trophy
    John_Betong's Avatar
    Join Date
    Aug 2005
    Location
    City of Angels
    Posts
    1,580
    Mentioned
    63 Post(s)
    Tagged
    3 Thread(s)
    @learner101 ;

    Please learn how to wrap your scripts in PHP brackets. To start enclose PHP in square brackets, paste your code then close the script with /PHP inside square brackets.

    I find difficulty in trying to see where the file starts and finishes, also the filename and does it start with the &lt;?PHP

    Please supply the complete file or a link to the file and I will try to get it to remove errors by uploading the file to my site.

    *** If programming was easy then everybody would be doing it

  19. #19
    SitePoint Member
    Join Date
    Dec 2012
    Posts
    22
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    The index.html is in the link:

    http://pastebin.com/xkRGVvgR


    In index.html the login happens, and then this leads to login_authentication.php whose code is in the link:

    http://pastebin.com/xkRGVvgR


    This then leads to admin_select.php whose code is in:

    http://pastebin.com/xdt0wvP4


    After this the nav_admin.php comes and its code is in link:

    http://pastebin.com/qY91DxzW


    I then used the code that you gave for showing the error with the same name as _function_show_setup.php which can be found in the link:

    http://pastebin.com/kLYnD1KE


    Finally comes the code that I have been working on.This will be huge with many different CSS and javascript functions that my team members have worked on. They all work fine and I dont think you have to care about them. You can see the part I was trying to work on from the line 751, where I added a dropdown box.

    You can then see the line 772, where I am trying to echo "none" or the option that I select in the dropdown box. You can then see that I included the code you gave me to show the error in the lines 777-779.

    This code is called "admin_c1.php" and can be found in the link:

    http://pastebin.com/f68VfFnE


    As before when I selected an option in the dropdown box the page went white, and I did saw that the file "ERROR_LOG.php" being created. But I couldnt see any help with its contents being created. They were like:

    [24-Jan-2013 20:00:10 UTC] PHP Warning: highlight_file(C:\webserver\www\proj-12-20\ERROR_LOG.PHP): failed to open stream: No such file or directory in C:\webserver\www\proj-12-20\_function_show_setup.php on line 32

    [24-Jan-2013 20:00:10 UTC] PHP Warning: highlight_file(): Failed opening 'C:\webserver\www\proj-12-20\ERROR_LOG.PHP' for highlighting in C:\webserver\www\proj-12-20\_function_show_setup.php on line 32


    So I think I am making mistake in calling the function you gave me. Please let me know what I should do, also please let me know if you need more info.


    Thanks

  20. #20
    SitePoint Mentor bronze trophy
    John_Betong's Avatar
    Join Date
    Aug 2005
    Location
    City of Angels
    Posts
    1,580
    Mentioned
    63 Post(s)
    Tagged
    3 Thread(s)
    @learner101

    I downloaded your files, amended and uploaded the amendments to "http://johns-jokes.com/downloads/sp-a/learner101/"

    The error file is now working and can be called from index-001.php

    All javascript has been disabled and the submit button now calls "login_authentication.php".

    I have spent a lot of time removing errors but have also left numerous other for you to become familiar with debugging

    I think JavaScript is a luxury and best if disabled. Get the form to do what you want it to do. Once satisfied then add JavaScript to do the clever stuff.

    Also notice the source files are available in learner101.zip
    Last edited by John_Betong; Jan 31, 2013 at 11:57. Reason: speling: not my fortay

  21. #21
    SitePoint Member
    Join Date
    Dec 2012
    Posts
    22
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Thanks for giving me all the files John. I modified the code as per your advice, and I met with few bugs which I hope you left it for my practise and I was able to solve them I believe

    The __main.php code can be found in
    http://pastebin.com/frWgk1Bu

    The _function_show_setup.php is in:
    http://pastebin.com/Nknxvf3W

    I didnt make changes to the java script files.

    The nav_admin.php is in:
    http://pastebin.com/bcZCxsms

    The admin_c1.php is in:
    http://pastebin.com/dSC74aCA

    the admin_select.php is in:
    http://pastebin.com/i4ZyytJA

    the index-001.php is in:
    http://pastebin.com/AL7bMbNu

    I made a mistake while pasting the "login_authentication.php" before, and it is as in the link below:
    http://pastebin.com/fT57rm3e

    I saw the "ERROR_LOG.PHP" was generated and it has the following two lines:

    [11-Feb-2013 20:41:01 UTC] PHP Warning: require(): Filename cannot be empty in C:\webserver\www\proj-2-1\index-001.php on line 159

    [11-Feb-2013 20:41:01 UTC] PHP Fatal error: require(): Failed opening required '' (include_path='.;C:\php\pear') in C:\webserver\www\proj-2-1\index-001.php on line 159


    Can you tell me if I have done correctly as you have instructed? Also can you tell me more about these errors?


    Thanks

  22. #22
    SitePoint Mentor bronze trophy
    John_Betong's Avatar
    Join Date
    Aug 2005
    Location
    City of Angels
    Posts
    1,580
    Mentioned
    63 Post(s)
    Tagged
    3 Thread(s)
    Quote Originally Posted by learner101 View Post
    Thanks for giving me all the files John. I modified the code as per your advice, and I met with few bugs which I hope you left it for my practise and I was able to solve them I believe

    I saw the "ERROR_LOG.PHP" was generated and it has the following two lines:

    [11-Feb-2013 20:41:01 UTC] PHP Warning: require(): Filename cannot be empty in C:\webserver\www\proj-2-1\index-001.php on line 159

    [11-Feb-2013 20:41:01 UTC] PHP Fatal error: require(): Failed opening required '' (include_path='.;C:\php\pear') in C:\webserver\www\proj-2-1\index-001.php on line 159


    Can you tell me if I have done correctly as you have instructed? Also can you tell me more about these errors?


    Thanks
    Whoops, I have amended index-001.php, now the error does not appear, have also included/required the correct file and a PRE block to show the source file.

    http://www.johns-jokes.com/downloads.../index-001.php

    I am pleased you can now see the "ERROR_LOG.PHP".


    [11-Feb-2013 20:41:01 UTC] PHP Warning: require(): Filename cannot be empty in C:\webserver\www\proj-2-1\index-001.php on line 159

    The errors:

    1. 11-Feb-2013 20:41:01 UTC] - shows the date of the server.

    2. PHP Warning: require(): - type of error and the severity (Warning)

    3. Filename cannot be empty - error details

    4. C:\...\index-001.php - source file

    5. line 159 - line number

    Special Note: ERROR_LOG.PHP is generated, new errors and warnings are appended. No damage is done if the file is deleted.

    Off Topic:


    Locally I usually start logging a new error file for each and every day, with a ".PHP" extension so that I can easily view the file in my text-editor:

    PHP Code:

       $fError 
    getcwd() .'/log-' .date('Y-m-d') .'.php';
       
    ini_set('error_log'$fError ); 
    Last edited by John_Betong; Feb 12, 2013 at 01:46. Reason: speling: not my fortay

  23. #23
    SitePoint Member
    Join Date
    Dec 2012
    Posts
    22
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Hi John, I tried with the code you put in the link above. It is giving another error as:

    Fatal error: Cannot redeclare _show_setup() (previously declared in C:\webserver\www\proj-2-1\_function_show_setup.php:5) in C:\webserver\www\proj-2-1\_function_show_setup.php on line 34

    I also see that in the index-001.php you have if loops like:


    <?php if(0) { require '_java-002.js';}?>
    <?php if(0) { require _show_setup();} ?>
    <?php if(1) { require '_function_show_setup.php';} ?>

    Why do you have to give "if(0)", wont this make the loop not to run?

    Also I couldnt see where the functions is redeclared. I have pasted the _function_show_setup.php in the link: http://pastebin.com/8rWtgs5d

  24. #24
    SitePoint Mentor bronze trophy
    John_Betong's Avatar
    Join Date
    Aug 2005
    Location
    City of Angels
    Posts
    1,580
    Mentioned
    63 Post(s)
    Tagged
    3 Thread(s)
    Quote Originally Posted by learner101 View Post
    Hi John, I tried with the code you put in the link above. It is giving another error as:

    Fatal error: Cannot redeclare _show_setup() (previously declared in C:\webserver\www\proj-2-1\_function_show_setup.php:5) in C:\webserver\www\proj-2-1\_function_show_setup.php on line 34

    I also see that in the index-001.php you have if loops like:


    <?php if(0) { require '_java-002.js';}?>
    <?php if(0) { require _show_setup();} ?>
    <?php if(1) { require '_function_show_setup.php';} ?>

    Why do you have to give "if(0)", wont this make the loop not to run?

    Also I couldnt see where the functions is redeclared. I have pasted the _function_show_setup.php in the link: http://pastebin.com/8rWtgs5d
    Hi learner101,

    The basic idea I had in mind was to get you started with debugging. The index-001.php page now renders and error logging is now working.

    Your javascript files are not being called because of the if(0) where 0 is a shortcut to FALSE.

    Your mission is now to include the javascript files by changing if(0) to if(1) where the 1 is equivalent to TRUE.

    Include each file one at a time and notice if any errors are being saved to the ERROR_LOG.PHP file. If there are errors then fix them, then move on to the next javascript file and change the 0 to 1.

    The following link shows index-001.php without any javascript and without a stylesheet:

    http://johns-jokes.com/downloads/sp-.../index-001.php


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •