Jump to content

Draicone

Members
  • Posts

    18
  • Joined

  • Last visited

    Never

Posts posted by Draicone

  1. [code]value='\r\n'[/code]
    As mentioned before, this tag is invalid. Also, a \r\n in HTML is meaningless, it translates to a carriage return followed by a line feed (i.e. an overloaded windows new line). Replace \r\n with <?php echo "\r\n"; ?> to see how it works. If your SQL surrounds the value inserted with single quotes, try adding this line just before it, assuming $html is the content of the textarea tag within the $_POST array:
    [code]$html = str_replace("'","\\'",$html);[/code]
    This should effectively escape it. If you use double quotes:
    [code]$html = str_replace('"','\\"',$html);[/code]
    If you use that other quote symbol, the `, just make sure there aren't any in your textarea tag and ignore this.
  2. Sorry, improvement on that code:
    [code]
    <?php
    function banUser($username,$reason) {
    // Code to ban user
    }
    $line = "/ban ABC For being ABC";
    if(preg_match("/\/ban ([\w]+) (.+)/i",$line,$matches)) banUser($matches[1],$matches[2]);
    ?>
    [/code]
    Where's the edit function? :P
  3. Try this:
    [code]
    <?php
    function banUser($username,$reason) {
    // Code to ban a user
    }
    $line = "/ban ABC For being ABC";
    preg_match("/\/ban ([\w]+) (.+)/i",$line,$matches);
    if(isset($matches)) {
    banUser($matches[1],$matches[2]);
    }
    ?>
    [/code]
    You'll have to write the code to ban the user. It compiles perfectly.
  4. Try this:
    [code]<?php
    // <db connect code etc...>

    while($row = mysql_fetch_array($result))
    {
    $mailto[] = array("to"=>$row['email'],
                      "subject"=>"Test email",
                      "message"=>"Test email message",
                      "from"=>"someone@mydomain.com",
      "headers"=>"From: $from");
    }

    mysql_close($con);

    foreach($mailto as $mail) mail($mail['to'],$mail['subject'],$mail['message'],$mail['headers']);
    ?>
    [/code]
    Hope this helps.
  5. It should actually work fine. In fact, for URLs and SRCs, you're meant to use an &amp; to encode the & (because the & denotes a HTMl character entity, which is not present, so you have to use the entity for the & itself). What PHP version are you using?
  6. This line:
    [code]mysql_connect(mysql.someserver.net,$username,$password);[/code]
    Should be ok without the quotes, because PHP will look for a defined value of each of those names, throw an error and then assume they are all one string (including the dots). Ask godaddy for your MySQL server, not the path to the local socket.
  7. Well, no, because the problem is that it is selecting the least of all those columns. You need a query for each. I suppose you can use a for loop in php to automate the process.
  8. Try right clicking and click view source (view page source in firefox), and look for the content inside the textarea html tag. It may just be a problem of the tag being prematurely closed, or the value not inserted between the tags properly.
×
×
  • 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.