Photographic Decay by Page Hits - javascript

I'm a beginner in all things code, but am extremely interested in working with it. I am a photo student wanting to integrate digital media and my photographic processes. I was seeing if anyone had any advice for a problem I'm having. I started using Processing to achieve a "generation loss" compression effect to my photographs, and I want to move that to the web. So what I want to happen is every time someone goes to the specified web address, the application, will continue. For example, if I am the first user there, I see the first photograph in the sequence. If I am the 650th person, I see the 650th image. I was wondering if anyone had any suggestions, if I should continue trying to use Processing, or use a javascript, or any other means. Any help would be greatly appreciated! I can also post what I'm using in processing and such. Thanks so much in advance.

You have to break this down into a few pieces:
The first piece is the actual algorithm that "decays" an image based on some number. It sounds like you have that working.
The second piece is storing that number on a server somewhere so that it can be accessed and modified by various users over multiple sessions. It sounds like that's the part you're confused about.
There isn't a way to automagically store variables across multiple runs in a Processing sketch. After all, that entire thing is actually being run on the clients' computer! But what you can do is store the variable in a central location so that everybody can "share" that variable.
There are many ways to accomplish that, which is why people are saying your question is too vague. The most obvious solution would be to use a database, although using a database to store a single number might seem like overkill. You could also setup your web server to increment a number stored in a file every time the page is accessed.
Which approach you take depends on the setup of your program, web server, as well as your own comfort level with programming.
Good luck! It sounds like an interesting project.

Related

My games being hacked easily by right click inspect. How can i prevent this?

I am a newbie game maker that making some web games with the language of JS, HTML and CSS. But the problem is i can't prevent the right click inspect hacking thing, so a people hacked my games by using this method.
My question is, how can i prevent this method to not to being hacked...
Here is my game http://ozansiar.com/mario/oyunok.php
Here is the score page http://ozansiar.com/mario/skorekran.php
as you can see it can be hacked...
Language is Turkish, sorry for not doing this in English, but i will.
Second question is, how can i improve my game developing? I heard that phaser is a good engine, so i'm doing a research for reach to some tutorials. But also, i need some good advices from you...
Sorry for my newbie questions, but i do need some good advices to improve my web development and also game development skills... Thanks so much!
Note : Games are made by what i learned from stackoverflow community... So also thank you very much for this.
Client-side code (HTML, CSS, JavaScript) is called "client-side" because it is downloaded to the client and executed there. There is absolutely nothing you can do to protect this code from users seeing it and modifying their local copy of it. Even storing your JavaScript in an external file and linking to it does not solve the issue. The same is true with obfuscation.
All protected code should exist on a secure server and execute there in a "server-side" architecture, such as .aspx, .PHP, .jsp, etc.
So I just ran through the game and "hacked" it. The problem you have is that you use forms and hidden inputs to send the game results to the server, first when the user finishes the game you submit the time it took them, then on the second page you send their final score in a hidden input. Both of these can be easily modified by the user before they're submitted.
What you could do is create a checksum of the hidden values that you don't want the player to modify. After they're posted to the server, use the values to re-calculate the checksum in PHP, and if it doesn't match the checksum submitted by the browser, don't accept it.
This won't stop people from hacking your game, but it will make it more difficult. If they absolutely want to fake their score, they can look up the javascript function you use to generate the checksum on the client side and use that to generate a new one with the values they want, so it's not 100% secure.
As for the final score, I'd suggest you use a session for that. Your skor.php file generates a form with the final score in a hidden input. Why? Just dump it in a session property, and read that back in skorislendi.php. That way, the user won't be able to edit it.
You can't prevent the client, i.e. the player, from hacking client side materials, i.e. client-side scripts, HTML and etc... Any legitimate actions that your scripts perform on the client side can be faked. At best, you can mitigate such hacks by obfuscating your JS code and post data. This makes it harder to hack but doesn't save you.
In the end, ask yourself this one question. Is security essential to my game? If it is, then worry about it. Otherwise, build what you can and from an agile point of view, add features, such as security, when NECESSARY.

Just want to make sure I'm doing things right

