
ECTG on July/02 |
| HOW CAN I PASS MY SQL TABLES TO MY MSSQL SEVER OR MYSQ, SIMPLY REQUEST TO EXPORT THEM FROM THE FILE MENU AND THEN CHOOSE THE FORMAT, HOW YOU LIKE THEM TO BE SAVED. ASP WOULD BE NICE IF YOU WORK ON IIS OR ISAPI OR PWS. |
|
So export and save as asp, active server page became the solution, though you also will notice that, all files are liable to be compacted all files also will be locke on demand, then you will see 2 files,,,,,file.mdb, and locer.ldb
|
| ECTG on July/02 |
Fully loaded versions of aid software are to be installed on your server root directory, on demand, initiated by ini files either on the win sys foler or on the c:/main dir.
|
Currently I am using, three db engines 2 ver of mysql and one ms sql Please be aware that for ms sql you don’t use Once all is loaded with the server you just need to run your apache machine to support your functions on the php part. A real problem on some severs would be, the errors, why? , guess they must be due to the differences of the implantations of one task: ex: the left toc = table of contact, as a menu on the left side of a browser would vary from ado to java applets,….how to refresh your setting and how to ensure that no several copies of one file are loaded causing more, conflicts…. |
|
WHAT TO DO IF YOUR FPAGE SERVER IS NOT CORRECTLY INSTALLED? errors due to previous fp installations…..
|
1. Delete the \Program Files\Microsoft FrontPage\version3.0 directory including all files and sub-directories.
2. Run IIS Setup and reinstall the FrontPage Server Extensions.
Some of the functionality available in the documentation's left frame, such as the table of contents (TOC) synchronization button, may not function properly if you have a previous version of Hhctrl.ocx installed. Because version control for this file has not been activated in the documentation, please search for Hhctrl.ocx and delete any other copies/As I searched for this file personally I found nothing.....!
Errors that occur during unattended setup will be
written to the Windows 98 registry. Navigate to the following registry path
for error
information:
HKEY_LOCAL_MACHINE\
Software
\Microsoft
\Windows
\Setup
\OCmanager
\Errors
| The best way to get there: got to edit in start, and type, regedit. please do so, try not harm any other files, in your search. |
· Running Personal Web Server 4.0 on a computer with an Intel 486 processor that is slower than 50 MHz and has 16 megabytes or less of RAM, increases the likelihood that the script engines degrade into a memory heap packing mode, a process which will prevent the the server from accepting new connections. The heap packing process may take 20 to 30 minutes to complete (depending on the speed of the microprocessor).
THE CODE WAS MADE BY GENU THE FREE ORGANIZATION OF SOFTWARE.
HERE IS THE ADDRESS AND THE NAMES OF MANY OF ITS CONTRIBUTORS.....
phpMyAdmin - Readme
A set of PHP3-scripts to adminstrate MySQL over the WWW.
Version 2.1.0 - 08/06/2000
http://www.phpwizard.net/projects/phpMyAdmin/
Copyright (C) 1998-2000 Tobias Ratschiller <[email protected]>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Requirements:
PHP3
MySQL (tested with 3.21.x, 3.22.x and 3.23.x
a web-browser (doh!)
Summary:
phpMyAdmin is intended to handle the adminstration of MySQL over the WWW.
Currently it can:
- create and drop databases
- create, copy, drop and alter tables
- delete, edit and add fields
- execute any SQL-statement, even batch-queries
- manage keys on fields
- load text files into tables
- create and read dumps of tables
- export and import CSV data
- administer one single database
Download:
You can get the newest version at http://www.phpwizard.net/projects/phpMyAdmin/.
Credits:
This work is based on Peter Kuppelwieser's MySQL-Webadmin. It was his idea
to create a web-based interface to MySQL using PHP3. Although I have not
used any of his source-code, there are some concepts I've borrowed from
him. phpMyAdmin was created because Peter told me he wasn't going to further
develop his (great) tool.
Thanks go to
- Amalesh Kempf <[email protected]> who contributed the code for
the check when dropping a table or database. He also suggested that you
should be able to specify the primary key on tbl_create.php3. To version
1.1.1 he contributed the ldi_*.php3-set (Import text-files) as well as
a bug-report. Plus many smaller improvements.
- Jan Legenhausen <[email protected]>: He made many of the changes that were
introduced in 1.3.0 (including quite significant ones like the
authentification). For 1.4.1 he enhanced the table-dump feature. Plus
bug-fixes and help.
- Marc Delisle <[email protected]> made phpMyAdmin language-
independent by outsourcing the strings to a separate file. He also
contributed the French translation.
- Alexandr Bravo <[email protected]> who contributed tbl_select.php3,
a feature to display only some fields from a table.
- Chris Jackson <[email protected]> added support for MySQL functions in
tbl_change.php3. He also added the "Query by Example" feature in 2.0.
- Dave Walton <[email protected]> added support for multiple servers and
is a regular contributor for bug-fixes.
- Gabriel Ash <[email protected]> contributed the random access features
for 2.0.6.
The following people have contributed minor changes, enhancements, bugfixes
or support for a new language:
Jim Kraai, Jordi Bruguera, Miquel Obrador, Geert Lund, Thomas Kleemann, Alexander Leidinger,
Kiko Albiol, Daniel C. Chao, Pavel Piankov, Sascha Kettler, Joe Pruett,
Renato Lins, Mark Kronsbein, Jannis Hermanns, G. Wieggers.
THE OLDEST AND THE NEWEST VER OF MYSQL......
v 0.9.0 - 09/09/1998: + First internally used version
v 2.1.0 - 08/06/2000 + Bugfix: Query By Example now
works with high
error-
reporting
levels.
+ Bugfix: 'End' on the navigation bar in Browse
and
Select mode now functions
correctly.
+ Added random access option to the navigation
bar
in table Select and Browse
mode
+ Added form for changing the number of rows
displayed
per
page.
+ Bugfix: Reading SQL dumps had magic quotes
problems.
+ Added support for wildcards in MySQL
user
authentication
system.
+ Added support to edit/delete rows in table
without
primary
key.
+ Added support for mysqldump-like Complete
Inserts
(ie. optionally adding the field list to the
dumps).
+ Changed the table browsing mode to display
Prev/Next
links also on top of the
rows.
+ Added authentication on a per-table
basis.
+ Added print views for tables and
databases.
+ Added link to browse table from left frame
(copied
from
phpPgAdmin).
+ Security: Fixed possible security issue with
reading
SQL
dumps.
+ Fixed some more PHP 4.0 issues (warnings,
problems
with 0/empty().
Please always review your registry errors log files for complete understanding of the problem on:
Never use your mdb with active server: so is non on your pws INSTEAD ONCE YOU SET UP YOUR TABLE DECIDE TO SAVE AS A //ASP FILES
· Active Server Pages
o If the only database you use with Active Server Pages® (ASP) is Microsoft SQL Server—that is, you never use Microsoft Access (.mdb) files with ASP—and you create instances of the Database Access Component that you store in the Session object
o just store your db components:
o you can enhance performance by changing the threading model for Database Access Component instances from Apartment to Both in the registry. To
o enhance your acces perfoemance: apartment and threding to both:
o change from Apartment to Both, double-click Makefre15.bat in the Program Files\Common Files\System\Ado folder.
To reverse this process, (that is, to change the threading model from Both to Apartment) double-click Makeapt15.bat in the Program Files\Common Files\System\Ado folder.
Note We recommend that you do not store instances of the Database Access Component in the Session object.
o THE MAPPATH METHOD:
o There is a mistake in the ASP documentation which states that the MapPath method does not support relative path syntax, such as
RELATIVE PATH SYNTAX IS LIKE…
o ./path or ../path.
o The MapPath method supports relative path syntax if the Enable Parent Paths metabase property is enabled. When the Enable Parent Paths property is not enabled, using the MapPath method with a relative path results in an error.
ECTG on July/02
o PLEASE FIX YOUR SCRIPT DICTIONARY, FOR PL AND PHP TO BE USED:
o The Scripting.Dictionary object is
o
Erroneously marked as
Both-threaded. It should be marked as Apartment-threaded. To change this, use
the Registry Editor to open the following registry
key:
HKEY_CLASSES_ROOT\
CLSID
\{EE09B103-97E0-11CF-978F-00A02463E06F}
\InprocServer32
Change the named value for ThreadingModel to Apartment. If you use the Dictionary object at Application scope without making this change, corruption of data may occur.
o If you change the network bindings on a running Web site with active users, then those users will be disconnected.
o Properties set for the ASP Request, Response, and Server objects are valid only during the processing of a request. For example, if you set a property in Global.asa, such as Response.Buffer = True, the property will only apply to a single request and not to all requests.
o FOR THIS VERSION YOU AY NEED TO CONTACT: ACTIVE WARE FOR A PROPER VERSION: CHECK THE SCRIPTING FOLDER AND UPDAT YOUR SOFTWARE, PLEASE.
o There are currently known problems with using PerlScript with ASP. If you are running PerlScript from ActiveWare, contact ActiveWare for a new PerlScript engine.
o The Scripter's Reference documentation enumerates properties in the MyInfo object and states that Personal Web Server initializes these properties. Although this information is valid for a Macintosh installation of Personal Web Server on the Macintosh computer, this information is may not be valid for a Windows 95 installation of Personal Web Server. None of the properties enumerated in the Scripter's Reference documentation exist when MyInfo is first instantiated. Rather, these properties are created during execution by means of an assignment statement. This means that if a property does not exist, querying for its value will return an empty string and any attempt to use the property in an expression will return an error.
o If you create or use components developed in Microsoft® Visual Basic 5.0™ (Enterprise or Professional Editions) for use with ASP, it is strongly recommended that you upgrade to Visual Studio 97 Service Pack 2, both for your development and server computers.
You can download the Visual Studio 97 Service Pack 2 at http://www.microsoft.com/vstudio/sp/.
· When running Java components on a busy server, it is possible for the java virtual machine (VM) to become locked during initialization, as a result of being initialized from 40 or more threads. This only occurs the first time the Java VM is initialized per process. As a workaround, add the following code to the Global.asa file for your application (the "YourJavaObject" can be a dummy component that does nothing).
· · <SCRIPT LANGUAGE=vbscript RUNAT=SERVER>
· Sub Application_OnStart
· set initobj = Server.CreateObject("YourJavaObject")
· End Sub
</SCRIPT>
· You can only publish files from your local drive. For security reasons, the Personal Web Manager publishing wizard will not publish a file that resides on a network drive.
· In the home page wizard of Personal Web Manager, the stylesheet graphics associated with the home page templates are best viewed with Internet Explorer 4.01. Subtle differences between the way the home page template appears in IE 3.0 and Netscape are normal.
· HINT ABOUT <BR> TAGS
· Internet Explorer versions 3.0 and 4.0 ignore line break characters in text fields. To break a line in a text field entry, add the <BR> HTML tag to the end of each line.
THE ADO ACTIVE X PARTS
YOU WILL CREATE BY OTHER PROGRAMS WOULD HAVE A PROBLEMS AS THE ACTIVE X PART WILL NOT CHECK THE REPORTS REGISTRY FOR ANY POSSIBLE PREVIOUS ERRORS,
"no use of log files, what a shame". IT SHOULD BE ABLE TO DO SO, ENSURE YOU ADD THIS CODE IN YOUR ACTIVE X PARTS BUILDING……..
IN THE CGI BIN YOU MAY PLACE ALSO YOUR EXE, AND YOUR PL FILES AS A SCRIPTING RESOURCES.
· ActiveX Data Objects (ADO) uses the standard COM method of passing error information but ADO does not check to see if any other information has been put into the ErrorInfo object ,
erasing this object it when it destructs. There is a code workaround for this problem in Microsoft® Visual Basic®, Visual C++®, and Visual J++™ that should be implemented in your error handler.
For Visual Basic, the code should read:
ErrorHandler:
' cleanup
If Not adoRS Is Nothing Then
Set adoRS = Nothing
End If
If Not adoConn Is Nothing Then
Set adoConn = Nothing
End If
Err.Raise Err.Number, "Bank.Accout.Post", Err.Description
Exit Function
For Visual C++, the code should read:
//
// ErrorInfo is saved here because the following
// ADO cleanup code may clear it.
//
IErrorInfo * pErrorInfo = NULL;
GetErrorInfo(NULL, &pErrorInfo);
if (adoRsBalance) adoRsBalance->Release();
if (adoCoConnection) adoCoConnection->Release();
AtlReportError( CLSID_CAccount, pErrMsg, IID_IAccount, hr);
//
// put the error back in TLS
//
SetErrorInfo(NULL, pErrorInfo);
For Visual J++, the code should read:
if (adoRsBalance != null) {if (adoRsBalance.getState() == ObjectStateEnum.adStateOpen)
adoRsBalance.Close();
ComLib.release (adoRsBalance);
}
if (adoConn != null) {if (adoConn.getState() == ObjectStateEnum.adStateOpen)
adoConn.Close();
ComLib.release (adoConn);
}
Note In Visual J++ you must explicitly close recordsets and/or connections as well as explicitly release the ADO objects. If you are writing server-side components in Java and
, type msnews.microsoft.com. You do not need to http://www.microsoft.com/support/news/ and select Personal Web Server.
This Report was made using the WinMySQLAdmin 1.4 Tool
8/14/02 12:25:23 PM
Description :
How-To-Repeat :
Fix :
Synopsis :
Submitter-Id :
Originator :
Organization :
MySQL support : [none | licence | email support | extended email support ]
Severity : [non-critical | serious | critical ]
Priority : [low | medium | high ]
Category : [mysqld, mysql client, C, PHP, PERL, ...]
Class : [ sw-bug | doc-bug | change-request | support ]
OS Platform : Windows 98
Machine description:
Compiler : VC++ 6.0
Architecture : i686
Total Memory : 60896 KB RAM
My.ini File
[mysqld]
basedir=C:/MYSQL
datadir=C:/MYSQL/data
Server Status Values
Server Info 3.23.51
Host Info localhost via TCP/IP
Client Info 3.23.51
Proto Info 10
Aborted_clients 1
Aborted_connects 0
Bytes_received 0
Bytes_sent 0
Com_admin_commands 0
Com_alter_table 0
Com_analyze 0
Com_backup_table 0
Com_begin 0
Com_change_db 273
Com_change_master 0
Com_check 0
Com_commit 0
Com_create_db 2
Com_create_function 0
Com_create_index 0
Com_create_table 0
Com_delete 0
Com_drop_db 1
Com_drop_function 0
Com_drop_index 0
Com_drop_table 0
Com_flush 3
Com_grant 0
Com_insert 0
Com_insert_select 0
Com_kill 0
Com_load 0
Com_load_master_table 0
Com_lock_tables 0
Com_optimize 0
Com_purge 0
Com_rename_table 0
Com_repair 0
Com_replace 0
Com_replace_select 0
Com_reset 0
Com_restore_table 0
Com_revoke 0
Com_rollback 0
Com_select 0
Com_set_option 0
Com_show_binlogs 0
Com_show_create 0
Com_show_databases 6
Com_show_fields 242
ODBCConf called with arguments: '/S /Lv odbcconf.log /F C:\WINDOWS\SYSTEM\mdaccore.rsp'
Data Struct:
Reboot First : 0
Use Response File : 1
Response File : 'C:\WINDOWS\SYSTEM\mdaccore.rsp'
Erase Response File: 0
Silent : 1
Continue on Error : 0
Log Mode : 2
Log File : 'odbcconf.log'
Actions:
8, '(null)', '(null)', ''
6, 'MS Code Page Translator|Translator=MSCPXL32.dll||', '(null)', '"MS Code Page Translator|Translator=MSCPXL32.dll||"'
5, 'Microsoft ODBC for Oracle|Driver=msorcl32.dll|Setup=msorcl32.dll||', '(null)', '"Microsoft ODBC for Oracle|Driver=msorcl32.dll|Setup=msorcl32.dll||"'
1, 'Microsoft ODBC for Oracle', 'CPTimeout=60', '"Microsoft ODBC for Oracle" "CPTimeout=60"'
EXECUTING ACTIONS
Executing Action: INSTALLDRVRMGR
arg1: '(null)'
arg2: '(null)'
args: ''
Install Driver Manager succeeded
Return HR: 0x0
Executing Action: INSTALLTRANSLATOR
arg1: 'MS Code Page Translator|Translator=MSCPXL32.dll||'
arg2: '(null)'
args: '"MS Code Page Translator|Translator=MSCPXL32.dll||"'
INSTALLTRANSLATOR SQLInstallTranslatorEx succeeded
Return HR: 0x0
phpdev -
What's it all about ?
:) - well its all about getting PHP/MySQL/Apache
(PERL)(others?) running on your Win32 machine.
Why not use Linux ??, well
because for my day to day work *NIX does just not cut it, gimp etc is fine but I
am pampered and need my Photoshop/Fireworks/MS-Word (yes really !)/etc/etc , so
I need windows (and as a workstation much prefer it). That said, IIS is dogmeat,
so Apache really is the only answer, as is PHP (IMO), MySQL is there because it
is so popular and very useful despite the usual criticisms.
So phpdev is
a pre configured suite of all the bits and pieces you need to get
Apache/PHP/MySQL/other running on your machine. It is not invasive and does not
alter any windows settings or touch the registry etc. In its current incarnation
PHP runs as an apache module.
phpdev - downloads:ersion 3: 8.89MB
PHP 4.04pl1
Apache 1.3.19
phpMyAdmin2.01
MySQL 3.23 + win GUI
The way this counter works is it creates a cookie on the user's computer with their IP and it updates the count according to the status of that cookie. If the cookie is present and the IP in the cookie is the same as the user's current IP then the script knows the user has already been there and it does nothing or if it is present, but has an IP different than the user's current IP or is not present the script knows that the user is either new or was there before, but the cookie has expired so it then updates the count. This script will be using the setcookie() function, which must be sent before any headers are sent. Basically what that means is that it must be placed before any HTML. The count will be held in a text file for ease of use but if you desire to use a database that is perfectly acceptable. Now for the code.
$c_ip = $HTTP_COOKIE_VARS["user_ip"];
$counter_file = "counter/count.txt";
$counter_file_line = file($counter_file); if(!$c_ip) {
setcookie("user_ip", $REMOTE_ADDR, time()+360000); $counter_file_line[0]++;
$cf = fopen($counter_file, "w+");
fputs($cf, "$counter_file_line[0]"); fclose($cf);
}
elseif($c_ip != $REMOTE_ADDR){
$counter_file_line[0]++; $cf = fopen($counter_file, "w+");
fputs($cf, "$counter_file_line[0]");
fclose($cf);
}
Okay then, well there is certainly a lot going on there. Let's break it down shall we.
$c_ip = $HTTP_COOKIE_VARS["user_ip"];
$counter_file = "counter/count.txt";
$counter_file_line = file($counter_file);
This first line is reassigning a variable name as you can hopefully tell. The variable we are naming is the variable that refers to our cookie that the counter script will later create. It is not necessary to use $HTTP_COOKIE_VARS[] to refer to a cookie, they can generally be called by just name as a variable (i.e. $user_ip), but to be safe we have. The second variable indicates where the text file for the counter is being stored. You can change this to whatever you please. The third variable opens the counter and writes it's content to an array using the file() function. The counter file is only one line long so therefore it only has one array element.
if(!$c_ip) {
This line is our if() statement that simply checks for the presence of our cookie variable. From here is where things start happening
setcookie("user_ip", $REMOTE_ADDR, time()+360000);
This line
creates our cookie. If you do not understand the setcookie() function I advise you look it up in the
manual for the greatest detail, but basically what is happening is we are making
a cookie who's name is "user_ip" and who's value is the user's IP Address. The
third argument is the amount of time before the cookie is deleted and it makes a
call to the time() function. As you can see it says
time()+360000 which means the current time Unix time index plus 360000 seconds.
This is the number I chose for my script and it is a pretty decent amount of
time before the cookie is removed however you may use whatever you please. If
you leave the third argument out the cookie will never be deleted unless done
manually (which I do not suggest). This code is obviously only used if the
server doesn't find the required cookie.
$counter_file_line[0]++;
$cf = fopen($counter_file, "w+");
fputs($cf, "$counter_file_line[0]");
fclose($cf);
}
This part is pretty straight forward. It is our code to add to the counter. The first line in this chunk of code just adds 1 to the value of the first line in the counter file. The second line here opens the counter file for editing so we can write the data back in. The third line actually does the writing of the new value. Finally, the sixth line closes the file.
elseif($c_ip != $REMOTE_ADDR) {
This line is pretty straight-forward. All this line does is check the cookie to see it's value. If the value of the cookie is not equal to the users current IP the code is executed.
$counter_file_line[0]++;
$cf = fopen($counter_file, "w+");
fputs($cf, "$counter_file_line[0]");
fclose($cf);
}
This line is exactly the same as before and should require no explaining. This line also completes all the code we need to write data with though what good is data in a file if no one sees the data. To display our counter we only need one line of code assuming that the above code is executed on the same page as the count is viewed on.
echo $counter_file_line[0];
The above code will display our count. If you desire to get the count on a page other than the page that you increment the counter use this:
$counter_file = "counter/count.txt";
$counter_file_line = file($counter_file);
echo $counter_file_line[0];
That basically wraps up this tutorial on counters. If you have more questions feel free to email me but for now, happy programming.
When you are paying for hosting, you may not have access to your access logs. You may still want to view what sort of traffic you are getting and you may also want to view who's linking to your site, what page they are entering your website on and etc. This brief tutorial will show you how to make a custom logging function for your PHP driven website, without the use for MySQL. We'll be using a flat text file to log our traffic and we'll talk about two methods, one is for individual sessions and one the other method is for logging all page hits. This tutorial is also a good introduction to Predefined Variables.
Method 1 - Session Logging
This method is where you want to minimize the impact on your log file. We want to only log the number of unique visitors and not their entire page views. This code below will do just that:
<?php
session_start();
if(!session_is_registered('counted')){
$agent = $_SERVER['HTTP_USER_AGENT'];
$uri = $_SERVER['REQUEST_URI'];
$user = $_SERVER['PHP_AUTH_USER'];
$ip = $_SERVER['REMOTE_ADDR'];
$ref = $_SERVER['HTTP_REFERER'];
$dtime = date('r');
if($ref == ""){
$ref = "None";
} if($user == ""){
$user = "None";
} $entry_line = "$dtime - IP: $ip | Agent: $agent | URL: $uri | Referrer: $ref | Username: $user \n";
$fp = fopen("logs.txt", "a");
fputs($fp, $entry_line);
fclose($fp);
session_register('counted');
}
?>
Let's talk about this code example below:
Start the Session |
|
|
|
We'll start the PHP engine and start a session. We'll need to use sessions because we will create a method to count the sessions and exclude updating the counter file while that person's session is active. |
|
Check Session Values |
|
|
|
Here we'll check to see if we have a session variable registered called "counter", if there isn't one, we'll execute the following code. |
|
Define Variables from Predefined Variables |
|
|
This chunk
of code utilizes some Predefined Variables so we can find out some
information about the user. Let's discuss those here:
|
|
Some Extra Checks |
|
|
|
Here's a couple of if statements to check to see if we have a $ref (Referring Page) and a $user (Logged in user). If we don't, we'll just assign them a "None" for our log file entry. |
|
Writing to the File |
|
|
| This is
where the action begins.
$entry_line defines what we want our log entry to look like. You can modify it however you want to format your logs to your own custom method. $fp = fopen("logs.txt", "a"); will open the file you specify in "Append" mode to add a new line to the bottom of the file. $fputs($fp, $entry_line); is the code that actually writes the line. It's using the file pointer $fp from above to determine which file to write to. fclose($fp); When done writing the new line, let's close the file! session_register('counted'); Let's register a session variable so that the user will not be counted again. Remember our first if statement above? if(!session_is_registered('counted')) well, they weren't registered before, but now they will. The next time this script is run they'll have met the criteria to skip the logging. |
We've got the Method 1 script written, on the next page, I'll show you how to write a script that counts every single page view.
Method 2 - All page
logging
This method will count every single page view on your
website. This is not always a good idea because your log files will grow rapidly
in size depending on the amount of traffic your site has.
<?php
$agent = $_SERVER['HTTP_USER_AGENT'];
$uri = $_SERVER['REQUEST_URI'];
$user = $_SERVER['PHP_AUTH_USER'];
$ip = $_SERVER['REMOTE_ADDR'];
$ref = $_SERVER['HTTP_REFERER'];
$dtime = date('r');
if($ref == ""){
$ref = "None";
} if($user == ""){
$user = "None";
} $entry_line = "$dtime - IP: $ip | Agent: $agent | URL: $uri | Referrer: $ref | Username: $user \n";
$fp = fopen("logs.txt", "a");
fputs($fp, $entry_line);
fclose($fp);
?>
As you can see from the code on the previous page, all we have done is removed the following lines:
<?php
session_start();
if(!session_is_registered('counted')){
session_register('counted');
}
?>
We removed all of the session information from this script and now ever single page will be counted.
Let's talk about setting up the log file and some security considerations on the next page.
Setting Up Your Log File and Security Considerations
You'll need to create an empty file and upload it to your webserver and configure the path in the file pointer $fp to that file. It's always a good idea to use the FULL PATH to root such as /www/htdocs/logs.txt if that's your path. You'll also need to make this writeable by the web server. I recommend that you chown the file to the same user that the web server runs as. Usually this is "apache" or "nobody" on unix/linux systems. After you have done that I would run a CHMOD 755 on that file to ensure it has the proper permissions.
You must also consider if you want this file to be visible to the public. If you don't, make sure that the file resides outside of your DOCUMENT ROOT.
Good luck and happy logging!
Run PHP-GTK and PHP-Apache on
Win32
Simon
Wheeler Simon
Wheeler
Reader
Ratings: 3 - Average
score: 9.7 ![]()
To set the scene: you have PHP running happily as an Apache module on your Windows development machine. Quite sensibly you only test PHP/Apache on Windows and always upload to some *NIX flavour for the hosting of your pages and applications. So far, so good.
Then you hear about PHP-GTK and see the huge advantage of being able to develop x-platform client-side GUI's with PHP as opposed to JAVA or VB. You already know that PHP can handle pretty much anything you can throw at it, and you already know it inside out -- so why wouldn't you use it?
So you download the latest PHP-GTK binary from gtk.php.net and follow the instructions carefully... which is where things start to go wrong. Let's look at why, and see if we can't get you back on the road to successfully running PHP-GTK and PHP-Apache on Win32.
The Install

Once you've downloaded PHP-GTK, if you were to follow the PHP-GTK installation instructions, you'd open a command prompt and type c:\gtk\php4\php.exe -q c:\gtk\samples\test.php. Now, when you hit 'return', 1 of 4 things will occur:
1. PHP-GTK will work as expected and will not affect your existing PHP-Apache setup (preferred but unlikely)
2. PHP-GTK will work as expected but you'll receive several unusual errors when you start Apache
3. PHP-Apache will continue to work as normal, but PHP-GTK will fail at every attempt
4. Neither PHP-GTK nor mod_php work anymore
Why does this happen? Because you followed the instructions!
The first thing many people do is exactly what the PHP-GTK download tells them to -- they extract the php4ts.dll into the system32 folder, thus overwriting any existing versions, and, unless you're very lucky, causing your mod_php apache setup to fail miserably.
Note that if your apache-php setup appears to fail after you install PHP-GTK, you'll need to reinstall PHP -- Apache is not the issue. Note also that if you do not already have PHP-Apache on your machine, the installation as recommended at gtk.php.net will work flawlessly, but that's an unusual scenario for any developer who's interested in PHP-GTK.
Why Does it Fail?
There are 2 main reasons why the recommended installation may fail.
1. PHP versions
As PHP-GTK and PHP are both evolving at different paces it's not always easy to have the PHP & PHP-GTK binaries compiled against the same build. Thus php_gtk.dll & php4ts.dll might be compiled against PHP4.1.* cvs and your main PHP binaries against 4.2.1 (hopefully you have upgraded to 4.2.2 by now).
You can get more up to date PHP-GTK builds here, but even if you do have all the right versions, I'd still suggest at this point in the PHP-GTK development cycle that you proceed with the following structure. Why? Simply because it can't go wrong -- this has to (and does) work, and will continue to work even after you upgrade your Apache-PHP version.
2. The php.ini
The php.ini issue is partially related to the versioning issue. The php.ini that PHP (as an Apache module) uses, has several incompatible modules listed, plus totally different include paths, and includes several other possible stumbling blocks (such as the Zend optimiser, for example). Again, as it's difficult to grab compatible GTK and PHP versions, we need to completely separate the two.
...so let's get started!
Assumptions
I'll assume that you have PHP running as an Apache module.
The location at which you've installed your PHP and Apache binaries is irrelevant, with the exception of having PHP installed to C:\PHP. PHP-GTK will assume that PHP is installed to C:\PHP (unless you tell it otherwise), and if you've installed it elsewhere, you may find that some PHP-GTK scripts will work, while others fail.
Installation
Grab the latest GTK binary from gtk.php.net, unzip it to the folder of your choice (I suggest c:\gtk for the purposes of this tutorial), and you should have a structure a little like this:

I'll assume that you unzipped to c:\gtk though anywhere will do. Next, go into the \winnt\system32 folder, grab its entire contents, and put these files into the php4 folder. Do the same for the php.ini file in \winnt Once that's done, you can delete the c:\gtk\winnt folder (don't worry -- you'll always have the zip file as a backup). That's it: installed!
Now if that seems too easy, well it is. However, now you'll want to check whether it works or not. There are several sample scripts that come with PHP-GTK, but let's knock up a quickie here. We'll make it as simple as it gets -- a window with a button -- but don't worry about how it works at this point. Just test to ensure that it does in fact work!
ECTG COPY RIGHT.