Jump to content

marcus

Members
  • Posts

    1,842
  • Joined

  • Last visited

Posts posted by marcus

  1. <?php
    echo " 
    <html> 
    <head> ";
    
    
    if (isset($_POST["submit"])) {
    
        include "connect.php";
    
        $name = $_POST['name'];
        $path = $_POST['path'];
        $description = $_POST['description'];
        $date = getdate();
    
        if (strlen($name) < 1 || strlen($path) < 1 || strlen($description) < 1) {
            print "<table>";
            print "<tr><td><center>Trying to add file.</center></td></tr>";
            print "<tr><td><center>";
            print "One of the required fields was not filled in, please go back and try again";
            print "</td></tr></table>";
        } else {
    
            $posting = "INSERT INTO strata_links (name, path, description,date) values ('$name', '$path', '$description', '$date')";
            mysql_query($posting) or die("could not post");
        }
    } else {
    ?> 
    </head> 
    <body bgcolor="white">
    <table align="center" border="1" bordercolor="gray" width="400px">
    
    <tr>
    <td><form action="<?= $PHP_SELF ?>" method="post">
    <font style="font-family:Verdana, Arial, Helvetica, sans-serif; color:#FF0000;">name of file</font><input type="text" name="name" value="name of file" /><br/><br/>
    <font style="font-family:Verdana, Arial, Helvetica, sans-serif; color:#FF0000;">Complete Path of File:</font><input type="text" name="path" value="Complete Path here"/><br/><br/>
    <font style="font-family:Verdana, Arial, Helvetica, sans-serif; color:#FF0000;">Description of file:</font><textarea id='7' rows='6' name="description" cols='45'></textarea>
    <input type="submit" name="submit" value="submit" /></form> 
    </td> 
    </tr> 
    </table>  
    </body>  
    </html>
    <?
    }
    ?> 
    

  2. mysql error most likely

     

    <?php
    include ('connectdb.php');
    
    $sql = "SELECT * FROM `fflists` WHERE `id`='" . $id .
        "' AND `active`='1' LIMIT 1";
    $result = mysql_query($sql) or die(mysql_error());
    $num = mysql_num_rows($result);
    
    while ($row = mysql_fetch_array($result)) {
        $business_name = $row['business_name'];
        $listid = $row['id'];
        $dcr = $row['dcr'];
        $add1 = $row['add1'];
    }
    ?>

  3. eep error in mine.

     

    <?php
    
    $get = count($_GET);
    
    if($get > 0){
    foreach($_GET as $name => $value){
    	echo $name . " has the value of " . $value . "<br>\n";
    }
    }else {
    echo "There are no valid get parameters in the URL!";
    }
    
    ?>
    

     

    when my url looks like: http://localhost/test/get.php?1=2&3=4&5=6

     

    my results:

     

    1 has the value of 2
    3 has the value of 4
    5 has the value of 6
    

     

    when my url looks like: http://localhost/test/get.php

     

    my results:

     

    There are no valid get parameters in the URL!
    

  4. hmm

     

    <?php
    
    function errors($value){
    $errors = array();
    
    if(strlen($value) < 3){
    	$errors[] = "The value must be greater than 3 characters";
    }else {
    	if(strlen($value) > 32){
    		$errors[] = "The value must be less than 32 characters";
    	}
    }
    
    return $errors;
    }
    
    $error_check = errors('some values');
    
    if(count($error_check) > 0){
    foreach($error_check AS $error){
    	echo $error . "<br>\n";
    }
    }else {
    echo "No errors, proceed with caution!";
    }
    
    ?>
    

  5. If you really want to check 50,000+ filenames...

     

    <?php
    for ($a = 2005; $a <= 2008; $a++) { //year
        for ($b = 1; $b <= 12; $b++) { //month
            for ($c = 1; $c <= 31; $c++) { //days
                for ($d = 1; $d <= 24; $d++) { //hours
                    for ($e = 1; $e <= 60; $e++) { //minutes
                        if (file_exists("test" . $a . $b . $c . $d . $e . ".jpg")) {
                            echo "Filename: " . "test" . $a . $b . $c . $d . $e . ".jpg exists<br>\n";
                        }
                    }
                }
            }
        }
    }
    ?>
    

  6. Try:

     

    function calculate_range($cat, $bool, $range_min, $range_max, $tab = TRUE)
    

     

    Then do inside the function:

     

    $split_by = $tab ? "\t" : " ";
    

     

    Then change:

     

    list($_cat, $_bool, $_id, $num) = explode("\t", $line_value);

     

    To:

     

    list($_cat, $_bool, $_id, $num) = explode($split_by, $line_value);

     

    And if you're splitting by just a single space, when calling your function:

     

    calculate_range($cat, $bool, $range_min, $range_max, FALSE);

     

    Add false as your last parameter.

     

    If you're doing by the tab, just keep it:

     

    calculate_range($cat, $bool, $range_min, $range_max);

  7. hehe you're trying to do multiple emails.

     

    try:

     

    <?php
    
    $to = $_POST['emailto'];
    // other variables
    
    $ex = explode(";",$to);
    
    if(count($ex) > 0){
    foreach($ex AS $emails){
    	$email = trim($emails);
    	mail($email,$subject,$message,$headers);
    }
    }else {
    mail($email,$subject,$message,$headers);
    }
    
    ?>
    

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