I am planning on creating a website with one of my friends. Both of us know next to
nothing of coding and programming. We are planning to display hundreds, potentially thousands
of images on this website. These images will have a short description, and will not be user uploaded, but we may potentially want to implement an option to save the favorite images.
There will be a button that randomizes the images shown (one image at a time). Users will click this button and it will randomize from all the images, displaying a new one on the screen replacing the old one. Is it possible to write code that makes it so it will display a new random image, but not repeat the same image until it has cycled through all of the images (potentially thousands)?
Just from browsing the web, looking at tutorials, and reading some other stuff we've have a general idea of what needs to be done. We need to store the images as files on a server, and store the description of the images and file path on a database. To create the button function we use javascript(?) and write a script that will randomize. Someone mentioned JSON but I don't know what that is.
Are we on the right track? We are both currently looking into PHP. Although we have a general idea of what needs to be done, we don't know where to start as far as tying this whole project together.We are trying to figure out how to start saving the images as files, and implementing them into the database but don't really know how.
tl;dr We would like some guidance on where to go with this, how we can possibly tie all of this together, and if we have the right idea of what to do.
Learning this stuff out of the blue can seem kind of overwhelming at first, that is why I'm extremely grateful for all the advice and answers.
Forgive me for leaving this as an answer. I don't have enough rep to leave it as a comment.
Programming is all about problem solving one step at a time. I'd suggest writing a basic list of all the things your program must do. For instance, in your case, the list may start like:
1. Store img file path in database
2. Retrieve img path from database to display on webpage
3. Attach a description to img
4. Write code to randomize images
5. Write code to display images
6. Etc. etc.
Once you have this, you can start looking into which programming languages are best suited for the task. First each task, you'll usually have several options. For instance, you may decide on PHP or ASP.NET for tasks involving your server. Or JSON vs XML for handling data. I good place to browse basic language capabilities is w3schools.com. They provide pretty basic stuff that someone with no programming experience can understand. Hope this helps! Good luck!
You might be able to limit your technical needs quite a bit in my opinion.
As far as I have understood what you wanna do, you won't really need a server-side scripting language and you won't need a database neither.
And if you are totally new to programming then you would profit a lot on restricting yourselves to one programming language instead of having to learn three (for example PHP, Javascript and MySQL).
So you would "just" need to learn a bit of HTML, CSS and Javascript.
To store the images on your webserver, you just need some FTP client. You will need the FTP client or some editor with FTP client included to upload your HTML, CSS and Javascript files as well anyways.
To save the link or url to your images, you don't necessarily need a database. for example you can put all the images into your HTML code with <img> tags. you can initially hide them by CSS. Or you save the urls of your images by using Javascript arrays or objects (JSON means nothing else than JavaScript Object Notation).
All the logic can be done by Javascript itself. You can use it to randomize the images you wanna display plus to save the images a user already has seen.
TL;DR: I recommend that you restrict yourselves to "just" learning a bit of HTML, CSS and Javascript. Seems like everything you wanna do can be done without needing a server-side programming language or a database.

Creating a note taking app using JQuery mobile and phone gap

