Miscellaneous Code
  Home arrow Miscellaneous Code arrow Snapshot Taker
Codewalker Forums 
  Tutorials  
Database Articles  
Miscellaneous  
Navigation Usability  
PEAR Articles  
Programming Basics  
Server Administration  
XML Tutorials  
  Reviews  
Database Book Reviews  
Linux Book Reviews  
Miscellaneous Reviews  
PHP Book Reviews  
PHP Software Reviews  
Server Admin Reviews  
SQL Tool Reviews  
  Code Gallery  
Content Management Code  
Contest Code  
Counters Code  
Database Code  
Date Time Code  
Discussion Board Code  
Email Code  
File Manipulation Code  
GUI Code  
Link Farm Code  
Miscellaneous Code  
Search Code  
Site Navigation Code  
User Management Code  
Forums Sitemap 
Download TestComplete 
JMSL Numerical Library 
IBM® developerWorks
Weekly Newsletter 
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
MISCELLANEOUS CODE

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

    Table of Contents:

    Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    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

     

    IBM® developerWorks developerWorks - FREE Tools!


    Check out the new Jazz space on developerWorks

    <a href="http://zeus.developershed.com/shonuff.php?blackbird=3853&zoneid=442&source=&dest=http%3A%2F%2Fwww.ibm.com%2Fdeveloperworks%2Fspaces%2Fjazz%3FS_TACT%3D105AGY31%26S_CMP%3DDEVSHED&ismap="><img src="http://images.devshed.com/corp/img/news/jazz01.gif" alt="developerWorks Jazz space" align="left"></a>You've heard the buzz about Jazz... want to know more about it from a developer's perspective? Check out the Jazz space on developerWorks. This space is an up-to-date resource for developers, including technical information about Jazz and products built on Jazz, like Rational Team Concert Express. The Jazz space includes content from a wide variety of sources, including links, feeds, and comments from experts.
    FREE! Go There Now!


    NEW! Achieving True Agility -- How process can change the behavior of your tools

    Achieving true agility is a never-ending effort. We will showcase how you can become agile incrementally, a few practices at the time.Which practices should any agile team strive to adopt? What additional practices should you consider based on your needs to scale? Adopting practices are however made much easier with the right tool support. What about if your tools adapt to your practices? We will take a look at how the Jazz technology can be leveraged to make your process change the behavior of your tools.
    FREE! Go There Now!


    NEW! BlammoSplat: Build a community Web site of OpenLaszlo animations, Part 3: The community animation

    Learn to enable users to both rate existing animations and to combine existing animations into new snippets. This is the third in a series of three tutorials that chronicle the building of a site that enables collaborative discussion and animation building using Domino and OpenLaszlo.
    FREE! Go There Now!


    NEW! Build Web services with transport-level security using Rational Application Developer V7, Part 1: Build Web services and Web services clients

    Build secure Web services with transport-level security using IBM Rational Application Developer V7 and IBM WebSphere Application Server V6.1. Follow this three-part series for step-by-step instructions about how to develop Web services and clients, configure HTTP basic authentication, and configure HTTP over SSL (HTTPS). This first part of the series walks you through building a Web service for a simple calculator application. You generate and test two different types of Web services clients: a Java Platform, Enterprise Edition (Java EE) client and a stand-alone Java client. You also handle user-defined exceptions in Web services.
    FREE! Go There Now!


    NEW! Download a free trial of Lotus Quickr 8.0

    Visit IBM developerWorks to download a free trial version of Lotus Quickr 8.0, which enables collaboration by transforming the way everyday business content such as documents, rich media, photos, and video can be shared. Lotus Quickr makes it faster and easier to share content of all types (not just documents) within virtual teams. It is designed to make it easier to collaborate across organizational boundaries, while continuing to work within the context of familiar desktop applications.
    FREE! Go There Now!


    NEW! IBM Rational Systems Development e-Kit

    As systems increase in complexity, communication between systems and software teams becomes more and more difficult. Now, there’s a way to improve product quality and communication.<br />Read the “Model Driven Systems Development” white paper to see how. Also included in this kit are more educational white papers, customer examples, tutorials, informative Webcasts, and best practices for designing, building and managing systems.<br />
    FREE! Go There Now!


    NEW! Integrating XML into Your Enterprise Using Data Federation

    XML has become a common way of storing business data as flat files and many data server vendors including IBM have provided ways to store this data within relational database systems. Increasingly collections of XML files are accessed like databases using an xQuery and other XML standard mechanisms. Businesses find the need to combine the traditional tabular structured data with XML formatted data. In this webcast, you’ll learn about IBM’s WebSphere Federation Server technology, which provides users with the ability to integrate these two data formats.
    FREE! Go There Now!


    NEW! Trial download: IBM Rational Manual Tester V7.0.1

    Try the latest version of IBM Rational Manual Tester V7.0.1 by downloading a free trial from IBM developerWorks. This manual test authoring and execution tool promotes test step reuse to reduce the impact of software change on testers and business analysts and addresses the needs of teams performing at least a portion of their testing manually.
    FREE! Go There Now!


    NEW! Try the IBM SOA Sandbox for People

    Visit IBM developerWorks to try the IBM SOA Sandbox for people. The SOA Sandbox for people provides a trial environment with the necessary tooling and components required to enable consistent human and process interaction and collaboration, showing how you can improve user experience and business productivity.
    FREE! Go There Now!


    NEW! Webcast: WebSphere Process Server

    WebSphere Process Server delivers a unique integration framework that simplifies existing IT resources. Often, as IT assets grow to support business demand, so too does their complexity and manageability. In this webcast, we’ll discuss how WebSphere Process Server helps deliver an SOA infrastructure that provides a common model to orchestrate, mediate, connect, map, and execute the underlying IT functions. Discover how WebSphere Process Server simplifies integration of business processes by leveraging existing IT assets as reusable services without the complexities of traditional integration methodologies.
    FREE! Go There Now!



    All FREE IBM® developerWorks Tools!

    MISCELLANEOUS CODE ARTICLES

    - upload image to database sql
    - Random Password Generator
    - BCroot, get the root of a number with BC fun...
    - Find pi in a high precision
    - [PHP5] FORMCHECKER : data validation
    - SPL and ITERATOR : examples
    - Xml with Rss Feeds
    - [PHP5] NOTIMEOUT PACKAGE
    - Class to return variables to a Flash movie.
    - BCGCD Greatest Common Denominator (Large Num...
    - HMAC
    - Binary to Decimal
    - Decimal to Binary using logs
    - web.framework v1.0.0
    - Shopping Cart Class





    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway
    Stay green...Green IT