Jump to content

wwfc_barmy_army

Members
  • Posts

    320
  • Joined

  • Last visited

    Never

Posts posted by wwfc_barmy_army

  1. Hello.

     

    I have this htaccess file:

    Options +FollowSymLinks
    
    RewriteEngine On
    RewriteCond %{REQUEST_URI} !\.(exe|jpg|jpeg|png)$
    
    RewriteRule ^([^/]*)$ page.php?slug=$1 [L]

     

    I accessed localhost/test/test-here...it works ok, but the slug variable is outputting 'page.php'. So I tried this:

    RewriteRule ^help/([^/]*)$ page.php?slug=$1 [L]

    I accessed localhost/test/help/test-here... and it worked and the slug variable was 'test-here'.

     

    The htaccess is in the root of the 'test' folder.

     

    Any ideas?

     

    Thanks.

     

  2. Thanks for your reply!

     

    The .htaccess is in the root dir yes.

     

    When I visit the mentioned pages and then check the logs there is nothing (even for my IP), but there are sometimes 10+ of the same 'missing page' for the same IP at exactly the same time. But these pages work fine for me and have done on every machine i've ever tested on!

     

    I've visited all pages with firebug running and I received no errors and the odd ajax post.

     

    Seems really strange to me, but errors keep appearing in the logs.

     

    Any other ideas?

  3. Hopefully this is the right section to post this in.

     

    I've been checking through our error logs and I've noticed quite a few like this:

    [Thu Jul 07 09:36:01 2011] [error] [client ip_here] File does not exist: /home/username/public_html/company-search

     

    Now we have a htaccess mod-rewrite on and this part is:

     

    RewriteRule ^company-search$ companylist.php
    RewriteRule ^company-search/$ companylist.php

     

    It works fine, and when I go to mydomain.com/company-search it works fine.

     

    But this would indicate to me that it isn't working for some people. At it seems to be doing the same on other pages that are similar. Any ideas? :confused:

  4. Hello,

     

     

    $sql = "SELECT DISTINCT products.product_id, category_matchup.match_cat_id, products.product_name
    FROM category_matchup
    INNER JOIN products
    ON category_matchup.product_id = products.product_id
    WHERE match_cat_id IN (1870,1871,1872,1875,1880,1881,1882,1883,1884)";
        	$result = mysql_query($sql, $connex) or die(mysql_error());
        if(mysql_num_rows($result)!=0){
    $i = 0;
         while($row = mysql_fetch_array($result))
    {
    .................. Output etc..................

     

     

    It works, but despite the distint still being in there it is returning multiple records.

     

    I have 2 tables for this Product table and a match up table as 1 product can be in many categories. So an example of the matchup table could be:

     

    match_id

    product_id

    cat_id

    1

    12

    532

    2

    12

    535

    3

    12

    356

    4

    12

    36

    5

    12

    3436

    6

    13

    3436

    7

    15

    3436

     

    For example if I looked for products in category 3436 AND 36 it will return product ID 12 twice (based on the above example).

     

    Can anyone shed any light on this?

     

    Thanks.

  5. Hello,

     

    I just thought i'd check but i can't seem to find any information anywhere,

     

    Can you replace a query like this:

    SELECT * FROM tablename WHERE name = "name" OR name = "name2" OR name = "name3"

     

    with something like;

    SELECT * FROM tablename WHERE name = "name", "name2", "name3"

     

    or some shorthand way of having multiple where conditions on the same column?

     

    Thanks.

  6. Lots of errors:

     

    Warning: Missing argument 1 for resizeImage::__construct(), called in C:\xampp\htdocs\test\index.php on line 155 and defined in C:\xampp\htdocs\test\resize_image.php on line 4

     

    Warning: getimagesize() [function.getimagesize]: Filename cannot be empty in C:\xampp\htdocs\test\resize_image.php on line 11

     

    Warning: Division by zero in C:\xampp\htdocs\test\resize_image.php on line 18

     

    Warning: Division by zero in C:\xampp\htdocs\test\resize_image.php on line 19

     

    Warning: imagecreatetruecolor() [function.imagecreatetruecolor]: Invalid image dimensions in C:\xampp\htdocs\test\resize_image.php on line 21

     

    Warning: imagecreatefromjpeg() [function.imagecreatefromjpeg]: Filename cannot be empty in C:\xampp\htdocs\test\resize_image.php on line 22

     

    Warning: imagecopyresampled() expects parameter 1 to be resource, boolean given in C:\xampp\htdocs\test\resize_image.php on line 23

  7. Lifesaver :)

     

    However I have another problem which hopefully someone can help with.

    I get the following error when I run the code on line 71.

     

    Parse error: syntax error, unexpected '='

     

    It's the same code as before but i've just pasted the section again. I am trying to create an editable region on m website. Can anyone help because with the = I get the error but without it it won't let me edit the pages it shows me the page.

    else {
    echo "<p align='center'>
    	<a href="?file=../example1.html">Example1</a><br/> //THIS IS LINE 71
    	<a href="?file=../example2.html">Example2</a><br/>
    	<br/>
    	<em>Click on the links above to edit the files.</em><br/>
    	<a href='?index.php'>logout</a></p>";
    }
    

    Can someone please help I am completely confused as to why it won't let me do it either way. I need some expertise please :)

     

    You are breaking the echo at <a href="?. Try the following:

     

    else {
    echo "<p align='center'>
    	<a href='?file=../example1.html'>Example1</a><br/>
    	<a href='?file=../example2.html'>Example2</a><br/>
    	<br/>
    	<em>Click on the links above to edit the files.</em><br/>
    	<a href='?index.php'>logout</a></p>";
    }
    

  8. Did you get any error messages?

    Could you also include

    include('simpleImage.php');

     

    It's over there - http://www.white-hat-web-design.co.uk/articles/php-image-resizing.php

     

    The error I get is:

    Warning: S3::putObject(): [RequestTimeout] Your socket connection to the server was not read from or written to within the timeout period. Idle connections will be closed. in pathtofile.php on line 358

    Something went wrong while uploading your file... sorry.

     

    The original (none resized image) uploads in seconds.

  9. Hello. I'm using an Amazon S3 class to uploaded to S3. I have 2 upload boxes - The first uploads once and the second needs to upload twice - 1 full size, 1 thumb.

     

    The issue i'm having is that the 2nd image (the thumb) seems to be failing, although if I don't save the first full sized image I am able to upload the thumb. So I think the issue is with using the temp file twice?

     

    This is my code:

     

    		 //retreive post variables
    			$fileName = $randomString . "_" . $_FILES['theFile']['name'];
    			$fileTempName = $_FILES['theFile']['tmp_name'];
    			$fileName2 = $randomString . "_" . $_FILES['theFile2']['name'];
    			$fileTempName2 = $_FILES['theFile2']['tmp_name'];
    
    		    //move the file
    			if ($s3->putObjectFile($fileTempName, "containerhere", $fileName, S3::ACL_PUBLIC_READ)) {
    				echo "<strong>Uploaded Image</strong>";
    			}else{
    				echo "<strong>Something went wrong while uploading your file... sorry.</strong>";
    			}
    
    			//move the file
    			if ($s3->putObjectFile($fileTempName2, "containerhere", $fileName2, S3::ACL_PUBLIC_READ)) {
    				echo "<strong>Uploaded Image</strong>";
    			}else{
    				echo "<strong>Something went wrong while uploading your file... sorry.</strong>";
    			}
    
    
    			  include('simpleImage.php');
    			  $image = new SimpleImage();
    			  $image->load($_FILES['theFile2']['tmp_name']);
    			  $image->resizeToWidth(100);
    			  $image->save($_FILES['theFile2']['tmp_name']);
    
    			$fileName3 = $randomString . "_" . $_FILES['theFile2']['name'];
    			$fileTempName3 = $_FILES['theFile2']['tmp_name'];
    			//move the file
    			if ($s3->putObjectFile($fileTempName3, "containerhere", "thumbs/" . $fileName3, S3::ACL_PUBLIC_READ)) {
    				echo "<strong>Uploaded Image</strong>";
    			}else{
    				echo "<strong>Something went wrong while uploading your file... sorry.</strong>";
    			}

     

    Can anyone offer any advice?

     

    Thanks.

  10. Hello Guys,

     

    I've come to try it this morning but I am still getting an error.

     

    My database connection file:

    $conn_local2 = mysql_connect('localhost','root','') or die(mysql_error());
    mysql_select_db('db1',$conn_local2) or die(mysql_error()); 
    
    $conn_local = mysql_connect('localhost','root','') or die(mysql_error());
    mysql_select_db('sb2',$conn_local) or die(mysql_error()); 

     

    Calling the function:

    <?php echo get_News(3, $conn_local2); ?>

     

    The function:

    function get_News($limit, $connx) {
    $sql = "SELECT * FROM news_items ORDER BY news_date DESC LIMIT 0,$limit";
        $result = mysql_query($sql, $connx);
        if(mysql_num_rows($result)!=0){
        while($row = mysql_fetch_array($result))
            {
    ....

     

    The error:

    Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in C:\xampp\htdocs\mysite\includes\adv-link\adv-function.php on line 69

     

    Can anyone see where I'm going wrong?

     

    Thanks.

     

     

  11. Ok Thanks Guys. I will look into everything you've mentioned :)

     

    Without maybe sounding stupid, I have a number of functions already that I have been calling which have been working fine from the database without me passing a connection variable through to the function. Is that fine as long as there isn't multiple connections like i've now tried to do now?

     

    Also PFMaBiSmAd, my error_reporting is already set to E_ALL and display_errors is on but I still don't get an undefined noticed message on the $conn_local.

     

    Thanks again guys.

     

  12. The database file is included in the header of the website so it there on all pages, although the code is in a function in a functions.php page.

     

    I've tried echo'ing $conn_local although nothing is displayed (i know I wont get anything back other than an object but I would expect something to be displayed if it exists). Although surely if it's included at the top of the page is should be there when called within the function.

     

    Although, I have figured that if I do this:

    $sql = "SELECT * FROM dbname.news_items ORDER BY news_date DESC LIMIT 0,$limit";
        $result = mysql_query($sql) or die(mysql_error());
        if(mysql_num_rows($result)!=0){
        while($row = mysql_fetch_array($result))
            {
    

     

    then it appears to work. (adding the dbname.table)

     

    Although I didn't really want to go through specifying database names in the queries as these will change when it goes live.

     

    Any suggests on what I could try?

     

    Thanks.

  13. Hello,

     

    I'm using this code in a php file to connect to 2 databases (something that I need to do):

    $conn_local = mysql_connect('localhost','root','',TRUE);
    $conn_local2 = mysql_connect('localhost','root','');
    mysql_select_db('db1',$conn_local);
    mysql_select_db('db2',$conn_local2); 

     

    I'm then trying to use this code to call it from the 1st Database:

    $sql = "SELECT * FROM news_items ORDER BY news_date DESC LIMIT 0,$limit";
        $result = mysql_query($sql,$conn_local);
        if(mysql_num_rows($result)!=0){
        while($row = mysql_fetch_array($result))
    ...etc

     

    Although I am getting this error:

    Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in C:\xampp\htdocs\test\includes\function.php on line 17

     

    If I ONLY include the 1 database and don't bother putting the ',$conn_local' into the mysql_query it will work fine and return the records needed. It only seems to be when I try and include more than 1 database.

     

    Any ideas where I'm going wrong?

     

    Thanks.

  14. My test page is simply:

     

    <!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>Untitled Document</title>
    </head>
    
    <body>
    <h1>My test page</h1>
    <div id="header"></div>
    <div class="total_price">£44.99</div>
    <div id="footer">FOOTER</div>
    </body>
    </html>
    

     

    Any ideas?

     

    Thanks.

×
×
  • 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.