php-general Digest 28 May 2007 19:18:01 -0000 Issue 4816

Topics (messages 255703 through 255717):

Re: Protected Mail Request
        255703 by: nlopess.php.net

alert pcinfinity
        255704 by: Heiko Sudar
        255706 by: Stut

Re: PHP5 oop question...
        255705 by: Stut
        255707 by: Andrei
        255710 by: Jared Farrish

[TEST] LINKS EXCHANGE
        255708 by: Marco Sottana

Tracking exit links with php?
        255709 by: Merlin
        255711 by: Jared Farrish
        255712 by: Tijnema

php and Ajax problem
        255713 by: Richard Kurth

Unknown number of check boxes?
        255714 by: Søren Neigaard
        255716 by: Stephen

Upload a ppt file
        255715 by: tedd
        255717 by: Jared Farrish

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:
        [EMAIL PROTECTED]


----------------------------------------------------------------------
--- Begin Message ---
Forwarded message is available.



--- End Message ---
--- Begin Message ---
hi all,

does someone ever hear of an internet explorer alert "pcinfinity"?
I really didn´t find anything in forums and search engines, so maybe
somebody in this list knows better...

thanks for answers
heiko

-----------------------------------------------
„lernen ist wie rudern gegen den strom – 
hört man damit auf, treibt man zurück!“
(laotse)
-----------------------------------------------
heiko sudar
kranzhornstraße 4a
85567 grafing
 
08092 860585 (t)
08092 860587 (f)
0179 6863181 (m)
 
www.countingstation.de
www.applico.biz
www.lokalitaeten.net

--- End Message ---
--- Begin Message ---
Heiko Sudar wrote:
does someone ever hear of an internet explorer alert "pcinfinity"?
I really didn´t find anything in forums and search engines, so maybe
somebody in this list knows better...

I'm not sure what you mean by "internet explorer alert", but it sounds like either advertising or you have some malware. Either way this is definitely not the right place to ask.

-Stut

--- End Message ---
--- Begin Message ---
Andrei wrote:
    Hi list,

    I have a class which I use to parse simple bbcode inside some comments.
    I noticed on PHP5 that scope of preg_replace function is changed
when function is called inside a class. To the point:

[CODE]
class PHS_editor
{
    ...

    function parse_content( $str = null )
    {
        $from_arr = array( "@\[B\](.*?)\[\/[EMAIL PROTECTED]",
"@\[U\](.*?)\[\/[EMAIL PROTECTED]", "@\[I\](.*?)\[\/[EMAIL PROTECTED]",
                           "@\[URL=([^\]]*)\]([^\[]*?)\[\/[EMAIL PROTECTED]",
                           "@\[IMG=([^\]]*)[EMAIL PROTECTED]",
                           "@\[QUOTE=([^\]]*)\]([^\[]*?)\[\/[EMAIL PROTECTED]"
                            );

        $to_arr = array( '<b>\1</b>', '<u>\1</u>', '<i>\1</i>',

                         '<a href="\1" target="_blank">\2</a>',

                         "'<img src=\"'.stripslashes(
\*$this->get_image_location*( '\\1' ) ).'\" border=\"0\">'",

                         "'<table width=\"98%\" align=\"center\"
cellpadding=\"1\" cellspacing=\"0\" border=\"0\" class=\"form_type\">".
                          "<tr>".
                            "<td class=\"maintext\">'.stripslashes(
\*$this->remove_mytags*( '\\2' ) ).'</td>".
                         "</tr>".
                         "</table>'"

                         );

        if( is_null( $str ) )
            $str = $this->editor_content;
return preg_replace( $from_arr, $to_arr, str_replace( " ", "
&nbsp;", nl2br( $str ) ) );
    }

    ...
}
[/CODE]

    When it gets to parse [IMG] tags I get "Fatal error: Using $this
when not in object context in ...". So it seems they changed the scope
for preg_replace callback functions. As this function is called inside
the method shouldn't it have the scope of the class?
    Is there a workaround for this? I cannot declare a function
get_image_location which will staticly call the method bcuz I use
variables from instanced class.

How are you trying to use this class? It sounds like you're trying to use the method statically. When a method is called statically it does not have a $this.

-Stut

--- End Message ---
--- Begin Message ---
Stut wrote:
> Andrei wrote:
>>     Hi list,
>>
>>     I have a class which I use to parse simple bbcode inside some
>> comments.
>>     I noticed on PHP5 that scope of preg_replace function is changed
>> when function is called inside a class. To the point:
>>
>> [CODE]
>> class PHS_editor
>> {
>>     ...
>>
>>     function parse_content( $str = null )
>>     {
>>         $from_arr = array( "@\[B\](.*?)\[\/[EMAIL PROTECTED]",
>> "@\[U\](.*?)\[\/[EMAIL PROTECTED]", "@\[I\](.*?)\[\/[EMAIL PROTECTED]",
>>                            "@\[URL=([^\]]*)\]([^\[]*?)\[\/[EMAIL PROTECTED]",
>>                            "@\[IMG=([^\]]*)[EMAIL PROTECTED]",
>>                           
>> "@\[QUOTE=([^\]]*)\]([^\[]*?)\[\/[EMAIL PROTECTED]"
>>                             );
>>
>>         $to_arr = array( '<b>\1</b>', '<u>\1</u>', '<i>\1</i>',
>>
>>                          '<a href="\1" target="_blank">\2</a>',
>>
>>                          "'<img src=\"'.stripslashes(
>> \*$this->get_image_location*( '\\1' ) ).'\" border=\"0\">'",
>>
>>                          "'<table width=\"98%\" align=\"center\"
>> cellpadding=\"1\" cellspacing=\"0\" border=\"0\" class=\"form_type\">".
>>                           "<tr>".
>>                             "<td class=\"maintext\">'.stripslashes(
>> \*$this->remove_mytags*( '\\2' ) ).'</td>".
>>                          "</tr>".
>>                          "</table>'"
>>
>>                          );
>>
>>         if( is_null( $str ) )
>>             $str = $this->editor_content;
>>                return preg_replace( $from_arr, $to_arr, str_replace(
>> "  ", "
>> &nbsp;", nl2br( $str ) ) );
>>     }
>>
>>     ...
>> }
>> [/CODE]
>>
>>     When it gets to parse [IMG] tags I get "Fatal error: Using $this
>> when not in object context in ...". So it seems they changed the scope
>> for preg_replace callback functions. As this function is called inside
>> the method shouldn't it have the scope of the class?
>>     Is there a workaround for this? I cannot declare a function
>> get_image_location which will staticly call the method bcuz I use
>> variables from instanced class.
>
> How are you trying to use this class? It sounds like you're trying to
> use the method statically. When a method is called statically it does
> not have a $this.
>
> -Stut
>
    Yes, method was called staticly. Strange tho in php 4 it worked.
    Thnx for enlighting me with this.

    Andy

--- End Message ---
--- Begin Message ---
When in-scope and using static functions, use self:

<code>

class Static_Ex {
   private static $variable = 'This is a static variable';
   public static function tryStatic() {
       return self::$variable;
   }
}
echo Static_Ex::tryStatic();

</code>

If you think about it, there is no $this in a static function. If static
functions do not need an instatiated object to access class code, you don't
refer to them the same, nor do you use $this internally inside the functions
that are static.

Using static functions and variables is quite tricky. Static methods and
variables make tasks like programming a singleton to point to a single
database connection for all database activities on a website simple and
easy. But if it has to interact with the internals of an instantiated object
within it's own class, then you need to either pass in all variables
(Static_Ex::method($this) when in scope to an instantiated object should
work), and/or make it work entirely on it's own without $this.

--
Jared Farrish
Intermediate Web Developer
Denton, Tx

Abraham Maslow: "If the only tool you have is a hammer, you tend to see
every problem as a nail." $$

--- End Message ---
--- Begin Message ---
i would like to test 
www.3viso.com/addurl 
try to input your link and categories and tell me what you think about it 
thank a lot

--- End Message ---
--- Begin Message ---
Hi there,

I am wondering if it is possible to track links on for example google adsense as exit URLs with PHP. You can track referers, I know, but what about the adsense banner on your pages. Did you ever wonder which page exactly leads to a click?

I would like to track which adsense link they clicked on what page.
Is this even possible? The ads are implemented into the publisher pages, but the ad itself is delivered by there adservers, so there is no logentry or similar on my server.

Any ideas on how to track that?

Thanx for any hint.

Best regards, Merlin

--- End Message ---
--- Begin Message ---
Any ideas on how to track that?

Two things:

1) This is probably going to have to some kind of javascript spy that
reports to a (php/asp/python/ruby) page for recording onUnload().
2) You might read the Google AdSense legalese to see if they allow it, or if
they provide it (maybe for a fee). What you want is access to their redirect
page log.

You also might look into Urchin and the ISP's that support it.

