Miscellaneous Code

  Home arrow Miscellaneous Code arrow Snapshot Taker
MISCELLANEOUS CODE

Snapshot Taker
By: Codewalkers
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 7
    2003-01-05

    Table of Contents:

     
     

    SEARCH CODEWALKERS

    TOOLS YOU CAN USE

    advertisement
    This is a simple script that takes a snapshot of what your screen. Check out http://www.sitepointforums.com/showthread.php?threadid=89660&highlight=snapshot&pagenumber=1 for details and how to use JS with it :)... clete2@sowibb.com

    By : Clete2

    <?php

    /*

    ~~~README~~~

    Change your paths and everything.

    NOTE that a script is never done and I have not changed it a bit when I copied/pasted it in here. If you have any problems, e-mail me at clete2@sowibb.com or look for me on AIM as CleteBlackwell

    Add this to your MySQL DB:

    CREATE TABLE finished (
    id int(11) NOT NULL auto_increment,
    ip varchar(15) NOT NULL default '',
    KEY id (id)
    ) TYPE=MyISAM;

    CREATE TABLE queue (
    id int(11) NOT NULL auto_increment,
    time varchar(255) NOT NULL default '',
    KEY id (id),
    KEY time (time)
    ) TYPE=MyISAM;


    Then, download http://www.howiesfunware.com/ScreenCp.exe.

    Next, make vars.php and put your MySQL stats in there, $host, $user, $pass, and $db.

    Again, if you have trouble, contact me. It only works on windoze :(. Enjoy.

    */

    // Grabbing our stats

    require("vars.php");

    $connect = mysql_connect($host,$user,$pass);
    mysql_select_db($db,$connect);

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

    @mysql_query("SELECT time FROM queue ORDER BY time ASC LIMIT 0,1");

    ?>

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

    <?

    else:

    $currwindow = $_GET['currwindow'];

    if(!isset($currwindow)):

    $currwindow = 0;

    endif;

    // Seeing if it is ok to let the user take a
    // Snapshot. If not, make them wait 30 seconds.

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

    $time = date("mdHis");

    // Change the 30 on the below line to how many
    // Seconds you wish for them to wait for their
    // Very own snapshot... of your computer

    $read = $read + 30;

    if($time >= $read):

    $countread++;

    $remote_addr = $_SERVER['REMOTE_ADDR'];

    @mysql_query("INSERT INTO finished SET ip = '$remote_addr'");

    // Write how many people have gotten their shot
    // Successfully because this one is getting his.

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

    // Set the time so that the next person still has
    // To wait

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

    // Make sure that it does not make picture002.png

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

    // The very most important part, actually take
    // The shot

    // C:\HQScreen.exe make_sound file_type(no gif)
    // quality filename_without_extension file-folder
    // $currwindow is take only the current window?

    exec("C:\HQScreen.exe 0 PNG 8 picture C:\ ". $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/index.php">here</a>.
    <br />
    <br />


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

    </div>

    <?

    else:

    $time1 = $_GET['time'];

    $sql1 = @mysql_query("SELECT * FROM queue WHERE time = '$time1'");

    $sql = @mysql_query("SELECT * FROM finished");
    $count = mysql_num_rows($sql);

    if($count <= 1){

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

    }else{

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

    }

    $lastshot = $time - $read + 30;

    $timeuntillshot = 30 - $lastshot;


    ?>

    <META http-equiv="refresh" content="<?=$timeuntillshot?>; URL=http://216.143.50.59/test/index.php?currwindow=<?=$_GET['currwindow']?>&inserted=1&time=<?=$time1?>&id=<?=$sql['id']?>">
    <div align=center>Sorry, but someone else is currently using this script, this page will refresh when your screenshot is ready. This may take up to 30 seconds.
    <br />
    The total wait time between one snapshot and another is 30 seconds.
    <br />
    <?=$count?> <?=$people?> <?=$have?> successfully recieved their snapshot.
    <br />
    The last snapshot was taken <?=$lastshot?> seconds ago.
    <br />
    </div>

    <?

    endif;
    endif;

    ?>

    <div align="center">
    <br />
    <br />
    <br />
    <br />
    <br />
    &copy; 2003 <a href="http://www.scriptingresource.com/"><b>The</b> Scripting Resource</a>
    </div>
    DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware.

    More Miscellaneous Code Articles
    More By Codewalkers

    blog comments powered by Disqus

    MISCELLANEOUS CODE ARTICLES

    - Creating a Web Page Controller with the HMVC...
    - Coding Controllers and Views for the HMVC De...
    - A Sample Web Application with the HMVC Desig...
    - Adding a Class to Parse Views to an HMVC Des...
    - Building a Model Class for the HMVC Design P...
    - Filtering Input Data and Generating HTML For...
    - The HMVC Design Pattern: Working with MySQL ...
    - Dispatching Requests to MVC Triads with the ...
    - Implementing the Hierarchical Model-View-Con...
    - A Web App Based on a Model for the CodeIgnit...
    - Completing a Model for the CodeIgniter PHP F...
    - Validating Input Data with the CodeIgniter P...
    - Deleting Database Records with the CodeIgnit...
    - Inserting Database Records with a CodeIgnite...
    - Fetching Database Rows with a Model for the ...


    © 2003-2012 by Developer Shed. All rights reserved. DS Cluster 2 - Follow our Sitemap