Jump to content

enoyhs

Members
  • Posts

    42
  • Joined

  • Last visited

    Never

Everything posted by enoyhs

  1. Try like this: <? if ( $_GET['go'] != '' ) { include("$_GET['go']"); } ?>
  2. Try: echo "<a href='http://www.testsite.com/files/" . $_POST["folder"] . $_FILES["userfile"]["name"]'>"www.garyrip.com/files/" . $_POST["folder"] . $_FILES["userfile"]["name"]</a>"; To specify what I changed: I put single quotes around href.
  3. Look at my specified code above. Options will be separated by enter (or if you want other separator just change "\n" to whatever value you want in explode("\n",$text)
  4. Yes it will work. Code would be something like this: $text = file_get_contents("test.txt"); $array = explode("\n",$text); echo "<select>"; foreach ($array as $value) { echo "<option value='$value'>$value</option>"; } echo "</select>";
  5. Daniel0: I'm not sure about this... For example take a look at big pages which have lot of content. When you load page content is showing up while you are loading. Not sure if it is php (maybe it is another so I may be mistaking here), but I'm pretty sure that I have seen php pages give out content while it is still loading... Or am I missing something here?
  6. After several testing I got bad results: Using cURL only got me around 20 records in 30 seconds. So changed max_execution_time in php.ini and got a bit better result ~1000 results in 6 minutes was max. Could anyone give some advices how to speed up things? I will explain a bit further what I'm trying to do. I got website which has many entries around 3.000 and they look like this: http://www.website.com/result.php?result=1 So I used for loop to loop trough various pages (changing result value). My goal: To find all valid results. For example if result doesn't exist in database it returns page with text: "Invalid page" (though all page formatting is kept). But if page exist for most of pages they are very long so I think this really slows down my gathering. But actually I only need a top of page from valid pages so is there way to limit how much bytes I need to receive to speed up things? I hope I made myself clear.
  7. $table1 = "SomeTableInDatabase"; I'm not sure if this is an error but that is the one I currently see that could be.
  8. First: Do you have variable $table1 defined?
  9. That must be because unix_timestamp() is SQL function... Try this: $sql = "select * from example order by abs( unix_timestamp('$date')- unix_timestamp(datetime) ) limit 1";
  10. It is because variables won't work in single quotes. $sql = 'select * from example order by ' . abs( unix_timestamp('$date')- unix_timestamp(datetime) ) . ' limit 1';
  11. Of course to make it much simpler you could have written this like this: <form> <fieldset> <label> <span>Title:</span> <span class="price"><input name="title" type="text" id="title" value="<? echo $_SESSION['firstname']?>" size="24" /> </span> </fieldset> </form> In php everything must not be echoed. Everything that you want tot put out in php tags though must be. So simply use php tags only when you need them.
  12. One of ways I am aware of is: <?php $phpVar = "Hello world!"; ?> <script type="text/javascript"> var jsVar = '<?php echo $phpVar ?>'; alert(jsVar); </script> There must be several ways but I usually use this when needed...
  13. Daniel0: Thanks! But already found it, but I wasted around half hour trying to find resources to install it but it was already built in with wamp only needed to activate. The Little Guy: Thanks for those codes
  14. It sounds great. Could you please link to more info about CURL and/or explain in short what is CURL.
  15. As I mentioned earlier it will really take long (I have around 2500 pages to check) and I would like to see results as fast as I can...
  16. I quite didn't understand your question... What I mean with function call is you need to call function like this: version_check(); So the full code would be: <?php function version_check() { $template_version = '2.5'; if (ini_get("allow_url_fopen") == 1) { $lastest_version = @file_get_contents("http://www.jaredritchey.com/downloads/601.txt"); $check = version_compare($template_version, $lastest_version, ">="); } echo($latest_version); } ?> version_check();
  17. Hm... Not what I meant but that is good idea too... But with your approach I would need a way to store all previously outputted data so I can see it at end. What would you suggest for that? I think just change method to POST and recognize steps by ifs..
  18. Hm... I'm currently testing "stream_get_contents" I will let you know. So after Daniel0's answer here is my next question: Is it possible to execute part of code and see result and then continue next step? For example I will give for cycle: <?php for ($i=1; $i<=10; $i++) { // Do some stuff. // Currently halt script to print out current results. // Continue with script. } ?> Just to clarify: I'm using W.A.M.P. on Windows Vista and I will firefox for outputting result. My idea would be to execute some code, output it and then refresh page (with headers or how ever you could refresh it after specified time) and continue script from last place. Or is there better way?
  19. Yes. It will give you one of rows (tables) to order by so you will have a chance of getting specific result in 1/count($arr) times. But I think better way to pick random would be by randoming id number and then picking specific id. If there are missing id just pick one closest... PS. Oh... Didn't know that GingerRobot. Ok so my statement isn't correct I suppose.
  20. Edited my post above before you posted... Also note that this won't really give you very random results because it will have 1/number of tables(mistakenly mentioned as rows before). I can't currently think of any better way I but I will try and think...
  21. First error I see is: Second error from your message is: You can't order rand(). You have to order by one of rows. So one of the ways is write all rows in array and then $arr[rand()]. Something like this: $arr[0]='row1'; $arr[1]='row2'; $arr[2]='row3'; $arr[3]='row4'; // And so on... $result2 = mysql_fetch_row(mysql_query("select * from promotions WHERE used='n' order by " . $arr[rand(0,count($arr)) . " limit 1"));
  22. Hi! I would like to know what is fastest way to read contents of web page? I would like to know what possibilities are there. Currently with "file_get_contents()" reads around 10-13 pages in 30 seconds (Default max execution time). I know I can change max execution time so it can read more pages but I would like to find another way if it is possible... Also I would like to know is it possible to print out the results while still loading page? Maybe it is browser(my settings), php setup or script fault so I'm not sure... If code is needed I will offer it after asked.
  23. You will need to use either javascript with Ajax, already have predefined semesters stored in arrays or refresh page each time programe_name is selected.
×
×
  • 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.