I have an app i'm developing with JQ Mobile and PhoneGap. Within this app, i want to include a 'Notes Taking' page and it has to do the following.
Make new notes and save them locally.
Recall them whenever i need to,
Edit them and delete them
i could not find a good example to follow, i tried this:
http://tutorialzine.com/2012/09/simple-note-taking-app-ajax/
but he lost me at the index php and how to implement that, i also tried this example:
http://miamicoder.com/2011/building-a-jquery-mobile-application-part-1/
but its so complex i got lost in all the code.
I'm a beginner at programming and my JavaScript is very very poor and i have no idea where to start and what kind of code is involved in making this part of the app.
Please help. Thank you.
Your first site (http://tutorialzine.com/2012/09/simple-note-taking-app-ajax/) will not work for you as the examples are embedding PHP into the html and that is not acceptable with phonegap apps.
Your second site is making it way more complicated than it needs to be for your limited scope.
Not going to do this for you but I will give you some advice and places to look.
Draw out what you want the user interface to look like and create that html
Create a load and save function in javascript to... well... load and save your notes. Take a look at the below references:
This will show you how to interact with the local database and store and retrieve info. Always a good thing to read the documentation.
This is a great resource for help all sorts of stuff. In this case, with SQL queries.
Test, test, test. With the above, you will be able to figure it out if you put your mind to it. Come back here and post specific questions with code samples of what you have tried if you get stuck.

Is there any way to prevent people from making my web game available offline?

It's not the type of game that really need a server to operate. I'm using javascript and html5 right now, and I cant think of a way to prevent the game from being rip off.
Using obsfucator is useless, the game would still work offline.
Implementing a validation scheme is not invincible either. Someone smart can just crack the script and remove the validation part.
Make it attractive for users to play on your site.
For example:
Provide online Highscores.
Introduce a multiplayer option
Create friends list
Provide a server based achievement system
Develop other games and provide them on the same page so users want to come back
Create "level packs" and similar add on content and release them on your page
Overall, there are other possibilities to get users to play on your site besides technical restrictions, which - as you already found out - are difficult to deploy in an open source, browser driven environment. But, on the web, this has always been a feature, not a bug.
You're right in that a clientside-only can't be prevented from running offline. How about moving part of the game logic to the server?
You could continue to use html5 and javascript, but move your javascript to the server side using node.js For example http://www.yuiblog.com/blog/2010/09/29/video-glass-node/
If you combine obfuscation and validation, you'll go a long way. Can someone crack and use it offline? Possibly. Is it really going to be worth the effort? I mean, even an installed game can be cracked. This is especially true if you make the validation extra obfuscated by hand by spreading it out over several methods.
I would avoid moving more logic to the server than you have to, because it would obviously slow the app way down, but you might be able to get away with moving tiny crucial pieces that only happen rarely like between levels (chapters?).

What's the best way of stopping users from copying and pasting text from a web app?

The site I'm working on displays some proprietary 3rd party data that's quite valuable. As such they want to stop people copying and pasting their information. They understand that, of course, there's nothing we can do to stop users just writing down info or printing it off, but they want to make it as difficult as possible for their data to be taken. The other big concern is performance. The site sees a healthy amount of activity, so keeping it snappy is a big deal.
I was hoping to get a bit of feedback from you guys on the best way of accomplishing this
Some potential solutions that have been suggested:
Use a bit of javascript to stop users hitting ctrl / right clicking (irritating and won't stop more advanced users)
Use flex (very slow, but very safe since the data is binary)
Create or find some funky html to image converter and display the data as images
Your thoughts and opinions are very welcome.
Thanks in advance!
Charge the users for access to the information.
You can try all sorts of code workarounds, but you really aren't going to stop anyone who is determined. By charging, you limit access to people who really need the information and if they copy it, then at least you've been reimbursed. It also filters out a lot of the people who would use it maliciously. Also, put a legal notice on the information detailing how it can be used so that you can follow up copiers with legal action if necessary.
This really sounds like a serious problem with the origins of the question. If this is something that shouldn't be easy to copy, why is it visible at all?
If its really proprietary, why is it a good idea to post it on the web?
Seems that an internal webpage would be more appropriate.
It is a tricky situation, since this is the web...
You could use a very small bit of flash to display the sensitive data, which you'd have complete control over, and if it's small, shouldn't hurt your download times. This would probably be my preferred method.
Option #3 would stop people from copying and pasting, but it wouldn't stop them from downloading the image. I'm not sure if that matters to you.
Do you need to serve audiences that have javascript turned off? If not, you could use AJAX to pull the sensitive information in the first place, then use a script to stop them from copying that div or whatever.
You might want to check out Tynt Tracer. It doesn't prevent copying, but at least allows you to track where it's going...in part anyway.
You might look at the option 1, as a "bare minimum" way of doing it, but admittedly it isn't a great option, as simply disabling JS gets around it.
Your third idea would also work, but you can actually make it easier to save by going to the image and the way they are stored in temporary internet files.
Also, as a side note, to prevent printing you might want to specify a print only CSS that hides all content.
body {display:none;}
It isn't perfect, but again stops the casual user from printing.
Charging money for the content is a good answer, but I'm guessing you're already charging for the content.
#2 is clearly the most secure option, and the most flexible, allowing you to really punish yourself as much as possible as well (do things like implement over the wire encryption etc...) So it should come as no surprise it is also the most expensive to implement.
Given, someone can just decompile your code and inspect memory, but at that point, it is doubtful you are going to stop anyone.
Offer the information for download in password protected pdf, where the only thing that they can do is to view it, no printing, copy paste, etc. Although you can't stop a print screen. Primo PDF can do that for you and is free. http://www.primopdf.com/
They key here is the that effort it takes to bypass any solution you choose, is greater than the value of the information you are trying to protect from being copied.

Categories

Resources