Jump to content

crackpanda

Members
  • Posts

    19
  • Joined

  • Last visited

    Never

Posts posted by crackpanda

  1. Hey, thank you for taking time to read this and for possibly helping me sort this.

     

    So I'm trying to make it so:

     

    http://mysite.com/thing/key
    
    is rewritten as:
    
    http://mysite.com/thing.php?k=key
    
    while keeping a general rule for:
    
    http://mysite.com/thing
    
    being written to:
    
    http://mysite.com/thing.php

     

    Please help :( thank you.

  2. Hey, i have a problem with a captcha, i have been trying to solve this since last nite and i still haven't fixed it, its getting me pretty frustrated..  :-\

     

    I'm using this script: http://www.white-hat-web-design.co.uk/articles/php-captcha.php

     

    I have the captcha image working, but the session is not working properly.

     

    I removed session_start(); because i have it in my root file, and i renamed;

     

    $_SESSION['security_code'] = $code;

     

    to

     

    $_SESSION["captcha"]=$code;

     

    Another thing to note, is i named my session so for example, my root file has session_name("mysession");

     

    Any ideas on why $_SESSION["captcha"]=$code; does not work? Please help  :P

  3. A simple

     

    <?php
    if (preg_match('~^[a-z ]+$~iD', $str)) {
    //do something
    }
    ?>

     

    will do :)^ and $ makes it check the whole string, and the pattern modifiers i and D makes the search case insensitive and makes sure $ truly is the end, respectively.

     

    That is godly, thank you very much, that was exactly the puzzle piece i needed.  ;D

  4. What you might want to use is a preg_match_all  (detailed info here http://us3.php.net/preg_match_all)

     

    $html = "<b>bold text</b><a href=howdy.html>click me</a>";

     

    preg_match_all("/(<([\w]+)[^>]*>)(.*)(<\/\\2>)/", $html, $matches, PREG_SET_ORDER);

     

    You could then replace offending characters with

    preg_replace

     

    <?php

    $string = 'The quick brown fox jumped over the lazy dog.';

    $patterns[0] = '/quick/';

    $patterns[1] = '/brown/';

    $patterns[2] = '/fox/';

    $replacements[2] = 'bear';

    $replacements[1] = 'black';

    $replacements[0] = 'slow';

    echo preg_replace($patterns, $replacements, $string);

    ?>

     

     

    Hope that helps.

     

    I was looking for something more simple such as an ereg statement, i just can't figure out how to set it up myself. I dont want to replace anything, i just want a true or false on a string.

     

    For example:

     

    im expecting: hello hello

     

    or: Hello Hello

     

    but i want to give an error if something such as:

     

    Hello2 Hello

     

    or

     

    Hello!

     

    is given.

     

    The code you gave me over-complicates the result, but thank you for helping. :)

  5. Hey, could someone help me put together a statement to check a string for letters and spaces and return true or false (i want see if the string has letters and spaces, which would be normal, or if it also contains numbers and these guys !@#$^& e.t.c, which would be unwanted)

     

    - Thank you.  ;D

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