php-general Digest 24 Nov 2002 09:23:29 -0000 Issue 1723

Topics (messages 125739 through 125772):

Re: using cookies
        125739 by: Paul Marinas
        125742 by: Rich Gray
        125754 by: Chris Shiflett

Re: Using Ping (was: using cookies)
        125740 by: Marco Tabini

Passing Variables
        125741 by: Craig Edgmon
        125743 by: Marco Tabini
        125745 by: Rich Gray
        125749 by: Stephan Seidt

Re: Php search results]
        125744 by: Tom Culpepper

Re: grabbing data from a site
        125746 by: Tom Culpepper

Re: put result of "include" into a variable
        125747 by: Tom Culpepper

Re: dynamic arraynames
        125748 by: Floyd Baker
        125753 by: Hugh Danaher

logs(querystring) in php4 or apache?
        125750 by: Frank Wang

PHP Syntax - mail statement
        125751 by: Michael Sharp
        125752 by: Marco Tabini

strings and vars
        125755 by: empty
        125756 by: Kyle Gibson
        125757 by: Ernest E Vogelsinger
        125758 by: empty

Parse URLs
        125759 by: Stephen
        125760 by: Tom Culpepper
        125761 by: Stephen
        125762 by: Tom Culpepper

getting mysql dump using php
        125763 by: See Kok Boon
        125764 by: Rich Gray
        125765 by: Morgan Hughes

Secureing PHP.
        125766 by: Steven Adams
        125767 by: Stephan Seidt

Re: sessions and trans-sid problem/question
        125768 by: Jean-Christian Imbeault
        125769 by: Jean-Christian Imbeault
        125770 by: Jean-Christian Imbeault

does //commenting reduce performance?
        125771 by: Adam

Newbie: element index array
        125772 by: Michael Wai

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 ---
dose anyone how to send a "ping" in local network

thanks

Paul Marinas
Technical Support
RDS Craiova


Phone:  +402-51-410-194
Mobile: +407-22-451-439
Fax:    +402-51-416-579
www.rdsnet.ro
.....................................................

Privileged/Confidential Information may be contained in this message. If you
are not the addressee indicated in this
message (or responsible for delivery of the message to such person), you may
not copy or deliver this message to
anyone. In such a case, you should destroy this message and kindly notify
the sender by reply e-mail.


--- End Message ---
--- Begin Message ---
Try the system() or passthru() functions...

Rich
-----Original Message-----
From: Paul Marinas [mailto:[EMAIL PROTECTED]]
Sent: 23 November 2002 13:09
To: Rich Gray
Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: RE: [PHP] using cookies



dose anyone how to send a "ping" in local network

thanks

Paul Marinas
Technical Support
RDS Craiova


Phone:  +402-51-410-194
Mobile: +407-22-451-439
Fax:    +402-51-416-579
www.rdsnet.ro
.....................................................

Privileged/Confidential Information may be contained in this message. If you
are not the addressee indicated in this
message (or responsible for delivery of the message to such person), you may
not copy or deliver this message to
anyone. In such a case, you should destroy this message and kindly notify
the sender by reply e-mail.



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



--- End Message ---
--- Begin Message ---
--- Ken Nagorski <[EMAIL PROTECTED]> wrote:

> I have never used cookies before, however I am trying to
> implement them to make things a little more secure. Rather
> than passing a sql statement via a hidden input tag I am
> setting a cookie.

I think someone else already mentioned this, but let me emphasize
that this is a terrible idea and definitely does not make things a
little more secure.

The best analogy I can think of for a cookie would be handing out
name tags to people who visit your site. Imagine that you write the
following SQL on someone's name tag:

select * from foo where unique_id='12345'

This helps you distinguish them from the next person who may have a
unique identifier of 23456. While this might work for those who play
by the rules, you are placing a tremendous amount of trust in these
people. What if someone erased what you wrote on their name tag,
replacing it with this:

delete from foo

If you were to trust this person's name tag the next time you saw
them, you would delete all of the data from that table.

In addition to this, hidden form variables are just as bad. It is a
different method, but you are still basically sending something to
the client and just trusting the client to return exactly what you
sent. Placing so much trust in the client is never a good idea.

