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  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
Download TestComplete 
Forums Sitemap 
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 / 7
    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!


    NEW! Addressing software-as-a-service challenges using Tivoli security and WebSphere solutions

    Building a software-as-a-service solution requires addressing a few key technical challenges. In this webcast, we'll focus on the role of IBM Tivoli Directory Server and WebSphere Portlet Factory in creating a Software as a Service solution. We will demonstrate how to use Tivoli Directory Server to prevent the user population of one tenant from accessing the virtual portal and portlet components of another tenant. We will also use the dynamic profile capability of WebSphere Portlet Factory to create multiple highly customized applications from one code base.
    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! 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! Rational 'Talks to You' Teleconference Series

    This Fall, IBM Rational talks to you directly through a special teleconference series giving you access to the best minds in IBM Rational - product experts and market thought leaders who will answer your questions during these pre-scheduled telephone conference calls. Register today!
    FREE! Go There Now!


    NEW! Rational Talks to You: Manage RUP-based CMMI initiatives

    Join this Rational Talks to You teleconference on December 4 at 1:00 pm ET to discuss how Rational Method Composer can help meet your compliance objectives. Get your questions answered!
    FREE! Go There Now!


    NEW! Software Change and Configuration Management Solution Guidelines

    This whitepaper provides areas to consider when evaluating any software configuration management solution. It addresses how the IBM solutions (Rational ClearCase and Rational ClearQuest) meet the needs and requirements of both project leaders and developers to provide successful Software Change and Configuration Management.
    FREE! Go There Now!


    NEW! Try IBM Rational Asset Manager V7.0 online!

    You can now evaluate IBM Rational Asset Manager V7.0 online without installing or configuring it on your own system! Rational Asset Manager helps create, modify, govern, find, and reuse any type of development assets, including SOA and systems development assets. Rational Asset Manager helps you reduce software development costs and improve quality by facilitating the reuse of all types of software development-related assets. Visit developerWorks to learn more about this product and register to explore its capabilities online.
    FREE! Go There Now!


    NEW! Using IBM Rational Developer for System z and IBM Rational ClearCase together to manage application development

    Whether you are creating new applications or modifying existing ones, managing integration of new components with traditional z/OS elements is a critical part of building and deploying modern applications. Listen to this webcast to see how IBM can help you optimize your development process using an IDE like Rational Developer for System z that integrates with management tools, such as ClearCase to manage your application development on mainframes.
    FREE! Go There Now!


    NEW! Webcast: Introducing the new Information Server and Solutions community: LeverageInformation

    User communities play an important role in communication and collaboration around products, solutions and other areas of special interest to members. Successful communities are able to provide the right mix of content and services to deliver a value proposition that resonates with each audience. Join Tom Inman, VP of Marketing for Information and Platform Solutions as he introduces the new LeverageINFORMATION community. During this webcast, learn about the value provided by the community and how customers and partners derive value from the community in addressing their own technical and business challenges.
    FREE! Go There Now!



    All FREE IBM® developerWorks Tools!

    MISCELLANEOUS CODE ARTICLES

    - 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 ...
    - Model Data and Validation Rules for a Generi...
    - Building a Generic Model for the CodeIgniter...
    - 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





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 6 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek