Jump to content

SergeiSS

Members
  • Posts

    239
  • Joined

  • Last visited

Posts posted by SergeiSS

  1. but I want to run a rather lengthy procedure, and while it's running I would like it to record it's status in a multi-line text box as sort of a debugger ( and to pass the time while waiting )

     

    How can I accomplish this?  :)

     

    I also don't know how to ask google about this task :)

     

    But I can direct you, I give you an algorithm.

    1. You need daemon at your server. It could be PHP daemon. 

    2. This daemon must receive your request to start that lengthy procedure and start it.

    3. Daemon answers to browser that it has started your task.

    4. Your JS script will periodically ask (via AJAX) that daemon about the state of the task.

    5. While in process it returns one state, when finished it returns another state.

     

    You may use ajax or WebSocket to connect JS script and server. The second one, I think, is preferrable for this task, because server can send to the browser any information without additional requests.

  2. I think I understand what you like to do.

     

    1. Use normal AJAX.

    2. Another possibility - iframe, hidden iframe. Just create your URL (in JS) and set iframe's SRC equal to this URL. Script will be loaded into this iframe. Moreover, you may send some JS commands from iframe to the main frame in order to get the feedback.  

  3. Do you know about PrintScreen button? It's better to use it than your camera in order to show the screen :)

     

    About your question.

    Try to set style = "width: 100%;position: fixed;bottom: 0px;" for the div with id="sub_wrap". It might help you - phone and e-mail will be always at the bottom of the screen.

  4. What is the meaning of the last qoute in this line? You have incorrect syntax here

    $allowed_ext = array("gif", "jpeg", "jpg", "png", "pdf", "doc", "docs", "zip" , "mov", "flv", "mp4", "3gp", ");
    

    Maybe this is the only problem?

     

    Also, you insert raw POST data into the MySQL. It's bad!

     

    Then... What for do you "require_once 'header.php';" in 2 places???

  5. Just imagine - you take your phone, dial number and called subscriber answered. After that you may talk to that man.

     

    Internet connection is similar to phone call. First you need a connection and when this connection is established two programs (client and server) may talk.

     

    In other words your question is "Is it possible to talk to a remote person without making a call to his phone?"  :D What can you answer to this question?

  6. It's easy to do :)

     

    1. onsubmit="return false;"    you should remove that - as it was said earlier.

    2. Create a function to submit a form. Let it be form_caller(). This function have to set a special JS variable (V) and then call submit() function for a from.

    3. Create second function, let's name it submit_check. It checks the state of special variable V and return true if V is set and return false otherwise.

    4. Write for the form onsubmit="return submit_check()".

    5. It's ready. If you press Enter, submit_check() is called and return false. Form is not submitted. If you call form_caller(), then submit_check() will return true and form will be submitted.

     

    I hope that this explanation in clear enough.

  7. I have a question for you. If you also believe that it should be done another way, and I'm sure you've seen that OP is trying to learn that better way, why did you give him/her the bad answer?

    What is wrong in my answer? Endorphin tries to create a list of comma-separated values. His task was to remove the last comma. Am I right? And I show the way how to create a string without comma at it's end. Do you agree? OK, again - where my answer is wrong?

     

    Even if he would like to use multidimensional array, he can use my code. He just need to change it a little.

  8. You'd better do it in another way. The more accurate (and more compact) code is the next

    if($via != null)
    {
    $points=array();
    foreach($via as $point)
    {
    if($point != "")
      $points[]="{location:'$point'}";
    }
    if( count( $points > 0 ) )	
      echo "var points = [".implode( ',', $points)."];\n";
    
    

  9. Yes, it's possible. And from my point of view it's the preferred method. Because if something is wrong in the input data, I can show all data entered and give to user a chance to change it.

    When data is correct I can process it and do anything I wish. If I need, I can root to another script or do something here, in this script.

  10. I think you need GD2 or Imagick library if you like to do it inside PHP.

    You may save resized images at you server or resize them 'on the fly', dynamically, every time when you need it. In the first case you save a time (but need some space on a server), in the second case you save a space on your server (but need a time to resize every time when you need a smal copy).

  11. HEllo I wanted to know wheter php function can be call in js functions.

    The direct answer to your question is "no". But if you explain what do you like to get (I mean algorithm), then we can think together and find out a good solution for you needs.

     

    PS. I could be ajax of course, but maybe not. It's up to you, what is your aim.

  12. ...because my script was for a mobile site & most of mobile devices are not support java script.

    Also it will not work in user's browser who disabled java script.

    The only way to measure load time is to do it on client side. If it's not possible because of any reason - it's impossible at all. As I told already it this topic "PHP solution is not correct  It will show page preparation time."

  13. Maybe JS? In the beginning, when loading is started, set first JS variable, make it equal the current client's time. And also when page is loaded read the current time. Calculate the difference between that times and you will know the loading time.

     

    BTW, do you expect a long period of time? Why do you like to control it?

     

    PS. scootstah, PaulRyan - PHP solution is not correct :) It will show page preparation time. TC would like to know how long this page is transfered from server to client.

  14. I need it to run through the whole file adding up every 4th section.

    Well... I explain an algorithm as I see it.

    You need functions fopen(), fgets() (fread), fwrite() and some others. Read your file line by line, add any info and write it in another file. Then remove old file and finally give your new file the name of an old file.

    In the result your will have that you need.

  15. It's possible, of course :) The algorithm is depends on if you have just one string or more strings. Better say, if this string is the last in the file or not the last.

    The reason is that if this info is the last in the file, you may add new info very easy. If it's not the last info you have to rewrite your file.

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