[PHP] Setting cookie for two domains.
Hi, How can I register a session or cookie for two domains. I want to maintain logged user's state when he goes from one domain to other domain. Example Suppose a user is logged in on domain1.com. A cookie is set and user is authenticated from database on the basis of that cookie. When he goes from domain1.com to domain2.com, I want he remains loggedin on domain2.com. I do not want any query string. Is it possible by playing with cookie or session settings? Please advise if anybody has faced such problem. Regards http://www.phpgurru.com
Re: [PHP] admin variables in CGI version
On Tue, Jan 03, 2006 at 11:07:16AM -0800, Tim Traver wrote: > Hi all, > > ok, when using the CGI binary for PHP execution, is there a way to send > it environment variables to set the admin values like you can in mod_php ??? > > For instance, when using the apache module, you might do something like > this : > > php_admin_value session.save_path /some/path You can do php_admin_value in a directive, so if the cgi scripts reside in /var/www/cgi-scripts/ you can have php_admin_value Also if you have .htaccess enabled you can put that there as well. I may not be 100% on this but it is close. Curt. -- cat .signature: No such file or directory -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mysqli bind_param and store_result don't work well together
On Wed, Jan 04, 2006 at 12:31:02AM +0530, anirudh dutt wrote: > hi > the subject is pretty much what the problem is. > > if i use > $st1 = $sql->stmt_init(); // $sql is a mysqli obj/conn > $st1->prepare("select `num` from `activity` where `id` = ?"); > $st1->bind_param('s', $myid); > $myid = '3f6d017d3e728b057bcc082a7db75a57'; // forcing value to check ... > > gives rows: 0, num: 0 ... > > also, if i use an sql var in the prepare/bind case as > $st1->prepare("select @ck_num:=`num` from `activity` where `id` = ?"); > var_dump($rz) is NULL; otherwise it's int(7) What version of php and mysql do you have? Curt. -- cat .signature: No such file or directory -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Curl Question
On Tue, Jan 03, 2006 at 01:52:44PM -0700, Ray Hauge wrote: > Hello everyone, > > I just wanted to see if anyone knew if there was any difference in > performance between using curl in an exec() statement and when using the > libCurl functions within PHP. You might notice a difference if you loop though the code 100,000 times or so. One advantage of using libCurl vs exec() is that you dont have to worry about where the location of the actual 'curl' binary is: exec('/usr/local/bin/curl'); exec('/usr/bin/curl'); exec('/bin/curl'); exec('C:/windows/curl.exe'); exec('C:/Program Files/Curl/curl.exe'); exec('X:/shared apps/curl/curl.exe')' etc.. With libCurl, you just ensure that curl is enabled in php. Curt. -- cat .signature: No such file or directory -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] are these db stats normal?
On Tue, Jan 03, 2006 at 12:29:14PM -0500, James Tu wrote: > I used phpMyAdmin to look at the stats for this mysql server. > > http://www.2-bit-toys.com/db_info/server_status.html > > What concerns me mainly are the stats at the top-right...'Failed > attempts' and 'Aborted.' > When would these situations occur? Is it normal to see these? This is more of a mysql issue, a nice google of 'mysql connections aborted' works pretty good [1]. > I'm using PHP's mysql_pconnect for all my scripts. Could this be > causing the failed/aborted attempts? What is not clear is if > mysql_pconnect will open another connection if the current one is > being used. Becareful with pconnect: http://php.net/mysql_pconnect http://php.net/manual/en/features.persistent-connections.php Historically, both _connect and _pconnect will reuse an existing connection based on the username, password and server it is connecting to, within the same script so if you have $dbh = mysql_pconnect('localhost', 'username', 'password'); $dbh2 = mysql_pconnect('localhost', 'username', 'password'); Both $dbh and $dbh2 are using the same resource. mysql_connect has an option to remove this feature/flaw/annoyance. As far as the 'Aborted' connections, and how php could affect the value is with the _pconnect Consider you have a peak hour and you have 100 requests (at one time), php now has reserved 100 connections to the db. And after the peak, you just get about 10-50 requests. Those other 50-90 connections that php had made a connection to earlier become stale (based on the mysql's wait_timeout or interactive_timeout setting [1]) so an aborted connection is registered when a stale connection is accessed. [1] http://dev.mysql.com/communication-errors.html HTH, Curt. -- cat .signature: No such file or directory -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] fread problem
On Mon, Jan 02, 2006 at 09:35:21PM +0100, Mario de Frutos Dieguez wrote: > Hi! > > I have a problem using fread with a XML document. When i read some nodes > with a great amount of text it cuts in the same place of the text. There > are any limitation of text or something? I have in the php.ini the amount > of memory in 256M. The limitation is what you specify in your fread's second argument. If I understand the problem you are incrementally reading a file that is parsed for matching begin and ending elements, so if you have a document like: // 2048 characters of data And you do a: $line = fread($fp, 2048); You wont get the closing element within the fread. Curt. -- cat .signature: No such file or directory -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHPMailer inserting unwanted spaces
On Tue, Jan 03, 2006 at 10:37:10AM -0700, Ren Fournier wrote: > Actually, I can send the example messages but here is another > description of the same problem. (So PHPMailer is inserting line > breaks, not spaces�or something is...) > > http://sourceforge.net/tracker/index.php? > func=detail&aid=1267539&group_id=26031&atid=385708 I've never seen phpmailer convert spaces into 's, the html I give it is the html it sends. There probably is something wrong with the html or how your using phpmailer. In order to help with your issue, you'll have to provide a small example of: 1) The raw html you are using. 2) the row email message that is delivered Curt. -- cat .signature: No such file or directory -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] How to: Search web for specific file type?
Hello, Just curious if anyone could give me some google keywords/links/suggestions/tips/comments/feedback on a good place to start for writing a search engine script. I think I might have a good idea for a specific type of search engine. Basically it would crawl web and index links to a specific type of file... really simple. Obviously making the results searchable is a must. Not sure where to start though. Thanks! Cheers, Micky -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: failed to open stream warning
zedleon wrote: >>Warning: fopen(home/path/temp") failed to open stream: No such file or >>directory >>I am trying to write a script to work with GnuPG, but can't get past this >>basic problem. >>Everything I try gives me the same warning. > >I just corrected the code...I had it correct but posted it in correctly. > >$fp = fopen("home/path/temp" "w+"); >puts($fp, $msg); >fclose($fp); > >Still getting the same warning... > > There is still an error in that code (missing comma) and the error message also has an unmatched quote. The actual error message seems clear "No such file or directory" - does "home/path/temp" exist, did you mean "/home/path/temp". Travis -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: failed to open stream warning
On Jan 4, 2006, at 4:56 PM, zedleon wrote: I just corrected the code...I had it correct but posted it in correctly. $fp = fopen("home/path/temp" "w+"); puts($fp, $msg); fclose($fp); Still getting the same warning... I think you forgot a comma this time... $fp = fopen("home/path/temp", "w+"); Other than that, do you have a file you can specify? Also, you should make sure your permissions are set correctly... check the parent folder and the file you want to open. I am sure you have been here already, but: http://us2.php.net/manual/en/function.fopen.php Good luck, Micky -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: failed to open stream warning
I just corrected the code...I had it correct but posted it in correctly. $fp = fopen("home/path/temp" "w+"); puts($fp, $msg); fclose($fp); Still getting the same warning... Thanks ""zedleon"" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Has anybody had any experience in resolving this kind of issue? > > Warning: fopen(home/path/temp") failed to open stream: No such file or > directory > I am trying to write a script to work with GnuPG, but can't get past this > basic problem. > Everything I try gives me the same warning. > > Here is the code: > > $fp = fopen("home/path/temp "w+"); > puts($fp, $msg); > fclose($fp); > > any suggestion would be appreciated, > > Thanks > > zed -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] failed to open stream warning
On Jan 4, 2006, at 4:28 PM, zedleon wrote: $fp = fopen("home/path/temp "w+"); You only got 3 quotes in the above code... try this: $fp = fopen("home/path/temp", "w+"); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Graphically displayed number to confirm user is a human [SOLVED]
Thank you all for pointing me in the right direction. I was extremely unlikely to come across the term "CAPTCHA" by starting with the search terms I was using. I'm really glad I asked here. Your time taken to answer my query is much appreciated. -- Dave M G -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Counting in Hex
Never mind - wasn't adding properly. Found it after all on php.net, anyway. Thanks anyway. -Original Message- From: Ben Miller [mailto:[EMAIL PROTECTED] Sent: Wednesday, January 04, 2006 5:01 PM To: php-general@lists.php.net Subject: [PHP] Counting in Hex Is there a way in PHP to count using hex instead of numerals so that the following statement $var = 237F; $var++; echo "$var"; would result in 2380 Thanks a bunch. Ben -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Counting in Hex
Is there a way in PHP to count using hex instead of numerals so that the following statement $var = 237F; $var++; echo "$var"; would result in 2380 Thanks a bunch. Ben -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] New extension: the extension formally known as MSession is now MCache
Just want to open a discussion about what used to be called msession. As many of you may be aware, msession had some problems with later Linux kernels as well as stability issues on Apache 2. MCache is redesign of msession is is intended to more or less replace msession. For more info, go to www.mohawksoft.org. MCache and its PHP extension code is available via CVS. It is in alpha state and not all functions are working, but the basic session management should be working. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Parsing through an Apache Log File?
> If this is just a one time thing you're looking to do, all of this may be > over the top. However, if the bosses are going to want to review this data > month in and month out, I think the time spent doing something like this will > be worth it. As of now I've got it working and inserting the data into the database! I did see your code and since you are being so generious as to let me use it I'll probably tweak it (a very little bit!) as we are going to be using this script once a week to read the log files. We are using it to get some numbers out of it so make our own custome stats thing based off of a lot more numbers that included this as part of the number getting. Thanks so much for your help! jay
Re: [PHP] Parsing through an Apache Log File?
Jay Paulson (CE CEN) wrote: Jay Paulson (CE CEN) wrote: Hello everyone! I've been given the responsiblity of coding an apache access_log parser. What my tasks are to do is to return the number of hits for certain file extensions that happen on certain dates with specific IP address. As of now I'm only going back 7 days in the log looking for this information and I'm only looking for 5 file types (.doc, .pdf, .html, .php, and .flv). I'm using the fgets() function so I can read the file line by line and do the matches that I need to do and increment the counters as needed. Right now I have 3 loops looking for everything, which seems to me not to be the best way of doing this. I've also encountered that a line may have the file extension I want but it's actually the soucre of another file. (see below for example) Log file example: I want the first line but not the second line. The second line has a .css file which was used by the .html file therefore I don't want this line. I do want the first line that all it has is .html and no other files. 10.25.40.64 - - [01/Jan/2006:07:33:18 -0600] "GET /home.html HTTP/1.1" 200 8220 "-" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)" 10.25.40.64 - - [01/Jan/2006:07:33:18 -0600] "GET /styles/redesign.css HTTP/1.1" 200 2381 "http://wfmu.wfm.pvt/home.html"; "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)" At any rate, here's some of my psudo code/code for what I'm trying to accomplish. I know there has to be a better way for this and I'm looking for suggestions! Save yourself a ton of work. Dump the raw logs into a db, and you can do all the queries on the db. Something like this... I took your idea and did a search on Google and found that this has already been done for me! Check it out! http://www.php-scripts.com/php_diary/012103.php3 Very cool :) This is the script I wrote when we first started this project a few months ago to parse the 2+ years of log files, and intially get them into the db. If you want to use parts of it, feel free. http://john.nichel.net/parse.phps -- John C. Nichel IV Programmer/System Admin (ÜberGeek) Dot Com Holdings of Buffalo 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Parsing through an Apache Log File?
Jay Paulson (CE CEN) wrote: Jay Paulson (CE CEN) wrote: Hello everyone! I've been given the responsiblity of coding an apache access_log parser. What my tasks are to do is to return the number of hits for certain file extensions that happen on certain dates with specific IP address. As of now I'm only going back 7 days in the log looking for this information and I'm only looking for 5 file types (.doc, .pdf, .html, .php, and .flv). I'm using the fgets() function so I can read the file line by line and do the matches that I need to do and increment the counters as needed. Right now I have 3 loops looking for everything, which seems to me not to be the best way of doing this. I've also encountered that a line may have the file extension I want but it's actually the soucre of another file. (see below for example) Log file example: I want the first line but not the second line. The second line has a .css file which was used by the .html file therefore I don't want this line. I do want the first line that all it has is .html and no other files. 10.25.40.64 - - [01/Jan/2006:07:33:18 -0600] "GET /home.html HTTP/1.1" 200 8220 "-" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)" 10.25.40.64 - - [01/Jan/2006:07:33:18 -0600] "GET /styles/redesign.css HTTP/1.1" 200 2381 "http://wfmu.wfm.pvt/home.html"; "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)" At any rate, here's some of my psudo code/code for what I'm trying to accomplish. I know there has to be a better way for this and I'm looking for suggestions! Save yourself a ton of work. Dump the raw logs into a db, and you can do all the queries on the db. Something like this... CREATE TABLE `rawLogs` ( `ipAddress` int(15) NOT NULL default '0', `rfcIdentity` varchar(32) NOT NULL default '', `apacheUser` varchar(32) NOT NULL default '', `date` int(15) NOT NULL default '0', `request` longtext NOT NULL, `statusCode` varchar(32) NOT NULL default '', `sizeBytes` int(11) NOT NULL default '0', `referer` longtext NOT NULL, `userAgent` longtext NOT NULL, KEY `ipAddress` (`ipAddress`), FULLTEXT KEY `search` (`request`,`referer`,`userAgent`) ) TYPE=MyISAM; A few questions with this train of thought. I can see the advantages of putting the raw log file into a database but I would still need to parse the file and get the information out of it for each column. Correct, but putting it into a db, you only have to parse the file once instead of every time you want to sort your data. I'm also not quite sure what some of your feilds are for 'rfcIdentity'?? What is that? Why would I need an 'apacheUser' also? In the output example of your logs, it looks as if your using the format of Apache logs which contain this data (the two dashes after the IP). Most of the time, that's what they will be; dashes, no data. Look here: http://httpd.apache.org/docs/1.3/logs.html Anyway, not too sure how I would get this information in an easy way for the massive amounts of inserts I would have to do on a 10 meg log file. Script it. Just like you're parsing each line right now, but split the line on the tab (I assume that's your separator), and you'll have an array of the values in that line. Use that array to insert your values. I do this with daily logs on our sites (some of the files are over 100mb) I also convert the IP and date into integers for easier searching before inserting them into the db. YMMV. Once you have them in the db, it's easy to run your queries on that table (or break the data up into other tables for different search criteria). On our system, I dump the raw log table every month (because it's already been broken down to other tables and better normalized), as trying to put two months of data into it would put it beyond the 4gb limit on our system. If this is just a one time thing you're looking to do, all of this may be over the top. However, if the bosses are going to want to review this data month in and month out, I think the time spent doing something like this will be worth it. -- John C. Nichel IV Programmer/System Admin (ÜberGeek) Dot Com Holdings of Buffalo 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Parsing through an Apache Log File?
Jay Paulson (CE CEN) wrote: > Hello everyone! I've been given the responsiblity of coding an apache > access_log parser. What my tasks are to do is to return the number of hits > for certain file extensions that happen on certain dates with specific IP > address. > > As of now I'm only going back 7 days in the log looking for this information > and I'm only looking for 5 file types (.doc, .pdf, .html, .php, and .flv). > I'm using the fgets() function so I can read the file line by line and do the > matches that I need to do and increment the counters as needed. Right now I > have 3 loops looking for everything, which seems to me not to be the best way > of doing this. I've also encountered that a line may have the file extension > I want but it's actually the soucre of another file. (see below for example) > > Log file example: > I want the first line but not the second line. The second line has a .css > file which was used by the .html file therefore I don't want this line. I do > want the first line that all it has is .html and no other files. > > 10.25.40.64 - - [01/Jan/2006:07:33:18 -0600] "GET /home.html HTTP/1.1" 200 > 8220 "-" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)" > 10.25.40.64 - - [01/Jan/2006:07:33:18 -0600] "GET /styles/redesign.css > HTTP/1.1" 200 2381 "http://wfmu.wfm.pvt/home.html"; "Mozilla/4.0 (compatible; > MSIE 6.0; Windows NT 5.1; SV1)" > > At any rate, here's some of my psudo code/code for what I'm trying to > accomplish. I know there has to be a better way for this and I'm looking for > suggestions! Save yourself a ton of work. Dump the raw logs into a db, and you can do all the queries on the db. Something like this... I took your idea and did a search on Google and found that this has already been done for me! Check it out! http://www.php-scripts.com/php_diary/012103.php3 Very cool :) jay
RE: [PHP] Parsing through an Apache Log File?
Jay Paulson (CE CEN) wrote: > Hello everyone! I've been given the responsiblity of coding an apache > access_log parser. What my tasks are to do is to return the number of hits > for certain file extensions that happen on certain dates with specific IP > address. > > As of now I'm only going back 7 days in the log looking for this information > and I'm only looking for 5 file types (.doc, .pdf, .html, .php, and .flv). > I'm using the fgets() function so I can read the file line by line and do the > matches that I need to do and increment the counters as needed. Right now I > have 3 loops looking for everything, which seems to me not to be the best way > of doing this. I've also encountered that a line may have the file extension > I want but it's actually the soucre of another file. (see below for example) > > Log file example: > I want the first line but not the second line. The second line has a .css > file which was used by the .html file therefore I don't want this line. I do > want the first line that all it has is .html and no other files. > > 10.25.40.64 - - [01/Jan/2006:07:33:18 -0600] "GET /home.html HTTP/1.1" 200 > 8220 "-" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)" > 10.25.40.64 - - [01/Jan/2006:07:33:18 -0600] "GET /styles/redesign.css > HTTP/1.1" 200 2381 "http://wfmu.wfm.pvt/home.html"; "Mozilla/4.0 (compatible; > MSIE 6.0; Windows NT 5.1; SV1)" > > At any rate, here's some of my psudo code/code for what I'm trying to > accomplish. I know there has to be a better way for this and I'm looking for > suggestions! Save yourself a ton of work. Dump the raw logs into a db, and you can do all the queries on the db. Something like this... CREATE TABLE `rawLogs` ( `ipAddress` int(15) NOT NULL default '0', `rfcIdentity` varchar(32) NOT NULL default '', `apacheUser` varchar(32) NOT NULL default '', `date` int(15) NOT NULL default '0', `request` longtext NOT NULL, `statusCode` varchar(32) NOT NULL default '', `sizeBytes` int(11) NOT NULL default '0', `referer` longtext NOT NULL, `userAgent` longtext NOT NULL, KEY `ipAddress` (`ipAddress`), FULLTEXT KEY `search` (`request`,`referer`,`userAgent`) ) TYPE=MyISAM; A few questions with this train of thought. I can see the advantages of putting the raw log file into a database but I would still need to parse the file and get the information out of it for each column. I'm also not quite sure what some of your feilds are for 'rfcIdentity'?? What is that? Why would I need an 'apacheUser' also? Anyway, not too sure how I would get this information in an easy way for the massive amounts of inserts I would have to do on a 10 meg log file. jay
RE: [PHP] Problem on Instalation ~ several module failed to load
I was trying used php 5.1, but it still same problem appear, several modules succesfully load (mbstring, bz2, dba, dbase, exif, filepro, gd2, gettext, imap, ldap, mime_magic, ming, pgsql, shmop, snmp, socket, tidy, xmlrpc, xsl.) and several others are failed to load : (curl, fdf, ifx, interbase, mcrypt, mhash, mssql, mysql, mysqli, oci8, openssl, sybase_ct). Also, I was re-install my apache(2.0) Is this problem related with php or apache or my OS(XPSP2)? Hopefully, someone can help me to solve my problem. Thanks & Regards From: Bagus Nugroho Sent: Friday, December 09, 2005 10:31 PM To: php-general@lists.php.net Subject: RE: [PHP] Problem on Instalation ~ several module unable to download here is my last list of module which bale to load and unable to load excerpt php.ini extension=php_mbstring.dll ;extension=php_bz2.dll extension=php_cpdf.dll ;extension=php_curl.dll extension=php_dba.dll extension=php_dbase.dll extension=php_dbx.dll ;extension=php_exif.dll ;extension=php_fdf.dll extension=php_filepro.dll extension=php_gd2.dll extension=php_gettext.dll ;extension=php_ifx.dll ;extension=php_iisfunc.dll extension=php_imap.dll ;extension=php_interbase.dll ;extension=php_java.dll ;extension=php_ldap.dll ;extension=php_mcrypt.dll ;extension=php_mhash.dll extension=php_mime_magic.dll extension=php_ming.dll ;extension=php_mssql.dll ;extension=php_msql.dll ;extension=php_mysql.dll ;extension=php_mysqli.dll ;extension=php_oci8.dll ;extension=php_openssl.dll ;extension=php_oracle.dll ;extension=php_pdf.dll extension=php_pgsql.dll extension=php_shmop.dll extension=php_snmp.dll extension=php_sockets.dll ;extension=php_sybase_ct.dll extension=php_tidy.dll ;extension=php_w32api.dll extension=php_xmlrpc.dll extension=php_xsl.dll ;extension=php_yaz.dll ;extension=php_zip.dll -- I was re-check that php_mysql.dll, php_mysqli.dll etc is on c:\php\ext as others. Any idea how come Thanks From: Bagus Nugroho [mailto:[EMAIL PROTECTED] Sent: Fri 09-Dec-2005 21:06 To: php-general@lists.php.net Subject: [PHP] Problem on Instalation ~ several module unable to download Hi All, Previously I always succed to instalation PHP, but currently I have strange problem as several module is unable to download(i.e : php_mysql.dll, php_mysqli.dll), while several other are succesfully download(i.e : mbstring, gd). I have re-installed or copy PHP folder from my succeded instalation, but it is not work. I'm used WindowsXP, Apache2.0, PHP5 May be someone out there could help me to solve it. Thanks in advance -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Parsing through an Apache Log File?
Jay Paulson (CE CEN) wrote: Hello everyone! I've been given the responsiblity of coding an apache access_log parser. What my tasks are to do is to return the number of hits for certain file extensions that happen on certain dates with specific IP address. As of now I'm only going back 7 days in the log looking for this information and I'm only looking for 5 file types (.doc, .pdf, .html, .php, and .flv). I'm using the fgets() function so I can read the file line by line and do the matches that I need to do and increment the counters as needed. Right now I have 3 loops looking for everything, which seems to me not to be the best way of doing this. I've also encountered that a line may have the file extension I want but it's actually the soucre of another file. (see below for example) Log file example: I want the first line but not the second line. The second line has a .css file which was used by the .html file therefore I don't want this line. I do want the first line that all it has is .html and no other files. 10.25.40.64 - - [01/Jan/2006:07:33:18 -0600] "GET /home.html HTTP/1.1" 200 8220 "-" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)" 10.25.40.64 - - [01/Jan/2006:07:33:18 -0600] "GET /styles/redesign.css HTTP/1.1" 200 2381 "http://wfmu.wfm.pvt/home.html"; "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)" At any rate, here's some of my psudo code/code for what I'm trying to accomplish. I know there has to be a better way for this and I'm looking for suggestions! Save yourself a ton of work. Dump the raw logs into a db, and you can do all the queries on the db. Something like this... CREATE TABLE `rawLogs` ( `ipAddress` int(15) NOT NULL default '0', `rfcIdentity` varchar(32) NOT NULL default '', `apacheUser` varchar(32) NOT NULL default '', `date` int(15) NOT NULL default '0', `request` longtext NOT NULL, `statusCode` varchar(32) NOT NULL default '', `sizeBytes` int(11) NOT NULL default '0', `referer` longtext NOT NULL, `userAgent` longtext NOT NULL, KEY `ipAddress` (`ipAddress`), FULLTEXT KEY `search` (`request`,`referer`,`userAgent`) ) TYPE=MyISAM; -- John C. Nichel IV Programmer/System Admin (ÜberGeek) Dot Com Holdings of Buffalo 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Newbie question: need to transfer directory contents fr om my local machine to my website
Jim Moseby wrote: ... Perhaps I misunderstand what the OP wanted. I thought he was running a webserver somewhere, and that he wanted his remote webserver to be able to grab a file listing on his local machine by just visiting a webpage there. if you ask me it wasn't very clear what the OP wanted, I was concerned that the reference to php being a 'server-side' tool/language would be confusing to the OP (or give him the wrong impression about php's capabilities). to the OP: php being serverside is only relevant in terms of using php as a webserver module; the 'client side' is the browser and php does not run inside the browser (i.e. a php website can not directly interact with anything on your own PC (unless the website lives physically on your own pc)) [actually Wez Furlong wrong a plugin for IE IIRC that allows you to use php in the same way as you might use javascript inside the browser] Of course PHP can query the local filesystem. I thought he wanted it to query a remote filesystem. JM -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Parsing through an Apache Log File?
Hello everyone! I've been given the responsiblity of coding an apache access_log parser. What my tasks are to do is to return the number of hits for certain file extensions that happen on certain dates with specific IP address. As of now I'm only going back 7 days in the log looking for this information and I'm only looking for 5 file types (.doc, .pdf, .html, .php, and .flv). I'm using the fgets() function so I can read the file line by line and do the matches that I need to do and increment the counters as needed. Right now I have 3 loops looking for everything, which seems to me not to be the best way of doing this. I've also encountered that a line may have the file extension I want but it's actually the soucre of another file. (see below for example) Log file example: I want the first line but not the second line. The second line has a .css file which was used by the .html file therefore I don't want this line. I do want the first line that all it has is .html and no other files. 10.25.40.64 - - [01/Jan/2006:07:33:18 -0600] "GET /home.html HTTP/1.1" 200 8220 "-" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)" 10.25.40.64 - - [01/Jan/2006:07:33:18 -0600] "GET /styles/redesign.css HTTP/1.1" 200 2381 "http://wfmu.wfm.pvt/home.html"; "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)" At any rate, here's some of my psudo code/code for what I'm trying to accomplish. I know there has to be a better way for this and I'm looking for suggestions! //path to log file $path = "./"; //name of log file $log_filename = "access_log"; if (!file_exists($path.$log_filename)) { echo "file does not exists!"; die; } //open log file if (!$handle = fopen($path.$log_filename, "r")) { echo "error in loading file!"; die; } //get date range from past 7 days put into array for comparision of log file $dates = array(); $days = 7; for ($i=1;$i<=$days;$i++) { $dates[] = date("d/M/Y", strtotime("-$i day")); } //get document types that need to match $docs = array(); $docs[] = ".doc"; $docs[] = ".pdf"; $docs[] = ".html"; $docs[] = ".htm"; $docs[] = ".php"; $docs[] = ".flv"; $contents = ""; while (!feof($handle)) { $line = fgets($handle); //look to see if the line has a date we are looking for foreach ($dates as $date) { //if date is in the line look for the doc type we want if (strpos($line, $date)) { //look to see if the line has the doc type we want foreach ($docs as $doc) { //if the line has the doc type we want then grab the region //and increment the counter for page hit //make sure to break out of the loops once found //need to add functionality for lines that have file extensions //that are not wanted but also have file extensions that are wanted if (strpos($line, $doc) { break; } //end if } //end foreach ($docs as $doc) break; } //end if } //end foreach ($dates as $date) } //close log file fclose($handle); Thanks! Jay
RE: [PHP] Newbie question: need to transfer directory contents fr om my local machine to my website
> > > > You will not be able to do what you propose with a purely > PHP solution. PHP > > is a server-side technology. That means all the processing > is done at the > > server, then output to your browser. PHP, to my knowledge, > has no way to > > inspect your computer's folders. You would need to look to > a client-side > > er??? stick the following in a file (localfiles.php): > > > function readDirWin($dir) { > $d = dir($dir); > while (false !== ($entry = $d->read())) { > if($entry!="." && $entry!="..") { > echo ($entry = $dir."\\".$entry), "\n"; > if(is_dir($entry)) { > readDirWin($entry); > } > } > } > $d->close(); > } > var_dump( readDirWin("C:") ); > > ?> > > and call it like so: > C:\path\to\your\CLI\php.exe C:\path\to\your\localfiles.php Perhaps I misunderstand what the OP wanted. I thought he was running a webserver somewhere, and that he wanted his remote webserver to be able to grab a file listing on his local machine by just visiting a webpage there. Of course PHP can query the local filesystem. I thought he wanted it to query a remote filesystem. JM -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Access Client IP address
[snip] Is there any way to client's IP address inside a php document. I am trying to generate a code that depends on the IP address of the client. [/snip] http://us3.php.net/manual/en/reserved.variables.php#reserved.variables.serve r $_SERVER['REMOTE_ADDR'] but it may not always be reliable -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Access Client IP address
Nilanjan Dasgupta wrote: > Hi, > Is there any way to client's IP address inside a php document. I am > trying to generate a code that depends on the IP address of the client. > > thanks a lot, > Nilanjan > Give a look at $_SERVER, and more specifically $_SERVER["REMOTE_ADDR"] http://php.net/manual/en/reserved.variables.php#reserved.variables.server HTH, cheers. Silvio -- tradeOver | http://www.tradeover.net ...ready to become the King of the World? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Access Client IP address
$_SERVER['REMOTE_ADDR'] http://www.php.net/manual/en/reserved.variables.php#reserved.variables.server HTH Nilanjan Dasgupta wrote: Hi, Is there any way to client's IP address inside a php document. I am trying to generate a code that depends on the IP address of the client. thanks a lot, Nilanjan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Access Client IP address
Nilanjan Dasgupta wrote: Hi, Is there any way to client's IP address inside a php document. I am trying to generate a code that depends on the IP address of the client. Yes. -- John C. Nichel IV Programmer/System Admin (ÜberGeek) Dot Com Holdings of Buffalo 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Access Client IP address
Hi, Is there any way to client's IP address inside a php document. I am trying to generate a code that depends on the IP address of the client. thanks a lot, Nilanjan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Newbie question: need to transfer directory contents frommy local machine to my website
I would take a look at glob. http://us2.php.net/manual/en/function.glob.php Scott -Original Message- From: Jason Pappin [mailto:[EMAIL PROTECTED] Sent: Wednesday, January 04, 2006 10:48 AM To: Jon Westcot; PHP General Subject: Re: [PHP] Newbie question: need to transfer directory contents frommy local machine to my website Hi, You should perhaps look at setting up a web server on your computer. PHP as stated works server-side and if those folders/files you wish to transfer reside in the web root, then PHP can process those files. Perhaps look at how a web based FTP client written in PHP works for how to copy/move/delete files in PHP. If you can't set up Apache with PHP on Windows, try something like phpdev5 for a click and use solution. As for your IP, it won't really matter unless you want the server to send data back to your computer. If a static IP or hostname is in order, then they are easy enough to set up even if you are on a dial up connection. Regards Jason Jon Westcot wrote: > Hi all: > > I'm really new at PHP and will probably embarrass myself many times > over asking questions that have been asked gazillions of times > before, so let this serve as a blanket apology. > > Now, to my question. Here's what I'm trying to do. I have a simple > database on my website that I wish to populate with information from > various directories on my local computer. The website is running > Linux; my computer is running Windows XP. Once the data are stored, > I want to be able to update the information as things change on my > local computer (not in real time, mind you, but at my request). > > I can set up the database access easily enough, and I know how to > both populate and query it. What I don't know is how to obtain the > information from my local computer via the website. Initially, I'd > like to be able to specify the folder on my local computer to access > and whether or not to process any subfolders that are found. After > the data have been added, I'd like the web application to be able to > access the individual folders without having to specify them again > (although I'd still be able to identify new folders to include in > subsequent updates). > > I'm not really asking for anyone to write the code for me, but I am > looking for suggestions for PHP functions to use to accomplish the > inspection of my local computer's folders. I'd also need to know > what additional information I'd need to store in the database so that > subsequent updates can be automated (i.e., do I need to somehow store > my IP address?). > > Any help you can send my way will be greatly appreciated! Thanks in > advance. > > Sincerely, > > Jon > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: php / mysql / js search result question
Am 2005-12-27 08:03:42, schrieb Dave Carrera: > Hi List, > User input is "a" so the list moves to first instance of "a". User > continues to input "ap" so the list moves to "2 Apple Customer" and so on. This can only be done from a JavaScript. > Thank you in advance > > Dave c Greetings Michelle -- Linux-User #280138 with the Linux Counter, http://counter.li.org/ # Debian GNU/Linux Consultant # Michelle Konzack Apt. 917 ICQ #328449886 50, rue de Soultz MSM LinuxMichi 0033/3/8845235667100 Strasbourg/France IRC #Debian (irc.icq.com) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Graphically displayed number to confirm user is a human
John Meyer wrote: > Duncan Hill wrote: > >>On Wednesday 04 January 2006 16:56, Dave M G wrote: >> >> >> >>> First, is there a term for these kinds of images, or that kind of >>>verification system? What would be the best search terms to look for >>>source scripts? >>> >> >>captcha >> >> > > I've been looking for this term for a while as well. Me too. Geez the things I Googled for without luck makes me cringe. Thanks a bunch. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Newbie question: need to transfer directory contents fr om my local machine to my website
Jim Moseby wrote: Hi Jon, welcome. I'm really new at PHP and will probably embarrass myself many times over asking questions that have been asked gazillions of times before, so let this serve as a blanket apology. You will get a cold response from the regulars on this list if you "ask questions that have been asked gazillions of times before". Friendly advice: always take a little time to search the archives of this list and google a bit to see if your question has already been answered. Can you imagine what this list would be like if every newbie asked the same questions every day? That said, on to your questions. amen. I'm not really asking for anyone to write the code for me, but I am looking for suggestions for PHP functions to use to accomplish the inspection of my local computer's folders. I'd also need to know what additional information I'd need to store in the database so that subsequent updates can be automated (i.e., do I need to somehow store my IP address?). You will not be able to do what you propose with a purely PHP solution. PHP is a server-side technology. That means all the processing is done at the server, then output to your browser. PHP, to my knowledge, has no way to inspect your computer's folders. You would need to look to a client-side er??? stick the following in a file (localfiles.php): read())) { if($entry!="." && $entry!="..") { echo ($entry = $dir."\\".$entry), "\n"; if(is_dir($entry)) { readDirWin($entry); } } } $d->close(); } var_dump( readDirWin("C:") ); ?> and call it like so: C:\path\to\your\CLI\php.exe C:\path\to\your\localfiles.php technology, like Java, for that. STOP RIGHT THERE - php might have been designed for spitting out webpages and the like but these days you can run it as a general purpose scripting language in all sorts of situations - including running a CLI version on your windows desktop machine. go here and install - not only will you have a CLI version of php to play with - it will try to setup a webserver SAPI for whatever webserver you have installed locally (within reason - personally i only use Apache) you can have a php script inspect your local machine by running locally and stick its results in a database that lives on a machine on the otherside of the world. QUESTIONS: 1. what is the local machine? 2. where does the DB live? (is it a different machine?) 3. do you need reporting/information about the local machine inspection anywhere other than the local machine? 4. will there be more than one local machine? 5. why do you want to do this? However, you can upload data to your website using PHP to process the uploaded file. So, at your convienience, you can have a "Browse" button on an update page that will allow you to browse and find your data to upload. After the upload you can have PHP process the uploaded file any way you wish. You can also use cron to kick off scheduled tasks with PHP CLI scripts that will, for instance, open an FTP connection to your machine and download data files to the server for processing. windows also has a task scheduler ... how good it is I don't really know Also I would suggest that it would be better for the local machine to push data to a server than for the server to pull data from the local machine. JM -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Graphically displayed number to confirm user is a human
Duncan Hill wrote: On Wednesday 04 January 2006 16:56, Dave M G wrote: First, is there a term for these kinds of images, or that kind of verification system? What would be the best search terms to look for source scripts? captcha I've been looking for this term for a while as well. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Graphically displayed number to confirm user is a human
On Wednesday 04 January 2006 16:56, Dave M G wrote: > First, is there a term for these kinds of images, or that kind of > verification system? What would be the best search terms to look for > source scripts? captcha -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Graphically displayed number to confirm user is a human
> PHP General List, > > This is something I tried to find on Google, but I'm > hindered by not > knowing the proper terminology. > On many sites that have contact or registration forms, > they have a > small image file with a randomly generated number shown in a distorted > graphical fashion that is hard for a computer to scan and read. > The purpose is that the site visitor has to type in the > numbers into a > field, in order to verify that it is, in fact, a human filling out the > form. > First, is there a term for these kinds of images, or > that kind of > verification system? What would be the best search terms to look for > source scripts? > Second, can anyone recommend a resource for that kind > of PHP script. If > I really worked at it, I could probably write the script to generate a > small PNG image with a random number in it. But I haven't the faintest > clue how to distort it so it's only legible to humans, nor how to > correlate the image with a number that a user inputs into a > form field. Google for "CAPTCHA", and you'll be amazed at the number of hits! JM -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Graphically displayed number to confirm user is a human
Dave M G wrote: > First, is there a term for these kinds of images, or that kind of > verification system? What would be the best search terms to look for > source scripts? CAPTCHA > Second, can anyone recommend a resource for that kind of PHP script. If > I really worked at it, I could probably write the script to generate a > small PNG image with a random number in it. But I haven't the faintest > clue how to distort it so it's only legible to humans, nor how to > correlate the image with a number that a user inputs into a form field. http://pear.php.net/package/Text_CAPTCHA Cheers, David -- David Grant http://www.grant.org.uk/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Graphically displayed number to confirm user is a human
PHP General List, This is something I tried to find on Google, but I'm hindered by not knowing the proper terminology. On many sites that have contact or registration forms, they have a small image file with a randomly generated number shown in a distorted graphical fashion that is hard for a computer to scan and read. The purpose is that the site visitor has to type in the numbers into a field, in order to verify that it is, in fact, a human filling out the form. First, is there a term for these kinds of images, or that kind of verification system? What would be the best search terms to look for source scripts? Second, can anyone recommend a resource for that kind of PHP script. If I really worked at it, I could probably write the script to generate a small PNG image with a random number in it. But I haven't the faintest clue how to distort it so it's only legible to humans, nor how to correlate the image with a number that a user inputs into a form field. Any advice would be much appreciated. -- Dave M G -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Newbie question: need to transfer directory contents from my local machine to my website
Hi, You should perhaps look at setting up a web server on your computer. PHP as stated works server-side and if those folders/files you wish to transfer reside in the web root, then PHP can process those files. Perhaps look at how a web based FTP client written in PHP works for how to copy/move/delete files in PHP. If you can't set up Apache with PHP on Windows, try something like phpdev5 for a click and use solution. As for your IP, it won't really matter unless you want the server to send data back to your computer. If a static IP or hostname is in order, then they are easy enough to set up even if you are on a dial up connection. Regards Jason Jon Westcot wrote: > Hi all: > > I'm really new at PHP and will probably embarrass myself many times > over asking questions that have been asked gazillions of times > before, so let this serve as a blanket apology. > > Now, to my question. Here's what I'm trying to do. I have a simple > database on my website that I wish to populate with information from > various directories on my local computer. The website is running > Linux; my computer is running Windows XP. Once the data are stored, > I want to be able to update the information as things change on my > local computer (not in real time, mind you, but at my request). > > I can set up the database access easily enough, and I know how to > both populate and query it. What I don't know is how to obtain the > information from my local computer via the website. Initially, I'd > like to be able to specify the folder on my local computer to access > and whether or not to process any subfolders that are found. After > the data have been added, I'd like the web application to be able to > access the individual folders without having to specify them again > (although I'd still be able to identify new folders to include in > subsequent updates). > > I'm not really asking for anyone to write the code for me, but I am > looking for suggestions for PHP functions to use to accomplish the > inspection of my local computer's folders. I'd also need to know > what additional information I'd need to store in the database so that > subsequent updates can be automated (i.e., do I need to somehow store > my IP address?). > > Any help you can send my way will be greatly appreciated! Thanks in > advance. > > Sincerely, > > Jon > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Newbie question: need to transfer directory contents from my local machine to my website
At 02:18 AM 1/4/2006, Jon Westcot wrote: Hi all: I'm really new at PHP and will probably embarrass myself many times over asking questions that have been asked gazillions of times before, so let this serve as a blanket apology. Now, to my question. Here's what I'm trying to do. I have a simple database on my website that I wish to populate with information from various directories on my local computer. The website is running Linux; my computer is running Windows XP. Once the data are stored, I want to be able to update the information as things change on my local computer (not in real time, mind you, but at my request). I can set up the database access easily enough, and I know how to both populate and query it. What I don't know is how to obtain the information from my local computer via the website. Initially, I'd like to be able to specify the folder on my local computer to access and whether or not to process any subfolders that are found. After the data have been added, I'd like the web application to be able to access the individual folders without having to specify them again (although I'd still be able to identify new folders to include in subsequent updates). I'm not really asking for anyone to write the code for me, but I am looking for suggestions for PHP functions to use to accomplish the inspection of my local computer's folders. I'd also need to know what additional information I'd need to store in the database so that subsequent updates can be automated (i.e., do I need to somehow store my IP address?). Any help you can send my way will be greatly appreciated! Thanks in advance. Sincerely, Jon Jon, I don't know how to do this, but it's a bad idea. Can it be done? Probably, but it is still a bad idea. Why do you want to: Expose the contents of your machine to the world? Make your machine vulnerable to attack via your web application? Enable a path into the file system on your computer? I would suggest approaching it the other way - if it's something the world should see, upload it to the web server. PHP has lots of tools for reading and traversing directories. If the uploading task becomes onerous, write a script to run on your local machine, using whatever language you are comfortable with, to upload all of the desired content to the web server. Read some articles on cross site scripting to discover why your original approach is not a good idea. Here's one: http://www.cgisecurity.com/articles/xss-faq.shtml and see the links at the end. Regards - Miles Thompson -- No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.1.371 / Virus Database: 267.14.12/220 - Release Date: 1/3/2006 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Newbie question: need to transfer directory contents fr om my local machine to my website
Hi Jon, welcome. > I'm really new at PHP and will probably embarrass myself > many times over asking questions that have been asked > gazillions of times before, so let this serve as a blanket apology. You will get a cold response from the regulars on this list if you "ask questions that have been asked gazillions of times before". Friendly advice: always take a little time to search the archives of this list and google a bit to see if your question has already been answered. Can you imagine what this list would be like if every newbie asked the same questions every day? That said, on to your questions. > I'm not really asking for anyone to write the code for > me, but I am looking for suggestions for PHP functions to use > to accomplish the inspection of my local computer's folders. > I'd also need to know what additional information I'd need to > store in the database so that subsequent updates can be > automated (i.e., do I need to somehow store my IP address?). You will not be able to do what you propose with a purely PHP solution. PHP is a server-side technology. That means all the processing is done at the server, then output to your browser. PHP, to my knowledge, has no way to inspect your computer's folders. You would need to look to a client-side technology, like Java, for that. However, you can upload data to your website using PHP to process the uploaded file. So, at your convienience, you can have a "Browse" button on an update page that will allow you to browse and find your data to upload. After the upload you can have PHP process the uploaded file any way you wish. You can also use cron to kick off scheduled tasks with PHP CLI scripts that will, for instance, open an FTP connection to your machine and download data files to the server for processing. JM -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: fread problem
How looks your characterData function? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Comparing of string
I would guess that the '&' in $_GET['formCheck'] will cause problems... Trying your code without the ampersand as in: $_GET['formCheck'] = 'ZL0X~TT4PQ%0~R0OXPRUHY7E!4~W337J71V4WDDI6$GS9480XP0TNP2I$1YX75S' It works just fine. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Comparing of string
janbro wrote: Hi Jeremy, I tried if ( strcmp( trim($SollKombination), trim($formCheck) ) ) same negativ result. For some reason both strings are not considered to be the same. They have the same length, are of the same type and have the same content. Why PHP doesn't recognize them as beeing equal I don't get it. thanks for your help so far janbro This is just a shot in the dark, but have you checked the HTML source of your test to make sure that some of the characters aren't been parsed as HTML entities? That would technically make the strings different, but you wouldn't be able to tell with just echoing alone. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Comparing of string
Hi Jeremy, I tried if ( strcmp( trim($SollKombination), trim($formCheck) ) ) same negativ result. For some reason both strings are not considered to be the same. They have the same length, are of the same type and have the same content. Why PHP doesn't recognize them as beeing equal I don't get it. thanks for your help so far janbro Jeremy Privett schrieb: > janbro wrote: > >> Hello List >> >> I've got the following little code: >> >>$formCheck= $_GET['formCheck']; >>$SollKombination = $_SESSION['zufall']; >> >>echo "$SollKombination$formCheck"; >>print gettype($formCheck); >>echo "---"; >>print gettype($SollKombination); >> >> >>if ($SollKombination == $formCheck){ >> echo "test"; >>} >> >> To give you some background: This code is supposed to check if a user >> has tried to login via my form. >> >> Which gives me the following output: >> >> ZL0X~TT4PQ%0~R0OXPRUHY7E&!4~W337J71V4WDDI6$GS9480XP0TNP2I$1YX75S >> ZL0X~TT4PQ%0~R0OXPRUHY7E&!4~W337J71V4WDDI6$GS9480XP0TNP2I$1YX75S >> string---string >> >> Everything the way it's supposed to be >> >> What I don't get is, why isn't the if statement true? Shouldn't it >> show test as well? Where is my mistake? >> I run PHP 5.1.1 on Windows. On my Win PHP 5.0 this code works proper, >> but not here ?!? >> >> thx JanBro >> >> >> > Hey JanBro, > > Try replacing the if statement you have with this: > > if ( strcmp( trim($SollKombination), trim($formCheck) ) ) { > echo "test"; > } > > --- > Jeremy Privett [ http://www.jeremyprivett.com ] > Founder - Lead Software Developer - Hosting Systems Administrator > Omega Vortex > (http://www.omegavortex.com) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php