--
Jared Farrish
Intermediate Web Developer
Denton, Tx

Abraham Maslow: "If the only tool you have is a hammer, you tend to see
every problem as a nail." $$

--- End Message ---
--- Begin Message ---
On 5/28/07, Merlin <[EMAIL PROTECTED]> wrote:
Hi there,

I am wondering if it is possible to track links on for example google
adsense as exit URLs with PHP. You can track referers, I know, but what
about the adsense banner on your pages. Did you ever wonder which page
exactly leads to a click?

I would like to track which adsense link they clicked on what page.
Is this even possible? The ads are implemented into the publisher pages,
but the ad itself is delivered by there adservers, so there is no
logentry or similar on my server.

Any ideas on how to track that?

Thanx for any hint.

Best regards, Merlin


You would need to edit the javascript code from google, this is
possible, but I don't think google will be happy with it, and they
will probably say that you were doing illegal actions by modifing the
code and you won't get any money ...

Tijnema

--- End Message ---
--- Begin Message ---
I can not figure out way this is not working can somebody help?
 
<html>
<head>
 <title>Untitled</title>
<script language="JavaScript">
function createRequestObject() {
 
   var req;
 
   if(window.XMLHttpRequest){
      // Firefox, Safari, Opera...
      req = new XMLHttpRequest();
   } else if(window.ActiveXObject) {
      // Internet Explorer 5+
      req = new ActiveXObject("Microsoft.XMLHTTP");
   } else {
      // There is an error creating the object,
      // just as an old browser is being used.
      alert('Problem creating the XMLHttpRequest object');
   }
 
   return req;
 
}
 
// Make the XMLHttpRequest object
var http = createRequestObject();
 
function sendRequest(action,arg) {
   // Open PHP script for requests
   http.open('get', 'eventaction.php?takeaction='+action+'&uid='+arg);
   http.onreadystatechange = handleResponse;
   http.send(null);
 
}
 
function handleResponse() {
    if(http.readyState == 4){
        var response = http.responseText;
        var update = new Array();
 
        if(response.indexOf('|' != -1)) {
            update = response.split('|');
            document.getElementById(update[0]).innerHTML = update[1];
        }
    }
}
</script>
</head>
 
<body>
<?php 
 $event['deleteevent']='<a
href="javascript:sendRequest(delete,32423434234234234324)">Delete this
event</a>';
 
 echo $event['deleteevent'];
?>
</body>
</html>
 
 
 
this  is the 'eventaction.php script yo test if the ajax script works
<?
if($_GET['takeaction']=="delete"){
$uid=$_GET['uid'];
echo $uid;
exit;
}
 

?>

--- End Message ---
--- Begin Message ---
Hi

I would like to have a unknown number of generated check boxes like this:

<input type="checkbox" name="chk01" />
<input type="checkbox" name="chk02" />
<input type="checkbox" name="chk0X" />

And the name will be generated "chk01 to chk99", but how do I make the receiving PHP script that "scans" for post variables that are sent, so that I can work on this information?

Best regards
Søren

Attachment: smime.p7s
Description: S/MIME cryptographic signature


--- End Message ---
--- Begin Message ---
Søren Neigaard wrote:
I would like to have a unknown number of generated check boxes like this:

<input type="checkbox" name="chk01" />
<input type="checkbox" name="chk02" />
<input type="checkbox" name="chk0X" />

And the name will be generated "chk01 to chk99", but how do I make the receiving PHP script that "scans" for post variables that are sent, so that I can work on this information?

The form posting agent will only return values for boxes that are checked.

You can do isset in a loop up to the maximum possible value.

But I suspect that you are generating the form dynamically. If that is the case, add a hidden input with a value of the number of checkboxes. That would be the upper limit of your loop.

Stephen

--- End Message ---
--- Begin Message ---
Hi Gang:

I can upload a text file and an image file via a html form, but I am having problems uploading a PowerPoint file. Apparently, that's a different critter.

Does any have any references or an example to show me?

Thanks,

Cheers,

tedd

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

--- End Message ---
--- Begin Message ---
Does any have any references or an example to show me?

Well, I think we need a description of the error or the invalid response
you're having. It could be a file-size issue (your php.ini configuration
won't allow file sizes > 8mb's, for instance).

Have you googled it?

--
Jared Farrish
Intermediate Web Developer
Denton, Tx

Abraham Maslow: "If the only tool you have is a hammer, you tend to see
every problem as a nail." $$

--- End Message ---

Reply via email to