Jump to content

DeathRay2K

Members
  • Posts

    70
  • Joined

  • Last visited

Posts posted by DeathRay2K

  1. Actually, the entire file is laoded to your computer and left there at YouTube.They put the movies in a Flash player so that they can stream them easily, and so that its a little bit more difficult for users to access them, but ifsomeone wants to they can get them anyways.

  2. Yeah, that's exactly what I thought when I first post, and it turns out that's right...I've seen this happen a dozen times before, always ending with disgruntled team members, because the team leader starts to make some money, and they aren't getting any of it.

  3. You didn't really answer most of his questions...Are you planning to pay the people who work on it? Obviously you would be making money, and that just doesn't seem fair, especially considering that you have yet to say what exactly you are doing.If you are paying, I may be interested. :)I do web design and am moderately skilled in PHP/SQL.

  4. In the end, big businesses choose ASP.NET, small businesses and individuals choose PHP.Usually, there are always exception.I know quite a bit of PHP, and some ASP.NET, and I find PHP much easier, but not as fast as I would like. I have yet to find something that PHP simply cannot do, though.

  5. Simply remove the call to itself to only get the direct children to $parent. You don't need $level this way. You'll then have this:

    <?phpfunction listCategory($parent = 0){   // where parent of 0 means it's top-level   $retval = "";   $indent = "<br />";   for ($i=0; $i<$level; $i++) $indent .= "     ";		   $result = mysql_query("SELECT * FROM categories WHERE parent_id='$parent'");   while ($row = mysql_fetch_assoc($result))  {		extract($row);		$retval .= $indent . "<a href=\"?c=$category_id\">" . $category_name . "</a>";   }   return $retval;}?>

    Then, to get the children of the id in the query string, just call the function with it as a parameter, i.e:

    <?	listCategory($_GET['c']);?>

  6. Did you set the height of the box (the one that everything is in)? If you didn't it should just resize with the content, including the footer.Can you post the relevant CSS and HTML?

  7. To do that with PHP, it has to be done before any HTML output occurs.If you want to do it after the original page has loaded, you're better off with javascript. If you still want to do it with PHP, it is done like this:

    <?	header('Location: otherfile.php');?>

    Just remember that in PHP, that has to be done before any HTML output, including empty space.Also, PHP is not a replacement for Javascript. PHP is executed on the server, so there is no interaction with the user on a single page.

  8. Relative paths are perfectly fine.Are you sure that the uploads directory allows uploads? Try chmodding it to 777. If that works then great.I made an uploads script some time ago when I was just getting into PHP. Granted, I dissallowed certain extensions rather than simply only allowing certain mime types, but that can easily be amended:

    $target_path = "uploads/";$target_path = $target_path . basename($_FILES['uploadedfile']['name']); $allowed_types = array('image/gif', 'image/jpeg', 'image/pjpeg');if($_POST['MAX_FILE_SIZE'] >= filesize($_FILES['uploadedfile']['tmp_name']) && in_array($_FILES['uploadedfile']['type'], $allowed_types)){	if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path))	{		//Success message	}	else	{		//Error message	}}else{	//Not allowed message}

    And for the form, you just need something like this:

    <form enctype="multipart/form-data" action="upload_class.php" method="post">	<input type="hidden" name="MAX_FILE_SIZE" value="5242880" />	Choose a file to upload: <input type="file" name="uploadedfile" /><br />	<input type="submit" value="Upload File" /></form>

    Simple!Just make sure that permissions for the uploads folder allow uploads! :)

  9. err, that would make something like document.php into documentdocument. So.... err
    Try it, it works. And without the regex overhead.It takes basename($_SERVER['PHP_SELF']), which gives you something like 'document.php', and replaces '.php' with '', an empty string, leaving you with 'document'.
  10. On the top navigation, the hover image, and the current page image don't really go well with the regular image, as the regular image looks like a button, and the other two don't, nor do they bear any resemblance to each other either...Also, when the button shows the current page, the text should be a bit lower.The top border of the left hand navigation doesn't fit with the sides and bottom very well.Finally, the banner image looks kind of stretched, so if you can, you might want to get a larger background image.

  11. I though it was <<<EOD?Yeah, it is:echo <<<EODTextEOD;Not script
    Actually it doesn't matter what you use, it just has to alphanumeric + underscores and start with a letter.I just used SCRIPT to make it clear that it conatins javascript.
  12. Or you could just use Heredoc.Like this:

    echo <<<script<script>alert("hey")</script>SCRIPT

    note that it should be < < < SCRIPT without the spaces, but for some reason the forum won't let me type that.

  13. I like your way, but what should the directory be CHMODed to allow PHP to access the file without allowing the user to do so, and I would recommend using a .htaccess file to have a more friendly user than blah.php?download=62839 could simply be download/file.zip and be redirected to a page for you to download it from.

  14. Easy enough.

    	function percentbar($correct, $total, $width, $height)	{		$percent = $correct / $total;		$percent *= $width;		$im = imagecreatetruecolor($width, $height);		$green = imagecolorallocate($im, 0, 255, 0);		$red = imagecolorallocate($im, 255, 0, 0);		imagefilledrectangle($im, -1, 0, $percent, $height - 1, $green);		imagefilledrectangle($im, $percent, 0, $width, $height - 1, $red);		imagepng($im);		imagedestroy($im);	}

×
×
  • Create New...