SitePoint Sponsor

User Tag List

Results 1 to 18 of 18
  1. #1
    blonde.... Sarah's Avatar
    Join Date
    Jul 2001
    Location
    Berkshire, UK
    Posts
    7,442
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    PHP code checker/compiler

    Does one exist? If so where can I get one? Also are they worth it?

    Problem is that I am still having errors when people view php pages using Win 98 and win 95 - and would like to try and see if there is something which can check the code?

    thanking you in advance

    Sarah

  2. #2
    SitePoint Addict coolbuzz's Avatar
    Join Date
    Aug 2001
    Location
    Here
    Posts
    223
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    PHPCompiler v0.0.2 Beta

    http://www.deskcode.com/phpcompiler/

    I haven't used it yet and don't know how it is .

  3. #3
    blonde.... Sarah's Avatar
    Join Date
    Jul 2001
    Location
    Berkshire, UK
    Posts
    7,442
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    page could not be displayed was all I got from your url!?

    I shall search for it anyway

    Thanks

    Sarah

  4. #4
    Mlle. Ledoyen silver trophy seanf's Avatar
    Join Date
    Jan 2001
    Location
    UK
    Posts
    7,168
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: PHP code checker/compiler

    Originally posted by Sarah
    Problem is that I am still having errors when people view php pages using Win 98 and win 95 - and would like to try and see if there is something which can check the code?
    All the work of PHP is done on the server side so the operating system of a user is not going to cause problems

    Sean
    Harry Potter

    -- You lived inside my world so softly
    -- Protected only by the kindness of your nature

  5. #5
    blonde.... Sarah's Avatar
    Join Date
    Jul 2001
    Location
    Berkshire, UK
    Posts
    7,442
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Although I agree with you I also know it NOT to be the case! Because of this I have set up various testing pages which starts very simple and then each new test adds something new to hopefully locate where this problem is - as I do know that the code is the problem but also why when it works on NT does it not 95 or 98...

    Anyway hard to believe maybe but believe me I have tested and proved this many times but as yet found the problem.

    Sarah

  6. #6
    SitePoint Addict coolbuzz's Avatar
    Join Date
    Aug 2001
    Location
    Here
    Posts
    223
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Sorry for that Sarah
    I should have checked the link before posting it actually I had stored it in a file.

  7. #7
    SitePoint Enthusiast
    Join Date
    Aug 2001
    Location
    NJ
    Posts
    68
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Can we see your code....that doesnt make sense, and there is no doubt that PHP is server side...maybee something in your output is incompatable...can we see it?
    signature

  8. #8
    blonde.... Sarah's Avatar
    Join Date
    Jul 2001
    Location
    Berkshire, UK
    Posts
    7,442
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    sure here is code that doesn't work - the previous version (without css worked fine on NT 98 and 95) the actual pages are linked with four other pages depending on whether you answer a b c or d depends which one you go to.

    This version works on 95 but not 98...

    <?php
    $system = $HTTP_SERVER_VARS["ALL_HTTP"];
    if ( isset ( $submit ) )
    {
    //connect to the database server
    $dbcnx = @mysql_connect("localhost", "sarah", "sarah");
    if (!$dbcnx)
    {
    echo("<P>Unable to connect to the database server at this time.</P>");
    exit();
    }
    //select the leaf database
    if (! @mysql_select_db("leaf"))
    {
    echo("<P> Unable to locate the <B>leaf</B> database at this time.</P>");
    exit();
    }
    //add details to the database
    $sql = "INSERT INTO author ( name, usertype, system, date) values ('$name', '$usertype', '$system', CURDATE())";
    if (mysql_query($sql))
    {
    switch ( $usertype )
    {
    case "type1":
    $aid = mysql_insert_id();
    header("Location: b.php?aid=$aid");
    break;
    case "type2":
    $aid = mysql_insert_id();
    header("Location: b2.php?aid=$aid");
    break;
    case "type3":
    $aid = mysql_insert_id();
    header("Location: b3.php?aid=$aid");
    break;
    default:
    print "Please make sure that you have selected one of the user type options";
    }
    }
    else {
    echo("<P>Error adding your details at this time.</P>" . mysql_error());
    }
    }
    ?>
    <HTML>
    <HEAD>
    <TITLE> leaf test page A </TITLE>
    <LINK REL=STYLESHEET TYPE="text/css" TITLE="LEAF stylesheet" HREF="style.css">
    </HEAD>
    <BODY>
    <form action="<?php echo($PHP_SELF); ?>" method=post>
    <TABLE border=1 cellpadding=5 cellspacing=0 bordercolor=#ffffff width=50% align=center>
    <TR>
    <TD colspan=2><CENTER>FORM A</CENTER></TD>
    </TR>
    <TR>
    <TD>Name /TD>
    <TD align=right><INPUT TYPE="text" NAME="name" SIZE="30" MAXLENGTH="100"></TD>
    </TR>
    <TR>
    <TD>Usertype /TD>
    <TD align=right><SELECT NAME="usertype" SIZE="1">
    <OPTION VALUE="type1">Usertype 1
    <OPTION VALUE="type2">Usertype 2
    <OPTION VALUE="type3">Usertype 3</SELECT></TD>
    </TR>
    <TR>
    <TD colspan=2><CENTER><INPUT TYPE="submit" NAME="submit" VALUE="send"></CENTER></TD>
    </TR>
    </TABLE>
    </form>
    </BODY>
    </HTML>

    any help would be great as I have "lost" a lot of peoples commenst because they cannot get off the first page. generally this one won't go off to the next page..!

    As I said (I think there is another thread here about this) but I know its daft but its certainly 98 and 95 machiens that are having problems..

    any help much appreciated

    Sarah x

  9. #9
    blonde.... Sarah's Avatar
    Join Date
    Jul 2001
    Location
    Berkshire, UK
    Posts
    7,442
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    since now having win 98 to test on I have found this interesting thing - the above code doesn't work but if I change the switch part to:


    switch ( $usertype )
    {
    case "type1":
    $aid = mysql_insert_id();
    header("Location: b.php?aid=$aid");
    exit;
    case "type2":
    $aid = mysql_insert_id();
    header("Location: b2.php?aid=$aid");
    exit;
    case "type3":
    $aid = mysql_insert_id();
    header("Location: b3.php?aid=$aid");
    exit;
    default:
    print "Please make sure that you have selected one of the user type options";
    }


    surprise surprise it now works!!!!!!!!!!!!!!

    i.e. break --> exit

    Any thought as to why and whathaveyou great although my php book certainly says to use break... !@#!*&%!@

    I will keep on working away to figure out what else doesn't work right [actually meant fumed couldn't find it!]

    Sarah

  10. #10
    Mlle. Ledoyen silver trophy seanf's Avatar
    Join Date
    Jan 2001
    Location
    UK
    Posts
    7,168
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You should use break; what the code you posted will do is actually stop the script running after it has met a certain condition.

    In your code you have, for example, header("Location: b3.php?aid=$aid"); you can not use location like this. Using this the script will just treat it as though you had put header("Location: b3.php");

    Sean
    Harry Potter

    -- You lived inside my world so softly
    -- Protected only by the kindness of your nature

  11. #11
    blonde.... Sarah's Avatar
    Join Date
    Jul 2001
    Location
    Berkshire, UK
    Posts
    7,442
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Hmm strange...

    why cannot I not use Location like I have? and how else can I get it to go to another page? I thought that location was the only way to get to a new page?

    More and more confused now....

    thanks though look forward to more pearls

    Sarah

  12. #12
    SitePoint Addict zoordaan's Avatar
    Join Date
    Feb 2001
    Location
    NYC/Texas
    Posts
    348
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    In your code you have, for example, header("Location: b3.php?aid=$aid"); you can not use location like this. Using this the script will just treat it as though you had put header("Location: b3.php");
    Seanf, Actually I have used location like this in several scripts on different servers and the value of my variable has been passed to the script. If it doesn't work for you then it's probably how your server is set up.
    Last edited by zoordaan; Sep 3, 2001 at 08:56.

  13. #13
    SitePoint Addict zoordaan's Avatar
    Join Date
    Feb 2001
    Location
    NYC/Texas
    Posts
    348
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Sarah, in addition to location, you can also use the meta tag to redirect to another page.

    Code:
    <meta http-equiv="refresh" content="n; url=otherpage.html">
    
    // n is number of seconds the current page should take to redirect to url.

  14. #14
    blonde.... Sarah's Avatar
    Join Date
    Jul 2001
    Location
    Berkshire, UK
    Posts
    7,442
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    zoordan - thanks mine also seems to work fine as the aid etc gets logged into the db no problem - but then again there is something strange going on....

    I shall have a look at the meta tag way of moving across - very useful - can you also attached $aid? to it? as that is the way that I link my db.

    Thanks though I haven't looked it it much today put that one aside for tomorrow

    Sarah

  15. #15
    SitePoint Member
    Join Date
    Aug 2001
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yes, you can do that.

    <meta http-equiv="refresh" content="0; url=b3.php?aid=$aid">
    signature

  16. #16
    SitePoint Author Kevin Yank's Avatar
    Join Date
    Apr 2000
    Location
    Melbourne, Australia
    Posts
    2,571
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Very odd that Win95/98 versions of MSIE (I presume) are ignoring your Location: header when it is followed by page content, but obeying it when it isn't. Have you tried this with the latest versions of MSIE (5.5SP2 and 6.0) on Win95/98? It definitely sounds like a browser bug.

    Meanwhile, your page should definitely 'exit' after the switch-case statement if for no other reason than to avoid needlessly sending the form page to the browser along with your redirect header. To do this, simply add exit after all the form processing code has completed:
    PHP Code:
    <?php 
    $system 
    $HTTP_SERVER_VARS["ALL_HTTP"]; 
    if ( isset ( 
    $submit ) ) 

    //connect to the database server 
    $dbcnx = @mysql_connect("localhost""sarah""sarah"); 
    if (!
    $dbcnx

    echo(
    "<P>Unable to connect to the database server at this time.</P>"); 
    exit(); 

    //select the leaf database 
    if (! @mysql_select_db("leaf")) 

    echo(
    "<P> Unable to locate the <B>leaf</B> database at this time.</P>"); 
    exit(); 

    //add details to the database 
    $sql "INSERT INTO author ( name, usertype, system, date) values ('$name', '$usertype', '$system', CURDATE())"
    if (
    mysql_query($sql)) 

    switch ( 
    $usertype 

    case 
    "type1"
    $aid mysql_insert_id(); 
    header("Location: b.php?aid=$aid"); 
    break; 
    case 
    "type2"
    $aid mysql_insert_id(); 
    header("Location: b2.php?aid=$aid"); 
    break; 
    case 
    "type3"
    $aid mysql_insert_id(); 
    header("Location: b3.php?aid=$aid"); 
    break; 
    default: 
    print 
    "Please make sure that you have selected one of the user type options"


    else { 
    echo(
    "<P>Error adding your details at this time.</P>" mysql_error()); 
    }
    exit; 
    // END OF SCRIPT IF FORM SUBMITTED!

    ?> 
    <HTML> 
    <HEAD> 
    <TITLE> leaf test page A </TITLE> 
    <LINK REL=STYLESHEET TYPE="text/css" TITLE="LEAF stylesheet" HREF="style.css"> 
    </HEAD> 
    <BODY> 
    <form action="<?php echo($PHP_SELF); ?>" method=post> 
    <TABLE border=1 cellpadding=5 cellspacing=0 bordercolor=#ffffff width=50% align=center> 
    <TR> 
    <TD colspan=2><CENTER>FORM A</CENTER></TD> 
    </TR> 
    <TR> 
    <TD>Name :</TD> 
    <TD align=right><INPUT TYPE="text" NAME="name" SIZE="30" MAXLENGTH="100"></TD> 
    </TR> 
    <TR> 
    <TD>Usertype :</TD> 
    <TD align=right><SELECT NAME="usertype" SIZE="1"> 
    <OPTION VALUE="type1">Usertype 1 
    <OPTION VALUE="type2">Usertype 2 
    <OPTION VALUE="type3">Usertype 3</SELECT></TD> 
    </TR> 
    <TR> 
    <TD colspan=2><CENTER><INPUT TYPE="submit" NAME="submit" VALUE="send"></CENTER></TD> 
    </TR> 
    </TABLE> 
    </form> 
    </BODY> 
    </HTML>
    Kevin Yank
    CTO, sitepoint.com
    I wrote: Simply JavaScript | BYO PHP/MySQL | Tech Times | Editize
    Baby’s got back—a hard back, that is: The Ultimate CSS Reference

  17. #17
    blonde.... Sarah's Avatar
    Join Date
    Jul 2001
    Location
    Berkshire, UK
    Posts
    7,442
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    YES !!! YES !!!

    Well Kevin I have to say that you are the php god! After weeks of that bugging me I can now say that its been tested and it works a treat!!!

    As to why... is another matter but hey I will pin it up on my wall so that I never have this problem again.

    (oh most people were using IE5 above anyway!)

    Thanks

    Sarah
    [bouncing happy person once again]


  18. #18
    SitePoint Member
    Join Date
    Jul 2001
    Location
    Luxembourg
    Posts
    18
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    if you're still searching for a php coder/compiler, there is a free one downloadable at http://www.phpide.de That's the on I use (works fine)

    Tzaff


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
  •