I would recommend abandoning these methods for anything that you, as
you say, are wanting to make more secure. Look into using sessions
instead. When you use sessions, the only sensitive data you trust the
client to return to you is PHPSESSID. While there are some dangers
associated with this trust, it is a more tolerable risk. When you set
a session variable, it is kept safely on the server, so it is at
least much less convenient for an attacker to alter this data,
because only you can do that.

I hope this helps you get started down the right path. There are
methods you can use to further mitigate the risk of trusting the
client's PHPSESSID, but that can be discussed later.

Chris
--- End Message ---
--- Begin Message ---
I took the liberty of changing the subject of your e-mail because this
way everyone can follow it better.

Well, you can execute the ping command directly from within PHP and then
parse its input. For example:

<?php

preg_match ("/([0-1]) received/", shell_exec ("ping -c 1 -w 2
www.phparch.com 2>/dev/null"), $a);

if (count ($a) && $a[1])
        echo "success";
else
        echo "failure";
?>

This will work only under Unix, but you can very easily adapt it to
whatever os you need, as long as it supports pinging from the command
line.

Marco

------------
php|architect - The magazine for PHP Professionals
The monthly worldwide magazine dedicated to PHP programmers
Check us out on the web at http://www.phparch.com


On Sat, 2002-11-23 at 16:08, Paul Marinas wrote:
> 
> dose anyone how to send a "ping" in local network
> 
> thanks
> 
> Paul Marinas
> Technical Support
> RDS Craiova
> 
> 
> Phone:  +402-51-410-194
> Mobile: +407-22-451-439
> Fax:    +402-51-416-579
> www.rdsnet.ro
> .....................................................
> 
> Privileged/Confidential Information may be contained in this message. If you
> are not the addressee indicated in this
> message (or responsible for delivery of the message to such person), you may
> not copy or deliver this message to
> anyone. In such a case, you should destroy this message and kindly notify
> the sender by reply e-mail.
> 
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 


--- End Message ---
--- Begin Message ---
I am sure this question has been answered, but there is a ton of data to
sift through on this. I am running Apache 1.3 and the latest PHP 4.2.3. .
I am just working with variables and I cannot seem to get them to pass from
my html file to the php call. I will get the html portion fine, but not the
variable. I have checked my language and have compared my files with
supposed good code from a reliable source with the same results. Any idea on
this. It happens on multiple systems.


--- End Message ---
--- Begin Message ---
Try looking into the manual for register_globals

Marco

------------
php|architect - The magazine for PHP Professionals
The monthly worldwide magazine dedicated to PHP programmers
Check us out on the web at http://www.phparch.com

On Sat, 2002-11-23 at 14:42, Craig Edgmon wrote:
> I am sure this question has been answered, but there is a ton of data to
> sift through on this. I am running Apache 1.3 and the latest PHP 4.2.3. .
> I am just working with variables and I cannot seem to get them to pass from
> my html file to the php call. I will get the html portion fine, but not the
> variable. I have checked my language and have compared my files with
> supposed good code from a reliable source with the same results. Any idea on
> this. It happens on multiple systems.
> 
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 


--- End Message ---
--- Begin Message ---
Is your register_globals setting set to Off? This is the default setting in
v4.2.x upwards.

Rich
-----Original Message-----
From: Craig Edgmon [mailto:[EMAIL PROTECTED]]
Sent: 23 November 2002 11:43
To: [EMAIL PROTECTED]
Subject: [PHP] Passing Variables


I am sure this question has been answered, but there is a ton of data to
sift through on this. I am running Apache 1.3 and the latest PHP 4.2.3. .
I am just working with variables and I cannot seem to get them to pass from
my html file to the php call. I will get the html portion fine, but not the
variable. I have checked my language and have compared my files with
supposed good code from a reliable source with the same results. Any idea on
this. It happens on multiple systems.



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



--- End Message ---
--- Begin Message ---
if you mean something like bla.php?foo=bar, etc and you have register_globas enabled
it'll be stored as $_GET['foo'] ($_REQUEST['foo'])

On Sat, 23 Nov 2002 11:42:49 -0800
[EMAIL PROTECTED] (Craig Edgmon) wrote:

> I am sure this question has been answered, but there is a ton of data to
> sift through on this. I am running Apache 1.3 and the latest PHP 4.2.3. .
> I am just working with variables and I cannot seem to get them to pass from
> my html file to the php call. I will get the html portion fine, but not the
> variable. I have checked my language and have compared my files with
> supposed good code from a reliable source with the same results. Any idea on
> this. It happens on multiple systems.
> 
> 
--- End Message ---
--- Begin Message --- I wrote this function to fetch a news item off another web page but with
a little modification it should work for you. To use it you needed to
identify a set of of strings in the source to use as anchors ($start,
$end) and then it pulls that section and crops off the anchor text so
you are left with just what you wanted.

<?
function get_item($url, $start, $end) {
global $item;
if(!($fp=fopen($url,"r"))) {
echo $url." is not accessable";
exit;
}
while(!feof($fp)) {
$item.=fgets($fp,255);
}

fclose($fp);
$start_position=strpos($item, $start)+strlen($start);
$end_position=strpos($item, $end);
$length=$end_position-$start_position;
$item=substr($item, $start_position, $length);
}
echo $item;
?>

Soemthing like this might work for you:
<?
$results=search results;
$keyword=search string;
$startposition=strpos($results, $keyword)-200;
$endposition=strpos($results, $keyword)+200;
$length=$endposition-$startposition;
$item=substr($item, $startposition, $length;
echo $item
?>

Tom Culpepper
www.multicasttech.com
[EMAIL PROTECTED]


Alex wrote:
> you could also use regular expressions, but php isn't perl, so good luck on
> that one :p.
>
>
> "Philip Hallstrom" <[EMAIL PROTECTED]> wrote in message
> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
>
>>You could use strstr() to find the index location of the
>>string searched for in FIELD. Then use substr() to return say 50
>>characters on either side...
>>
>>-philip
>>
>>On Thu, 21 Nov 2002, Daniel Masson wrote:
>>
>>
>>>Hello everyone ...
>>>
>>>Im working on some kind of search engine for two little tables on text
>>>fields on mssql, and the text fields can be very large fields, im doing
>>>the search with SELECT FIELD FROM TABLE WHERE FIELD LIKE '%SOMTHING%' ..
>>>My question is:
>>>
>>>When displaying the search results i dont want to display the entire
>>>field, only the specific parts where the keyword was found , and bold
>>>for the keyword and i just dony know how to to do that, i mean
>>>displaying the keyword in bold is no problem .. I need to know how to
>>>display only the parts where this keyword is.
>>>
>>>Any help will be very helpful
>>>
>>>Thanks every1
>>>
>>>
>>>
>>>--
>>>PHP General Mailing List (http://www.php.net/)
>>>To unsubscribe, visit: http://www.php.net/unsub.php
>>>
>>
>
>
>



--- End Message ---
--- Begin Message --- Try this function, Ijust wrote it for the same purpose. You just need a unique string in front of the stuff you want, and one after it. You can usually get a string of code on either end that will do this. The function will open the URL, find the anchor strings you told it, then strip them away leaving only the text/code that was in between them

<?
function get_item($url, $start, $end) {
global $item;
if(!($fp=fopen($url,"r"))) {
echo $url." is not accessable";
exit;
}
while(!feof($fp)) {
$item.=fgets($fp,255);
}

fclose($fp);
$start_position=strpos($item, $start)+strlen($start);
$end_position=strpos($item, $end);
$length=$end_position-$start_position;
$item=substr($item, $start_position, $length);
}
echo $item;
?>

Tom Culpepper
Multicast Technologies

Adam wrote:
someone gave me the following expression which uses another program and it
works fine for them... is there something similar with php?

wget --timeout=90 -q -O- http://www.BoM.GOV.AU/products/IDO30V01.shtml | sed
'1,/>Melbourne <sup/d' | sed '1d;3,$d;s/.*">//;s/<.*//'

thanks,
adam.

"Evan Nemerson" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

If the target is in well-formed XML (XHTML is an example), you could use
XSLT

to say 'i want the third column of a particular row - in this instance,
Melbourne'. However, since few people actually adhere to standards, you're
probably going to need a regex... if you're not comfortable with them,
explode() could be useful (although it is slower)

Somebody posted an extremely helpfull little quick reference at
php.net/ereg,

i think... that might help you.


On Friday 22 November 2002 01:40 pm, Adam wrote:

I have the following website that i want to grab info from:

http://www.bom.gov.au/products/IDV60034.shtml

Say I wanted the current temperature for Melbourne from this table, what
line of code would I need to tell it to get that info - ie, an ereg()
expression...

i'm wondering whether there are ways of saying "i want the third column

of

a particular row - in this instance, Melbourne"?

Thanks for any help.
Adam.
- --
I pledge allegiance to the flag, of the United States of America, and to
the

republic for which it stands, one nation indivisible, with liberty, and
justice for all.

- -Pledge of Allegiance
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (GNU/Linux)

iD8DBQE93qVm/rncFku1MdIRAshSAJ9phj0DqR3seanlzKXhdnKj8cvI8QCfW7kM
tfUfUEF4yVJSRnm0GCkIeaM=
=AyI1
-----END PGP SIGNATURE-----





--- End Message ---
--- Begin Message --- Try using fopen() to open the file and then fread() to read it into the buffer and set that equal to the variable.

Tom Culpepper
Multicast Technologies

Patrick Anderson at TUE wrote:
Hi,

For some (strange, I know) reason I would like to copy the content of a
webpage into a database.

I would like to have code like

$whocares = include ("http://www.microsoft.nl";);
$query = "insert into html values ($whocares,...)";
..

However, include can not copy the content to a variable. Does anyone
have an idea how to circumvent this problem?

Thanks,
Patrick




--- End Message ---
--- Begin Message ---
On Sat, 23 Nov 2002 10:58:02 -0500, you wrote:

>> I am trying to generate arrays to hold inputs to columns.  Column
>> titles are input to a table as needed.  They are read by the program
>> and placed across the page.  Then an array goes under each column name
>> to collect the inputs to the various rows.  Everything works except to
>> dynamically change the name of the array.
>> 
>> 
>> while($foo=mysql_fetch_array($mysql_result)){
>>     print "<INPUT TYPE=text NAME=correspondingfoo[]>";}
>
>Do you want this??
>
>print "<INPUT TYPE=text NAME=" . $foo['something'] . "[]>";
>
>---John Holmes...


No John.  I'm ok with simply inputting a value and otherwise using
arrays that are hard coded and previously named but my problem is in
creating different arrays on the fly to represent each column that
there is a name for.  I want to end up with something like $meat[] and
$potatoes[] and whatever else is needed from a list...  The list of
meat, potatoes, etc determines how many arrays and their names.
  
I'm not to swift when it comes to arrays and think I'm probably stuck
on some simple misconception.  I'm trying to convert $meat to $meat[],
on the fly, to have something to input to...  I read today maybe I
don't need the brackets?  

Floyd


--

--- End Message ---
--- Begin Message ---
Floyd,
if you are using mysql then you can use the mysql_list_fields to get the
names of the mysql table's column (field) names, then do mysql_num_fields to
get the number of columns (fields), then fill the columns with whatever
using a while loop.
I've attached a php page that fetches this info from any size table then
displays the table.  You can extract the info you need and extend it with
check boxes etc.
Hope this helps.
Hugh


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Input Data Page</title>
<?php include ("css.txt"); ?>
</head>
<body bgcolor="#1D3E81" >
<h1><font color="#ffff33">DATABASE TABLES</font></h1>

<form action="<?php print $php_self?>" method="post">
<?php

print "<table cellpadding=7 border=1 bgcolor=#d5d5d5><tr><td>";
print "<h6>Database name:</h6><input type=text name=db
STYLE=width:140px></td><td>";
print "<h6>Username:</h6><input type=text name=user STYLE=width:140px>";
print "<h6>Password:</h6><input type=text name=pass STYLE=width:140px>";
print "</td><td valign=middle align=center><input type=submit value=\" go
\">";
print "<input type=hidden name=start value=1>";
print "</td></tr></table></form><br>";
if ($start=="1")
 {
 $link=mysql_connect("localhost","$user","$pass");
 if (! $link) die("couldn't connect mysql");
 mysql_select_db($db,$link) or die ("couldn't open $db ".mysql_error());
 $tables=mysql_list_tables($db,$link);
 $num=mysql_num_rows($tables)-1;
 mysql_close($link);
 ?>
 <form action="<?php print $php_self?>" method="post">
 <?php
 print "<table cellpadding=7 border=1 bgcolor=#d5d5d5><tr><td>";
 print "<h6>Table Name: </h6><select type=text name=table
STYLE=width:140px><option>";

 for ($i=0;$i<=$num;$i++)
  {
  print "<option>".mysql_tablename($tables,$i);
  }
 print "</select>";

 print "</td><td><input type=submit value=\" go  \">";
 print "<input type=hidden name=start value=2>";

 print "<input type=hidden name=db value=$db>";
 print "<input type=hidden name=user value=$user>";
 print "<input type=hidden name=pass value=$pass>";
 print "</td></tr></table></form><br>";
 }

if ($start=="2")
 {
 $link=mysql_connect("localhost","$user","$pass");
 if (! $link) die("couldn't connect mysql");
 mysql_select_db($db,$link) or die ("couldn't open $db ".mysql_error());

 $results=mysql_query("select * from $table");
 $fields = mysql_list_fields("$db", "$table", $link);
 $columns = mysql_num_fields($fields);
 mysql_close($link);
 print "<table width=95% bgcolor=#d5d5d5 border=1 cellspacing=0
cellpadding=0><tr><td align=center><h3>$table</h3>";
 print "<table width=100% bgcolor=#d5d5d5 border=1 cellspacing=0
cellpadding=4>";
 print "<tr>";
 for ($i = 0; $i < $columns; $i++)
  {
  print "<td align=center bgcolor=#6c6c6c><h5><font
color=white>".mysql_field_name($fields, $i)."</font></h5></td>";
  }
 print "</tr>";
 print "<tr>";
 for ($i = 0; $i < $columns; $i++)
  {
  print "<td align=center bgcolor=#fbfbfb><h5>".mysql_field_type($results,
$i)."</h5></td>";
  }
 print "</tr>";
 while ($a_row=mysql_fetch_row($results))
  {
  print "<tr>";
  foreach($a_row as $field)
   {
   if ($field=="")
    {
    $field="&nbsp;";
    }
   print "<td align=center><h5>".$field."</h5></td>";
   }
  print "</tr>";
  }
 print "</table></td></tr></table>";
 }
?>
</body>
</html>



----- Original Message -----
From: "Floyd Baker" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Saturday, November 23, 2002 2:07 PM
Subject: Re: [PHP] dynamic arraynames


> On Sat, 23 Nov 2002 10:58:02 -0500, you wrote:
>
> >> I am trying to generate arrays to hold inputs to columns.  Column
> >> titles are input to a table as needed.  They are read by the program
> >> and placed across the page.  Then an array goes under each column name
> >> to collect the inputs to the various rows.  Everything works except to
> >> dynamically change the name of the array.
> >>
> >>
> >> while($foo=mysql_fetch_array($mysql_result)){
> >>     print "<INPUT TYPE=text NAME=correspondingfoo[]>";}
> >
> >Do you want this??
> >
> >print "<INPUT TYPE=text NAME=" . $foo['something'] . "[]>";
> >
> >---John Holmes...
>
>
> No John.  I'm ok with simply inputting a value and otherwise using
> arrays that are hard coded and previously named but my problem is in
> creating different arrays on the fly to represent each column that
> there is a name for.  I want to end up with something like $meat[] and
> $potatoes[] and whatever else is needed from a list...  The list of
> meat, potatoes, etc determines how many arrays and their names.
>
> I'm not to swift when it comes to arrays and think I'm probably stuck
> on some simple misconception.  I'm trying to convert $meat to $meat[],
> on the fly, to have something to input to...  I read today maybe I
> don't need the brackets?
>
> Floyd
>
>
> --
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

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

In a html i use a form to post data to a php file in a Apache server. I'd
like to take a look at the raw data submitted from the web browser to the
php, where can i find this info? the access.log in Apache does not contain
this info. thanks.

Frank


--- End Message ---
--- Begin Message ---
I have a html form that has just 3 fields and each are defined as
name="firstname", name="lastname", and name="email" . The action is
calling a sendmail.php file and the method is POST. Here is the contents
of sendmail.php:

<?php
$to = "[EMAIL PROTECTED]";
$subject = "Form Submission";
$contents = "$firstname, $lastname, $email";
mail ($to, $subject, $contents);
header ("Location: http://probsd.org/rlewis/thankyou.txt";);
?>

When submitting the form, mail gets sent to [EMAIL PROTECTED] with the
subject defined in sendmail.php, but the contents simply displayes both of
the commas from $contents =  and not $firstname, $lastname, and $email.

Syntax error or what?

Michael



--- End Message ---
--- Begin Message ---
Probably just a problem with register_globals

Try:

$contents = "{$_REQUEST['firstname']}, {$_REQUEST['lastname']}, {$_REQUEST['email']}";

Marco

------------
php|architect - The magazine for PHP Professionals
The monthly worldwide magazine dedicated to PHP programmers
Check us out on the web at http://www.phparch.com

On Sat, 2002-11-23 at 18:13, Michael Sharp wrote:
> I have a html form that has just 3 fields and each are defined as
> name="firstname", name="lastname", and name="email" . The action is
> calling a sendmail.php file and the method is POST. Here is the contents
> of sendmail.php:
> 
> <?php
> $to = "[EMAIL PROTECTED]";
> $subject = "Form Submission";
> $contents = "$firstname, $lastname, $email";
> mail ($to, $subject, $contents);
> header ("Location: http://probsd.org/rlewis/thankyou.txt";);
> ?>
> 
> When submitting the form, mail gets sent to [EMAIL PROTECTED] with the
> subject defined in sendmail.php, but the contents simply displayes both of
> the commas from $contents =  and not $firstname, $lastname, and $email.
> 
> Syntax error or what?
> 
> Michael
> 
> 
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 


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

i have a string and I want to set it as a variable name.

like tahat

i have string like: "string";

how can i get variable $string;

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

i have a string and I want to set it as a variable name.

like tahat

i have string like: "string";

how can i get variable $string;

I suppose you are trying to do the following:

$variable = "some value";

So if you wish to assign "string" as $string, simply do the following:

$string = "string";


--
Kyle Gibson
admin(at)frozenonline.com
http://www.frozenonline.com/

--- End Message ---
--- Begin Message ---
At 02:05 24.11.2002, empty said:
--------------------[snip]--------------------
>i have string like: "string";
>
>how can i get variable $string;
--------------------[snip]-------------------- 

$var = 'string';
$$var will resolve as $string


-- 
   >O     Ernest E. Vogelsinger
   (\)    ICQ #13394035
    ^     http://www.vogelsinger.at/


--- End Message ---
--- Begin Message ---
yiihhuuuvvv

it works;

I heard it, i remember variable variables I guess

Thanks all

EEV> $var = 'string';
EEV> $$var will resolve as $string

--- End Message ---
--- Begin Message ---
I have a simple post script and I want to make it so if a user types in a URL of some sort, to change it to make it clickable. How could I do that?

Thanks,
Stephen Craton
http://www.melchior.us
 
"Life is a gift from God. Wasting it is like destroying a gift you got from the person you love most." -- http://www.melchior.us
--- End Message ---
--- Begin Message --- not entirely sure what is going on there, but if the user is entering the url in a html form. Then just grab the variable on the next page and run this

$url=user $HTTP_GET_VARS["url"]; (or $HTTP_POST_VARS depending on your form method)
$url="<a href=".$url.">".$url."</a>";
echo $url;

the only way to change it dynamically on the same page would be javascript.

-tom culpepper

Stephen wrote:
I have a simple post script and I want to make it so if a user types in a URL of some sort, to change it to make it clickable. How could I do that?

Thanks,
Stephen Craton
http://www.melchior.us
"Life is a gift from God. Wasting it is like destroying a gift you got from the person you love most." -- http://www.melchior.us


--- End Message ---
--- Begin Message ---
They are entering in a whole paragraph or two of text and I want to search
the paragraph for URLs then make it a clickable URL and then store it in a
MySQL database.


----- Original Message -----
From: "Tom Culpepper" <[EMAIL PROTECTED]>
To: "Stephen" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Saturday, November 23, 2002 9:05 PM
Subject: Re: [PHP] Parse URLs


> not entirely sure what is going on there, but if the user is entering
> the url in a html form.  Then just grab the variable on the next page
> and run this
>
> $url=user $HTTP_GET_VARS["url"]; (or $HTTP_POST_VARS depending on your
> form method)
> $url="<a href=".$url.">".$url."</a>";
> echo $url;
>
> the only way to change it dynamically on the same page would be
javascript.
>
> -tom culpepper
>
> Stephen wrote:
> > I have a simple post script and I want to make it so if a user types in
> > a URL of some sort, to change it to make it clickable. How could I do
that?
> >
> > Thanks,
> > Stephen Craton
> > http://www.melchior.us
> >
> > "Life is a gift from God. Wasting it is like destroying a gift you got
> > from the person you love most." -- http://www.melchior.us
> >
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

--- End Message ---
--- Begin Message ---
from the archives of the list
http://www.phpbuilder.com/mail/php-windows/2001042/0222.php

-tom culpepper


Stephen wrote:
They are entering in a whole paragraph or two of text and I want to search
the paragraph for URLs then make it a clickable URL and then store it in a
MySQL database.


----- Original Message -----
From: "Tom Culpepper" <[EMAIL PROTECTED]>
To: "Stephen" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Saturday, November 23, 2002 9:05 PM
Subject: Re: [PHP] Parse URLs



not entirely sure what is going on there, but if the user is entering
the url in a html form.  Then just grab the variable on the next page
and run this

$url=user $HTTP_GET_VARS["url"]; (or $HTTP_POST_VARS depending on your
form method)
$url="<a href=".$url.">".$url."</a>";
echo $url;

the only way to change it dynamically on the same page would be
javascript.

-tom culpepper

Stephen wrote:

I have a simple post script and I want to make it so if a user types in
a URL of some sort, to change it to make it clickable. How could I do

that?

Thanks,
Stephen Craton
http://www.melchior.us

"Life is a gift from God. Wasting it is like destroying a gift you got
from the person you love most." -- http://www.melchior.us



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





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

can anyone tell me how to make auto backups of mysql databases?

i have a particular database that i want to backup everyday. what i can
think of now is to use crontab to execute a .php that will do the work, then
send the db schema (dump) via email every midnight.

however, i do not know the code to GET THE DUMP of the mysql db.

i know that i can be done because phpAdmin from sourceforge.net has the
export feature, which does what i want, except that i cannot execute the
hyperlink there using crontab.

can someone tell me:
1. what is the php code for getting the schema?
2. what is an alternatively BETTER way to backup?

thanks in advance

Yours sincerely,
See Kok Boon
---------------------------------
looking for - jobs? career? customer?
look in realPortal!
http://realportal.realizecreations.com

--- End Message ---
--- Begin Message ---
Answer is No. 2)

Use cron to run the mysqldump utility instead of a php script.
Let me know if you need more info.

Cheers
Rich

-----Original Message-----
From: See Kok Boon [mailto:[EMAIL PROTECTED]]
Sent: 23 November 2002 07:35
To: PHP
Subject: [PHP] getting mysql dump using php


hi,

can anyone tell me how to make auto backups of mysql databases?

i have a particular database that i want to backup everyday. what i can
think of now is to use crontab to execute a .php that will do the work, then
send the db schema (dump) via email every midnight.

however, i do not know the code to GET THE DUMP of the mysql db.

i know that i can be done because phpAdmin from sourceforge.net has the
export feature, which does what i want, except that i cannot execute the
hyperlink there using crontab.

can someone tell me:
1. what is the php code for getting the schema?
2. what is an alternatively BETTER way to backup?

thanks in advance

Yours sincerely,
See Kok Boon
---------------------------------
looking for - jobs? career? customer?
look in realPortal!
http://realportal.realizecreations.com


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



--- End Message ---
--- Begin Message ---
On Sun, 24 Nov 2002, Rich Gray wrote:

> Answer is No. 2)
> Use cron to run the mysqldump utility instead of a php script.
> Let me know if you need more info.

  I use this one with crontab, it works pretty well, if your email program
  can handle uuencode:


#!/bin/sh
# File    : db_backup.sh
# Descript: Runs a ful mysqldump of one or more MySQL databases, uuencodes
#           and compresses them, and mails them to a specified address.
#           Requires mysqldump, gzip, uuencode, mail or mailx, and crontab.
#
#           Normally this run from crontab, with an entry like:
#             0 3 * * * sh ~/db_backup
#
# Version : 1.00
# Author  : Morgan Hughes ([EMAIL PROTECTED])
# License : Copyright (C) 2002, Morgan Hughes.  Use freely.


# Account/password/email info
db_list="your_database"
db_user="your_username"
db_pass="your_password"
email="your_email_addy"

# program locations
mysqldump="mysqldump"
dump_opts=""
uuencode="uuencode"
gzip="gzip"
mail="mail"

# Actual code
for db_name in $db_list ; do

        date=`date '+%Y%m%d-%H%M%S'`
        $mysqldump $dump_opts -u $db_user "--password=$db_pass" $db_name | \
        $gzip -c9 | $uuencode "$db_name-$date.sql.gz" | \
        $mail -s "DB backup, $db_name, $date" $email

done

# Ends    : db_backup.sh



  At home I have a script plugged into .procmailrc with an entry like:

# First off, catch inbound automated backups.
:0
* ^Subject: DB backup, kyhm
| ~/bin/catch_backup ~/kyhm.com/backups/db



  The ~/bin/catch_backup script is as follows:

#!/bin/sh
if [ "$1" != "" -a -d "$1" ] ; then
        cd "$1"
else
        cd ~
fi
cat | uudecode



  Hope this is useful...

-- 
   Morgan Hughes
   C programmer and highly caffeinated mammal.
   [EMAIL PROTECTED]
   ICQ: 79293356


--- End Message ---
--- Begin Message ---
Hi,
    I am looking to secure my php install, like the settings in php.ini etc.

I am using apache 1.3.27 and running latest php.

Is there like a tut or something that can take u thought the php.ini and
explain ina little more detail?

safe_mode = Off

is that a bad idea or should i leave it on..

/Steve

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

you should try to take the php.ini-recommended and edit it a little bit so that it 
fits your needs.
the settings there are very secure but also increase php's performance and coding 
standard.
if some settings won't fit to a single script, you can use ini_set(..., ...).
so you'll have to disable the output_buffer if you need implicit_flush.

and you safe_mode question.. sorry  i never played around with it ;)

bye

On Sun, 24 Nov 2002 17:41:20 +1100
[EMAIL PROTECTED] (Steven Adams) wrote:

> Hi,
>     I am looking to secure my php install, like the settings in php.ini etc.
> 
> I am using apache 1.3.27 and running latest php.
> 
> Is there like a tut or something that can take u thought the php.ini and
> explain ina little more detail?
> 
> safe_mode = Off
> 
> is that a bad idea or should i leave it on..
> 
> /Steve
> 
--- End Message ---
--- Begin Message ---
Ernest E Vogelsinger wrote:
>
    if ($_COOKIE[$_SESSION['cookie_name']] == $_SESSION['cookie_token']) {
Ok, please forgive my ignorance, but in PHP isn't $_COOKIES the same as $_SESSION?. I thought it was if the user had cookies turned off (and even if the user had cookies turned on come to think of it) ... If not I'm in trouble.

I was always under the impression that $_SESSION vars were passed as cookies ...

Hc

--- End Message ---
--- Begin Message ---
Michael Sims wrote:
I 'm not where I can test this right now, but if a session is older
than session.gc_maxlifetime, isn't it invalid anyway?  I.E. if I
bookmark a page on your site and then come back 3 hours later passing
an old SID, shouldn't that session have expired on the server by that
time, in which case the session vars would be empty and you could kick
me back to your login page?
If my understanding of sessions is correct, no.

session.gc_maxlifetime does set the lifetime of a session, but a session will not be cleaned by PHP until session.gc_probability has been hit. Again, if my understanding is correct, PHP doesn't automatically check to see if a session has expired before accessing it. It pre-supposes that any session file lying around is till active. And those session file will stay there until session.gc_probability has been hit.

I might be wrong though ...

Jc

--- End Message ---
--- Begin Message ---
Michael Sims wrote:
Then I suppose it's just an added feature of the session handler I am
using.  Maybe the OP should give it a shot, as I use it and I
definitely don't have a problem with expired sessions
I'll think about writing my own session handler as it can be quite useful. However I need to evaluate the amount of extra disk read/writes it would add. Using a DB vs the file system does add some overhead ...

Jc

--- End Message ---
--- Begin Message ---
I have always had the opinion that the more comments you put into php
scripts, the slower they will run because there is more data to be read...
Can someone tell me if there is any truth in this or whether commenting has
absolutely 'no' impact on the performance of a script?

Thanks,
Adam.


--- End Message ---
--- Begin Message ---
If I declared an element indexed array and put some values into it:

$a['element1'] = array('btime' => '19D', 'etime' => '22D', 'dayname' => 4);
$a['element2'] = array('btime' => '12D', 'etime' => '20D', 'dayname' => 2);
$a['element3'] = array('btime' => '15D', 'etime' => '17D', 'dayname' => 3);

I would like to ask that how can I completely delete the $a['element2'] in
the array? That's mean I will get 'false' in 'isset($a['element2']) after
the delete process is taken place.

Thanks for your help.

Regards,
Michael Wai


--- End Message ---

Reply via email to