Jump to content

glenelkins

Members
  • Posts

    760
  • Joined

  • Last visited

    Never

Posts posted by glenelkins

  1. the forum is not under my control no, not that it's really the concern of this discussion. the forum accounts are mine on the forum, the software is just to make my life easier in writing informative articles and posting them automatically rather than wasting valuable time posting myself.

     

    please continue to answer the question in the discussion.

  2. Well basically the issue is I am a PHP, JS etc programmer and im learning C# . I am writing an article submitter and a part of it is to login to a specific forum and post for me. It uses vBulletin but because the password field uses JS to take the value, rather than posting it with the form, it never fills the field in by name... if that makes sense?

     

    So i need something of the equivalent of the js:  document.getElementById ().value for C#

  3. looking at your picture, it appears your tables have a right margin, which adds extra invisible width, meaning the container element is not wide enough so the floats are pushed under. it is however hard to tell from the picture.

     

    I tested out some floating tables and they work fine. Perhaps you should post your code and a live example.

  4. im sorry about the blog post! im having an issue with wordpress there messing up the code..im going to look at fixing that tomorrow.

     

    so you added enctype="multipart/form-data" ??

     

    im also thinking you should check that $_FILES['new_picture']['tmp_name']  is set, just in case no file is being selected:

     

    if ( isset ( $_FILES['new_picture'] ) && isset ( $_FILES['new_picture']['tmp_name'] ) ) {
    

     

    could you also maybe past the output of the following code, put this after your check for $_POST['upload']

     

    echo '<pre>'; print_r ( $_FILES ); echo '</pre>';
    

  5. Hi, Here is a mysql query:

     

    "SELECT * FROM `private_messages` WHERE ( `sender_id` = '$user_id' AND ( `receiver_updated` = '1' || `sender_updated` = '1' ) AND `sender_deleted` = '0' ) || ( `receiver_id` = '$user_id' AND `receiver_deleted` = '0' ) AND `parent_id` = '0'"
    

     

    I want to add an ORDER BY but It needs to evaluate different depending on the fields set. So for example, if the field `sender_updated` = '1' then it needs to order by `sender_updated_datetime` . If `receiver_updated` = '1' then i need to order by `receiver_updated_datetime`

     

    Is there a way to put an IF statement on the ORDER BY clause?

     

  6. Hi

     

    I am having trouble getting the value of a hidden field.

     

    <input type="hidden" id="test" value="test" />

     

    alert ( $('#test').val() );
    

     

    the above code alerts NaN ... but if its a visible text element works fine, so how do i actually get the value of the hidden field?

  7. Hi

     

    I am trying to have the following as an example:

     

    <select name="test[]" multiple="multiple">options here</select>
    <select name="test[]" multiple="multiple">options here</select>
    

     

    Then using $_POST['test'] to grab the boxes in the array. I want to then loop over each box so for example:

     

    $boxes = $_POST['test'];
    
    foreach ( $boxes as $box ) 
    
        // now here i would of expected $box to be an array of the options,
    }
    

     

    but it's not working like this, all the options from all submitted select boxes come in one array so I cannot distinguish which select box in the array they relate to, is there a way to do this??

  8. Im going to explain this a bit clearer.

     

    I have a canvas element on the page. I load up a Tree image using javascript by loading the tree.png file. I place this on the canvas as scenery.

     

    After this i have an interval of 100 mil seconds that will load up the bird.png file and place it on the canvas using translate() to move it. Each time this runs I have to clear the canvas and re-draw the new bird position. All well and good.

     

    Now the problem, when i clear the canvas obviously the tree vanishes as well. So, i have to again re-draw the tree in the interval with the bird. But by doing so the translate function seems to move the tree as well...as though it applies to every element on the canvas. On the other hand if i move the bird using variables and just drawing it in the new position manually each time the tree just flickers!

     

    How can I keep the trees on the scene but allow the bird to move. This can be done without clearing the canvas, but the bird leaves a trail of uncleared images

     

    Hope this is clearer !

  9. Hi

     

    Here is the updated code. Here you can see the bird is re-drawn by clearing the rectangle, so that it animates the bird moving.

     

    The issue i have now is when the bird is cleared it also clears anything else in the scene where the bird currently is. So if you see $.renderScene() draws 3 trees...how can I re-draw the bird without it effecting the trees? Because I have to keep re-drawing the trees as well so it looks like the trees flicker when the bird flies near them...not sure how to stop this so the trees stay on the screen while the bird moves...if i dont clear the canvas the bird will duplicate all over the scene

     

    $(document).ready ( function() {
                   
                    // global vars
                    var trees = new Array();
                    var canvas = null;
                    var bird = null;
                    var birdX = 0;
                    var birdY = 0;
                    var posX = 2;
                    var posY = 4;
                   
                   
                    /*
                     function: renderScene
                     desc: renders the trees and any other objects onto the canvas - clears the canvas first
                                to avoid animation render repeating
                    */
                    $.renderScene = function() {
               
                       
                                 // draw 3 trees
                        trees[0] = new Image();
                        trees[1] = new Image();
                        trees[2] = new Image();
                       
                        trees[0].onload = function() {
                           
                            canvas.drawImage ( trees[0], 0, 0 );
                        }
                        trees[1].onload = function() {
                           
                            canvas.drawImage ( trees[1], 700, 10);
                        }
                        trees[2].onload = function() {
                           
                            canvas.drawImage ( trees[2], 350, 100);
                        }
                        trees[0].src = 'tree.png';
                        trees[1].src = 'tree.png';
                        trees[2].src = 'tree.png';
                       
                       
                    }
                   
                    /*
                     function: drawBird
                     desc: draws an animated bird
                    */
                    $.drawBird = function() {
                         
                         // create bird image object
                        bird = new Image();
                       
                        // create onload event handler to make sure the bird
                        // image loads - prevents crashing or halting
                        // - this is only called once the bird src is set
                        bird.onload = function() {
                           
                            // clear the canvas
                            canvas.clearRect( birdX - 10, birdY - 10, 90,90 );
                           
                            // draw the bird on our canvas
                            canvas.drawImage ( bird, birdX, birdY );
                           
                            if ( birdX + posX > 1024 || birdX + posX < 0 ) {
                               
                                posX = -posX;
                               
                            }
                           
                            if ( birdY + posY > 768 || birdY + posY < 0 ) {
                               
                                posY = -posY;
                            }
                           
                            birdX += posX;
                            birdY += posY;
                           
                            $('#pos').html ( 'X:' + birdX + 'Y:' + birdY );
                           
                           
                        }
         
                        // load the actual bird image
                        bird.src = "bird.png";
    
                        // Render the trees on top of the bird so the bird goes
                        // behind
                        $.renderScene();
                       
                       
                    }
                   
                    /*
                        function: init
                        desc: initialise the canvas and interval for bird movement
                    */
                    $.init = function() {
                       
                        // get reference to the canvas element
                        canvas = $('#canvas')[0].getContext ( '2d' );
                   
                   
                        // set interval to the drawBird function as 10 milliseconds
                        return setInterval ( $.drawBird, 10 );
                       
                    }
                   
             
                   
                   
                    // initialise
                    $.init();
               
                   
                });
    

  10. Hi

     

    Here is the updated code. Here you can see the bird is re-drawn by clearing the rectangle, so that it animates the bird moving.

     

    The issue i have now is when the bird is cleared it also clears anything else in the scene where the bird currently is. So if you see $.renderScene() draws 3 trees...how can I re-draw the bird without it effecting the trees? Because I have to keep re-drawing the trees as well so it looks like the bird flickers when it flies near them...not sure how to stop this?

     

    $(document).ready ( function() {
                    
                    // global vars
                    var trees = new Array();
                    var canvas = null;
                    var bird = null;
                    var birdX = 0;
                    var birdY = 0;
                    var posX = 2;
                    var posY = 4;
                    
                    
                    /*
                     function: renderScene
                     desc: renders the trees and any other objects onto the canvas - clears the canvas first
                                to avoid animation render repeating
                    */
                    $.renderScene = function() {
                
                        
                                 // draw 3 trees
                        trees[0] = new Image();
                        trees[1] = new Image();
                        trees[2] = new Image();
                        
                        trees[0].onload = function() {
                            
                            canvas.drawImage ( trees[0], 0, 0 );
                        }
                        trees[1].onload = function() {
                            
                            canvas.drawImage ( trees[1], 700, 10);
                        }
                        trees[2].onload = function() {
                            
                            canvas.drawImage ( trees[2], 350, 100);
                        }
                        trees[0].src = 'tree.png';
                        trees[1].src = 'tree.png';
                        trees[2].src = 'tree.png';
                        
                        
                    }
                    
                    /*
                     function: drawBird
                     desc: draws an animated bird
                    */
                    $.drawBird = function() {
                         
                         // create bird image object
                        bird = new Image();
                        
                        // create onload event handler to make sure the bird
                        // image loads - prevents crashing or halting
                        // - this is only called once the bird src is set
                        bird.onload = function() {
                            
                            // clear the canvas
                            canvas.clearRect( birdX - 10, birdY - 10, 90,90 );
                           
                            // draw the bird on our canvas
                            canvas.drawImage ( bird, birdX, birdY );
                            
                            if ( birdX + posX > 1024 || birdX + posX < 0 ) {
                                
                                posX = -posX;
                                
                            } 
                            
                            if ( birdY + posY > 768 || birdY + posY < 0 ) {
                                
                                posY = -posY;
                            }
                            
                            birdX += posX;
                            birdY += posY;
                            
                            $('#pos').html ( 'X:' + birdX + 'Y:' + birdY );
                           
                            
                        }
         
                        // load the actual bird image
                        bird.src = "bird.png";
    
                        // Render the trees on top of the bird so the bird goes
                        // behind
                        $.renderScene();
                        
                       
                    }
                    
                    /*
                        function: init
                        desc: initialise the canvas and interval for bird movement
                    */
                    $.init = function() {
                        
                        // get reference to the canvas element
                        canvas = $('#canvas')[0].getContext ( '2d' );
                    
                    
                        // set interval to the drawBird function as 10 milliseconds
                        return setInterval ( $.drawBird, 10 );
                        
                    }
                    
             
                    
                    
                    // initialise
                    $.init();
                
                    
                });
    

  11. Hi

    In the following code i load an image of a bird onto a canvas and make it bounce around.

     

    How can i allow this bird object to be clickable so it fires an onclick event? I tried adding bird.onclick = function()  inside and outside the onload handler and it does nothing!

     

    $(document).ready ( function() {
                    
                    // global vars
                    var canvas = null;
                    var birdX = 0;
                    var birdY = 0;
                    var posX = 2;
                    var posY = 4;
                     
                    /*
                     function: drawBird
                     desc: draws an animated bird
                    */
                    $.drawBird = function() {
                         
                         // create bird image object
                        var bird = new Image();
                        
                        // create onload event handler to make sure the bird
                        // image loads - prevents crashing or halting
                        // - this is only called once the bird src is set
                        bird.onload = function() {
                              
                        
                            // clear the canvas
                            // otherwise the bird will get repeated as a trail!
                            canvas.clearRect( 0,0,1024,768 );
                            
                            // draw the bird on our canvas
                            canvas.drawImage ( bird, birdX, birdY );
                            
                            if ( birdX + posX > 1024 || birdX + posX < 0 ) {
                                
                                posX = -posX;
                                
                            } 
                            
                            if ( birdY + posY > 768 || birdY + posY < 0 ) {
                                
                                posY = -posY;
                            }
                            
                            birdX += posX;
                            birdY += posY;
                            
                            $('#pos').html ( 'X:' + birdX + 'Y:' + birdY );
                           
                            
                        }
                      
                        // load the actual bird image
                        bird.src = "bird.png";
                        
                       
                    }
                    
                    /*
                        function: init
                        desc: initialise the canvas and interval for bird movement
                    */
                    $.init = function() {
                        
                        // get reference to the canvas element
                        canvas = $('#canvas')[0].getContext ( '2d' );
                        
                        // set interval to the drawBird function as 10 milliseconds
                        return setInterval ( $.drawBird, 10 );
                        
                    }
                    
                   
                    
                    
                    // initialise
                    $.init();
                
                    
                });
    

  12. Hi

     

    Can anyone see why the drawBird() function is not being called here??

     

    
            <script type="text/javascript" src="jquery.js"></script>
            
            <script type="text/javascript">
            
                $(document).ready ( function() {
                    
                    // global vars
                    var canvas = null;
                    var birdX = 0;
                    var birdY = 0;
                    
                     
                    /*
                     function: drawBird
                     desc: draws an animated bird
                    */
                    $.drawBird = function() {
                        alert('bird');
                       
                    }
                    
                    /*
                        function: init
                        desc: initialise the canvas and interval for bird movement
                    */
                    $.init = function() {
                        
                        // get reference to the canvas element
                        canvas = $('#canvas')[0].getContext ( '2d' );
                        
                        // set interval to the drawBird function as 10 milliseconds
                        return setInterval ( 'drawBird', 10 );
                        
                    }
                    
                   
                    
                    
                    // initialise
                    $.init();
                
                    
                });
    

  13. Hi

     

    Thanks for the reply. I was thinking of storing the salt in the database and just pulling it out when i need to check passwords. The problem is I have been told this isn't the best way to store the salt string, what is your opinion on this?

     

    My idea of the salt would be to generate a string of say 32 characters long with completely random characters, then hash this to make the salt for the password

  14. Hi

     

    I am looking for opinions on the best way to secure user passwords. I am currently using crypt() with a 32 bit salt string... now my main question here would be: Should I store a randomly generated md5 hashed salt in the database for each user, or maybe a single salt string in a config file?

     

    I am looking for the most secure option here.

  15. So you only have a small project and a small budget? I know it can be difficult to find a suitable web developer if you only need a few amends, a small script building or some debug work and you are on a tight budget. This is why I focus on the smaller jobs, just like yours!

     

    I have 11 years experience, mainly in programming. I have worked with many different companies on their web development projects and I love a challenge. My main areas of expertise are PHP, MySql, JavaScript, Jquery, AJAX, CSS, XHTML, ActionScript and XML.

     

    Why stress over finding a web developer when you have one available to you right now, 6 days per week? Do you think it's time to end your long stretch to finding a reliable developer? Email me now for a quick and efficient web development service: glen@glenelkins.co.uk

     

  16. Hi

     

    For the life of me I cannot work out why the following code is returning the following error:

     

    Request Entity Too Large

    The requested resource

    /api/rest/1.2/sandbox/prepare

    does not allow request data with POST requests, or the amount of data provided in the request exceeds the capacity limit.

     

    Additionally, a 413 Request Entity Too Large error was encountered while trying to use an ErrorDocument to handle the request.

     

    The strange thing is the API needs a POST request and this is saying it is not allowed? The api document for this preparing of the sandbox is here: https://sandbox.clickbank.com/rest/1.2/sandbox

     

    <?php
    
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, "https://api.clickbank.com/rest/1.2/sandbox/prepare");
    curl_setopt($ch, CURLOPT_HEADER, false); 
    curl_setopt($ch, CURLOPT_POST, true);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
    curl_setopt($ch, CURLOPT_HTTPHEADER, array("Accept: application/xml", "Authorization:DEV-219F7E04857FADEEDAC74A48E2CFAD6EBFEF:API-DDA02BA4D7F9C2F7CAD1E7C1BA0CE478B56A"));
    $result = curl_exec($ch);
    curl_close($ch);
    
    print $result;
    ?>
    

  17. Any idea why this redirect is not working? So if a url like index.php?route=advertiser/category/category_name/  is typed it redirects to www.domain.net/category_name/  (as per another rule further down the page )

     

    RewriteEngine On
    RewriteRule ^/index.php?route=advertiser/category/(.*)/$ http://www.domain.net/$1/ [L,R=301]
    ErrorDocument 404 /index.php?route=errors/index/404/
    
    # rewrite urls to always redirect to www. version
    RewriteCond %{HTTP_HOST} !^www.couponsmania\.net$
    RewriteRule ^(.*)$ http://www.couponsmania.net/$1 [L,R=301]
    
    # general url rewrites for seo friendly urls
    
    RewriteRule ^css/(.*)$ css/$1 [L]
    RewriteRule ^images/(.*)$ images/$1 [L]
    RewriteRule ^js/(.*)$ js/$1 [L]
    RewriteRule ^admin/$ index.php?route=admin/ [L]
    RewriteRule ^admin/(.*)/$ index.php?route=admin/$1/ [L]
    RewriteRule ^admin/(.*)/(.*)/$ index.php?route=admin/$1/$2/ [L]
    RewriteRule ^coupons/(.*)/$ index.php?route=advertiser/index/$1/ [L]
    RewriteRule ^coupons/(.*)/(.*)/$ index.php?route=advertiser/index/$1/$2/ [L]
    RewriteRule ^hot-deals/$ index.php?route=hotdeals/ [L]
    RewriteRule ^new-coupons-deals/$ index.php?route=newcouponsdeals/ [L]
    RewriteRule ^about-us/$ index.php?route=page/get/about-us/ [L]
    RewriteRule ^help/$ index.php?route=page/get/help/ [L]
    RewriteRule ^sitemap/$ index.php?route=sitemap/ [L]
    RewriteRule ^sitemap/(.*)/$ index.php?route=sitemap/category/$1/ [L]
    RewriteRule ^sitemap/(.*)/(.*)/$ index.php?route=sitemap/category/$1/$2 [L]
    RewriteRule ^(.*)/$ index.php?route=advertiser/category/$1/ [L]
    RewriteRule ^(.*)/(.*)/$ index.php?route=advertiser/category/$1/$2/ [L]
    OPTIONS -INDEXES
    
    
    <Files .htaccess>
    order allow,deny
    deny from all
    </Files>
    

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