Jump to content

Axeia

Members
  • Posts

    717
  • Joined

  • Last visited

    Never

Posts posted by Axeia

  1. alternatively

    <?php
        function byteConvert($bytes)
        {
            $s = array('B', 'Kb', 'MB', 'GB', 'TB', 'PB');
            $e = floor(log($bytes)/log(1024));
         
            return sprintf('%.2f '.$s[$e], ($bytes/pow(1024, floor($e))));
        }
    ?>

    (and as anyone who knows my awesome math skills knows as well.. I didn't write that, last comment on http://php.net/log ;))

  2. I don't completely understand how you want it to work, but can't you use sleep to make sure you wait at least a fixed amount of seconds between each request?

    Sleep for a second and check in the database if there anything with count = 0 left, if so let it curl itself."

    So yeah, that was the plan, can't do that on the page itself as it would result in a slow loading page refreshing all the time.

     

    I forgot to mention btw that an hourly cron job is adding the links to the database and I planned on letting that take care of the links where the count is greater than 1. Up till a yet to determine number where the link will switch its status to "impossible" or something as it might just be a lost cause if isn't up in say ~2 days.

  3. A yes that's the post I was referring to.

     

    My experiences with multiple IE have been dissapointing, what works in multiple IE can still NOT work in a real IE of the version (or the other way around).

     

    Best test so far has been to install windows under virtual machines, but

    a) You're not allowed to run 2 instances with the same key at the same time

    b) You need windows licenses..

    c) Recent windows version are fat pigs gobbling up a tremendous amount of resources, I though win2k would be good enough as it's small to install (xp + all updates takes up a lot of space) but it also just didn't get updates.. and IE8(maybe even 7) and Safari  wont run on it either, still good for testing IE6 though.

    Vista requires OVER 20GB to install and eats RAM like there is no tomorrow.

  4. I got a 100% height layout Where the header and footer stay in the screen to mimic the look of a desktop application, there's however one little problem with this for which I don't really have any hopes of finding a solution.

     

    When using ctrl+f the search result is highlighted at the very bottom of the screen, in this case behind the fixed positioned footer. So would anyone know a solution utilizing javascript to scroll down yet another 20px or so?

    Don't think there's any browser event happening javascript can detect for this one, but I'd like to be proven wrong.

     

    Do plan on adding a 'filter' bar to filter down to interesting values which basically should more or less people from preventing to use ctrl+f so it's not too big of a usability loss.. but still, if a workaround exists, do let me know.

  5. Okay, guess it's a bit too long to squeeze all in the subject line :)

     

    I got a list of links in my database with a counter field for the amount of times it's been attempted to download. Defaulting to 0.

    Now the idea is to slowly walk trough this list (to avoid getting banned from sites by flooding them with requests) while giving back a visual indication of what's going on. (without relying on ajax even)

     

    So my idea was to have 2 iframes

    1) A self refreshing page(via the meta tag and a ~30 sec delay or so) with the visual feedback a, list with the last 10 added values. And all results with count = 0

    2) Hidden iframe initiating the process of walking trough the list like this

    * SELECT blabla from blabla WHERE count = 0 AND limit = 1;

    * Get the blabla and feed it to curl, and if the retrieved content was page could not be found or something update the count +1. If it was succesfull move it to another table.

    * Sleep for a second and check in the database if there anything with count = 0 left, if so let it curl itself.

     

    Good way to go about it, or is there a better way?

     

  6. Problem is noone wants to go to court, not me, not a host, not the people sending out Cease and Desist notices for no good reason.

     

    Lots of them seem to be sent out just to see if the host cooperates, if they don't then boohoo.. tough luck, as they don't have a foot a stand on they can't really start sueing (at least not while hoping to win).

    Response from some hosts is "Oh, I see mail about illegal content, site is something about torrents.. yep I don't want go to court, I'll cooperate".

    I don't want to go to court either as I got better things to do.

     

    Just host it in the Middle East.
    Link me one that's reliable?
  7. Gives a very generic blog feel, guess that could be good consisdering it's a blog.

    One idea to spice it up a bit is to make the gradient on the top based on a background color (and transparent png) and then via javascript allow different background colors. (or via alternative stylesheets but those are well hidden.. could only find out how to change one in Firefox)

  8. Quite easy ones to spot tbh.

    If you fill in everything you get the following errors:

    Maid of Honors name is required
    Best Man's name is required
    An unknown error occurred.

    So ctrl+f (search) in your code for "maid of", which leads to

           if (!$_POST['maid_of_honor'])
              // if not, add that error to our array
              $errors[] = "Maid of Honors name is required";

    Which means you should have a input field whose name is "maid_of_honor" as well (like in the post) ctrl+f for "maid_of_honor" and you'll notice the focus wont change as it only occurs once in the file.

     

     

    And basically every time you write something like this:

           // check to see if a name was entered
           if (!$_POST['name'])
              // if not, add that error to our array
              $errors[] = "Your name is required";
           // check to see if a subject was entered
           if (!$_POST['bride'])
              // if not, add that error to our array
              $errors[] = "Bride's name is required";
           // check to see if a message was entered
           if (!$_POST['groom'])
              // if not, add that error to our array
              $errors[] = "Groom's name is required";
           if (!$_POST['maid_of_honor'])
              // if not, add that error to our array
              $errors[] = "Maid of Honors name is required";
           if (!$_POST['best_man'])
              // if not, add that error to our array
              $errors[] = "Best Man's name is required";
           if (!$_POST['bride_groom_dance'])
              // if not, add that error to our array
              $errors[] = "Bride/Groom dance is required";
           if (!$_POST['cake_song'])
              // if not, add that error to our array
              $errors[] = "Cake Cutting song is required";
           if (!$_POST['email'])
              // if not, add that error to our array
              $errors[] = "Your email is required";

    You should ask yourself if what you're doing is a good way to do what you're doing. Usually if you got a lot of similar code it's indication that there is a better way to do the same thing. Via a function or an array.

     

    Here's your form, but fixed:

    <?php
       
       $fields = array(
            
            "name"               => "Your Name",
            "bride"               => "Bride",
            "groom"             => "Groom",
           "bridesmaid_1"        => "1st   Bride's Maid",
           "groomsman_1"           => "1st Groomsman",
           "bridesmaid_2"        => "2nd Bride's Maid",
           "groomsman_2"           => "2nd Groomsman",
           "bridesmaid_3"        => "3rd Bride's Maid",
           "groomsman_3"           => "3rd Groomsman",
           "bridesmaid_4"        => "4th Bride's Maid",
           "groomsman_4"           => "4th Groomsman",
           "bridesmaid_5"        => "5th Bride's Maid",
           "groomsman_5"           => "5th Groomsman",
           "bride_mother"        => "Bride's Mother",
           "bride_father"        => "Bride's Father",
           "groom_mother"        => "Groom's Mother",
           "groom_father"        => "Groom's Father",
           "bride_groom_dance"    => "Bride / Groom Dance",
           "father_daughter_dance" => "Father / Daughter Dance",
           "mother_groom_dance"     => "Mother / Son Dance",
           "cake_song"           => "Cake Cutting Song",
           "entrance_song"        => "Entrance Song",
           "last_song"           => "Last Song",
           "email"              => "Your Email"
           
          );
    
       if ($_SERVER['REQUEST_METHOD'] != 'POST'){
          $me = $_SERVER['PHP_SELF'];
    
       // Form Fields Array
    ?>
       
    
    <p>Please fill in the information below.</p>
    <form action="<?php echo $me;?>" method="post">
    <table id="wedding_dance_form" align="center" cellpadding="2">
       <?php
            foreach( $fields as $id => $field ) {
            echo
            "<tr>
             <td><label for='$id'>$field</td>
             <td><input type='text' name='$id' id='$id' /></td>
            </tr>";
            }
       ?>
    
    <tr>
    <td><label for="extra_notes">Extra Note's</label></td>
    <td><textarea name="extra_notes" id="extra_notes" cols="50" rows="8"></textarea></td>
    </tr>
    
    <tr>
    <td><label for="submit">Submit List</label></td>
    <td><input type="submit" name="submit" id="submit" value="Send" /></td>
    </tr>
    
    </table>
    </form>
    
    
    
    
    
    <?php
    }else{
          print_r( $_POST ); //Say hello to you new best friend, print_r
           
            // initialize a variable to put any errors we encounter into an array
           $errors = array();
           
           // test to see if the form was actually posted from our form
           $page = $_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF'];
           if (!ereg($page, $_SERVER['HTTP_REFERER']))
              $errors[] = "Invalid referer\n";
    
          foreach($fields as $id => $field)
          {
      if(!$_POST[$id])
      {
        switch( $id ) //Below are the REQUIRED cases
        {
    	case 'name':
    	case 'bride':
    	case 'groom':
    	case 'maid_of_honor':
    	case 'best_man':
    	case 'bride_groom_dance':
    	case 'cake_song':
    	case 'email':
    	  $errors[] = $field." is required!";          
        }
      }
    }     
            
           // if there are any errors, display them
              if (count($errors)>0){
               echo "<strong class=\"redtext\">ERROR:<br>\n";
                 foreach($errors as $err)
                echo "$err<br>\n";
          
          }else{
      echo "Bingo!";
              // no errors, so we build our message
              $recipient = 'mike@nuancetone.com';
              $from = "Name: ".stripslashes($_POST['name'])."| Email: ".$_POST['email'];
              $subject = 'Wedding List';
              $msg = 'Submitted Responses';   
                 foreach($_POST as $key => $val){
                   if (is_array($val)){
                   $msg.="Item: $key\n";
                      foreach($val as $v){
                            $v = stripslashes($v);
                            $msg.="   $v\n";
                      }
                   }else{
                      $val = stripslashes($val);
                      $msg.="$key: $val\n";
                      }
             }
             }
              
              
              
               //if (mail($recipient,$subject,$msg)){
               // echo "<p>Thanks for filling out the form!</p>";
              //  echo nl2br($msg);
              //  echo "<p><b>PRINT THIS PAGE FOR YOUR RECORDS</b></p>";
    //}else {
    //            echo "An unknown error occurred.";
    }
    ?>

     

    I added a print_r so you can see what's going on and commented out your mail function as I don't want to send spam ;)

    Another necessary change was moving the $fields array OUTSIDE the if, since the values are needed in the switch in the else. So to grant them both access to it , it was place outside them.

     

  9. Well this is a script offered for download that downloads .torrents based on files on your own disk.

    The .torrent files wouldn't even be on the site, so that's even "less questionable" than a torrentsite.

     

    So basically any host that doesn't instantly give into a cease and desist notice would be good, as no sane company would ever bother to pay a lawyer to actually take it to court. (The don't start a fight if you can't win principle)

  10. Err somewhere on this forum is a post about a Microsoft tool allowing a preview in ie6/7/8 I think.. with intergration of browsers to be done at a later date. Not sure how reliable it is though.. only (good) way of installing the IE's seems to be by running them in something like virtualbox.

  11. Yeah that one is up to you, I also prefer to have it on the same page as with the code above you use the input array for the validation as well, so it's basically

    #non functional example code
    $array = array();
    if( POST ) {
      //output form based on $array
    }
    else {
      //validate based on $array;
    }

     

    And by having it on the some page you don't need to include it from elsewhere or do other strange things like resorting to global variables.

  12. It would look like this:

    https://bespin.mozilla.com/

    Was scrolling down to post that one :)

     

    audio tags! video tags!  All it's missing is a flash tag.

    Who needs flash? Canvas seems to be pretty close to magic for interfaces.. and for fancy animations you can some pretty impressive things with javascript/svg (it's fun to play around with svg/javascript btw as current support in non-ie browsers is pretty good)

  13. I know there's a sticky for webhosts, but it doesn't mention their policies regarding questionable content.

     

    No no, it's not actually anything harmful, it just provides links to torrent sites based on the content on your disk. Ofcourse if you have illigal content on your disk it will create links to that as well.. and that's where the questionable comes in.

    I'm pretty sure 99% of the webhosts will kick you off if they obtain an email from some big company stating your site is illegal.

     

    So does anyone know of a host that doesn't give in to some random cease and desist notice? Everything I google up seems to be either related to:

    A) Porn

    B) Go unanswered (perhaps due to people not wanting to discuss such a thing in public and the answer being supplied by private message.. or just noone knows)

     

    I stress again, the content nor the downloads on the site would be illegal on its own, so I just need a host that knows its own rights. (self hosting is out of the question due to the costs)

  14. JPGraph anyone?

    Or just work out how to do your own using GD.

    Must look VERY nice

     

    Making something yourself is easy (plenty of tutorials for both types of graphs) but making something look nice is quite hard from my experience, especially PIE graphs as the image arc functions don't always seem to work 100% properly.. but worse they're not anti aliased so you'll need something like http://mierendo.com/software/antialiased_arcs/ but that doesn't deal with gradients etc.

     

    Nah, if you want it to look nice I'd strongly advice against trying this yourself (I attempted so, and it's hard work)

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