Showing posts with label based. Show all posts
Showing posts with label based. Show all posts

Thursday, June 23, 2016

Creating a file based log system

If we have a website we would certainly want to know the impressions of our website visitors. 

In addition to knowing about information of visitors, a log file is also useful to help analyse the security.

I will go directly to explain the log system file in PHP script: 

<?php 
// checking the bowsers type 
$agent = $_SERVER [HTTP_USER_AGENT]; 

// * checking where the script is executed from -- GET (URL) 
$uri = $_SERVER [REQUEST_URI]; 

// * checking visitors IP 
$ip = $_SERVER [REMOTE_ADDR]; 

/ * checking where the script is referred from 
$ref = $_SERVER [HTTP_REFERER]; 

// * checking visitors proxy
$original = $_SERVER [HTTP_X_FORWARDED_FOR]; 

// * checking visitors connection 
$via = $_SERVER [HTTP_VIA]; 

// * variable date 
$dtime = date (r); 

// * note if  visitors use transparent Proxy 
// * Then the $_SERVER [HTTP_X_FORWARDED_FOR] will display the visitors IP 
// * otherwise $_SERVER [ REMOTE_ADDR] will display the Proxy 
// * For clear about Proxy i will explain in another tutorial 

// * This is a description of variable entry_line: 
$entry_line = "Time: $dtime | Original IP: $ip | Browser: $agent | URL: $uri | referrer: $ref | Proxy: $original | Connection: $via 
";   // * <- Attention! This must be a new line or you press enter to create a new line 

/ * "fopen ()" function for opening files, "a" is the most important.!, 
/ * This works if the file "trace.txt" does not exist in the server then PHP will create 
$fp = fopen ( "trace.txt", "a"); 

/ /* "fputs ()" function for writing into the log file 
fputs ($fp, $entry_line); 

// * "fclose ()" function to close the file 
fclose ($fp); 

?> 

This file based log system using php function is pretty useful instead of using mysql connection

Saturday, June 18, 2016

AJAX Based Chat

This class can be used to implement a simple Web based chat system that uses AJAX to update the chat dialog display area without reloading the whole page.

The class generates a page with a Web form to submit what each chat line that the users type.

The chat lines are sent to the server using a XMLHttpRequest object.

The chat lines are received by a server side script that uses the class to store what each user entered in a MySQL database table.

In response, the class outputs the chat list already formatted to by displayed in the user browser pages.

chat.php Class The Main Class 2,662

 chat.sql Data The SQL code 527

 refresh.php Aux. Retrieve data from class 189

 submit.php Aux. Submits data to the class 201

 index.php Example Example file 69

You can download those files from phpclasses.org or from:
Download all files: ajax-chat-2006-10-06.zip (104380 bytes)

Tuesday, June 14, 2016

TCExam Computer Based Assessment PHP Script

TCExam is currently the most commonly used Free CBA Software in the world. TCExam users includes important universities, schools, public and private companies.

TCExam php script is Web-Based, platform independent, language independent (includes translations in several languages and RTL support) and conforms to W3C Accessibility and Usability guidelines to provide equal opportunity to people with disabilities, including blind users.

TCExam in php automates all assessment phases: authoring, scheduling, delivering, and reporting. Its easy to use and do not require expensive hardware to run, nor additional commercial software. Users connect to the TCExam system using a common Web-browser like Mozilla Firefox or Internet Explorer.

The general advantages of TCExam over traditional Pen-and-Paper Testing (PPT) includes: increased delivery, administration and scoring efficiency; reduced costs for many elements of the testing lifecycle; improved test security resulting from electronic transmission and encryption; consistency and reliability; faster and more controlled test revision process with shorter response time; faster decision-making as the result of immediate scoring and reporting; unbiased test administration and scoring; fewer response entry and recognition errors; fewer comprehension errors caused by the testing process; improved translation and localization with universal availability of content; new advanced and flexible item types; increased candidate acceptance and satisfaction; evolutionary step toward future testing methodologies.

Download TCExam Online Exam PHP Script

Monday, June 13, 2016

Update Multiple Records Based On Radio Buttons Using FOR EACH

Today I will share a code snippet which will enable you to update multiple records based on radio buttons selection.

Consider this scenario:

Players are applying to play for a football team. There are more players than there are places, so some will get to play for the First team, some for the B team, some will be in the Reserves, and some will not get selected at all.

If you want to be able to pull up all players and assign their application result in the database in one update process.

Now you can do it using FOR EACH as shown in the snippet below:


foreach ($_POST[result] as $id => $result) {

$results[$result][] = $id;

}

$query = "UPDATE tablename SET result = CASE ";

foreach ($results as $res => $ids) {

$query .= sprintf("WHEN id IN (%s) THEN %s ", join(,, $ids), $res);

}

$query .= END;


Hope php script can guide you in the right direction.

Enjoy!

Friday, May 6, 2016

cPanel Email Forwarder Creator Create Email Forwarders On cPanel Based Hosting In PHP

Create email forwarders on cPanel based hosting. No need to login to cPanel. Provide cPanel login and password once, and use this script each time you need to create email forwarder.
Can be run in either way:
- Parameters passed via URL (see example below)
- If no parameters passed via URL then will show email forwarder parameters entry form

Usage:
  • Update script with your cPanel login, password, skin (once)
  • When running script to create email forwarder, provide following data:
    • Username - create email forwarder for this username(sample: john)
    • Domain - create email forwarder for this domain (sample: mysite.com)
    • Redirect to - forward emails to address (sample: jimm@site2.com) 
Sample parameters passing via url: 

cpanel_email_forwarder.php?euser=john&edomain=site1.com&eforward=johny@site2.com 

Download cPanel Email Forwarder Creator PHP Script

Friday, January 22, 2016

Calendarix A Web Based Calendar In PHP

About Calendarix
A powerful and comprehensive web-based calendar.

Calendarix is a powerful and easy to use web-based calendar php script  that runs on PHP and MySQL.

It has been developed with ease of use and quick access to information in mind.  It provides the user with the quickest possible navigation and accessing the most commonly used functions in the shortest steps.

Colors and fonts can be easily customized through style sheets and displays saved as themes.

A free version is available for download that would provide most basic calendar functions.

An advanced version is also available at a small price for those demanding more powerful features and greater interactivity with their calendars.

Key Features
Basic


  •     Public/Private calendar access
  •     Approvals
  •     Mini-calendar
  •     Customisable display through style sheets
  •     Optional advanced text editing with FCKeditor

Advanced (includes Basic features)
  •     Additional fields for location and fees
  •     Special day markers (holidays/anniversaries)
  •     Unlimited sub-categories
  •     Scheduled Reminders
  •     Notifications/Invitations/Responses
  •     RSS feed
  •     vCal/iCal exports 
 Download Web Based Calendar PHP Script

Note: Download the FCKeditor.zip and unzip it to be below the Calendar directory. Open cal_config.inc.php and modify $FCKEditorBasePath and $useFCKEditor to use it.