Jump to content

kenrbnsn

Staff Alumni
  • Posts

    8,234
  • Joined

  • Last visited

Posts posted by kenrbnsn

  1. You are doing absolutely no error checking and no validation of your input paramenters. Never trust user data.

     

    Here's how I would re-write your code:

    <?php
    elseif($_GET['rma']=="calender"){
    $sql101010="SELECT DISTINCT rma_year_issued FROM $tbl_name4 WHERE rma_issued='y' ORDER BY rma_year_issued";
    $result101010=mysql_query($sql101010);
    while($row101010=mysql_fetch_array($result101010)){
    	extract($row101010);
    	$content.='<a href="./acp_admincp.php?rma=calender&year='.$rma_year_issued.'">'.$rma_year_issued.'</a>
    	<br />';
    }
    
    if(isset($_GET['year'])){
    	$content="";
    	$logout.=' | <a href="./acp_admincp.php?rma=calender">Back to RMA Calender</a>';
    	$rma_year_issued=int($_GET['year']);
    	$sql111010="SELECT DISTINCT rma_month_issued FROM $tbl_name4 WHERE rma_year_issued='$rma_year_issued' ORDER BY rma_month_issued";
    	$result111010=mysql_query($sql111010) or die("Problem with the query: $$sql111010<br>" . mysql_error());
    	$months = array('', 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December');
    	while($row111010=mysql_fetch_array($result111010)){
    		$rma_months_issued2 = $months[$row111010['rma_month_issued']];
    		$content.="<a href='./acp_admincp.php?rma=calander&year=$rma_year_issued&month=$rma_month_issued'>$rma_month_issued2</a><br />";
    	}
    	if(isset($_GET['month'])){
    		$content="";
    		$logout.=' | <a href="./acp_admincp.php?rma=calender&year='.$rma_year_issued.'">Back to RMA Calender Year</a>';
    		$rma_month_issued=int($_GET['month']);
    		$sql211010="SELECT * FROM $tbl_name4 WHERE rma_year_issued='$rma_year_issued' AND rma_month_issued='$rma_month_issued' ORDER BY rma_date_issued";
    		$result211010=mysql_query($sql211010) or die("Problem with the query: $sql211010<br>" . mysql_error());
    		while($row211010=mysql_fetch_array($result211010)){
    			$content.="<a href='./acp_admincp.php?rma=calander&year=$rma_year_issued&month=$rma_month_issued&id=$rma_id'>$rma_number</a><br />";
    		}
    	}
    }
    }
    ?>

     

    Also, in the last loop, you're not using anything from the results of the query.

     

    Ken

  2. You don't need strtotime when the date/time is in that format, which is the number of seconds since 1970-01-01, just use the date function:

    <?php
    $date = 1306768978;
    echo date('Y-m-d',$date) . "<br>\n"; // yyyy-mm-dd
    echo date(l, F j, Y, $date) . "<br>\n"; // weekday, Month day, yyyy
    ?>

     

    Ken

  3. If you don't mind using a little bit of Javascript, you can do this in a few lines of jQuery. Put these lines at the just before the </head> tag:

    <script type="text/javascript">
        google.load("jquery", "1.6.1", {uncompressed:true});
    </script>
    <script type="text/javascript">
    $(document).ready(function() {
                $('.div_class_to_change').css('color','<?php echo $color['headers']; ?>');  // change all divs with class 'div_class_to_change' to the color defined
                $('#div_id_to_change').css('color','<?php echo $color['headers']; ?>');  // change all divs with id 'div_id_to_change' to the color defined
             });
    </script>
    

     

    Ken

     

  4. What is the value of the variable $keywords?

     

    Post the result of

    <?php
    echo '<pre>' . print_r($keywords,true) . '</pre>';
    ?>

     

    If $keywords is an array, you can create the query like this:

    <?php
    $q = "SELECT product_id FROM $tbl_name2 WHERE keyword like '%" . implode("%' or keyword like '%",$keywords) . "%'";
    ?>

     

    Ken

  5. Don't put the query in the while statement. When you do that, you're re-executing the query every time. Do something like

    <?php
    $getpin=sprintf("SELECT * FROM users WHERE UserEmail='%s' AND UserPassword='%s'", mysql_real_escape_string($email) , mysql_real_escape_string($password));
    $rs = mysql_query($getpin);
    while($row=mysql_fetch_assoc($rs)){
    ?>

     

    Ken

  6. This line

    <?php
    $content [$word[0]] => array('img_path' => $word[1], 'description' => $word[2], 'price' => $word[3]);
    ?>

    is where the error is. You probably want

    <?php
    $content[$word[0]] = array('img_path' => $word[1], 'description' => $word[2], 'price' => $word[3]);
    ?>

     

    Ken

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.