Jump to content

ksteuber

Members
  • Posts

    32
  • Joined

  • Last visited

    Never

About ksteuber

  • Birthday 04/02/1990

Contact Methods

  • AIM
    musicislife197
  • Website URL
    http://www.kirksteuber.com

Profile Information

  • Gender
    Male
  • Location
    California, USA

ksteuber's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. ksteuber:[quote]...I have been looking at the source after I run the script...[/quote]
  2. First of all, does this html work? If so I'm suprised. Let me redo this a bit... (quiz.php) [code] <?php $answerkey=array(1=>3,2=>2); if (isset($_POST['Number'])) { $grade=$_POST['grade']; if ($answerkey[$_POST['Number']]==$_POST['Answer']) $grade++; } ?> <html>   <head>     <title>Take my Quiz</title>     <style type="text/css">       table {         position: absolute;         left: 5px       }       h3 {         text-align:center;       }     </style>   </head>   <body>     <?php     if (($answerkey[$_POST['Number']]==$_POST['Answer'])&& isset($_POST['Number']))     echo "You got it correct!";     if (($answerkey[$_POST['Number']]!=$_POST['Answer'])&& isset($_POST['Number']))     echo "Sorry, You got it wrong.";     ?>     <table>       <tr>         <td>         <h3>Quiz about my site</h1>         <?php         if (!isset($_POST['Number']))         {         echo <<<END         <form action="test.php" method="POST">         1. When did I make this site?         <input type="hidden" name="Number" value="1">         <input type="hidden" name="grade" value="0">         <INPUT TYPE="radio" NAME="Answer" value="1"> in 1996         <INPUT TYPE="radio" NAME="Answer" VALUE="2"> in 1992         <INPUT TYPE="radio" NAME="Answer" VALUE="3"> in 2006         <INPUT TYPE="radio" NAME="Answer" VALUE="4"> in 2003         <input TYPE="submit" VALUE="Next question"></FORM> END;         } elseif ($_POST['Number']==1) {         echo <<<END         <form action="test.php" method="POST">         2. Who made this site?         <input type="hidden" name="Number" value="2"> <input type="hidden" name="grade" value="$grade">         <INPUT TYPE="radio" NAME="Answer" value="1"> Ksteuber         <INPUT TYPE="radio" NAME="Answer" VALUE="2"> Oyster         <INPUT TYPE="radio" NAME="Answer" VALUE="3"> the Yeti         <INPUT TYPE="radio" NAME="Answer" VALUE="4"> Mike Moore         <input TYPE="submit" VALUE="Finish"></FORM> END;         } elseif ($_POST['Number']==2) {           echo "Congratulations, you finished the test. You got $grade out of 2 correct. That's ",$grade*100/2," percent!";         }         ?>         </td>       </tr>     </table>   </body> </html> [/code] Is that what you were looking for?
  3. Let me see if I got this straight (I'm not sure I really understand the question). You're looking to make a script that figures out what the URL of the page it has been included in is, and then uses that information to decide what to do next? I think you want something like this: (main.php) [code] <?php $URL = $_SERVER['PHP_SELF']; if ($URL == "/index.php") echo "You are on the main page"; ?> [/code]
  4. Ok, so I tried the $done="hello"; idea, which made it so that the script would return a fopen error which turned out to be because $URL contained "http://" and "/" is a forbidden character in linux filenames. (Oops, thats an embarassing mistake) I changed the code to: [code] echo $done; $filename = "/home/content/k/s/t/ksteuber/html/php_uploads/logs/".substr($URL,7)." - ".date("F j, Y, g:i a"); $fp = fopen($filename,"w"); fwrite($fp,$done); fclose($fp); [/code] Now it makes the file properly, and the file contains the entire site (Yay). However, "echo $done;" still is not working properly. When I view the webpage, I still get only a fraction of $done. I also tried to export some different text at that point in the script that was the same length as $done would have been, but that didn't work either. But wait, here's the weird part. If I make a completely different script that echos that much info, but doesn't execute any of the other commands in the original script, it works. So presumably there is something else in the script that is interfering with the echo command. (The full code of the script is still at: http://www.kirksteuber.com/parser.txt)
  5. as for fopen, I have no way of knowing if it works, since the script doesn't even get past the echo command (it desplays a portion of $done, and not the rest of it, and I have tried but I can't get any other funtions that I use after "echo $done;" to give me a sign that it has been executed at all) as for the second idea, I have been looking at the source after I run the script, so I would see any abnormally long tags.
  6. Does anybody know? Shouldn't there be an easy solution?
  7. I'm not sure I understand the problem... You want a link that takes you to a new page with embeded video? doesn't that just require an object tag?
  8. Unless you are running these script on a pretty out of date server, or you are getting a ton of hits I don't think that you need to worry too much about that. Time the function; I would bet it takes less than a second. And afterwards, the memory no longer being used. Not a particularly heavy burden on any server.
  9. I suppose you could ftp in with something like: [code] <?php $conn_id = ftp_connect($ftp_server); $login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass); if ((!$conn_id) || (!$login_result)) {       echo "Could not connect to the FTP server";       exit;   } $upload = ftp_put($conn_id, 'log.txt', 'log.txt', FTP_BINARY); if (!$upload) {       echo "Could not upload to the FTP server";   } ftp_close($conn_id); ?> [/code] Is that what you had in mind?
  10. Well it seems like the html file ought to be fairly easy. I'm having a hard time understanding exactly where the information is comming from, but if I understand right, you want something like: [code] <?php $username = $_POST['username']; $userinfo1 = $_POST['userinfo1']; $userinfo2 = $_POST['userinfo2']; $html="<html><head><title></title></head><body><h1>This is Important User Information:</h1><table><tr><td>Piece of Information #1</td><td>$userinfo1</td></tr><tr><td>Piece of Information #2</td><td>$userinfo2</td></tr></table></body></html>"; $handle = fopen($username.".html", "w"); fwrite($handle, $html); fclose($handle); ?> [/code] Is this the sort of thing you were looking for?
  11. How do you plan to have this script executed? Since most php scripts are run when they are requested by some one over the internet, I don't see how you could have a script that would be executed based on when there are new pictures, or even a script that is run on a regular basis.
  12. if you are trying to find the size of the output of a page that will always be a constant size you can probably do this: [code] $site = file_get_contents('http://www.mywebsite.com/tracking.php?action=show'); print "filesize[" . strlen($site) . "]"; [/code] I believe that "filesize" only works for local files, so "filesize('http://www.mywebsite.com/tracking.php?action=show')" wouldn't work. Since 'http://www.mywebsite.com/tracking.php?action=show' is clearly not local. Also, if what you were attempting to do was to retrieve the file locally, the script would be looking for a file named 'tracking.php?action=show', not a file named 'tracking.php'. (Also retreiving a php file locally gets the code of the file, not the output. ie: filesize("helloworld.php") would get the length of "<?php echo 'Hello World'; ?>" rather than the length of "Hello World")
  13. Here are the answers as far as I know them 1) If any such function exists, I don't know of it. Just define one. [code] <?php function dirseek($path,$num) { if (!($handle = opendir($path))) { echo "The path could not be opened"; return; } else { $i=0; while (FALSE !== ($file = readdir($handle)) && $i < $num) {       $i++;   } closedir($handle); return $file; } } ?> [/code] 2) Whether or not this should be true hypothetically, it's not. 3) No, you underestimate how fast a computer, especially a server can find files.
  14. I'd have to agree with fran. I would direct the user to a different page. If you want you could even direct them to another page that uses <meta> or javascript to redirect them back to the original page
×
×
  • 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.