Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6

Thread: code checker?

  1. #1
    Senior Coder
    Join Date
    Jun 2008
    Location
    Cornwall
    Posts
    2,099
    Thanks
    297
    Thanked 12 Times in 12 Posts

    code checker?

    Does anyone know of a code checker where i can copy my code to check where the errors are if any?

    cheers
    Luke

  • #2
    Regular Coder Iszak's Avatar
    Join Date
    Jun 2007
    Location
    Perth, Western Australia
    Posts
    332
    Thanks
    2
    Thanked 58 Times in 57 Posts
    Many IDE's have built in checkers / parsers, you may want to look into getting one -e.g. phpDesigner. Other than that, I don't know any PHP checker of such like HTML/CSS checker, sorry.
    Last edited by Iszak; 03-05-2009 at 07:23 PM. Reason: bah, bad wording

  • #3
    Senior Coder
    Join Date
    Jun 2008
    Location
    Cornwall
    Posts
    2,099
    Thanks
    297
    Thanked 12 Times in 12 Posts
    thanks Iszak

    will try that

    luke

  • #4
    Senior Coder
    Join Date
    Jun 2008
    Location
    Cornwall
    Posts
    2,099
    Thanks
    297
    Thanked 12 Times in 12 Posts
    hi,

    tried that phpDesigner and i didnt get on with it very well, maybe i need to spend more time on it?

    can anyone see whats wrong with this code
    PHP Code:
    <?php 
    session_start
    ();
    ini_set('display_errors',1);
    ini_set('display_startup_errors',1);
    error_reporting(E_ALL);
    require(
    'functions.php'); 
    require(
    '_drawrating.php');
    include_once(
    'db101.php');?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Kernow Connect</title>
    <link rel="stylesheet" type="text/css" href="stylesheets/common_stylesheet.css" />
    <link rel="stylesheet" type="text/css" href="stylesheets/stores_stylesheet.css" />
    <link rel="stylesheet" type="text/css" href="css/rating.css" />
    <link href="SpryAssets/SpryTabbedPanels.css" rel="stylesheet" type="text/css" />

    <script type="text/javascript" language="javascript" src="js/behavior.js"></script>
    <script type="text/javascript" language="javascript" src="js/rating.js"></script>
    <script src="SpryAssets/SpryTabbedPanels.js" type="text/javascript"></script>

    <script type="text/javascript" src="dropdowncontent.js">

    /***********************************************
    * Drop Down/ Overlapping Content- © Dynamic Drive (www.dynamicdrive.com)
    * This notice must stay intact for legal use.
    * Visit http://www.dynamicdrive.com/ for full source code
    ***********************************************/

    </script>

    <style type="text/css">
    <!--
    body {
        background-image: url(images/background.jpg);
        background-repeat: repeat-y;
        background-position:center;
        }
        
    #apDiv1 {
        width:200px;
        height:115px;
        float:left;
    }
    .style2 {
        font-size: 12px;
        }
    -->
    </style>
    <?php

    print "</head>";
    print 
    "<body>";

    //Database info included in include
    if ($db_found) {

        if (
    $_SERVER['REQUEST_METHOD'] == 'GET') {
            
    $idReference '';
            
    $cat '';

        if (isset(
    $_GET['sID'])) {
            
    $idReference $_GET['sID'];
        }
        if (isset(
    $_GET['Cat'])) {
            
    $cat $_GET['Cat'];
        }
    }

        
    $pageinfo "SELECT * FROM stores Where name = '$idReference'";
        
    $result mysql_query($pageinfo)or die(mysql_error);
        }
        
        if (
    $result) {
            
        if( isset(
    $_POST['submit'])) {
               if( 
    $_SESSION['security_code'] == $_POST['security_code'] && !empty($_SESSION['security_code'] ) ) {
            
    // Insert you code for processing the form here, e.g emailing the submission, entering it into a database. 
            
    $sql="UPDATE ratings 
              SET 
            used_ips = NULL,
            total_value = 0,
            total_votes = 0 
              WHERE 
              id IN ('valuetemp', 'easeofusetemp', 'deliverytemp', 'delchargetemp')"
    ;
              
    $query mysql_query($sql);        
            
            
    $message="";

            unset(
    $_SESSION['security_code']);
       } else {
            
    // Insert your code for showing an error message here
            
    $message="Sorry, you have provided an invalid security code";
       }
    } else {}

        
    $total "total";
        
    $IDTotal "$idReference"."$total";
        
        
    // CHECK TO SEE IF THERE IS A TOTAL VOTES FIELD FOR THE STORE IF NOT ADD ONE
        
    $totalquery "SELECT * FROM ratings WHERE id = '$IDTotal'";
        
    $ttl mysql_query($totalquery);
        
    $ttl_rows mysql_num_rows($ttl);
        
        if (
    $ttl_rows == "0") {
            
    $insertsql "INSERT INTO ratings (id, storeID, total_votes, total_value, used_ips) VALUES ('$IDTotal',0,0,0,NULL)" ;
            
    $insertROW mysql_query($insertsql);
        }
        else {
        }
        
        
    $row mysql_fetch_array($result);
        
    $name $row['name'];
        
    $feedID $row['feedID'];
        
    $storeLink $row['storeLink'];
        
    $description $row['description'];
        
    $logo $row['logo_lg'];
        
    $logores $logo;
        
    $img_source "<a href='$storeLink' target='_blank'><img src='$logores' alt='Click To Visit The $name Store' border='0'></a>";
            
        
    //RSS TOP10
        
    $rss_feed "SELECT * FROM rss_feeds WHERE store = '$idReference' AND description = 'top'";
        
    $rss_result mysql_query($rss_feed);
        
    $rss_row mysql_fetch_array ($rss_result);
        
    $rssIndividual $rss_row['s_FeedURL'];
        
    $selectsql "select s_itemList from rss_feeds where description = 'top' and s_FeedURL='$rssIndividual'";
        
    $sql_run mysql_query($selectsql) or die(mysql_error());
        
    $itemList mysql_fetch_row($sql_run);
        
    $itemList explode("^",$itemList[0]);//[0] determins the column number

         
    $rss_feedLO "SELECT * FROM rss_feeds WHERE store = '$idReference' AND description = 'offers'";
        
    $rss_resultLO mysql_query($rss_feedLO); 
        
    $rss_rowLO mysql_fetch_array ($rss_resultLO); 
        
    $rssIndividualLO $rss_rowLO['s_FeedURL'];
        
    $selectsqlLO "select s_itemList from rss_feeds where description = 'offers' and s_FeedURL='$rssIndividualLO'";
        
    $sql_run mysql_query($selectsqlLO) or die(mysql_error());
        
    $itemListLO mysql_fetch_row($sql_run);
        
    $itemListLO explode("^",$itemListLO[0]);//[0] determins the column number
        
        //RSS NEW RELEASES
        
    $rss_feedNR "SELECT * FROM rss_feeds WHERE store = '$idReference' AND description = 'newest'";
        
    $rss_resultNR mysql_query($rss_feedNR);
        
    $rss_rowNR mysql_fetch_array ($rss_resultNR);
        
    $rssIndividualNR $rss_rowNR['s_FeedURL'];
        
    $selectsqlNR "select s_itemList from rss_feeds where description = 'newest' and s_FeedURL='$rssIndividualNR'";
        
    $sql_run mysql_query($selectsqlNR) or die(mysql_error());
        
    $itemListNR mysql_fetch_row($sql_run);
        
    $itemListNR explode("^",$itemListNR[0]);//[0] determins the column number
        
        //RSS DISCOUNT CODES
        
    $rss_feedDC "SELECT * FROM rss_feeds WHERE store = '$idReference' AND description = 'codes'";
        
    $rss_resultDC mysql_query($rss_feedDC);
        
    $rss_rowDC mysql_fetch_array ($rss_resultDC);
        
    $rssIndividualDC $rss_rowDC['s_FeedURL'];
        
        
    //Get sore overall value
        //$storerating = $idReference."total";
        //$value_query = "Select * FROM ratings WHERE id = '$storerating'";
        
    $value_query "Select * FROM ratings WHERE id = '$idReference"."value'";
        
    $query_result mysql_query($value_query);
        
    $result_rows mysql_fetch_array($query_result);
        
    $no_votes $result_rows['total_votes'];
        
    $tot_value $result_rows['total_value'];
        
        if ( 
    $no_votes == ){
             
    $avg 0;
            }
        else {
        
    $avg number_format($tot_value/$no_votes,2);
        }
        
        
    Toplinks();
        
        print 
    "<div id='storetext'>";
        print 
    "<br />";
        print 
    "<div class='storesLogo'>$img_source";
        print 
    "</div>";
        
        print 
    "<div class='storesDescription'>$description</div>";

        
        print 
    "<div class='storeRatings'>";
        print 
    "<div class='averagerating'>KC Rating<br /><b>$avg</b><p><font size='2'><br />";
        echo 
    $message;
        print 
    "<p><a href='http://www.kernow-connect.com' id='ratelink' rel='subcontent'>rate store here</a></font></p>";
        print 
    "</div>";//storeRatings closed
        
    print "</div>";//averagerating closed
        
        // HIDDEN DIV CONTAINING FORM
        
    ?>
    <div id="subcontent" style="position:absolute; border: 7px solid black; visibility:hidden; background-color: white; width: 250px; height:361px; padding: 8px;">

    <form  method="post">
    <div id="apDiv1">
        <table width="240" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td>Value for money</span></td>
            <td><?php print rating_bar('valuetemp',5)?></td>
          </tr>
          <tr>
            <td>Ease of use</td>
            <td><?php print rating_bar('easeofusetemp',5)?></td>
          </tr>
          <tr>
            <td>Delivery time</td>
            <td><?php print rating_bar('deliverytemp',5)?></td>
          </tr>
          <tr>
            <td>P&amp;P costs</td>
            <td><?php print rating_bar('delchargetemp',5)?></td>
          </tr>
          <tr>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
          </tr>
          <tr>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
          </tr>
          <tr>
            <td><img src="CaptchaSecurityImages.php?width=100&height=40&characters=5" /></td>
            <td>&nbsp;</td>
          </tr>
          <tr>
            <td colspan="2"><label for="label"><span class="style2">Please Enter Security Code: </span></label></td>
          </tr>
          <tr>
            <td colspan="2"><input id="security_code" name="security_code" type="text" /></td>
          </tr>
          <tr>
            <td></td>
            <td>&nbsp;</td>
          </tr>
          <tr>
            <td><input type="submit" name="submit" value="Submit" /></td>
            <td><a href="javascript:dropdowncontent.hidediv('subcontent')">Close</a></td>
          </tr>
        </table>
    <P>
                    </form>
        
                </div> </div>    
                
                
        <?php
     
    ?>
        <script type="text/javascript">
        //Call dropdowncontent.init("anchorID", "positionString", glideduration, "revealBehavior") at the end of the page:

        dropdowncontent.init("ratelink", "right-bottom", 600, "mouseover")
        dropdowncontent.init("contentlink", "left-top", 300, "click")

        </script>
    <?php
    print "</p>";
    print 
    "<div id='footer'> Copyright © 2009 Kernow-Connect.com</div>";
    print 
    "</body>";
    print 
    "</html>";
    ?>
    here is the page

    for some reason it doesnt like my $message varible and when i submit the form it takes it to a new page instead of just printing a message on the current page?

    cheers
    Luke

  • #5
    Regular Coder Iszak's Avatar
    Join Date
    Jun 2007
    Location
    Perth, Western Australia
    Posts
    332
    Thanks
    2
    Thanked 58 Times in 57 Posts
    It's not an error per say, basically it's saying $message is undefined, so define $message and it'll work or change your error_reporting to E_STRICT.

    Or you could try...
    PHP Code:
    if (isset($message) == true)
    {
      echo 
    $message;

    Last edited by Iszak; 03-05-2009 at 09:06 PM.

  • Users who have thanked Iszak for this post:

    LJackson (03-05-2009)

  • #6
    Senior Coder
    Join Date
    Jun 2008
    Location
    Cornwall
    Posts
    2,099
    Thanks
    297
    Thanked 12 Times in 12 Posts
    hi mate, that got rid of the message thanks, but the varible $message is defined here

    PHP Code:
        if( isset($_POST['submit'])) {
               if( 
    $_SESSION['security_code'] == $_POST['security_code'] && !empty($_SESSION['security_code'] ) ) {
            
    // Insert you code for processing the form here, e.g emailing the submission, entering it into a database. 
            
    $sql="UPDATE ratings 
              SET 
            used_ips = NULL,
            total_value = 0,
            total_votes = 0 
              WHERE 
              id IN ('valuetemp', 'easeofusetemp', 'deliverytemp', 'delchargetemp')"
    ;
              
    $query mysql_query($sql);        
            
            [
    COLOR="Red"]$message[/COLOR]="";

            unset(
    $_SESSION['security_code']);
       } else {
            
    // Insert your code for showing an error message here
            
    [COLOR="Red"]$message[/COLOR]="Sorry, you have provided an invalid security code";
       }
    } else {} 
    p.s dont suppose you know how to stop the form submitting to another version of the current page, try it out on my page if i could prevent this and just have the messages appear on the current page that would be sweet!!

    cheers mate
    Luke


  •  

    Posting Permissions

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