php-general Digest 13 Sep 2006 14:42:51 -0000 Issue 4345

Topics (messages 241692 through 241711):

Re: Open file on a Mounted Share on Mac OS X
        241692 by: Chris
        241708 by: Rahul S. Johari

Re: Filter MS Word Garbage
        241693 by: Paul Scott
        241694 by: Michael B Allen

Affiliate system
        241695 by: Peter Lauri
        241697 by: Robert Cummings
        241698 by: J R
        241699 by: Andrei
        241700 by: Peter Lauri

Re: FUNCTION TO CHECK IMAGE
        241696 by: BBC

PHP and mySQL dates
        241701 by: Dave Goodchild
        241702 by: Peter Lauri
        241703 by: Dave Goodchild
        241704 by: Peter Lauri
        241705 by: Dave Goodchild

USB Question Not PHP Related, so if you don't want to read this you don't have 
to
        241706 by: Jay Blanchard
        241707 by: benifactor
        241709 by: tg-php.gryffyndevelopment.com
        241711 by: tg-php.gryffyndevelopment.com

Re: DOM - parse HTML document [solved]
        241710 by: tedd

Administrivia:

To subscribe to the digest, e-mail:
        [EMAIL PROTECTED]

To unsubscribe from the digest, e-mail:
        [EMAIL PROTECTED]

To post to the list, e-mail:
        php-general@lists.php.net


----------------------------------------------------------------------
--- Begin Message ---
Rahul S. Johari wrote:
That was a good idea. I tried that... It was showing nothing for
/Volumes/foresight ... But it did show the contents of /Volumes... And
interestingly, 'foresight' was also listed there, but it's filetype was
blank... Others had like "dir" or "link" or "file".... But foresight's
filetype had nothing in it!!

That'll be the problem. PHP doesn't see it as a valid "type".

How is it mounted, through samba, through something else?

--
Postgresql & php tutorials
http://www.designmagick.com/

--- End Message ---
--- Begin Message ---
Samba. It's an SMB share.


On 9/13/06 12:39 AM, "Chris" <[EMAIL PROTECTED]> wrote:

> Rahul S. Johari wrote:
>> That was a good idea. I tried that... It was showing nothing for
>> /Volumes/foresight ... But it did show the contents of /Volumes... And
>> interestingly, 'foresight' was also listed there, but it's filetype was
>> blank... Others had like "dir" or "link" or "file".... But foresight's
>> filetype had nothing in it!!
> 
> That'll be the problem. PHP doesn't see it as a valid "type".
> 
> How is it mounted, through samba, through something else?

Rahul S. Johari
Supervisor, Internet & Administration
Informed Marketing Services Inc.
500 Federal Street, Suite 201
Troy NY 12180

Tel: (518) 687-6700 x154
Fax: (518) 687-6799
Email: [EMAIL PROTECTED]
http://www.informed-sources.com

--- End Message ---
--- Begin Message ---
On Tue, 2006-09-12 at 15:02 -0700, Kevin Murphy wrote:
> Is there some way I can filter/convert this information before it  
> gets to the mysql database?

Best way to do this is to send it through catdoc. Not sure if the Word
upload is HTML(ish) or a Word doc, but if the latter, then catdoc is
your best bet.

http://www.45.free.net/~vitus/software/catdoc/

--Paul

All Email originating from UWC is covered by disclaimer 
http://www.uwc.ac.za/portal/uwc2006/content/mail_disclaimer/index.htm 

--- End Message ---
--- Begin Message ---
On Tue, 12 Sep 2006 15:02:08 -0700
Kevin Murphy <[EMAIL PROTECTED]> wrote:

> I have a web form where trusted people will be inputing information  
> that they usually copy/paste out of MS Word. While the people are  
> trusted... MS Word isn't. I keep getting garbage characters in there,  
> usually associated with Smart Quotes. If I take the content out of  
> the DB, throw it into BBEdit and use the convert to ASCII command  
> that solves the problem.

Iterate of each character (byte) and use chr(b) to get the numeric
value. If that value is less than 128 the character is ASCII. Otherwise
it is not. Based on that, it would be very easy to write a function to
strip all non-ASCII characters.

