SitePoint Sponsor

User Tag List

Page 4 of 5 FirstFirst 12345 LastLast
Results 76 to 100 of 122
  1. #76
    SitePoint Enthusiast
    Join Date
    Oct 2002
    Posts
    69
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Does anyone know of a way to validate $url to make sure that it is in fact a URL? (with no dangerous code in it that could effect the system)

  2. #77
    SitePoint Addict Clete2's Avatar
    Join Date
    Mar 2002
    Location
    Columbia, South Carolina
    Posts
    304
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    YEAH I GOT ONE PART!

    D)

    I took out all the vbs and ftp crap and decided to do something a tad different in PHP:

    PHP Code:
    <?php

    if (file_exists('C:\\picture001.png')){
        
    unlink('C:\\picture001.png');
    }

    $url "http://www.yahoo.com";

    exec("C:\Progra~1\Intern~1\iexplore.exe "$url);

    sleep(5);

    exec("C:\HQScreen.exe 0 PNG 8");


    sleep(1);

    exec("copy C:\picture001.png C:\Progra~1\Apache~1\Apache\htdocs\picture001.png");

    ?>
    <img src="http://216.143.50.59/picture001.png" /> <- here is where the snapshot should be located at.
    *eherm* http://216.143.50.59/test/ *eherm*

    works somewhat, I think there is something wrong with the iexplore command, I will work on it more when I finish eating.

    EDIT: AHH!!! People quit clicking it lol it keeps opening yahoo. Changed the code. But It will:

    1) Not close the window once it opens
    2) Timeout unless you close the window

    so I think it needs some JS or something...?

    EDIT: Also I need it to capture the Yahoo window only. It captures my whole screen and I declare that a security risk, someone opened it while I was posting and probably got a screen with me editing the post...
    Last edited by Clete2; Jan 3, 2003 at 19:04.
    My Blog
    My Photography Website
    Linux user #339185

  3. #78
    SitePoint Enthusiast
    Join Date
    Oct 2002
    Posts
    69
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Not bad, not bad at all. That's why I like using the VBS... because I can close the window with it

  4. #79
    SitePoint Addict Clete2's Avatar
    Join Date
    Mar 2002
    Location
    Columbia, South Carolina
    Posts
    304
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    yess I can see... but this works good for snapshots

    EDIT: OOO I think I will use this as a 'See what I am up to' for my sig lol, but it would be great if you could fix that vbs script
    Last edited by Clete2; Jan 3, 2003 at 20:15.
    My Blog
    My Photography Website
    Linux user #339185

  5. #80
    SitePoint Enthusiast
    Join Date
    Oct 2002
    Posts
    69
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    What's wrong with the VBS script? It works fine on my system.

  6. #81
    SitePoint Enthusiast
    Join Date
    Oct 2002
    Posts
    69
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'm almost ready to put up my demo. I set it up so that multiple people can't capture at the same time.

    I just need to validate the URL entered by the user... anyone know how? I'm guessing I need to use a regular expression, but I can't get it work.

    Peter

  7. #82
    SitePoint Addict Clete2's Avatar
    Join Date
    Mar 2002
    Location
    Columbia, South Carolina
    Posts
    304
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    how did you set it so that 2 people cannot go on at the same time? like a queue line?

    1) Write a lock file when X user is on
    2) When that user is done, unlink it
    3) Tell the waiting user, XX to wait and refresh every 5 seconds

    like that?

    EDIT: Hey that's a nice idea, i'll try it... also, do I need the VB runtimes for the script and where can I get them if so? (I found that m$ is no longer giving dls and everyone else seems to be putting different versions out :S)

    EDIT: Ok, got a little check.

    PHP Code:
    <?php

    if(!isset($_GET['currwindow'])):

    ?>

    <div align="center"><form method="get" action="http://216.143.50.59/test/">
    Take only the current window? (1 = yes 0 = no) : <input type="text" name="currwindow" />
    <br />
    <input type="submit" value="Submit">
    </form></div>

    <?

    else:

     
    $file fopen("index.lock","r");
     
    $read fgets($file);
     
    fclose($file);

     
    $time date("mdHis");
     
    $read $read 30;

      if(
    $time >= $read):

       
    $count fopen("index.count","r");
       
    $countread fgets($count);
       
    fclose($count);

       
    $countread++;

       
    $upitup fopen("index.count","w");
       
    fwrite($upitup,$countread);
       
    fclose($upitup);

       
    $file fopen("index.lock","w");
       
    fwrite($file,$time);
       
    fclose($file);

        if(
    file_exists('C:\\picture001.png')):
         
    unlink('C:\\picture001.png');
        endif;

        
    //$url = "http://www.yahoo.com";

        
    exec("C:\HQScreen.exe 1 PNG 8 picture C:\ "$_GET['currwindow']);

        
    exec("copy C:\picture001.png C:\Progra~1\Apache~1\Apache\htdocs\picture001.png");

    ?>

    <div align="center">
    To take another snapshot, click <a href="http://216.143.50.59/test/">here</a>.
    <br />
    <br />


        <img src="http://216.143.50.59/picture001.png" />

    </div>

    <?

     
    else:

      
    $count fopen("index.count","r");
      
    $countread fgets($count);
      
    fclose($count);

       if(
    $countread <= 1){

        
    $have "has";
        
    $people "person";

       }else{

        
    $have "have";
        
    $people "people";

       }

      
    $lastshot date("mdHis") - $read 30;

    ?>
    <META http-equiv="refresh" content="5; URL=http://216.143.50.59/test/?currwindow=<?=$_GET['currwindow']?>">
    <div align=center>Sorry, but someone else is currently using this script, this page will keep refreshing every 5 seconds untill they are done.
    <br />
    The total wait time between one snapshot and another is 30 seconds.
    <br />
    <?=$countread?> <?=$people?> <?=$have?> successfully recieved their snapshot.
    <br />
    The last snapshot was taken <?=$lastshot?> seconds ago.
    </div>

    <?

    endif;

    //unlink("index.lock");

    endif; 

    ?>

    This is the niftiest script I have ever seen, hehe. Just need to get vbs working

    EDIT 1/4/03 12:29 PM: Made a few additions, like take only the current screen and some stats for the waiting user(s).
    Last edited by Clete2; Jan 4, 2003 at 12:28.
    My Blog
    My Photography Website
    Linux user #339185

  8. #83
    SitePoint Enthusiast
    Join Date
    Oct 2002
    Posts
    69
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I don't know if you need the runtimes or not... it just worked when I tried it (I'm on XP Home)

    The way I did it so that only one person can go at a time is...

    Once finished capturing, the PHP updates a file called lastcap.txt on the hard drive. In prints the month, day, year, hour (using 24 hour clock) and minute.

    So January 3, 2003 @ 6:32 PM (or 18:32) would look like this:
    0103031832

    So when some captures, it will first assign the number in the file to $storedtime. Then something along the lines of this:

    PHP Code:
        $earliest = ($storedtime 5);

        if ((
    date("mdyHi") >= $earliest)){
            
    //capture here
        
    }
        else {
            
    //error message that you can't capture yet
            // and to try again in a few minutes
        

    The above means that the person trying to capture must do so at least 5 minutes after the last person. Or it will not allow them too.

    Peter

  9. #84
    SitePoint Addict Clete2's Avatar
    Join Date
    Mar 2002
    Location
    Columbia, South Carolina
    Posts
    304
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ah I see. Well I felt 5 seconds was enough.

    EDIT: Post below: Yes I see, I figured you ran your own server for testing...
    Last edited by Clete2; Jan 3, 2003 at 21:00.
    My Blog
    My Photography Website
    Linux user #339185

  10. #85
    SitePoint Enthusiast
    Join Date
    Oct 2002
    Posts
    69
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'll probably lower it to a minute or 2.

    5 seconds would be enough if I wasn't using the FTP upload to another server though

  11. #86
    SitePoint Member
    Join Date
    Feb 2003
    Location
    Sydney, Australia
    Posts
    10
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Any further developments ?

    Ive been searching for something like this I can run on *nix for ages.

  12. #87
    SitePoint Enthusiast
    Join Date
    Oct 2002
    Posts
    69
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Sorry. The only way I know how to do it is with a Windows machine... and it probably is only good for small scale projects.

    Peter

  13. #88
    ********* Genius Mike's Avatar
    Join Date
    Apr 2001
    Location
    Canada
    Posts
    5,458
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The new MSN search engine has screen shots of the results, so it is possible somehow.
    Mike
    It's not who I am underneath, but what I do that defines me.

  14. #89
    SitePoint Addict Clete2's Avatar
    Join Date
    Mar 2002
    Location
    Columbia, South Carolina
    Posts
    304
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    seems this keeps getting bumped and sorry to bump again... looks like our HQScreen.exe program has been updated and will no longer work through the command-line... anyone have an old version? I would appreciate one very much... if you could just post a link or e-mail it to clete2@sowibb.com please?

    EDIT: Aha [img]images/smilies/biggrin.gif[/img] http://www.howiesfunware.com/ScreenCp.exe ... (this is his origional site)... the latest version seem to have been fixed (1.08) with command-line [img]images/smilies/smile.gif[/img]... Ok... all is good :P...

    And I still have it at http://216.143.50.59/test/ if I am not working on top-secret stuff or have apache off...
    Last edited by Clete2; Aug 1, 2003 at 14:11.

  15. #90
    SitePoint Addict Clete2's Avatar
    Join Date
    Mar 2002
    Location
    Columbia, South Carolina
    Posts
    304
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    by the way, to get it to work with Linux, you could find a command-line screen capture program, ask this howie guy to port it to Linux using winelib or rewriting it, or you could change the exec() command to exec("wine /HQScreen.exe ~~~Options Here~~~~" )

    ( search google for howie's funware or e-mail him at funware@aol.com )

  16. #91
    SitePoint Member
    Join Date
    Feb 2004
    Location
    san diego
    Posts
    7
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    I Did It!

    I did it... Ohh yeah.. I did it good too.

    Is this thread still going? Cause it got me started on making one of these thumbnail server things..

    php's exec() doesn't run batch files or vbs very good. After hours of researching and searching for code and forum threads I gave up on trying to run any batch file or WSH (vbs) script from the exec command.

    I'm running

    Apache/2.0.47 (Win32) mod_perl/1.99_10-dev Perl/v5.8.0 mod_python/3.0.3 Python/2.2.2 PHP/4.3.3

    on WinXP home..

    Basically, you gotta make a scheduled task that will run a batch file every 20 seconds or so...The batch file runs the VBS that does the screen capture and thumbnail resizing..

    It's all going to work very good.. and people don't have to wait in line. Just add your request and then wait to download a image with the name you specified in the begenning.

    If anyone is interested let me know and I might post some code

    (That's because it seems nobody else, from what I've found, has even came close to being successful at doing this.)

    All I need to do now is design the front-end to the program. A links page script could request the URL's thumbnail and then download the generated image later. (i.e: a site on a unix machine requesting the image from a windows machine.)

    You give the script the URL and a unique ID for a name.. Then wait like 30 seconds and try to download the picture.

    If I could find a way to encode/encrypt url's to a shorter length sutible for a file name I would. I could use md5, but then I can't get the URL from the encrypted string. To solve that I use a DB to store the uniqueName, and URL. (also time(), title, desc, keywords for later use)
    A shorter unique name would be kinda cool but...

    strtoupper(md5(uniqid(time())));

    works good for now to generate a unique filename for the URL. I just have to cross-reference the filename with the stored name in the DB to get the original URL.


    I DiD iT GOOD!
    harrrrrrr

  17. #92
    SitePoint Enthusiast OReason's Avatar
    Join Date
    Jun 2003
    Location
    Eindhoven, The Netherlands
    Posts
    44
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Thumbs up

    Code would be nice, please

    Thanks!

  18. #93
    SitePoint Member
    Join Date
    Feb 2004
    Location
    san diego
    Posts
    7
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    There is a lot of "code"... It'd probably be better to zip it all up..

  19. #94
    SitePoint Member
    Join Date
    Feb 2004
    Location
    san diego
    Posts
    7
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    and don't try to get any use out of your computer while your running it either..

    Here is the WSH code I pieced together..

    Code:
    'VBScript Example
    Set WshShell = WScript.CreateObject("WScript.Shell")
    Set WshShell2 = WScript.CreateObject("WScript.Shell")
    Set Args = WScript.Arguments
    Return = WshShell.Run("iexplore.exe", 3)
    WshShell.AppActivate "Internet Explorer"
    WScript.Sleep 2800
    WshShell.SendKeys "{F11}"
    WshShell.SendKeys "^o"
    WshShell.SendKeys Args(0)
    WshShell.SendKeys "{ENTER}"
    
    WScript.Sleep 8000
    
    WshShell2.Run("C:\capture\HQScreen.exe 0 PNG 24 picture C:\apache2\jamar\temp 1")
    WScript.Sleep 1000
    WshShell.SendKeys "{F11}"
    WScript.Sleep 100
    WshShell.SendKeys "%{F4}"
    Last edited by tr4nc3; Mar 9, 2004 at 21:09.

  20. #95
    SitePoint Member
    Join Date
    Feb 2004
    Location
    san diego
    Posts
    7
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Also you need to run a strong popup blocker because if a page pops up/under a window, the script doesn't close all the windows. Then the next time it's ran it doesn't display correctly.

    Maybe it could use mozilla as a browser? It has good popup blocking.

  21. #96
    SitePoint Member
    Join Date
    Feb 2004
    Location
    san diego
    Posts
    7
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Here is the that code again modified to work with Mozilla Firefox. You must make a shortcut to /program file../moz../firefox.exe inside of /windows

    Code:
    'VBScript Example
    Set WshShell = WScript.CreateObject("WScript.Shell")
    Set WshShell2 = WScript.CreateObject("WScript.Shell")
    Set Args = WScript.Arguments
    Return = WshShell.Run("firefox.exe", 3)
    WshShell.AppActivate "Mozilla Firefox"
    WScript.Sleep 2800
    WshShell.SendKeys "^l"
    WScript.Sleep 200
    WshShell.SendKeys Args(0)
    WshShell.SendKeys "{ENTER}"
    WScript.Sleep 200
    WshShell.SendKeys "%v"
    WshShell.SendKeys "t"
    WshShell.SendKeys "n"
    WshShell.SendKeys "{F11}"
    
    WScript.Sleep 8000
    
    WshShell2.Run("C:\capture\HQScreen.exe 0 PNG 24 picture C:\apache2\jamar\temp 1")
    WScript.Sleep 1000
    WshShell.SendKeys "{F11}"
    WScript.Sleep 200
    WshShell.SendKeys "%v"
    WshShell.SendKeys "t"
    WshShell.SendKeys "n"
    WScript.Sleep 100
    WshShell.SendKeys "%{F4}"

  22. #97
    SitePoint Member
    Join Date
    Feb 2004
    Location
    san diego
    Posts
    7
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    And now I've basically turned it in to a search engine or something..
    Last edited by tr4nc3; Mar 9, 2004 at 21:08.

  23. #98
    SitePoint Member
    Join Date
    Jul 2004
    Location
    Dallas, TX
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I have taken the codes from this thread and done a great job on capturing screen from more than 500 websites. However, there are two problems which won't let me run the scripts automatically.

    1. Sometimes, the bowser window size will be reduced and won't be the maximum size. How to insure each new window will be set to the maximum size?

    2. Some of my links require longer time to download. Is there anyway I can set the sleep time until it finish downloading?

    TIA

    Roger

  24. #99
    SitePoint Zealot amrknt's Avatar
    Join Date
    Nov 2003
    Location
    india
    Posts
    192
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    on of the DOMAIN registrar using same concept in site's WHOIS page. When you search for a partiuclar DOMAIN name it return with the screenshot of the website in WHOIS result. Unfortuantely I forget URL. But as soon as it will come in my mind I'll post it here. The URL was something like www.*******.de
    Sorry for an incomplete solution(?)

  25. #100
    SitePoint Member
    Join Date
    Mar 2005
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    this script makes sure the page has completely loaded before you do the screen capture. It is JScript, so save as .js file and you can execute it in windows.

    Cheers,




    // launch internet explorer with your URL
    var page = your_url_here;
    var ie = WScript.CreateObject( 'InternetExplorer.Application', 'ie_' );
    ie.Navigate2( page );
    ie.Visible = true;

    // wait until everything is done
    done = fale;
    while ( !done )
    WScript.Sleep( 500 );

    // events thrown by internet explorer
    function ie_DocumentComplete( obj, url )
    {
    if ( url == page )
    {
    // put your screen capturing code here...
    //.......
    // when things are done, close everything
    ie.Quit();
    done = true;
    WScript.Quit();
    }
    }


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •