Application to handle form approval - php

Hopefully this is the right place for this question.
I have done a fair amount of research and yet to find anything that matches what I want. What I'm envisioning is the following. Let me know if any of you know of a program that will do what I want.
Also it must be web-based
anom user -> fills out form ->
email gets sent to admin saying xyz has filled out form abc with links to approve/disapprove request.
admin can also login and edit form and resent results to original submitter. Also once the admin approves/disapproves request the original submitter gets an approve/disapprove email.
and you can search by date submitted, specific project/form, status of request(submitted, approved, disapproved).
any ideas all on where I could find this? I started to look into drupal with workflows and actions but it just doesn't flow right for this

This sounds like you need to program the solution yourself, using something like PHP or ASP.NET (as you specified) as possible technologies, and a backend database like MySQL. If your process takes more than one sentence to describe, the exact system you want usually does not yet exist.
If you don't have the knowledge to code this, it sounds like you will need to hire someone who does. This isn't exactly a specific "how do I do this" programming question; this is a specification for an application, which a competent programmer should be able to turn into a working application for you.
Best of luck!

Related

Chat server and show user typing

I am working on a little test project to implement a chat server for a site I am working on. I have followed the guide from http://www.sanwebe.com/2013/05/chat-using-websocket-php-socket and I've got it all pretty much working, I've also managed to amend it slightly so that you can send messages to individual users instead of globally to all online users.
What I am looking for now though whether using the implementation as shown in the tutorial above whether I can show that the user is currently typing.
I was thinking about looking for key events and just send a system message to the user and I can handle this in the client to show typing and then if after a second nothing else has come in hide it again, but this seems a bit inefficient and network.
Would my idea above be the only solution or is there a better implementation?
It actually depends on your definition of "currently typing".
For me, that would be "there is some text in the input field".
This would require you to listen to change events on the input field and only send a message when the field turns from empty to non-empty or the other way round.
And, of course, the server would need to send a "stopped typing" message if the user disconnected.
However, if your definition is "user has touched a key in the last X milliseconds", then there is no other way but to constantly send messages.
Besides being more network-intensive, this option has the disadvantage of lags being shown as disconnects, possibly resulting in a shaky UI appearance.
Either way, I would listen for change on the input field, and not for actual key presses.

Using cookies, change "unviewed" to "viewed" in db when user views page

