Solved

Web statisics with php

Posted on 2001-06-20
2
180 Views
Last Modified: 2008-03-06
Does someone know a good statistic software written in php. (visitors/browsers etc..) with grafic output ? (for freeif possible)
0
Comment
Question by:Oliver_Dornauf
2 Comments
 
LVL 11

Accepted Solution

by:
jimmy282 earned 100 total points
ID: 6213137
0
 

Expert Comment

by:FLA84
ID: 10812652
I am very new at PHP please help.
I have created a HTML Form with Java and it calls my PHP script that
displays your information entered.  Upon clicking the submit button
it should write your name to a text file on the server.
see sample HTML Form below...

                               <script LANGUAGE="JavaScript">
<!--
function submit_form(strPage){
var msg;
if (document.form.A0000001.value.length <3) {
   msg = "You Must Enter Your Social Security Number Correctly\n";
   msg += " \n";
   msg += "     Please try again\n";
   alert(msg);
   return false;
}
if (document.form.A0000002.value.length <2) {
   msg = "You Must Enter Your Social Security Number Correctly\n";
   msg += " \n";
   msg += "     Please try again\n";
   alert(msg);
   return false;
}
if (document.form.A0000003.value.length<4) {
   msg = "You Must Enter Your Social Security Number Correctly\n";
   msg += " \n";
   msg += "     Please try again\n";
   alert(msg);
   return false;
}
if (document.form.A0000004.value <= " ") {
   msg = "You Must Enter Your Last Name\n";
   msg += " \n";
   msg += "     Please try again\n";
   alert(msg);
   return false;
}
if (document.form.A0000006.value <= " ") {
   msg = "You Must Enter Your First Name\n";
   msg += " \n";
   msg += "     Please try again\n";
   alert(msg);
   return false;
}


else{  
   
    document.form.action=strPage;
    document.form.submit();}
      
}
//-->
</script>

<html>
                         
                  
<html>

<head>
<title>BERNARD TEST PAGE Application</title>
<style TYPE="text/css">

</style>
</head>

<body background="paperbkg.gif">

<form name="form" ACTION="TEST1HandleForm.php" method="post">

        </center></div><div align="center"><center><table border="0" cellpadding="0"
      cellspacing="0" width="100%">
       
      </center></div></td>
   
  <p>&nbsp;</p>
 
  <p>&nbsp;</p>
  <div align="center"><center><table width="80%" border="1">
    <tr VALIGN="TOP" ALIGN="LEFT">
      <td colspan="2"> U.S. Social Security number: <font color="#FF0000">*</font>&nbsp;&nbsp;&nbsp;
      <input NAME="A0000001" VALUE SIZE="003" MAXLENGTH="3">-
        <input NAME="A0000002" VALUE SIZE="002" MAXLENGTH="2">-
        <input NAME="A0000003" VALUE SIZE="004" MAXLENGTH="4"> <p><font
      color="red">&nbsp;(If you do not have a Social Security Number, please download printable application and mail to Admissions Office.)</font></td>
    </tr>
    <tr>
      <td>Last name: <font color="#FF0000">*</font></td>
      <td><input NAME="A0000004" VALUE SIZE="025" MAXLENGTH="17"></td>
    </tr>
    <tr VALIGN="TOP" ALIGN="LEFT">
      <td>Jr., III, etc. </td>
      <td><input NAME="A0000005" VALUE SIZE="003" MAXLENGTH="3"> </td>
    </tr>
    <tr VALIGN="TOP" ALIGN="LEFT">
      <td>First name: <font color="#FF0000">* </font></td>
      <td><input NAME="A0000006" VALUE SIZE="025" MAXLENGTH="15"> </td>
    </tr>
    <tr VALIGN="TOP" ALIGN="LEFT">
      <td>Middle name: </td>
      <td><input NAME="A0000007" VALUE SIZE="025" MAXLENGTH="15"> </td>
    </tr>
  </table>
  </center></div><p>&nbsp;</p>
  <hr>
 <p align="right">      
<table border="0" cellpadding="0" cellspacing="0" width="30%">
    <tr>
      <td width="50%"> <input type="reset" value="Reset"
      name="reset" style="background-color: rgb(0,128,0); color: rgb(255,255,255)">
   <input type="button" value="Continue"
      name="continue" style="background-color: rgb(255,128,64); color: rgb(255,255,255)"
      onClick="javascript:submit_form('TEST1HandleForm.php')"></td>
    </tr>
  </table>
  </div>
</form>

<p>&nbsp;</p>
</body>
</html>

The php script  comes up fine  and writes a comma when I place 'submit' inside of
the empty check if ( !empty ($_POST['$Name'])) {   instead of '$Name'  . Can someone
please give me some help here I think I am luke warm ... Please see PHP script below
Thanks in advance....... FLA84

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML
1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
     <meta http-equiv="content-type"
     content="text/html; charset=iso-8859-1" />
     <title>BERNARD TEST PAGE Application</title>

</head>

<body background="paperbkg.gif">
<?php
@extract($_POST);
//Address error handling.

ini_set ('display_errors', 1);
//error_reporting(E_ALL); // report everything
error_reporting (E_ALL & ~E_NOTICE);

/* This page receives and handles the data generated by "form.html". */
$idnum = $A0000001 . '-' . $A0000002 . '-' . $A0000003;
$Name = "$A0000004,$A0000006";
print "Your name concatenated is $Name. <BR>\n";
print "Your soc. sec num. is $idnum.<BR>\n";
print "your Last name is  $A0000004.<BR>\n";
print "your First name is $A0000006.<BR>\n";

print "<p> Your information will updated upon clicking the Submit button.</p>";

if(isset ($_POST['submit'])) { // see if Handle form submitted.

  if ( !empty ($_POST['$Name'])) { // Check for required value.

    if ($fp = fopen ('OUTPUT.txt','ab')) { // Try to open file.

        $data="$Name\n";

  fwrite ($fp, $data); // Write the data. Use \r\n on Windows.
  fclose ($fp); // Close the file
print "<p> Your application has been added to the data base.</p>";

} else { // Could not open the file. cond 3
     print "<p> Your information could not be stored due to a system error. </p>";
   } //end of cond 3
} else { // Failed to enter all your data.
    print "<p> Please enter all required data!</p>";

} // end of cond 2

} // END of SUBMIT IF. end of cond 1

// Leave PHP display the Form

?>
<form action="TEST1HandleForm.php" method="post">
<p>
<br />
<input type="submit" name="submit" value="SUBMIT" />
</p>
</form>
</body>
</html>
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Author Note: Since this E-E article was originally written, years ago, formal testing has come into common use in the world of PHP.  PHPUnit (http://en.wikipedia.org/wiki/PHPUnit) and similar technologies have enjoyed wide adoption, making it possib…
Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now