However, you might consider giving people back exactly what they
submitted. Meaning when storing the fragment use mysql_escape_string()
or equivalent and then when the HTML field use htmlentities() to escape
any special HTML character. That might preserve formatting information
embedded in the clipboard fragment (if that's something you want).

Mike

-- 
Michael B Allen
PHP Active Directory SSO
http://www.ioplex.com/

--- End Message ---
--- Begin Message ---
Hi guys,

I am reviewing an affiliate system that I created a while ago. I am using a
very simple method to do this, but I am curious if there is any better
system (better I mean less missed affiliate purchases).

1. User click on affiliate link http://thedomain.com/?a=1234
2. The if $_GET['a'] is set, we check if that is an valid affiliate, and
then set a cookie for that
3. At purchase, we check if that cookie still is there, if so, we register
it as a affiliate purchase and that info is stored in the purchase database

What should I do if they do not allow cookies? I could amend a=1234 onto
every url that they pass, but that would not be a "beautiful" solution.

Maybe I can also create a SESSION that stores the affiliate information so
that it at least get registered if the purchase is completed within the
session?

What do you think is the best way?

Best regards, 
Peter Lauri

www.lauri.se - personal web site
www.dwsasia.com - company web site

--- End Message ---
--- Begin Message ---
On Wed, 2006-09-13 at 12:58 +0700, Peter Lauri wrote:
> Hi guys,
> 
> I am reviewing an affiliate system that I created a while ago. I am using a
> very simple method to do this, but I am curious if there is any better
> system (better I mean less missed affiliate purchases).
> 
> 1. User click on affiliate link http://thedomain.com/?a=1234
> 2. The if $_GET['a'] is set, we check if that is an valid affiliate, and
> then set a cookie for that
> 3. At purchase, we check if that cookie still is there, if so, we register
> it as a affiliate purchase and that info is stored in the purchase database
> 
> What should I do if they do not allow cookies? I could amend a=1234 onto
> every url that they pass, but that would not be a "beautiful" solution.
> 
> Maybe I can also create a SESSION that stores the affiliate information so
> that it at least get registered if the purchase is completed within the
> session?

Sessions and temporary cookies solve the same issue (even if sessions
are using trans sid). If a user has cookies disabled then you can rely
on the trans sid feature which already performs the propagation of the
session via URLs as you have suggested. Failing that, you don't really
have any alternatives :)

Cheers,
Rob.
-- 
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com |
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for       |
| creating re-usable components quickly and easily.          |
`------------------------------------------------------------'

--- End Message ---
--- Begin Message ---
use session. or you can store it in a database but that will take speed. :)

using session is much better rather than using cookies for lots of reason
(just google) specially if you are concered with security.

just my 2cents.

hth,
john

p.s.

if the client cookies is disabled set to true the session.use_trans_id.

On 9/13/06, Robert Cummings <[EMAIL PROTECTED]> wrote:

On Wed, 2006-09-13 at 12:58 +0700, Peter Lauri wrote:
> Hi guys,
>
> I am reviewing an affiliate system that I created a while ago. I am
using a
> very simple method to do this, but I am curious if there is any better
> system (better I mean less missed affiliate purchases).
>
> 1. User click on affiliate link http://thedomain.com/?a=1234
> 2. The if $_GET['a'] is set, we check if that is an valid affiliate, and
> then set a cookie for that
> 3. At purchase, we check if that cookie still is there, if so, we
register
> it as a affiliate purchase and that info is stored in the purchase
database
>
> What should I do if they do not allow cookies? I could amend a=1234 onto
> every url that they pass, but that would not be a "beautiful" solution.
>
> Maybe I can also create a SESSION that stores the affiliate information
so
> that it at least get registered if the purchase is completed within the
> session?

Sessions and temporary cookies solve the same issue (even if sessions
are using trans sid). If a user has cookies disabled then you can rely
on the trans sid feature which already performs the propagation of the
session via URLs as you have suggested. Failing that, you don't really
have any alternatives :)

Cheers,
Rob.
--
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com |
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for       |
| creating re-usable components quickly and easily.          |
`------------------------------------------------------------'

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




--
GMail Rocks!!!

--- End Message ---
--- Begin Message ---
        I ran into same issue with a site... I solved this problem by saving
information in 2 places (in cookies and in database). So when saving
data once I saved in the cookie then into database. When I wanted to
read the information I first check if cookie exist and if it doesn't I
read from database.

        Andy

