Jump to content

BagoZonde

Members
  • Posts

    69
  • Joined

  • Last visited

Posts posted by BagoZonde

  1. I was using that technique with timestamp in one of my game project few years ago as cron was unavailable so this post bring a smile on my face :].

     

    Gentlemen, I think that inventing some basic algorithms is a grand joy :] so sufficient answer could be "To check how many turns passed, use timestamp to count difference and divide by 30 minutes". No doubt kicken's answer is the best delivered answer on a plate :].

  2. First of all, your code is vulnerable to SQL Injection. That's really bad.

     

    I'm not sure what's the problem but I will show you two things. Firstly:

     

     

    <option vallue="no">Select tree form</option>

     

    As you see, there's no attribute like "vallue".

     

    Secondly:

     

    Input named "evergreen" is defined twice so you're overwritting first input with next one.

  3. If you want fit whole text, just change overflow: hidden; to overflow: none; when expanded.

     

    $('#item<?php echo $i; ?>').parent().toggleClass('not_overflow');

     

    And add .not_overflow class in CSS:

     

    .not_overflow{
      overflow: none;
    }
    

     

    Obviously pay attention about inheritance of .not_overflow class.

  4. Every line like that:

     

    <p>DO NOT reply to this email! For further assistance please contact Dave Sturgeon at <a href="mailto:dave.sturgeon@wishtv.com">dave.sturgeon@wishtv.com</a> or Gerry Inks at <a href="mailto:gerry.inks@linmedia.com">gerry.inks@linmedia.com</a>.</p>

     

    change to:

     

    <p>DO NOT reply to this email! For further assistance please contact Dave Sturgeon at <a href=\"mailto:dave.sturgeon@wishtv.com\">dave.sturgeon@wishtv.com</a> or Gerry Inks at <a href=\"mailto:gerry.inks@linmedia.com\">gerry.inks@linmedia.com</a>.</p>

     

    as you don't escape quotes.

    I'm not looking for code as it's baaaad ;), I'm just telling you what you must fix to run that script properly :).

     

    Also if PHP don't display errors, try change ini on the very beginning and maybe it can help you in future to check where are problems:

     

     

    ini_set('error_reporting', E_ALL^E_NOTICE);
    ini_set('display_errors', 1);
    

  5. Use of target="_blank" in anchor is the only way. As you probably know, W3C validation will tell you that there is no attribute "target" so it's an error, ehhh, so no solution? Here's one: who tell people that W3C is the prophecy? However target attribute in HTML5 is a valid one, if you're interested there's article about target attribute, W3C and HTML5: http://bryanhadaway....f-target-blank/

     

    If you can't change PHP code or just don't want to, you could use Javascript/jQuery but I'm not using practices like that. Power of PHP is the key :).

     

    That's all I know.

  6. I've played a little more with regex as I like it so here's the code where you can specify tag, additionaly if this tag has classes it will still work, i.e. <p class="something" id="something_something">

     

    function getStringForTag($string, $tag){
       $pattern = "/<".$tag."[^>]*>(.*)<\/".$tag.">/";
       preg_match_all($pattern, $string, $matches);
       return $matches[1];
    }
    
    $output = getStringForTag($html, 'p');
    

  7. You need the timestamp, not just the ?.

     

    That's right. lewisstevens1, you need to change filename every time so it's cool to change part after query sign.

     

    BTW. I'm using date('YmdHis') instead of timestamp() as I'm thinking in blind-assembler-way ;) for 1MHz machines: OPTIMIZE ;). But sincerely this difference wasn't tested yet, haha ;).

  8. This will do nothing more than trick browser to read file once again because there will be no file like "myfile.jpg?20120121143700" in cache. You'll see updated image only.

  9. Is that what you asked for:

     

    print '<img src="/' . $file . '?' . date('YmdHis') . '" alt=" ' . $alt . ' ">';

     

    This trick will force browsers to overload image as there will be no one with given path in cache for sure.

  10. I can't tell you how to use it with $_SESSION as I'm using for these purposes sessionStorage in Javascript. It save all my inputs selected (select, checkbox etc.) so when I'm going backwards or reloading page: I'm getting and setting all inputs from that automagically. Perhaps somebody knows better what to do in your case. Good luck!

  11. In your ajax script do not open or close any form. You don't need it. Inputs are inserting to form into #txtHint. And my firebug shows me that all inputs are included in one form, even that ajaxed of course. I'm still confused what you're asking about. I put your code on my server and selected option. AJAX read next inputs properly. So then I submit that form and in main php file where first part of form is located, I just print_r($_GET) so it's working exactly what you're asking about?!

     

    For 100% clarity that's a part of main code where submit button is located:

     

    <input type="submit" name="submit" value="submit" id="submit"/>
    <div id="txtHint"></div>
    </form>

     

    And as I told you before, look for inputs' names as there are some inputs with that same name.

  12. foreach($query as $param){
    list($name, $value) = explode('=', $param);
    $params[urldecode($name)] = urldecode($value); //for array purposes
    $params_pairs[]=$param; //for string purposes
    }
    
    //Here we go with nice key=>value array
    print'<pre>';
    print_r($params);
    print '</pre>';
    
    
    $currentUrl = $protocol . '://' . $host . $script . '?' . implode('&', $params_pairs);

     

    However I put implode for learning purposes as I think you doing all that stuff for this reason. To get only names, just iterate through keys with foreach.

     

    However please be more precise when asking.

     

    P.S. Also I'm not sure as I haven't any SSL server, but maybe isset($_SERVER['HTTPS']) is a good way to check https.

     

    Edit: ok, requinix was more detailed with HTTPS, quite interesting :). Thanks.

  13. I put your code on my server then just move div#formwrap under input[type=submit] button, change it to span (it's not necessary at all) and it works! Of course I'm not using connection to database (I've just put there some array to read). I hope your script is connecting with database in ajax script (so it must have login and password too). And there's one more thing: use unique input names or just use "sum1[]" instead of "sum1" and "sum2[]" instead of "sum2" because that inputs are repeating few times in ajax form (ids are different but it's no matter for $_GET) so one value will overwrite another one.

  14. Just use:

     

    <input type="submit" name="submit" value="submit" id="submit"/>
    <span id="txtHint"></span>
    ...
    

     

    instead of:

     

    <input type="submit" name="submit" value="submit" id="submit"/>
    </div><div id="formwrap">
    <div id="txtHint">
    ...
    

     

    So div#formwrap and all that stuff is no needed anymore. You can set styles for your span to display in div way as well (display: block;).

  15. It's hard to work without real code as I'm not understanding what do you want, and I'm not sure what inside your commentajax.php at all? If you want to add some line to ol#update, just print parsed values from $_POST which going to database too. And if you want to change all stuff in ol#update, just change jQuery part:

     

    $("ol#update").append(html);

     

    to:

     

    $("ol#update").html(html);

  16. I don't know about best practice but in my own framework which is still under development I'm using includes as I'm working on very fast solution. For more constans data one of modules just creating array so it's a lot more faster than MySQL query. I was tested it for about 15000 records and it was a good choice I think... and less queries!

  17. It's because you don't print your record. In html variable you receive response from executed PHP script and your code appending it to ol#update. So let's try to add something like print 'Hello world!'; in commentajax.php then you will see what I'm talking about :). Entry should be printed there.

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