OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
php-general Digest 30 May 2008 07:09:23 -0000 Issue 5487

php-general-digest-helplists.php.net
Date: Fri May 30 2008 - 02:09:23 CDT


php-general Digest 30 May 2008 07:09:23 -0000 Issue 5487

Topics (messages 274833 through 274872):

sql injection
        274833 by: Sudhakar
        274835 by: Gabriel Sosa

validating # sign in php
        274834 by: Sudhakar

authentication verification
        274836 by: DeadTOm
        274839 by: Robert Cummings
        274840 by: Greg Maruszeczka

Re: Problem with Object references in an array via for loop
        274837 by: David Moylan
        274838 by: David Moylan

Re: A Little Something.
        274841 by: tedd

Re: preg_match_all
        274842 by: Mario Guenterberg
        274847 by: Eric Butera
        274848 by: Eric Butera

A problem with fgets()
        274843 by: Usamah M. Ali
        274850 by: Chris
        274851 by: Usamah M. Ali
        274852 by: Chris
        274853 by: Usamah M. Ali

PHP Code I Must find
        274844 by: John Taylor-Johnston
        274845 by: Jeremy Privett
        274846 by: TG
        274849 by: John Taylor-Johnston
        274861 by: John Taylor-Johnston

PHP Extensions as Shared Objects?
        274854 by: Weston C
        274855 by: Chris
        274856 by: Weston C
        274857 by: mike

Re: Help mms (Get audio Stream)
        274858 by: Shelley

A bit 0T - WAMPSERVER
        274859 by: Ryan S
        274860 by: Chris

Help with SSH2
        274862 by: Gonzalo Bettancourt
        274864 by: Jim Lucas

Re: Embed images in emails
        274863 by: Iñigo Medina García
        274865 by: Iñigo Medina García
        274866 by: Iñigo Medina García
        274867 by: Chris
        274869 by: Iñigo Medina García
        274870 by: Iñigo Medina García
        274871 by: Per Jessen
        274872 by: Chris

PHP eg.
        274868 by: mukesh yadav

Administrivia:

To subscribe to the digest, e-mail:
        php-general-digest-subscribelists.php.net

To unsubscribe from the digest, e-mail:
        php-general-digest-unsubscribelists.php.net

To post to the list, e-mail:
        php-generallists.php.net

----------------------------------------------------------------------

attached mail follows:


i have implemented a way to avoid sql injection from the php website from
this url
http://in.php.net/mysql_real_escape_string from the "Example #3 A "Best
Practice" query" section of this page

following are the steps i have followed after the form values are submitted
to a php file.

step 1.

if(get_magic_quotes_gpc())
{
$username = stripslashes($_POST["username"]);
.........
}

else
{
$username = $_POST["username"];
.........
}

step 2.

$conn = mysql_connect($hostname, $user, $password);

step 3.

$insertquery = sprintf("INSERT INTO table (`username`, ...) VALUES ('%s',
...)", mysql_real_escape_string($username, $conn), ...);

step 4.

 if(!$conn)
 {
header("Location: http://website/dberror.html");
exit;
 }

 else
 {
mysql_select_db($database, $conn);

$insertqueryresult = mysql_query($insertquery);

 if(!$insertqueryresult) {
 header("Location: http://website/error.html");
 exit; }

 }

with the above method i am able to insert values into the table even with if
i enter the ' special character which can cause problems.

i have also used a simple sql insert query like

$insertquery = "INSERT INTO table(username, ...) VALUES ('$username', ...)";

when i used this simple insert query and if i entered ' in the form and
submitted the form the php file is unable to process the information entered
because of the ' character and as per the code error.html file is being
displayed where as if i use

$insertquery = sprintf("INSERT INTO table (`username`, ...) VALUES ('%s',
...)", mysql_real_escape_string($username, $conn), ...);

even if i enter any number of ' characters in more than 1 form field data is
being inserted into the table

a)
so i am thinking that the steps i have taken from the php site is correct
and the right way to avoid sql injection though there are several ways to
avoid sql injection.

b)
for example if i enter data in the form as = abc'''def for name, the data in
the table for the name field is being written as abc'''def

based on how i have written the steps to avoid sql injection is this the
right way for the data to be stored with ' characters along with the data
example as i mentioned = abc'''def

please answer the questions a) and b) if there is something else i need to
do please suggest what needs to be done exactly and at which step.

any help will be greatly appreciated.

thanks.

attached mail follows:


YOU can write (') characters in the database.. that fine..

mysql_real_escape_string avoid injections doing that: escaping characters
then when you put in a form

abc'''def

the query will be

INSERT ..... (name.....) VALUES ( 'abc\'\'\'def'....

each ' => \'

for me the steps are right

saludos

On Thu, May 29, 2008 at 4:10 PM, Sudhakar <sudhakararaoggmail.com> wrote:
> i have implemented a way to avoid sql injection from the php website from
> this url
> http://in.php.net/mysql_real_escape_string from the "Example #3 A "Best
> Practice" query" section of this page
>
> following are the steps i have followed after the form values are submitted
> to a php file.
>
> step 1.
>
> if(get_magic_quotes_gpc())
> {
> $username = stripslashes($_POST["username"]);
> .........
> }
>
> else
> {
> $username = $_POST["username"];
> .........
> }
>
> step 2.
>
> $conn = mysql_connect($hostname, $user, $password);
>
> step 3.
>
> $insertquery = sprintf("INSERT INTO table (`username`, ...) VALUES ('%s',
> ...)", mysql_real_escape_string($username, $conn), ...);
>
> step 4.
>
> if(!$conn)
> {
> header("Location: http://website/dberror.html");
> exit;
> }
>
> else
> {
> mysql_select_db($database, $conn);
>
> $insertqueryresult = mysql_query($insertquery);
>
>
> if(!$insertqueryresult) {
> header("Location: http://website/error.html");
> exit; }
>
> }
>
> with the above method i am able to insert values into the table even with if
> i enter the ' special character which can cause problems.
>
> i have also used a simple sql insert query like
>
> $insertquery = "INSERT INTO table(username, ...) VALUES ('$username', ...)";
>
> when i used this simple insert query and if i entered ' in the form and
> submitted the form the php file is unable to process the information entered
> because of the ' character and as per the code error.html file is being
> displayed where as if i use
>
> $insertquery = sprintf("INSERT INTO table (`username`, ...) VALUES ('%s',
> ...)", mysql_real_escape_string($username, $conn), ...);
>
> even if i enter any number of ' characters in more than 1 form field data is
> being inserted into the table
>
> a)
> so i am thinking that the steps i have taken from the php site is correct
> and the right way to avoid sql injection though there are several ways to
> avoid sql injection.
>
> b)
> for example if i enter data in the form as = abc'''def for name, the data in
> the table for the name field is being written as abc'''def
>
> based on how i have written the steps to avoid sql injection is this the
> right way for the data to be stored with ' characters along with the data
> example as i mentioned = abc'''def
>
> please answer the questions a) and b) if there is something else i need to
> do please suggest what needs to be done exactly and at which step.
>
> any help will be greatly appreciated.
>
> thanks.
>

--
Los sabios buscan la sabiduría; los necios creen haberla encontrado.
Gabriel Sosa

attached mail follows:


my question is about validation using php. i am validating a username which
a user would enter and clicks on a image to find

if that username is available. example if a user enters abc#123 php file is
reading this value as abc ONLY which i do not

want instead the php file should read as abc#123. following is the sequence
of pages. please advice the solution.

first page = register.php here a user enters a username and clicks on an
image to find out if the username is available or

not. using a javascript function of onclick i am reading the value entered
in the form in javascript as
=============================================
var useri = document.registrationform.username
var valueofuseri = document.registrationform.username.value

var recui = /^\s{1,}$/g;

if ((useri.value==null) || (useri.value=="") || (useri.length=="") ||
(useri.value.search(recui))> -1)
{
alert("Please Enter a User Name")
return false
}

window.open("checkusernamei.php?theusernameis="+valueofuseri,
"titleforavailabilityi", "width=680, height=275, status=1,

scrollbars=1, resizeable=yes");

============================================

i have used a alert message in javascript to display the value, javascript
is able to capture all the characters entered

which is abc#123

second page = checkusernamei.php = this file uses GET to read what was
entered in the form.
============================================
$username = $_GET["theusernameis"];

if( $username == "" || !preg_match("/^[a-z0-9]+(?:_[a-z0-9]+)?$/i",
$username) )
{
echo "username is blank or has special characters";
}
============================================
the # sign is being ignored only if the image is clicked in order to check
the username, if the user enters abc#123 and

clicks the submit button without clicking on the checkuser image button then
my php validation for username shows an error

message.

==============================================================
if( $username == "" || !preg_match("/^[a-z0-9]+(?:_[a-z0-9]+)?$/i",
$username) )
{ echo "display error message for username"; }
==============================================================
now the problem is with clicking the image only and passing the value to
checkusernamei.php using GET method
i have also used an echo statement in checkusernamei.php as
echo "value of username is ". $username; = this displays abc and not abc#123

how can i fix this problem wherein checkusernamei.php will be able to read
abc#123. also in this checkusernamei.php file i

have a select query which will read if the username already exists in the
table. presently as checkusernamei.php is reading

abc ONLY the select query is also passing abc and not abc#123

$select = "Select username from table where username = '$username'";

please advice.

thanks.

attached mail follows:


So the user comes to the site and they're presented with a log in page.
They enter their username and password and php checks a mysql database for
a matching username and password.
In the case of a match, php then sets a cookie on their browser with a
value of 1 for authenticated and 0 for not authenticated. Every subsequent
page the user views checks the status of this cookie and if it's a zero it
kicks them back to the log in page. This cookie expires in 5 days and
after that they'll have to log in again.
I'm aware that this is terribly easy to circumvent by creating/modifying a
cookie with the 1 value and the site thinks you've passed muster.
What is a better way of doing this?

--

DeadTOm
http://www.mtlaners.org
deadtommtlaners.org
A Linux user since 1999.

attached mail follows:


On Thu, 2008-05-29 at 14:20 -0600, DeadTOm wrote:
> So the user comes to the site and they're presented with a log in page.
> They enter their username and password and php checks a mysql database for
> a matching username and password.
> In the case of a match, php then sets a cookie on their browser with a
> value of 1 for authenticated and 0 for not authenticated. Every subsequent
> page the user views checks the status of this cookie and if it's a zero it
> kicks them back to the log in page. This cookie expires in 5 days and
> after that they'll have to log in again.
> I'm aware that this is terribly easy to circumvent by creating/modifying a
> cookie with the 1 value and the site thinks you've passed muster.
> What is a better way of doing this?

Use PHP session engine... and set:

    $_SESSION['loggedIn'] = true;

Then you can check THAT value and they can't modify it.

Cheers,
Rob.
--
http://www.interjinn.com
Application and Templating Framework for PHP

attached mail follows:


On Thu, 29 May 2008 14:20:02 -0600 (MDT)
"DeadTOm" <deadtommtlaners.org> wrote:

> So the user comes to the site and they're presented with a log in
> page. They enter their username and password and php checks a mysql
> database for a matching username and password.
> In the case of a match, php then sets a cookie on their browser with a
> value of 1 for authenticated and 0 for not authenticated. Every
> subsequent page the user views checks the status of this cookie and
> if it's a zero it kicks them back to the log in page. This cookie
> expires in 5 days and after that they'll have to log in again.
> I'm aware that this is terribly easy to circumvent by
> creating/modifying a cookie with the 1 value and the site thinks
> you've passed muster. What is a better way of doing this?
>
> --
>
> DeadTOm
> http://www.mtlaners.org
> deadtommtlaners.org
> A Linux user since 1999.
>
>
>

Sessions.

http://php.net/manual/en/ref.session.php

--
   
Greg Maruszeczka

http://websagesolutions.com
skype: websage.ca
googletalk: gmarus

"Those who are possessed by nothing possess everything."
-- Morihei Ueshiba

attached mail follows:


Solved this. I tried setting a class variable directly and didn't have
the same issue (should have tried that long ago). So that told me that
my error was somewhere in some lower level code when I initialize my
objects. I tracked it down to a problem where I wasn't cloning properly
when I needed to (since PHP4 passes by value, and 5 by reference).

Sorry for the bandwidth and thanks for the help.

Dave

Robert Cummings wrote:
> On Thu, 2008-05-29 at 14:01 -0300, Gabriel Sosa wrote:
>> try doing this
>>
>> $secs = array();
>> foreach($_GET['sids'] as $sid){
>> $obj = null;
>> $obj = new CustomSecurity();
>> $obj->set(array('customSecurityID' => $sid));
>> $secs[] = $obj;
>> }
>
> No, no, no. If it's a reference issue you need to do the following:
>
> <?php
>
> $secs = array();
> foreach($_GET['sids'] as $sid)
> {
> unset( $obj );
>  $obj = new CustomSecurity();
>  $obj->set(array('customSecurityID' => $sid));
>  $secs[] = $obj;
> }
>
> ?>
>
> Assignment of null won't break a reference, it'll just make the value
> refer to null. You need unset to break the reference. Personally, I'd
> like to see the class definition to see what happens inside the set()
> method.
>
> Cheers,
> Rob.

attached mail follows:


Also, for the record: Referring to the objects in the array directly
works fine. So, syntax like

$secs[$sid] = new CustomSecurity();
$secs[$sid]->load($sid);

is fine, as I would expect. Don't have to define it to a simple
variable like $obj in the code below. Further, if I then do

$sec = $secs[$sid];

in the loop $sec refers correctly to object instances without the need
to unset it.

Thanks again.

Dave

David Moylan wrote:
> Solved this. I tried setting a class variable directly and didn't have
> the same issue (should have tried that long ago). So that told me that
> my error was somewhere in some lower level code when I initialize my
> objects. I tracked it down to a problem where I wasn't cloning properly
> when I needed to (since PHP4 passes by value, and 5 by reference).
>
> Sorry for the bandwidth and thanks for the help.
>
> Dave
>
>
> Robert Cummings wrote:
>> On Thu, 2008-05-29 at 14:01 -0300, Gabriel Sosa wrote:
>>> try doing this
>>>
>>> $secs = array();
>>> foreach($_GET['sids'] as $sid){
>>> $obj = null;
>>> $obj = new CustomSecurity();
>>> $obj->set(array('customSecurityID' => $sid));
>>> $secs[] = $obj;
>>> }
>>
>> No, no, no. If it's a reference issue you need to do the following:
>>
>> <?php
>>
>> $secs = array();
>> foreach($_GET['sids'] as $sid)
>> {
>> unset( $obj );
>>  $obj = new CustomSecurity();
>>  $obj->set(array('customSecurityID' => $sid));
>>  $secs[] = $obj;
>> }
>>
>> ?>
>>
>> Assignment of null won't break a reference, it'll just make the value
>> refer to null. You need unset to break the reference. Personally, I'd
>> like to see the class definition to see what happens inside the set()
>> method.
>>
>> Cheers,
>> Rob.
>
>

attached mail follows:


At 8:31 PM +0200 5/28/08, Michelle Konzack wrote:
>
>I have customers in Iran, Turkey, Syria, Lebanon, Moroco, Germany and
>Swiss.

Sounds like a sandwich. :-)

Cheers,

tedd

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

attached mail follows:


On Thu, May 29, 2008 at 01:07:11PM -0500, Chris W wrote:
> What I want to do is find all links in an html file. I have the pattern
> below. It works as long as there is only one link on a line and as long
> as the whole link is one line. It seems there should be a way to get
> this to work with more than one link on a single line. The work around
> I have done for now is to read the whole file into a buffer and remove
> all new lines and then add a new line after every closing a tag. Then
> process each line. There has to be a better way.
>
> Any Ideas? Also note I don't want to find any a tags that don't have an
> href.... there probably aren't any but just in case.
>
>
> preg_match_all("/(< *a[^>]*href[^>]+>)(.*)<\/a>/", $Line, $matches,
> PREG_PATTERN_ORDER);

Hi...

I have a little function to explode URLs with the following pattern:

$str = filename;

$pattern = '=^.*<a .* href\="(.*[://]|[:])(\S+)"[^>]*>(.*)</a>.*$=ims';

while (preg_match($pattern, $line, $exploded_url)) {
    some usefull stuff
    returns an array ($exploded_url)
    }

$exploded_url[1] = protocoll;
$exploded_url[2] = URL;
$exploded_url[3] = name of the URL;

greetings
MG

--
-----BEGIN GEEK CODE BLOCK-----
Version: 3.12
GCS/CM d- s++: a+ C++++>$ UBL*++++$ P++ L+++ E--- W+++ N+ o-- K- w O- M-
V-- PS++ PE++ Y PGP+++ t--- 5 X++++ R++ tv- b+++ DI D++++ G++ e* h----
r+++ y++++
------END GEEK CODE BLOCK------

attached mail follows:


On Thu, May 29, 2008 at 2:07 PM, Chris W <2wsxdr5cox.net> wrote:
> What I want to do is find all links in an html file. I have the pattern
> below. It works as long as there is only one link on a line and as long as
> the whole link is one line. It seems there should be a way to get this to
> work with more than one link on a single line. The work around I have done
> for now is to read the whole file into a buffer and remove all new lines and
> then add a new line after every closing a tag. Then process each line.
> There has to be a better way.
>
> Any Ideas? Also note I don't want to find any a tags that don't have an
> href.... there probably aren't any but just in case.
>
>
> preg_match_all("/(< *a[^>]*href[^>]+>)(.*)<\/a>/", $Line, $matches,
> PREG_PATTERN_ORDER);
>
> --
> Chris W
> KE5GIX
>
> "Protect your digital freedom and privacy, eliminate DRM, learn more at
> http://www.defectivebydesign.org/what_is_drm"
>
> Ham Radio Repeater Database.preg_match_all("/(<
> *a[^>]*href[^>]+>)(.*)<\/a>/", $Line, $matches, PREG_PATTERN_ORDER);
> http://hrrdb.com
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

Why not use DOMDocument with getElementsByTagName('href') [1]

http://us2.php.net/manual/en/domdocument.getelementsbytagname.php

attached mail follows:


On Thu, May 29, 2008 at 8:13 PM, Eric Butera <eric.buteragmail.com> wrote:
> Why not use DOMDocument with getElementsByTagName('href') [1]
>
> http://us2.php.net/manual/en/domdocument.getelementsbytagname.php
>

Sorry there was an error in that. It felt wrong when I sent it so I
looked again. Here is a snippet I'm using on a project right now, so
I know it works. ;)

$dom = DOMDocument::loadHTML($vo->htmlCopy);
foreach ($dom->getElementsByTagName('a') as $node) {
    if ($node->hasAttribute('href')) {
        $linkVO = new ...;
        $linkVO->url = $node->getAttribute('href');
        $linkVO->name = $node->nodeValue;

attached mail follows:


Hello,

I have a function that picks up a random entry from a file consisting
of city names, each name on a separate line. The random value is
generated by rand() before fseek()ing to the position determined by
it. The problem is that when using fgets() to get a random line, it
returns a part of the city name, not the whole name. AFAIK, fgets()
reads a whole line, and even if it's in the middle of a line, it reads
the whole next line.

Some sample of the city names file is as follows:

Amsterdam
Zurich
Alexandria
Dallas
Rome
Berlin

And the scripts outputs them weirdly enough something like:
Amster
andria
Da
me
Berlin

Here's the function:

<?php
function getCity($file)
{
    // Try to open the file
    if (!file_exists($file) || !($handle = fopen($file, "r")))
    {
        die('Could not open file for reading.');
    }

    $size = filesize($file);
    $randval = rand(0, $size);

    // Seek to a random position in the file
    fseek($handle, $randval);

    // Get random city name
    $line = trim(fgets($fp, 2048));

    fclose($fp);

    // If line was empty, try again
    if(empty($line))
    {
        $line = getCity($file);
    }

    return($line);
}
?>

I'm using XAMPP on Windows, PHP 5.2.1.

What am I missing here?

Regards,
Usamah

attached mail follows:


Usamah M. Ali wrote:
> Hello,
>
> I have a function that picks up a random entry from a file consisting
> of city names, each name on a separate line. The random value is
> generated by rand() before fseek()ing to the position determined by
> it. The problem is that when using fgets() to get a random line, it
> returns a part of the city name, not the whole name. AFAIK, fgets()
> reads a whole line, and even if it's in the middle of a line, it reads
> the whole next line.

fseek doesn't go to the start of a line, it goes to a particular byte -
so that's where the problem lies (not with fgets). There's no function
(that I could see) which would go to the start of the line based on that
offset (I guess you could fseek to a particular spot then reverse char
by char until you find a newline - but that'll be rather slow for
anything that has a long line).

You could read the whole thing into an array and do a rand on that:

$cities = file('filename.txt');

// take 1 off from the max number as $cities is a 0 based array
$number_of_cities = sizeof($cities) - 1;

$city_number = rand(0, $number_of_cities);
$city = $cities[$city_number];

Though if you have a big file that reads the whole thing into memory etc.

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

attached mail follows:


On Fri, May 30, 2008 at 3:38 AM, Chris <dmagickgmail.com> wrote:
> fseek doesn't go to the start of a line, it goes to a particular byte -
> so that's where the problem lies (not with fgets). There's no function
> (that I could see) which would go to the start of the line based on that
> offset (I guess you could fseek to a particular spot then reverse char
> by char until you find a newline - but that'll be rather slow for
> anything that has a long line).
>
>
> You could read the whole thing into an array and do a rand on that:
>
> $cities = file('filename.txt');
>
> // take 1 off from the max number as $cities is a 0 based array
> $number_of_cities = sizeof($cities) - 1;
>
> $city_number = rand(0, $number_of_cities);
> $city = $cities[$city_number];
>
> Though if you have a big file that reads the whole thing into memory etc.
>

I didn't say fseek() goes to the start of a line. I said that fgets()
should read a whole line, no matter where the pointer is at. I've
already managed to get the result I want by using file() as you've
suggested and array_rand(), and the result is very good.

I just need to figure out why when using fgets() with fseek() &
rand(), the script returns partial strings form the city names.

Regards,
Usamah

attached mail follows:


> I just need to figure out why when using fgets() with fseek() &
> rand(), the script returns partial strings form the city names.

Because fseek doesn't necessarily put you at the start of a line.

It puts you anywhere (which could be the start, middle, 3 chars from the
end) according to the number of bytes you tell it to start at.

Then fgets reads the rest of the line.

A file that looks like this:

(numbers are the "bytes" for ease of explanation)

123456789

is going to be different to a file that looks like this:

1234
56
789

and if you tell me you want to start at "byte 5", then in file 1, that's
the middle - in file 2 that's the start of the second line (#4 is a
newline char :P).

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

attached mail follows:


On Fri, May 30, 2008 at 4:21 AM, Chris <dmagickgmail.com> wrote:
>
>
>> I just need to figure out why when using fgets() with fseek() &
>> rand(), the script returns partial strings form the city names.
>
> Because fseek doesn't necessarily put you at the start of a line.
>
> It puts you anywhere (which could be the start, middle, 3 chars from the
> end) according to the number of bytes you tell it to start at.
>
> Then fgets reads the rest of the line.
>
> A file that looks like this:
>
> (numbers are the "bytes" for ease of explanation)
>
> 123456789
>
> is going to be different to a file that looks like this:
>
> 1234
> 56
> 789
>
> and if you tell me you want to start at "byte 5", then in file 1, that's
> the middle - in file 2 that's the start of the second line (#4 is a
> newline char :P).
>

So you're confirming that fgets() doesn't necessarily read a whole
line? This user note existed on the manual's page of fgets() since
2004 and nobody deleted it or commented about:

rstefanowski at wi dot ps dot pl
12-Aug-2004 09:03

"Take note that fgets() reads 'whole lines'. This means that if a file
pointer is in the middle of the line (eg. after fscanf()), fgets()
will read the following line, not the remaining part of the currnet
line. You could expect it would read until the end of the current
line, but it doesn't. It skips to the next full line."

That was my source of confusion.

Regards,
Usamah

attached mail follows:


A web site deploys what I think are UTF characters to mask email addresses.
Is there there a php function I can use to generate this? Or was this
hand-done?
It is crackable, but a darned good stab at the problem of spiders at the
same.
Any feedback, info or code would be appreciated,
John

John Taylor-Johnston wrote:
> My source is this page:
> http://www.grandlodge.mb.ca/contact.html
> John
>
>> /<div align="center">To report a technical problem with this site
>> please <a
>> href="mailto:&#119;&#101;&#098;&#109;&#097;&#115;&#116;&#101;&#114;&#064;&#103;&#114;&#097;&#110;&#100;&#108;&#111;&#100;&#103;&#101;&#046;&#109;&#098;&#046;&#099;&#097;">contact
>> the webmaster</a>.</div>/
>>
>> /In UTF code:
>>
>> mailto:&#119;&#101;&#098;&#109;&#097;&#115;&#116;&#101;&#114;&#064;&#103;&#114;&#097;&#110;&#100;&#108;&#111;&#100;&#103;&#101;&#046;&#109;&#098;&#046;&#099;&#097;
>>
>> would be this in latin characters:
>>
>> mailto:webmastergrandlodge.mb.ca/

attached mail follows:


John Taylor-Johnston wrote:
> A web site deploys what I think are UTF characters to mask email
> addresses.
> Is there there a php function I can use to generate this? Or was this
> hand-done?
> It is crackable, but a darned good stab at the problem of spiders at
> the same.
> Any feedback, info or code would be appreciated,
> John
>
> John Taylor-Johnston wrote:
>> My source is this page:
>> http://www.grandlodge.mb.ca/contact.html
>> John
>>
>>> /<div align="center">To report a technical problem with this site
>>> please <a
>>> href="mailto:&#119;&#101;&#098;&#109;&#097;&#115;&#116;&#101;&#114;&#064;&#103;&#114;&#097;&#110;&#100;&#108;&#111;&#100;&#103;&#101;&#046;&#109;&#098;&#046;&#099;&#097;">contact
>>> the webmaster</a>.</div>/
>>>
>>> /In UTF code:
>>>
>>> mailto:&#119;&#101;&#098;&#109;&#097;&#115;&#116;&#101;&#114;&#064;&#103;&#114;&#097;&#110;&#100;&#108;&#111;&#100;&#103;&#101;&#046;&#109;&#098;&#046;&#099;&#097;
>>>
>>>
>>> would be this in latin characters:
>>>
>>> mailto:webmastergrandlodge.mb.ca/
>
http://www.asciitable.com/
http://www.php.net/ord

The rest should be easy to figure out on your own.

--
Jeremy Privett
C.E.O. & C.S.A.
Omega Vortex Corporation

http://www.omegavortex.net

Please note: This message has been sent with information that could be confidential and meant only for the intended recipient. If you are not the intended recipient, please delete all copies and inform us of the error as soon as possible. Thank you for your cooperation.

attached mail follows:


You could look at the email cloaking routine that Joomla uses.

Here's a starting point:
http://dev.joomla.org/component/option,com_jd-wiki/Itemid,/id,references:joomla.framework:html:jhtmlemail-cloak/

-TG

----- Original Message -----
From: John Taylor-Johnston <jt.johnstonUSherbrooke.ca>
To: PHP-General <php-generallists.php.net>
Date: Thu, 29 May 2008 19:08:34 -0400
Subject: [PHP] PHP Code I Must find

> A web site deploys what I think are UTF characters to mask email addresses.
> Is there there a php function I can use to generate this? Or was this
> hand-done?
> It is crackable, but a darned good stab at the problem of spiders at the
> same.
> Any feedback, info or code would be appreciated,
> John
>
> John Taylor-Johnston wrote:
> > My source is this page:
> > http://www.grandlodge.mb.ca/contact.html
> > John
> >
> >> /<div align="center">To report a technical problem with this site
> >> please <a
> >>

href="mailto:&#119;&#101;&#098;&#109;&#097;&#115;&#116;&#101;&#114;&#064;&#103;&#114;&#097;&#110;&#100;&#108;&#111;&#100;&#103;&#101;&#046;&#109;&#098;&#046;&#099;&#097;">contact
> >> the webmaster</a>.</div>/
> >>
> >> /In UTF code:
> >>
> >>

mailto:&#119;&#101;&#098;&#109;&#097;&#115;&#116;&#101;&#114;&#064;&#103;&#114;&#097;&#110;&#100;&#108;&#111;&#100;&#103;&#101;&#046;&#109;&#098;&#046;&#099;&#097;
> >>
> >> would be this in latin characters:
> >>
> >> mailto:webmastergrandlodge.mb.ca/

attached mail follows:


Ok.

<?php
$mystring = "mefoo.com";
#How can I generate $mystring in ascii characters?
echo ??($mystring);
?>

lists-php wrote:
> that's not UTF, rather just the html representation of the ascii
> codes for the characters. [someone else has already pointed you to an
> ascii table.]
>
> when put in the context of the "mailto:" it's actually fairly easy
> for a bot to identify and decode (i'm not saying that they do, but
> it's not hard). if you're going to use this approach you may want to
> make the e-mail addresses user-readable, but unlinked. while still
> easily decoded, most bots won't waste time trying to decode every
> string like that that they encounter (at least not yet).
>
> - Rick
>
>
> ------------ Original Message ------------
>
>> Date: Thursday, May 29, 2008 07:08:34 PM -0400
>> From: John Taylor-Johnston <jt.johnstonUSherbrooke.ca>
>> To: PHP-General <php-generallists.php.net>
>> Subject: [PHP] PHP Code I Must find
>>
>> A web site deploys what I think are UTF characters to mask email
>> addresses.
>> Is there there a php function I can use to generate this? Or was
>> this hand-done?
>> It is crackable, but a darned good stab at the problem of spiders
>> at the same.
>> Any feedback, info or code would be appreciated,
>> John
>>
>> John Taylor-Johnston wrote:
>>
>>> My source is this page:
>>> http://www.grandlodge.mb.ca/contact.html
>>> John
>>>
>>>
>>>> /<div align="center">To report a technical problem with this site
>>>> please <a
>>>> href="mailto:&#119;&#101;&#098;&#109;&#097;&#115;&#116;&#101;&#11
>>>> 4;&#064;&#103;&#114;&#097;&#110;&#100;&#108;&#111;&#100;&#103;&#1
>>>> 01;&#046;&#109;&#098;&#046;&#099;&#097;">contact the
>>>> webmaster</a>.</div>/
>>>>
>>>> /In UTF code:
>>>>
>>>> mailto:&#119;&#101;&#098;&#109;&#097;&#115;&#116;&#101;&#114;&#06
>>>> 4;&#103;&#114;&#097;&#110;&#100;&#108;&#111;&#100;&#103;&#101;&#0
>>>> 46;&#109;&#098;&#046;&#099;&#097;
>>>>
>>>> would be this in latin characters:
>>>>
>>>> mailto:webmastergrandlodge.mb.ca/
>>>>
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>
> ---------- End Original Message ----------
>
>
>

attached mail follows:


Seen that in the manual. I'll need a routine of some sort I guess.
I'll get my cookie cutters out tomorrow and see what I can create.
I make cool gingerbread men, for a dude.
**htmlentities() does most of what I want, sort of.

**lists-php wrote:
> you might try looking at the php manual. start with: http://www.php.net/manual/en/function.ord.php and go from there.
>
>> <?php
>> $mystring = "mefoo.com";
>> # How can I generate $mystring in ascii characters?
>> echo ($mystring in ascii charachters);
>> ?>
>>
>>
>>
>> lists-php wrote:
>>
>>> that's not UTF, rather just the html representation of the ascii
>>> codes for the characters. [someone else has already pointed you to
>>> an ascii table.]
>>>
>>> when put in the context of the "mailto:" it's actually fairly easy
>>> for a bot to identify and decode (i'm not saying that they do, but
>>> it's not hard). if you're going to use this approach you may want
>>> to make the e-mail addresses user-readable, but unlinked. while
>>> still easily decoded, most bots won't waste time trying to decode
>>> every string like that that they encounter (at least not yet).
>>>
>>> - Rick
>>>
>>>
>>> ------------ Original Message ------------
>>>
>>>
>>>> Date: Thursday, May 29, 2008 07:08:34 PM -0400
>>>> From: John Taylor-Johnston <jt.johnstonUSherbrooke.ca>
>>>> To: PHP-General <php-generallists.php.net>
>>>> Subject: [PHP] PHP Code I Must find
>>>>
>>>> A web site deploys what I think are UTF characters to mask email
>>>> addresses.
>>>> Is there there a php function I can use to generate this? Or was
>>>> this hand-done?
>>>> It is crackable, but a darned good stab at the problem of spiders
>>>> at the same.
>>>> Any feedback, info or code would be appreciated,
>>>> John
>>>>
>>>> John Taylor-Johnston wrote:
>>>>
>>>>
>>>>> My source is this page:
>>>>> http://www.grandlodge.mb.ca/contact.html
>>>>> John
>>>>>
>>>>>
>>>>>
>>>>>> /<div align="center">To report a technical problem with this
>>>>>> site please <a
>>>>>> href="mailto:&#119;&#101;&#098;&#109;&#097;&#115;&#116;&#101;&#
>>>>>> 11
>>>>>> 4;&#064;&#103;&#114;&#097;&#110;&#100;&#108;&#111;&#100;&#103;&
>>>>>> #1 01;&#046;&#109;&#098;&#046;&#099;&#097;">contact the
>>>>>> webmaster</a>.</div>/
>>>>>>
>>>>>> /In UTF code:
>>>>>>
>>>>>> mailto:&#119;&#101;&#098;&#109;&#097;&#115;&#116;&#101;&#114;&#
>>>>>> 06
>>>>>> 4;&#103;&#114;&#097;&#110;&#100;&#108;&#111;&#100;&#103;&#101;&
>>>>>> #0 46;&#109;&#098;&#046;&#099;&#097;
>>>>>>
>>>>>> would be this in latin characters:
>>>>>>
>>>>>> mailto:webmastergrandlodge.mb.ca/
>>>>>>
>>>>>>
>>>> --
>>>> PHP General Mailing List (http://www.php.net/)
>>>> To unsubscribe, visit: http://www.php.net/unsub.php
>>>>
>>>>
>>> ---------- End Original Message ----------
>>>
>>>
>>>
>>>
>
> ---------- End Original Message ----------
>
>
>

attached mail follows:


This might be a dumb question with an obvious answer somewhere, but
I'm wondering if it's possible to build php extensions as shared
objects that plug into the PHP binary much like an apache shared
module plugs into apache.

Is PECL close to this?

Sorry if this is obvious. Searches on the topic are pretty noisy given
that php's installation as a shared module itself for Apache are a
fairly popular topic.

Thanks,

Weston

attached mail follows:


Weston C wrote:
> This might be a dumb question with an obvious answer somewhere, but
> I'm wondering if it's possible to build php extensions as shared
> objects that plug into the PHP binary much like an apache shared
> module plugs into apache.

Yes.

See http://www.php.net/dl (though a lot of hosts disable this
functionality for security reasons).

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

attached mail follows:


On Thu, May 29, 2008 at 7:11 PM, Chris <dmagickgmail.com> wrote:
> See http://www.php.net/dl (though a lot of hosts disable this
> functionality for security reasons).

Fortunately, I'll have full control of the hosting environment in the
context this matters. :)

dl is definitely interesting, but I'm worried that runtime invocation
might mean performance hits. Is there a way to do load/startup time
inclusion?

attached mail follows:


On 5/29/08, Weston C <westoncgmail.com> wrote:

> Fortunately, I'll have full control of the hosting environment in the
> context this matters. :)
>
> dl is definitely interesting, but I'm worried that runtime invocation
> might mean performance hits. Is there a way to do load/startup time
> inclusion?

you could put it in your php ini file

extension = "foo.so"

then I believe the impact will be on the first instance for that php
engine. so in fastcgi mode, you'd only have the hit once every
PHP_FCGI_MAX_REQUESTS when the child restarts...

attached mail follows:


My test result is that it works on Windows platform, but not on Linux.
Maybe that's because it is Microsoft Media Services protocol?

Whatever, I can not hear anything on Firefox 3 Beta 5 on Ubuntu.

2008/5/29 Gabriel Sosa <sosagabrielgmail.com>:

> what do you wanna do ?? just a bridge? or try to play it?? in that
> case you can't.
> i think you should get the streamming and try to play it with flash
>
> saludos
>
> On Thu, May 29, 2008 at 4:05 AM, Shelley <myphplistgmail.com> wrote:
> > 1. URL
> > http://pub.qmoon.net/WMSStatus/WMS.asmx/IRadioGetCurrentPublishPoint
> >
> > 2. Call method
> >
> > HTTP GET:
> > GET / WMSStatus/WMS.asmx/IRadioGetCurrentPublishPoint HTTP/1.1
> > Host: pub.qmoon.net
> >
> > 3. return (string)
> >
> > <?xml version="1.0" encoding="utf-8" ?>
> > <string xmlns="http://www.qmoon.net/">mms://pub.qmoon.net/audio</string>
> >
> > How can I listen to the audio stream with PHP?
> > Anybody some suggestions?
> >
> > Thank you in advance.
> >
> >
> > --
> > Regards,
> > Shelley
> >
>
>
>
> --
> Los sabios buscan la sabiduría; los necios creen haberla encontrado.
> Gabriel Sosa
>

--
Regards,
Shelley - http://phparch.cn

--
Regards,
Shelley

attached mail follows:


Hello all! Had some big problems with XAMPP crashing my windows (Vista) laptop 8 times out or 10 (actual figures) as I started XAMPP so have shifted over to WAMPSERVER2 So far so good, no crash... but their website seems to be down and need one small tidbit... if anyone of you are using WAMPSERVER can you tell me how to change MySqls default login? its on root/<no password> presently... want to change it to root/something Thanks! Ryan  ------ - The faulty interface lies between the chair and the keyboard. - Creativity is great, but plagiarism is faster! - Smile, everyone loves a moron. :-)

attached mail follows:


Ryan S wrote:
> Hello all!
> Had some big problems with XAMPP crashing my windows (Vista) laptop 8 times out or 10 (actual figures) as I started XAMPP so have shifted over to WAMPSERVER2
> So far so good, no crash... but their website seems to be down and need one small tidbit... if anyone of you are using WAMPSERVER can you tell me how to change MySqls default login?
> its on root/<no password> presently... want to change it to root/something

STW?

http://dev.mysql.com/doc/refman/5.0/en/resetting-permissions.html

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

attached mail follows:


Hello, I'm from Chile, so, I don't write great in English.

My cuestion is:

I'm programming a Website where you can see the files that you have in a
remote PC. (In my University Computer Room)
I don't know how to Download a file from the remote pc to my computer....
and, also, how to Upload a file to the remote computer.

The remote host is "cipres.cec.uchile.cl"... and i'm using the ssh2
library..

Thanks!

--
Gonzalo Bettancourt G.
Estudiante de Ingenieria
Universidad de Chile

http://www.cec.uchile.cl/~gbettanc

attached mail follows:


Gonzalo Bettancourt wrote:
> Hello, I'm from Chile, so, I don't write great in English.
>
> My cuestion is:
>
> I'm programming a Website where you can see the files that you have in a
> remote PC. (In my University Computer Room)
> I don't know how to Download a file from the remote pc to my computer....
> and, also, how to Upload a file to the remote computer.
>
> The remote host is "cipres.cec.uchile.cl"... and i'm using the ssh2
> library..
>
>
> Thanks!
>

If you do not have FTP access, then I would use something like winscp.

http://www.winscp.net

I use it on a daily basis and it works great.

--
Jim Lucas

    "Some men are born to greatness, some achieve greatness,
        and some have greatness thrust upon them."

Twelfth Night, Act II, Scene V
     by William Shakespeare

attached mail follows:


Hi Bastien,

thanks for the tip. I've already done it and it didn't run.
But I'll check it again.

  iñigo

> On Thu, May 29, 2008 at 6:11 AM, Iñigo Medina García <
> imedinadiazdesantos.es> wrote:
>
>> Hi,
>>
>> I'm trying to send emails with embed and dynamic images: a normal tell a
>> friend feature which sends the email with item's data: author, title,
>> image-cover, etc.
>>
>> Ideas PEAR and mime classes apart?
>>
>> thanks
>>
>> iñigo
>>
>> --
>> --------
>> Iñigo Medina García
>> Librería Díaz de Santos
>> Madrid (Spain)
>> Dpt.Desarrollo
>>
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>
> You'll need to create a HTML email, and then embed the image with the <img>
> tag, using the entire path to the image as the source attribute
>
> <img src='http://www.mysite.com/images/thisimage.jpg'>
>
> You may want to look at some email that you get that have images in them and
> just view the source.
>

--
--------
Iñigo Medina García
Librería Díaz de Santos
Madrid (Spain)
Dpt.Desarrollo

attached mail follows:


Hi Per,

yep, it's true, playing with mime it can be sent as attachment, but I
don't want that but embed.

   iñigo

> Bastien Koert wrote:
>
>> You'll need to create a HTML email, and then embed the image with the
>> <img> tag, using the entire path to the image as the source attribute
>
> Not necessarily, images may simply be sent as an attachment with
> type "image/jpeg" etc.
>
>
> /Per Jessen, Zürich
>
>

--
--------
Iñigo Medina García
Librería Díaz de Santos
Madrid (Spain)
Dpt.Desarrollo

attached mail follows:


Hi Shawn,

ey, that "content-disposition: inline" is new for me. Maybe it's a
solution. I'll check it and tell us.

thanks

   iñigo

> Per Jessen wrote:
>> Bastien Koert wrote:
>>
>>> You'll need to create a HTML email, and then embed the image with the
>>> <img> tag, using the entire path to the image as the source attribute
>>
>> Not necessarily, images may simply be sent as an attachment with
>> type "image/jpeg" etc.
>>
>> /Per Jessen, Zürich
>>
>
> I haven't done it in a while but I believe you need a multipart mime
> email with:
>
> Content-Type: image/jpeg
> Content-Disposition: inline
>
> unless you want it to be a separate attachment.
>
> -Shawn
>

--
--------
Iñigo Medina García
Librería Díaz de Santos
Madrid (Spain)
Dpt.Desarrollo

attached mail follows:


Iñigo Medina García wrote:
> Hi Bastien,
>
> thanks for the tip. I've already done it and it didn't run.
> But I'll check it again.
>
> iñigo
>
>> On Thu, May 29, 2008 at 6:11 AM, Iñigo Medina García <
>> imedinadiazdesantos.es> wrote:
>>
>>> Hi,
>>>
>>> I'm trying to send emails with embed and dynamic images: a normal tell a
>>> friend feature which sends the email with item's data: author, title,
>>> image-cover, etc.
>>>
>>> Ideas PEAR and mime classes apart?
>>>
>>> thanks
>>>
>>> iñigo
>>>
>>> --
>>> --------
>>> Iñigo Medina García
>>> Librería Díaz de Santos
>>> Madrid (Spain)
>>> Dpt.Desarrollo
>>>
>>> --
>>> PHP General Mailing List (http://www.php.net/)
>>> To unsubscribe, visit: http://www.php.net/unsub.php
>>>
>>>
>> You'll need to create a HTML email, and then embed the image with the <img>
>> tag, using the entire path to the image as the source attribute
>>
>> <img src='http://www.mysite.com/images/thisimage.jpg'>
>>
>> You may want to look at some email that you get that have images in them and
>> just view the source.

Using an img src doesn't "embed" the image, it's fetched on the fly from
the url (if you allow remote images to be displayed).

Use something like phpmailer which can embed the images in the content
for you (saves the headaches of working it all out yourself).

http://phpmailer.codeworxtech.com/tutorial.html#4

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

attached mail follows:


Hi Richard,

yep, i know your htmlMimeMail5. Ey, it's a good work! :-)

But in this case it would be easier for my work-team not to deal with
objects-jargon.

thanks anyway

  iñigo

>>>> You'll need to create a HTML email, and then embed the image with the
>>>> <img> tag, using the entire path to the image as the source attribute
>>>
>>> Not necessarily, images may simply be sent as an attachment with
>>> type "image/jpeg" etc.
>>>
>>> /Per Jessen, Zürich
>>>
>>
>> I haven't done it in a while but I believe you need a multipart mime
>> email with:
>>
>> Content-Type: image/jpeg
>> Content-Disposition: inline
>>
>> unless you want it to be a separate attachment.
>
> This may help:
>
> http://www.phpguru.org/static/htmlMimeMail5.html
>

--
--------
Iñigo Medina García
Librería Díaz de Santos
Madrid (Spain)
Dpt.Desarrollo

attached mail follows:


Hi Chris,

yep, phpmailer is a good work too. But it works the same i said about
htmlMimeMail5.

  iñigo

> Iñigo Medina García wrote:
>> Hi Bastien,
>>
>> thanks for the tip. I've already done it and it didn't run.
>> But I'll check it again.
>>
>> iñigo
>>
>>> On Thu, May 29, 2008 at 6:11 AM, Iñigo Medina García <
>>> imedinadiazdesantos.es> wrote:
>>>
>>>> Hi,
>>>>
>>>> I'm trying to send emails with embed and dynamic images: a normal tell a
>>>> friend feature which sends the email with item's data: author, title,
>>>> image-cover, etc.
>>>>
>>>> Ideas PEAR and mime classes apart?
>>>>
>>>> thanks
>>>>
>>>> iñigo
>>>>
>>>> --
>>>> --------
>>>> Iñigo Medina García
>>>> Librería Díaz de Santos
>>>> Madrid (Spain)
>>>> Dpt.Desarrollo
>>>>
>>>> --
>>>> PHP General Mailing List (http://www.php.net/)
>>>> To unsubscribe, visit: http://www.php.net/unsub.php
>>>>
>>>>
>>> You'll need to create a HTML email, and then embed the image with the <img>
>>> tag, using the entire path to the image as the source attribute
>>>
>>> <img src='http://www.mysite.com/images/thisimage.jpg'>
>>>
>>> You may want to look at some email that you get that have images in them and
>>> just view the source.
>
> Using an img src doesn't "embed" the image, it's fetched on the fly from
> the url (if you allow remote images to be displayed).
>
> Use something like phpmailer which can embed the images in the content
> for you (saves the headaches of working it all out yourself).
>
> http://phpmailer.codeworxtech.com/tutorial.html#4
>

--
--------
Iñigo Medina García
Librería Díaz de Santos
Madrid (Spain)
Dpt.Desarrollo

attached mail follows:


Iñigo Medina García wrote:

> Hi Per,
>
> yep, it's true, playing with mime it can be sent as attachment, but I
> don't want that but embed.
>
> iñigo

OK, then you need to revisit what Bastien said. However, instead of
<img> referring to an external image, you need to use
src="cid:nnnnnnnn" where 'nnnnnnn' will refer to an attached image file
with a Content-ID header. It may sound a little complicated, but it's
not really difficult - if you want to know more, see RFC2111.

/Per Jessen, Zürich

attached mail follows:


Iñigo Medina García wrote:
> Hi Chris,
>
> yep, phpmailer is a good work too. But it works the same i said about
> htmlMimeMail5.

So use either package to figure out what it does and how it does it -
you can learn a lot from other peoples code.

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

attached mail follows:


Hi,
  I'm trying to learn a PHP by myself...and i need a help.
I have learned all the basic but i dont know how to implement the stuff.
Can you please guys help me out give me a small site in PHP so that i can
study and learn.

thank you.