Peter Lauri wrote:
> Hi guys,
> 
> I am reviewing an affiliate system that I created a while ago. I am using a
> very simple method to do this, but I am curious if there is any better
> system (better I mean less missed affiliate purchases).
> 
> 1. User click on affiliate link http://thedomain.com/?a=1234
> 2. The if $_GET['a'] is set, we check if that is an valid affiliate, and
> then set a cookie for that
> 3. At purchase, we check if that cookie still is there, if so, we register
> it as a affiliate purchase and that info is stored in the purchase database
> 
> What should I do if they do not allow cookies? I could amend a=1234 onto
> every url that they pass, but that would not be a "beautiful" solution.
> 
> Maybe I can also create a SESSION that stores the affiliate information so
> that it at least get registered if the purchase is completed within the
> session?
> 
> What do you think is the best way?
> 
> Best regards, 
> Peter Lauri
> 
> www.lauri.se - personal web site
> www.dwsasia.com - company web site
> 

--- End Message ---
--- Begin Message ---
That is probably what I will do. Thanks for your comment.

-----Original Message-----
From: Andrei [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, September 13, 2006 2:43 PM
To: [php] PHP General List
Subject: Re: [PHP] Affiliate system


        I ran into same issue with a site... I solved this problem by saving
information in 2 places (in cookies and in database). So when saving
data once I saved in the cookie then into database. When I wanted to
read the information I first check if cookie exist and if it doesn't I
read from database.

        Andy

Peter Lauri wrote:
> Hi guys,
> 
> I am reviewing an affiliate system that I created a while ago. I am using
a
> very simple method to do this, but I am curious if there is any better
> system (better I mean less missed affiliate purchases).
> 
> 1. User click on affiliate link http://thedomain.com/?a=1234
> 2. The if $_GET['a'] is set, we check if that is an valid affiliate, and
> then set a cookie for that
> 3. At purchase, we check if that cookie still is there, if so, we register
> it as a affiliate purchase and that info is stored in the purchase
database
> 
> What should I do if they do not allow cookies? I could amend a=1234 onto
> every url that they pass, but that would not be a "beautiful" solution.
> 
> Maybe I can also create a SESSION that stores the affiliate information so
> that it at least get registered if the purchase is completed within the
> session?
> 
> What do you think is the best way?
> 
> Best regards, 
> Peter Lauri
> 
> www.lauri.se - personal web site
> www.dwsasia.com - company web site
> 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

--- End Message ---
--- Begin Message ---
BBC wrote:
What types of images are these? JPG, PNG, GIF?
Its jpg. Look... I don't know exactly what your point, I'm just asking you about the function to resolve the size of image like the
codes below:
if (file_exists($img_path)){
list($width,$height) = getimagesizes($img_path);
}else{
$width = $ height = $max_size;
}
So is there any other option to replace file_exists();?


Well, if I do remember correctly, then you are uploading a file. If that's the case, then rather than using file_exists() you should be using is_uploaded_file. Once you've verified that is_uploaded_file() returns true, then use move_uploaded_file() to move the file to someplace on your filesystem. If that returns true, then you should not have to check file_exists again and just be able to use get getimagesize().

So, a good function for this would probably be:

function getUploadedImageSize($image, $to_path) {
        global $max_size;

        $width = $height = $max_size;

        if (is_uploaded_file($image)) {
                if (move_uploaded_file($image, $to_path)) {
                        list($width,$height) = getimagesize($to_path);
                }
        }

        return array($width, $height);
}

list($width, $height) = getUploadedImageSize($tmp, '/the/final/path');

BTW, I don't know if you did a copy and paste from your code or if you just typed it in really quickly, but you do have a few syntactical errors in the code above. First, the image sizing function is getimagesize - singular, not plural. Second, in your assignment statement, you have a space where there should not be one:

$width = $ height = $max_size;
         ^

Just wanted to make sure you knew about that in case it was copied and
pasted.

thank you for your input, it really helps.
========================================================================================
Semarakkan kemerdekaan RI ke 61 th dengan ikut bermain netkuis 17-an di http://netkuis.telkom.net/17an/
Kumpulkan poin sebanyak-banyaknya. Dan siap-siap tunggu rejeki dari sponsor 
kami.

========================================================================================
--- End Message ---
--- Begin Message ---
Hi all. I am building an online events registry and have mapped out all the
dates between Oct 1 2006 and Dec 31 2030, stored in the database as
timestamps incremented by 86400 to give daily slots. I have output the
values using the php date function and all is well. Users can enter either
one-off or regular events, and I am using a mapping table to tie events to
dates as they comprise a many-to-many relationship.

I am struggling with some date conversions, however. When a user enters a
single event for example, the data is entered into the events table, the
inserted id captured, and then the system will look for the relevant record
in the dates table, and eventually enter the event id and date id into the
mapping table for later joins during the search process.

To do this, I call:

$date_string =
mktime(0,0,0,$_SESSION['month],$_SESSION['day'],$_SESSION['year'])

to assemble a timestamp from the supplied user data, and now I need to look
for the matching date in the dates table. My problem is in converting
between UNIX and mySQL timestamp values. My first attempt to match used this
(query extract):

"SELECT id FROM dates WHERE FROM_UNIXTIME($date_string) = date"

then

"SELECT id FROM dates WHERE UNIX_TIMESTAMP(date) = $date_string"

neither is working. Am I making some fundamental error here or missing
something? Any help appreciated!

--
http://www.web-buddha.co.uk
http://www.projectkarma.co.uk

--- End Message ---
--- Begin Message ---
[snip]
Hi all. I am building an online events registry and have mapped out all the
dates between Oct 1 2006 and Dec 31 2030, stored in the database as
timestamps incremented by 86400 to give daily slots. 
[/snip]

I do not really understand the purpose of mapping all dates between Oct 1
2006 and Dec 31 2030 and store them into a database as a timestamp. First of
all, a date is a date, not a timestamp. A timestamp is date and time
together.

Why don't you just save the events with the date as DATE format and then
compare them with CURDATE() or similar. Or just with "$_SESSION[year]-
"$_SESSION[month]- "$_SESSION[day]"

Just some thoughts.

/Peter

--- End Message ---
--- Begin Message ---
Thanks. I have been so up close and personal with this that I can't see the
wood for the trees. Of course, so obvious. Thank you - you have made me very
happy.





--
http://www.web-buddha.co.uk
http://www.projectkarma.co.uk

--- End Message ---
--- Begin Message ---
No problem, now I will go and make my girlfriend happy :)

-----Original Message-----
From: Dave Goodchild [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, September 13, 2006 6:27 PM
To: Peter Lauri
Cc: PHP General
Subject: Re: [PHP] PHP and mySQL dates

Thanks. I have been so up close and personal with this that I can't see the
wood for the trees. Of course, so obvious. Thank you - you have made me very
happy.

>
>


-- 
http://www.web-buddha.co.uk
http://www.projectkarma.co.uk

--- End Message ---
--- Begin Message ---
Good luck with that.


>


--
http://www.web-buddha.co.uk
http://www.projectkarma.co.uk




--
http://www.web-buddha.co.uk
http://www.projectkarma.co.uk

--- End Message ---
--- Begin Message ---
I generally would not do this, but I have an urgent need and this group
has seen everything; I need two USB ports on a system to have the same
channel. I continue to STFW but have not come upon something like this
yet. The application is for softphones in a call center environment, the
headsets to be used are USB headsets...having two USB ports on the same
channel would allow supervisors to plug-in and listen to a call with a
call center rep. Anyone heard of anything like this? I appreciate any
clues and nuggets.

--- End Message ---
--- Begin Message ---
you should try to search for a headset with a splitter. i dont know if this
would work for your needs, but it would allow multiple connectons and
require only one port.

----- Original Message ----- 
From: "Jay Blanchard" <[EMAIL PROTECTED]>
To: <php-general@lists.php.net>
Sent: Wednesday, September 13, 2006 4:59 AM
Subject: [PHP] USB Question Not PHP Related, so if you don't want to read
this you don't have to


I generally would not do this, but I have an urgent need and this group
has seen everything; I need two USB ports on a system to have the same
channel. I continue to STFW but have not come upon something like this
yet. The application is for softphones in a call center environment, the
headsets to be used are USB headsets...having two USB ports on the same
channel would allow supervisors to plug-in and listen to a call with a
call center rep. Anyone heard of anything like this? I appreciate any
clues and nuggets.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

--- End Message ---
--- Begin Message ---
We have a similar (and still non-PHP related) issue at work where we want to do 
the "call may be monitored for quality assurance" thing on the new phone system 
we just got.  Our old phone system was analog and provided for this feature.  
The new system is a Cisco IP Phone deal which is really really 
cool/nice/wicked/whatever, but doesn't allow us to do the call intercept 
in-house.

There IS something you can get for our system that taps directly into the 
server and allows call monitoring that way though.

I don't know what system you have, but if it's a 'soft phone' then I'm guessing 
there's a server involved and your system may have some allowances for call 
interception at the server level.  I guess in that case, your supervisor types 
would plug their soft phones into their own USB ports and run software that'd 
allow them to select which phone to monitor and get the data directly from the 
server.

I don't know if USB allows 'splitting' in a fashion that would be useful to 
what you're trying to do.  There may be too much two-way communication and 
you'd have two USB soft phones competing for Mom's attention at the same time.  
Not saying it's impossible, just don't know how that'd work.

If you post more info on what system you have (if you can) maybe someone knows 
some specifics for that particular system.

-TG

= = = Original message = = =

I generally would not do this, but I have an urgent need and this group
has seen everything; I need two USB ports on a system to have the same
channel. I continue to STFW but have not come upon something like this
yet. The application is for softphones in a call center environment, the
headsets to be used are USB headsets...having two USB ports on the same
channel would allow supervisors to plug-in and listen to a call with a
call center rep. Anyone heard of anything like this? I appreciate any
clues and nuggets.

___________________________________________________________
Sent by ePrompter, the premier email notification software.
Free download at http://www.ePrompter.com.

--- End Message ---
--- Begin Message ---
Sorry, misread the "splitter" comment earlier.  A splitter pre-USB off of the 
headset or phone-unit somewhere may work too.

-TG


= = = Original message = = =

We have a similar (and still non-PHP related) issue at work where we want to do 
the "call may be monitored for quality assurance" thing on the new phone system 
we just got.  Our old phone system was analog and provided for this feature.  
The new system is a Cisco IP Phone deal which is really really 
cool/nice/wicked/whatever, but doesn't allow us to do the call intercept 
in-house.

There IS something you can get for our system that taps directly into the 
server and allows call monitoring that way though.

I don't know what system you have, but if it's a 'soft phone' then I'm guessing 
there's a server involved and your system may have some allowances for call 
interception at the server level.  I guess in that case, your supervisor types 
would plug their soft phones into their own USB ports and run software that'd 
allow them to select which phone to monitor and get the data directly from the 
server.

I don't know if USB allows 'splitting' in a fashion that would be useful to 
what you're trying to do.  There may be too much two-way communication and 
you'd have two USB soft phones competing for Mom's attention at the same time.  
Not saying it's impossible, just don't know how that'd work.

If you post more info on what system you have (if you can) maybe someone knows 
some specifics for that particular system.

-TG

= = = Original message = = =

I generally would not do this, but I have an urgent need and this group
has seen everything; I need two USB ports on a system to have the same
channel. I continue to STFW but have not come upon something like this
yet. The application is for softphones in a call center environment, the
headsets to be used are USB headsets...having two USB ports on the same
channel would allow supervisors to plug-in and listen to a call with a
call center rep. Anyone heard of anything like this? I appreciate any
clues and nuggets.

___________________________________________________________
Sent by ePrompter, the premier email notification software.
Free download at http://www.ePrompter.com.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


___________________________________________________________
Sent by ePrompter, the premier email notification software.
Free download at http://www.ePrompter.com.

--- End Message ---
--- Begin Message ---
At 12:07 AM +0200 9/13/06, Leonidas Safran wrote:
Hello all,

I have found a way...

$doc = new DomDocument();
$doc->loadHTMLFile($source["url"]);

$elements = $doc->getElementsByTagName("tr");

$i = 0;

while( $elements->item($i) ){
if( $elements->item($i)->hasAttributes() && preg_match("/td[0|1]/",$elements->item($i)->getAttribute("id")) > 0 ){
  echo $elements->item($i)->nodeValue . "<br />";
  }
  $i++;
}

Works like i want...


Regards,

LS


Interesting -- it doesn't work for me. I keep getting --

Parse error: parse error, unexpected T_OBJECT_OPERATOR

-- in your if statement. But, I don't see the problem.

tedd
--
-------
http://sperling.com  http://ancientstones.com  http://earthstones.com

--- End Message ---

Reply via email to