I'm trying to make a notifications system from scratch after looking around at ready mades and possible integratable versions that fell short.
I'm focusing on one aspect first: notifications for comments.
My database table comments looks like this: !(http://oi43.tinypic.com/2zgtaoz.jpg)
When a user submits a comment the recepient's ID is added to the field to_id.
unviewed is the default status of every comment.
Then I made this code to check for all unviewed comments:
SELECT COUNT(*) FROM comments WHERE to_id='$myid' AND status='unviewed'
I made some dummy comments and the count works 100%.
I also made a dropdown box to view the notifications in but the code is really long and not crucial to what I need to do next so I'll omit it unless needed to clarify later.
Now I'm trying to find out how I can change the value in the status field to 'viewed' when a user clicks through to it from their notifications menu.
Does anybody know how I can achieve this using php and cookies? Just looking for a point in the right direction, my mind is a bit frazzled after writing code all day.
Does anybody know how I can achieve this using php and cookies? Just looking for a point in the right direction, my mind is a bit frazzled after writing code all day.
You shouldn't reinvent the wheel. Just use one of the analytics frameworks available, such as google analytics. Note this is usually a paid service.
The approach you propose is slow, not scalable and rather limited.
The way it works, you just add a reference to JavaScript code. This code is located on a content delivery network, which means it is fast to get to the user. Usually, it is much faster than your production server. The code tracks a lot of user activities that can be valuable to a business. In most cases, such analytics is backed by nosql database.
Disclamer: I am not connected to any analytics framework in any way.
When you click a notification, I assume it is something basic like a checkbox or similar.
Just do a AJAX request or a simple POST request to a page called, maybe notif_read.php
There, get the value of the checkbox clicked and do a database query as follows:
"UPDATE Comments SET Status='viewed' WHERE to_id = '$myid' AND status='unviewed'"
Also, try using a simple boolean datatype for the status, since it makes things easier to update and check. Just a thought, will work as it is now.

Building a simple wedding RSVP system with PHP?

I am contemplating building a website for my wedding next year. It would contain information about the event, photos and blogs from my fiancee and I.... you get the picture.
One feature i'd like if possible would be a way of letting my guests RSVP online. I envision that their physical invite has a passcode, which they enter into a text field on the site and tick whether they can or can't attend.
The passcode they entered will be compared against a secure guest-list containing names and passcodes. If it doesn't match, they receive an error message, if there is match however, the information is then relayed to me via email. I will probably build the site using Wordpress, so I would be dealing with PHP.
Can anyone recommend how i might approach this project, as being a front-end dev I have absolutely no idea and my ambition exceeds my limited PHP knowledge.
Would love to hear your ideas or suggestions.
Speaking in generalities, for this sort of thing I find it useful to start by outlining the various components of the system.
While the info pages can be static, you'll need a database to which you can persist your invite data, so I'd start by thinking about the data entities. Devise a list of entities that will exist in the system that might need data tables. E.g. invite, blog post etc.
Then think about the operations that need to be performed on those entities. Are they read-only? Do you need to create new ones, or modify existing ones? You'll need to write code to perform those operations at some point.
Then think about the various ways information from those entities might need to be presented to the user. This gives you an idea of what templates you'll need to build.
If you're thinking of using Wordpress, you can cover off the blog functionality and static page stuff using that application alone. You'd then need to think about how the RSVP functionality might be implemented separately to Wordpress, or within it as a plugin. If you're really lucky, there might be a plugin out there already that will do what you need - or something similar that you can augment yourself.
If you're new to the backend side of things I'd recommend building a blog + static page site using Wordpress, getting it "done" and then looking at the RSVP stuff as a second phase. At least then if it proves unfeasible you still have a useful working site.
Hope that helps!
I'd build this as a simple plugin for WordPress and create an additional DB table that would hold the name against the passcode (this could be auto-generated based on the ID or otherwise).
You could then make a simple admin page when you can add new guests and check the response of guests.
First: congratulations with your marriage. From what I understand you have very little knowledge of PHP so start with reading a few books or articles about basic PHP/MySql. Then, put your ideas in a drawing or flowchart and just go for it. Make lots of mistakes, learn from them, ask for help on SO or a PHP colleague or friend. And above all, have fun doing it.
If I were in your shoes I would install the contact 7 plugin. In the contact form, add passcode as a required text input. Have the results emailed to you and to them. They could make up the passcode which is the downside.
This doesn't have all the options you are wanting but you can either spend several hours writing your own php code and then trouble shoot it, or just install the plugin and be done in 30 minutes.

How to prevent automated request?

I was wondering how to set up a system in which an authenticated user could send, with a simple graphical interaction (cliccking a button or so) a non-replayable request/message to the server from an application or a web page.
It's crytical there's must not be a way to set up an automated system that replaces user interaction automating the request as this would totally break up my entire project.
Moreover, as this action must be frequently repeated, it should not implement boring stuff like chaptas or so.
A pratical example: let's say the web page, shown after the login, displays a button that sends the server a request. How can I be sure the request was sent because the user actually clicked the button and it wasn't some sort of bot that forged the message?
Is that even possible to check? I'm sure it is and I'm quite sure there's must be some simple implementation I'm missing, and I'm sorry if this is a trivial question.
Also, if the solution is hiding ('cause I already searched a lot!) out there, please point me to it.
Thanks for your attention.
You could use a non-graphical captcha like a simple question.
Generate a simple addition of two random integers between 0 and 10.
Add a text field to ask for the result.
The result is very easy to find (for a human being), and very quick to type.
Example:
What is the result of 7+5? Write your result here: [_]
It should only block robots and very young or very stupid people.

Automate getting report from webpage

I'm a Java developer and I have a question about automating a task I've been given.
I'm having to 3 times daily, login to this website we have at work, select a few form elements and then click on submit to get a report printed out.
I'm wondering how I can write some sort of script that will automate this task? Where should I start? What language should I do it in? I was thinking PHP might be able to do this or even a greasemonkey script possibly?
Thanks a lot.
Check out cURL in PHP. It allows you to do all the normal functions of a web browser with code (other than moving the mouse). And yes, you'll need to do screen scraping.
I think the potential sticking point that hasn't been touched on yet is your phrase "login to this website"... Depending on how you need to log in, you may need to go in through a back door to access the report.
I had problems with this kind of thing in the past when I had to download a report from a third party site. The issue was that I couldn't authenticate to access the report parameters because of the hard-coded and less-than-script-friendly way I was required to log in to the site. However, I presume that your site is internal to your organisation, so it may be possible to bypass/rework the security requirements in order to access the data. If this is the case, then you should be able to use one of the screen scraping methods outlined above.
If not, you may need to incorporate the actual login procedure into your script or application, download and capture any cookies that may be set and incorporate them into your data request.
I don't know what language your form is written in, but what you could do is:
rewrite the form to a script which generates the report when called
use a cron entry to schedule this task to be done daily and mail the output to you
A cron is basically a scheduled task on Unix systems. Windows-based servers can use the Task Scheduler to much the same end.
The above assumes that you have access to the script which generates the report at the moment and can modify it / copy it to a new file which will email the output to you. If not, then you may need to look into screen scraping. As you're a Java developer, you may find this list of Java screen scraping utilities handy to get you started.
It's called "web scraping" or "screen scraping", and there are a lot of libraries out there to do this. I couldn't speak to a Java-specific tool, though: I'm a .Net guy (the .Net way would be System.Net.WebClient or System.Net.HttpWebRequest/System.Net.HttpWebResponse). But I'm sure there's something.
In the meantime, the first step is go to the page where you input the form values and view the source of the page. Look for the specific <form> element you're filling out, and see where it posts to (it's action). Then, find any <input> <select>, <textarea> elements you use, including any hidden inputs for the form, and figure out what values you need to get. That will tell you how to build your request once you find a library that will let you send it.
If you need to login to the site first to get to the page, things can be more complicated. You may need to retrieve and parse a session value or be able to send certain cookies to the server.

Categories