Jump to content

Masna

Staff Alumni
  • Posts

    288
  • Joined

  • Last visited

Posts posted by Masna

  1. Just nest another while loop in the original outer loop. In this one, fetch the comments for each news item.

     

    Also, I highly suggest making a separate <comment> tag to hold each new comment (as opposed to clumping them all together in one <comments> tag and joining them with |.

  2. I was just working on some mods for an SM forum that I'm installing on my own site, and I came across this...

     

    if (!empty($regOptions['check_reserved_name']) && isReservedName($regOptions['username'], 0, false))
    {
    	if ($regOptions['password'] == 'chocolate cake')
    		fatal_error('Sorry, I don\'t take bribes... you\'ll need to come up with a different name.', false);
    	fatal_error('(' . htmlspecialchars($regOptions['username']) . ') ' . $txt[473], false);
    }

     

    Basically, when trying to register on an SM forum, if the username you enter is already in use and you enter the password 'chocolate cake', the error "Sorry, I don't take bribes... you'll need to come up with a different name." shows.

     

    I thought that was quite hysterical, and so I felt the need to share.

     

    Try it on this forum. :)

  3. Ok, so basically I don't need to worry that the 'field' name 'department' has multiple choices, it will take the 'value' assigned to whatever choice they select and populate the $to variable with the front-end of the email and complete it with the $your_site content.

     

    For some reason I was thinking I had to deal with an array issue of some sort since it was a drop down selection with multiple choices under one group name. Guess that's not the case, eh?

     

    Thanks for your response!

     

    Yes, you are correct. You do not have to use an array here (and if you happen to come across a browser that sends an array of information when sending the value selected of a drop-down field, let me know).

  4. <?php
    
    function check_porn_terms($input){
         $porn_terms = array("porn", "sex", "tits", "cock", "penis", "vagina", "pussy", "itakeithard", "hard_cock", "really_hard_cock", "suckmydickbitch", "fuck", "me", "good"); //add terms here
         foreach($porn_terms as $term){
              if(substr_count($input, $term) > 0) return false;
         }
    
         return true;
    }
    
    if (isset($_POST['name']) && !empty($_POST['name'])) {
    mysql_connect("mysqlv3", "username", "password") or
    die(mysql_error());
    mysql_select_db("sand2") or die(mysql_error());
    
    if(!check_porn_terms($_POST['name'])) die("No porn!");
    
    $table = mysql_real_escape_string($_POST['name']);
    
    $query = "CREATE TABLE `$table` (id INT(11) NOT NULL auto_increment, site VARCHAR(150) NOT NULL, votes_up BIGINT(9) NOT NULL, votes_down BIGINT(9) NOT NULL, PRIMARY KEY(id), UNIQUE (site))";
    $result = mysql_query($query) or die(mysql_error());
    
    
    }
    
    ?>

  5. Why are you putting everything in a loop? All of your header declarations should be outside of the loop. The only thing in the loop should be the readfile for each file (and whatever else you need to add each file to the .zip).

     

    my mistake, moved them out of the loop and it still dont work...

     

    Post your new code.

  6. <?php
    //display the competitions
    $query = "SELECT comp_name FROM comps";
    $result = mysql_query($query) or die('Error : ' . mysql_error());
    $comp_names = array();
    
    while ($row     = mysql_fetch_array($result, MYSQL_ASSOC)) { 
         $comp_names[]   = $row['comp_name'];
    }
    
    $comp_names = array_unique($comp_names);
    
    foreach($comp_names as $comp_name){
    ?>
    
    
    <p><?php echo $comp_name;?> - 
    <a href="comp_view.php?comp_name=<?php echo(urlencode($comp_name))?>">View Entrants</a></p>
    
    
    <?php
    }
    
    ?>

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