Re: [PHP] SOMETIMES, my SID gets embedded in the URL ???

2004-10-11 Thread PHPDiscuss - PHP Newsgroups and mailing lists
I tried ini_set('session.use_only_cookies', "1").
I also tried ini_set('session.use-trans-sid', 0). Right after I made the
change, the sid was gone, urls didn't contain it anymore, BUT, the next
day, today, when I accessed the site from my office (another computer),
the SID is there again!

And this is exactly like when I first added
ini_set('session.use_only_cookies', "1") : before the addition the sid was
sometimes there, after the addition it wasn't. Few days later it was there
again.
Then I added ini_set('session.use-trans-sid', 0) and it was ok, today it's
not.
Don't know what to believe anymore...

The strange thing is, phpinfo() says session.use_only_cookies is ON and
session.use_trans_sid likewise.
So if session.use_trans_sid is on, why do I lose my session after
redirecting to a relative url ? The docs say that "relative URIs will be
changed to contain the session id automatically".

Also when I access the forums on my site (IPB), the sid isn't embedded. 

So my question is: if session.use_only_cookies is ON, why on earth is the
sid present in the url ?
PS: php is version 4.3.8.


Marek Kilimajer wrote:

> PHPDiscuss - PHP Newsgroups and mailing lists wrote:
> > he problem is that SOMETIMES, my SID gets embedded in the URL, although at
> > the begining of every page I have this code:
> > 
> > ini_set(session.use_only_cookies, "1");

> The above sets sessionuse_only_cookies to 1. I did not miss a dot, 
> session and use_only_cookies are interpreted as constants. You need quotes:

> ini_set('session.use_only_cookies', "1");

> > session_set_cookie_params(60*60); 
> > session_start();
> > session_register("blabla");
> > if (!$_SESSION["logged_in"])
> > session_destroy();
> > etc, etc; 
> > 
> > So there are days/times when the SID isn't embedded in the URL (and in the
> > links of the page), and days/times when it is, regardless of what value
> > $_SESSION["logged_in"] has.
> > I tested the value returned by ini_set and it's always different from
> > false.
> > What gives ???
> >

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



Re: [PHP] Parse Error --- can not solve at this time... please assit

2004-10-11 Thread Janet Valade
GH wrote:
With the following code, I am getting the following message
Parse error: parse error, expecting `')'' in
/var/www/html/cert/admin_template.php on line 30
Line 30 Reads as follows:
 foreach($admin_get_options_result as $api => $file, $desc)
Your syntax is incorrect on this statement. It should be:
foreach($admin_get_options_result as $api => $file)
PHP is expecting the ) after $file. Here's the documentation for 
foreach. http://www.php.net/manual/en/control-structures.foreach.php

Janet
Can any one please assist.
***ENTIRE CODE STARTING AT LINE 1 FOLLOWS *


ADMINISTRATION SCREEN




	
	echo 'this is a test of the system';
	
	if(!isset($_GET['api']) || (isset($_GET['api']) &&
((strlen(trim(urldecode($_GET['api']))) == 0) ||
(!is_int($_GET['api'])
		$_GET['api']=0;
	
	if($_GET['api'] == 0)
	{
		$admin_get_options_query_text = "Select * from Adminpage";
		$admin_get_options_results_reference =
mysql_query($admin_get_options_query_text,$db_access) or die("Admin
Get Options: ". mysql_error());
		$admin_get_options_result =
mysql_fetch_assoc($admin_get_options_result_reference);
	
		if(mysql_num_rows($admin_get_options_results_reference)>0)
		{	
?>


  Link   DESCRIPTION 
 $file, $desc)
{
echo ' ';
echo ' Click Here  
';
echo ''.$desc.'';
}
?>
			
	

	}
	else
	{
	  $admin_get_page_query_text = "Select * from Adminpage Where
adminpageid = $_GET['api'] LIMIT 1";
	  $admin_get_page_results_reference =
mysql_query($admin_get_page_query_text,$db_access) or die("Admin Get
Page: ". mysql_error());
	  $admin_get_page_result = mysql_fetch_row($admin_get_page_result_reference);

	  if (mysql_num_rows($admin_get_page_results_reference) > 0)
	  {
	  	require "mod/admin/".trim(strtolower($admin_get_page_result[1]));
	  }
	  else
	  {
	  	echo "ERROR: Invalid Admin Page Requested ";
		echo 'Please Try Again ...  Click
Here ';
	  }
	  
	}	
?>




--
Janet Valade -- janet.valade.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Finding one line in a Variable?

2004-10-11 Thread Nick Wilson
Hello all, 

I have to find and put one line of an html file in a variable. I already
have the entire html file stored in a variable like this:

$myHTML="blah blah blah"; - Grabbed using cURL

The particular line I want will *always* contain the string
"the_identifying_string"

So the line itself (the line i want to get into a var) would look like
this:



How can I get that entire line?

many thanks, im sure your all bored of my regex woes heh.. but thanks,
it's appreciated..
-- 
Nick W

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



[PHP] Best practise for resolving potential conflicts when editing db content?

2004-10-11 Thread Murray @ PlanetThoughtful
Hi All,

 

I'm developing a wiki-esque application for an in-house project and am
wondering how others go about resolving potential conflicts when multiple
users are editing the same content drawn from a MySQL database?

 

In particular, I'm working on code that allows users to rename 'pages' (ie
the value in the 'pagetitle' field for the record currently being
displayed). Theoretically, there may be other records in the table that have
intra-record links to the record being renamed (I'm using the Markdown
syntax [see http://daringfireball.net/projects/markdown/syntax and
http://www.michelf.com/projects/php-markdown/] in the content fields). In a
perfect world, I should just be able to run a MySQL replace function across
any records that contain the old page title, replacing the value with the
new page title, however I foresee a problem if a user is currently editing
content from a record that has the old page title. When that user saves
their changes, it will currently overwrite any changes made by the MySQL
replace function.

 

So, I'm wondering, how do others handle potential conflicts of this kind?
This conflict should be just as relevant to the idea of two users
concurrently attempting to edit the same record, as it does to the specific
situation outlined above.

 

Any help appreciated!

 

Much warmth,

 

Murray

 



Re: [PHP] sending SMS messages to mobile phones from PHP

2004-10-11 Thread Jad Madi
-
User8 is [EMAIL PROTECTED] * [EMAIL PROTECTED]
User8 using arcor.de.eu.dal.net www.arcor.de - Arcor Online Serv


On Mon, 11 Oct 2004 23:34:18 +0530, Sagar C Nannapaneni
<[EMAIL PROTECTED]> wrote:
> You can use SMSTERM
> 
> /sagar
> 
> 
> - Original Message -
> From: "SunTan.co.uk" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Sunday, October 10, 2004 7:38 PM
> Subject: [PHP] sending SMS messages to mobile phones from PHP
> 
> > Hi there,
> >
> > I want my website to be able to send me an SMS message to my phone when
> > somebody fills our contact form in.
> > Does anybody do this already? If so, how?
> > I think that I need an SMS service but I'm not sure what one is or how
> much
> > it'll cost us.
> > Please advise.
> >
> > [EMAIL PROTECTED]
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
> >
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 


-- 
http://www.W3planet.info/
http://www.EasyHTTP.com/jad/

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



Re: [PHP] forms

2004-10-11 Thread Minuk Choi
What is a "connect_db" file?
- Original Message - 
From: "bigmark" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Sunday, October 10, 2004 11:33 PM
Subject: Re: [PHP] forms


Thanks-- i got that going-GREAT !  now i have a form that creates the
database and tables, any ideas how i can get this info to change the
connect_db file so that it doesnt have to be done manually.

"Minuk Choi" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
try this :
$link = mysql_connect($host, $user, $pass);
Note : No SINGLE quotes.
In PHP, quotations are as follows
$host = 'localhost';
$a = '$host';
$b = "$host";
echo $a;
that prints $host
echo $b;
that prints localhost.
HTH
-Minuk
- Original Message -
From: "bigmark" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Sunday, October 10, 2004 10:23 PM
Subject: [PHP] forms/variables/create database
> hi, does anyone know why this is not working, i have married 2 pieces 
> of
> code together and i have no idea what im doing--any help is 
> appreciated.
> I get an error that says it cant find the host--$host so obviusly its
not
> passing it from the form.
>
> /
>  $host =  $_POST['host'];
> $user =  $_POST['user'];
> $pass =  $_POST['pass'];
> $db_name =  $_POST['db-name'];
>
>
> $link = mysql_connect('$host', '$user', '$pass');
> if (!$link) {
>   die('Could not connect: ' . mysql_error());
> }
>
> if (mysql_create_db('db_name')) {
>   echo "Database created successfully\n";
> } else {
>   echo 'Error creating database: ' . mysql_error() . "\n";
> }
> ?>
> /
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

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


Re: [PHP] install /setup script

2004-10-11 Thread Minuk Choi
Well, you can just put up a regular form, something to the effect of

Hostname 
User Name
Password 
...
...
...
etc.

and when you submit that form, those variables will be accessible under the 
$_POST array

such as
$hostName = $_POST['Hostname'];
$userName=$_POST['username'];
etc.
NOTE that doing it this way presents several security issues
 1) You should add some checking before connecting to the MySQL database; a 
user can specify "mysql" as the database and you'd have your tables 
installed in the mysql database(which is used by mysql for its 
privilege/user tables and such... I normally make it a practice to NOT mess 
it with the mysql tables).  (e.g. If you plan to drop the database and 
repopulate it, then specifying "mysql" for database would destroy MySQL's 
core tables)
 2) If you are not familar with the $_POST array, it is the data that you 
specified between the  and  and , there is a $_GET array.  But many 
people frown if you have a form that asks for username and password and you 
submit that via GET(as the values you specified would be appended at the end 
of the URL).

HTH
-Minuk
- Original Message - 
From: "bigmark" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, October 11, 2004 12:14 AM
Subject: [PHP] install /setup script


Thanks for the help with the createdb and tables form, now can anyone help
with changing the config.php
(ie: host,user,password) via a form also-- so that it doesnt have to be 
done
manually within the config script.

Basically i want an install/setup page with all the form elements--
Hostname-
username-
Password-
Choose database name-
Then it installs the database and tables then redirects to the main site
page and the config.php is already configured for them
BigMark
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Parse Error --- can not solve at this time... please assit

2004-10-11 Thread Minuk Choi
the ", $desc)" is your culprit.
foreach ($arrayVariable as $key=>$value)
is probably the form you meant.
foreach ($admin_get_options_result as $api =>$file, $desc)
what is $api, $file, $desc supposed to be?  If I were to hazard a guess, is 
the $admin... array a nested array, something like

$admin...[$api][$file]=$desc
NOTE : your name for $admin... is too long, so I'm writing it as "$admin..." 
in case you were wondering

If that is the case that you have a nested array, try the following
foreach ($admin... as $api => $data)
   foreach ($data as $file=>$desc)
   {
   //stuff.
   }
On a unrelated note, in your sniplet, there is no declaration for 
$admin_get_options_results, perhaps you meant, 
$admin_get_options_results_reference?

Typically, I prefer to have short but meaningful variable names.  Yours is 
kinda long.  This is just a personal opinion, but perhaps you should 
reconsider your naming scheme, as that might save time on any misspelled 
variable names.

HTH
-Minuk
- Original Message - 
From: "GH" <[EMAIL PROTECTED]>
To: "PHP General" <[EMAIL PROTECTED]>
Sent: Monday, October 11, 2004 1:48 AM
Subject: [PHP] Parse Error --- can not solve at this time... please assit


With the following code, I am getting the following message
Parse error: parse error, expecting `')'' in
/var/www/html/cert/admin_template.php on line 30
Line 30 Reads as follows:
foreach($admin_get_options_result as $api => $file, $desc)
Can any one please assist.
***ENTIRE CODE STARTING AT LINE 1 FOLLOWS *


ADMINISTRATION SCREEN




echo 'this is a test of the system';
if(!isset($_GET['api']) || (isset($_GET['api']) &&
((strlen(trim(urldecode($_GET['api']))) == 0) ||
(!is_int($_GET['api'])
$_GET['api']=0;
if($_GET['api'] == 0)
{
$admin_get_options_query_text = "Select * from Adminpage";
$admin_get_options_results_reference =
mysql_query($admin_get_options_query_text,$db_access) or die("Admin
Get Options: ". mysql_error());
$admin_get_options_result =
mysql_fetch_assoc($admin_get_options_result_reference);
if(mysql_num_rows($admin_get_options_results_reference)>0)
{
?>

  Link   DESCRIPTION 
 $file, $desc)
{
echo ' ';
echo ' Click Here  ';
echo ''.$desc.'';
}
?>


}
}
else
{
  $admin_get_page_query_text = "Select * from Adminpage Where
adminpageid = $_GET['api'] LIMIT 1";
  $admin_get_page_results_reference =
mysql_query($admin_get_page_query_text,$db_access) or die("Admin Get
Page: ". mysql_error());
  $admin_get_page_result = 
mysql_fetch_row($admin_get_page_result_reference);

  if (mysql_num_rows($admin_get_page_results_reference) > 0)
  {
  require "mod/admin/".trim(strtolower($admin_get_page_result[1]));
  }
  else
  {
  echo "ERROR: Invalid Admin Page Requested ";
echo 'Please Try Again ...  Click
Here ';
  }
}
?>


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

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


Re: [PHP] Finding one line in a Variable?

2004-10-11 Thread Minuk Choi
If you don't mind NOT using regex or regular expression searching commands, 
you can try it this way.

Assuming that there is a carriage break(e.g. "\r\n" if windows, and I'm 
assuming the HTML file was written in windows, otherwise, just "\n" for Unix 
and "\n\r" for Mac, I believe).

$eolnString ="\r\n";
$searchString = "the_identifying_string";
$result="NOT FOUND";
$HTMLDumpArray = explode($eolnString, $myHTML);
/*
   if $myHTML = "\r\n\t\r\n\t\r\n";
   then
   $HTMLDumpArray is now
   $HTMLDumpArray[0] = "";
   $HTMLDumpArray[1] = "\t";
   $HTMLDumpArray[2] = "\t";
   $HTMLDumpArray[3] = "";
*/
foreach ($HTMLDumpArray as $HTMLLine)
   if (stripos($HTMLLine, $searchString)!==FALSE)
//stripos returns the index number of where the $searchString was found OR 
returns FALSE
   {
   $result = $HTMLLine;
   break;
   }

echo "RESULT ".$result;
try that and let me know if that works.
HTH,
-Minuk
- Original Message - 
From: "Nick Wilson" <[EMAIL PROTECTED]>
To: "php-general" <[EMAIL PROTECTED]>
Sent: Monday, October 11, 2004 3:45 AM
Subject: [PHP] Finding one line in a Variable?


Hello all,
I have to find and put one line of an html file in a variable. I already
have the entire html file stored in a variable like this:
$myHTML="blah blah blah"; - Grabbed using cURL
The particular line I want will *always* contain the string
"the_identifying_string"
So the line itself (the line i want to get into a var) would look like
this:

How can I get that entire line?
many thanks, im sure your all bored of my regex woes heh.. but thanks,
it's appreciated..
--
Nick W
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] testing - disregard

2004-10-11 Thread Minuk Choi
This is a test e-mail, please disregard

RE: [PHP]

2004-10-11 Thread php-list
Never mind guys, I figured it out. I appreciate your help. Thanks for
everything!

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Sent: Sunday, October 10, 2004 10:43 PM
To: [EMAIL PROTECTED]
Subject: [PHP] 

Thanks to all of you for your explanation of my method. Minuk, thanks for
the detailed explanation, it really helps me understand what I'm doing
wrong.

Now I have one more problem. When the $children array is empty, it returns a
10 instead of a 0. Why is that? Here's the method again with the recommended
improvements you guys provided:



function get_children($parent) {
// FORMULA: rgt value of first child + 1 = left value of second
child
//  check rgt value of parent against each child (rgt + 1).
//  If rgt valueof child plus 1 equals rgt value of parent
then
//  that child is the last child of the parent.
$parent_coord = tree::get_item_coord($parent);
$descendants = $this->get_descendants($parent);
$children = array();
for ($i = 0; $i < count($descendants); $i++) {
if ((empty($children)) && (($parent_coord['0']['lft'] + 1) ==
$descendants[$i]['lft'])) {
$children[] = $descendants[$i]; // found first child
}
elseif (($children[count($children)-1]['rgt'] + 1 ==
$descendants[$i]['lft']) && $children[count($children)-1]['rgt'] + 1 !=
$parent_coord['0']['rgt']) {
$children[] = $descendants[$i]; // find next children
}
}
if (count($children)>0) {
return $children;
} else {
return 0;
}
}



-Original Message-
From: Minuk Choi [mailto:[EMAIL PROTECTED] 
Sent: Sunday, October 10, 2004 1:55 AM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] 

I can tell you from a quick glance that you have the following case

function X()
{
if ()
{
$children=...
}
elseif ()
{
$children=...
}
return $children;
}

Have you tried giving $children an initial value, such as

function X()
{
$children = array();

if ()
{
$children[]=...
}
elseif ()
{
$children[]=...
}

if (count($children)>0)
return $children;
return 0;
}

I may be getting a head of myself, but the

$children[]=...

line adds the $descendants into the ARRAY variable, $children.  Unless I'm 
wrong, you MUST declare $children as an ARRAY FIRST(see first line of the 
function, "$children=array();")

Secondly, if you want the function to return 0 if no $descendant entries are

added to $children, you must check to see if the $children ARRAY is EMPTY.

if (count($children)>0)
return $children;

that line basically says if ARRAY variable $children has more than 0 
elements, return that ARRAY.

Finally,

return 0;

if the ARRAY variable $children has 0 elements(count($children) returns the 
number of elements in ARRAY variable, $children), "return $children" is NOT 
executed.  The next line is "return 0".

This is a lazy way of writing the following :

if (count($children)>0)
return $children;
else
return 0;

If it seems like I'm explaining too much, it's because from the code 
snipplet you provided, it sounds like you're a novice to PHP... and you did 
write, '...explain this error to me'. :-P


Hope This Helps
-Minuk

- Original Message - 
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, October 09, 2004 10:29 PM
Subject: [PHP]

> Hello everyone,
>
> I'm hoping you guys can help me with this error. Here's what I'm getting:
>
> Notice: Undefined variable: children in
> L:\localhost\catalog\catalog_0.1.0\includes\classes\tree.class.php on line
> 58
>
> This error occurs only when the class's method outputs $children as having

> a
> value of zero. Below is the class. I want it to return zero but I don't 
> want
> this error. Do I need to change my error settings in my php.ini file? The
> error level is currently set to E_ALL and I'm using PHP 5.0.1. If at all
> possible, I want to keep this error setting at high because I want
> everything to be coded strictly. What did I do wrong in my class and how 
> can
> I fix it to where it doesn't output an error when a class's method returns

> a
> value of zero? Here's the class:
>
>function get_children($parent) {
>$parent_coord = tree::get_item_coord($parent);
>$descendants = $this->get_descendants($parent);
>for ($i = 0; $i < count($descendants); $i++) {
>if ((empty($children)) && (($parent_coord['0']['lft'] + 1) ==
> $descendants[$i]['lft'])) {
>$children[] = $descendants[$i]; // found first child
>}
>elseif (($children[count($children)-1]['rgt'] + 1 ==
> $descendants[$i]['lft']) && $children[count($children)-1]['rgt'] + 1 !=
> $parent_coord['0']['rgt']) {
>

[PHP] [Fwd: curl and certificate]

2004-10-11 Thread Tassos T
hi,
i face a problem with curl. i have a certificate file (certificate.cer) 
and i use the follow code :

$ch = curl_init();
$cert = "certificate.cer";
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
curl_setopt ($ch, CURLOPT_SSLCERT, $cert);
curl_setopt ($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt ($ch, CURLOPT_SSLCERTPASSWD, "password");
curl_setopt ($ch, CURLOPT_HEADER, 0);
and always i receive this errro message:
"unable to set certificate file (wrong password?)".
any idea?
thanks
tassos
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] PHP gurus...how are they doing this?

2004-10-11 Thread Mag
Hi John,
Thank you for replying.

>> once a person submits a site, they are doing 2
things
>> that totally puzzle me, 
>> 1.showing the number of "outgoing links"
 
> Middle man. You have them click on a link containing
> an ID, increment 
> the counter for that ID, then forward them to the
> requested link.

I'm not sure I understand what you mean here.

This is how far I have come trying to imitate the
above: (Its not working of course :-)   )

http://www.jumac.com/');
$html = implode('', file("$url")); //put the page
source in a string

//find the links and put them in an array
$links = array();
if (preg_match_all('/]*)[\"\']?[^>]*>.*?<\/a>/i', $html, $matches))
{
foreach($mathes as $match){$links[] = $match;}
}

//check for offsite links
$parsed_url = parse_url($url); //parse the url
$thissite = $parsed_url['host'];
$ii=0;
foreach($links as $link){
  if (strstr($link, 'http://') AND !strstr($link,
"$thissite")){   //the link is not relative, and not
on this host
  $ii++;
  }
}
print "There were $ii offsite links";

?>





>> 2. counting the number of linked to pictures (eg:
>> href='blah.jpg') and movies (eg: href='blah,mpg')
and
>> also giving the size of each movie (this i figured
>> out) and the resulation!!
> 
> Can be as easy as a regex match for ".jpg" or
".mpg".

I thought so too, but then its not picking up the
normal image links
eg:


its only takeing the href image links
eg:


Another problem is I am not too good with REGEX (still
learning from php walkers)

I know this is solveable as its working on someone
elses program...but just not able to work out the
logic for myself.

Ideas?

Thanks,
Mag

=
--
- The faulty interface lies between the chair and the keyboard.
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)



___
Do you Yahoo!?
Declare Yourself - Register online to vote today!
http://vote.yahoo.com

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



[PHP] Gmail Search

2004-10-11 Thread Mulley, Nikhil
Hi guys,
 
I have a new need here...,
 
I have some 3 gmail accounts which are filled up with some 800MB stuff useful each 
like MySQl and PHP ,Linux  ,What I wanted is a search 
 
 
I have my home page in my Intranet, I want to put a search their, What it should do is 
take the search query and search the relevant query in my GMail Inboxes ( provided in 
a config file with the userid and passwords --- if a program developed ;) ). and take 
those search results in an array ( or an array of arrays --PHP way ), then put them in 
a standard HTML Table format or any convenient browsing way.
 
 
And the thing I would not let my user ID and password let open to the world in any 
case :) , avoidin  security breach 
 
Does any one have any clue 
 
 
Regards,
Nikhil.


Re: [PHP]

2004-10-11 Thread Jason Wong
On Monday 11 October 2004 19:41, [EMAIL PROTECTED] wrote:
> Never mind guys, I figured it out. I appreciate your help. Thanks for
> everything!

Next time you start a thread please give it a meaningful subject.

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
--
/*
The three best things about going to school are June, July, and August.
*/

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



RE: [PHP] PHP gurus...how are they doing this?

2004-10-11 Thread Graham Cossey
[snip]
>
> This is how far I have come trying to imitate the
> above: (Its not working of course :-)   )
>
>  $url=fsockopen('http://www.jumac.com/');
> $html = implode('', file("$url")); //put the page
> source in a string
>
> //find the links and put them in an array
> $links = array();
> if (preg_match_all('/ >]*)[\"\']?[^>]*>.*?<\/a>/i', $html, $matches))
> {
> foreach($mathes as $match){$links[] = $match;}

If this is a copy&paste of your code you may want to change the above line
to:

  foreach($matches as $match){$links[] = $match;}
  ^

[snip]

Graham

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



Re: [PHP] sending SMS messages to mobile phones from PHP

2004-10-11 Thread Jordi Canals
On Sun, 10 Oct 2004 15:23:54 +0100, Andrew Cowles
<[EMAIL PROTECTED]> wrote:

> We operate an SMS Gateway service (http://www.kapow.co.uk/) which would do
> exactly what you need.
> It's been reliably sending SMS since 1995 - and MANY of our clients use PHP.

Unfoturnately your price list is only in pounds: No Euros, No Dollars
:( It Looks like you only accept British Customers.

Regards,
Jordi.

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



Re: [PHP] SOMETIMES, my SID gets embedded in the URL ???

2004-10-11 Thread Jordi Canals
I had this problem in the past, and asking the PHP people, found that
"session.use_trans_sid is PHP_INI_DIR for PHP 4 and PHP_INI_ALL for
PHP
5." That is the response I received from a bug I submited some time
ago http://bugs.php.net/bug.php?id=28991

So, You're setting user_trans_sid with ini_set and that does not work
in PHP 4, you should edit your PHP.INI file or add an entry to the
.htaccess file.

Regards,
Jordi

On 11 Oct 2004 06:59:32 -, PHPDiscuss - PHP Newsgroups and mailing
lists <[EMAIL PROTECTED]> wrote:
> I tried ini_set('session.use_only_cookies', "1").
> I also tried ini_set('session.use-trans-sid', 0). Right after I made the
> change, the sid was gone, urls didn't contain it anymore, BUT, the next
> day, today, when I accessed the site from my office (another computer),
> the SID is there again!
> 
> And this is exactly like when I first added
> ini_set('session.use_only_cookies', "1") : before the addition the sid was
> sometimes there, after the addition it wasn't. Few days later it was there
> again.
> Then I added ini_set('session.use-trans-sid', 0) and it was ok, today it's
> not.
> Don't know what to believe anymore...
> 
> The strange thing is, phpinfo() says session.use_only_cookies is ON and
> session.use_trans_sid likewise.
> So if session.use_trans_sid is on, why do I lose my session after
> redirecting to a relative url ? The docs say that "relative URIs will be
> changed to contain the session id automatically".
> 
> Also when I access the forums on my site (IPB), the sid isn't embedded.
> 
> So my question is: if session.use_only_cookies is ON, why on earth is the
> sid present in the url ?
> PS: php is version 4.3.8.
> 
> 
> 
> 
> Marek Kilimajer wrote:
> 
> > PHPDiscuss - PHP Newsgroups and mailing lists wrote:
> > > he problem is that SOMETIMES, my SID gets embedded in the URL, although at
> > > the begining of every page I have this code:
> > >
> > > ini_set(session.use_only_cookies, "1");
> 
> > The above sets sessionuse_only_cookies to 1. I did not miss a dot,
> > session and use_only_cookies are interpreted as constants. You need quotes:
> 
> > ini_set('session.use_only_cookies', "1");
> 
> > > session_set_cookie_params(60*60);
> > > session_start();
> > > session_register("blabla");
> > > if (!$_SESSION["logged_in"])
> > > session_destroy();
> > > etc, etc;
> > >
> > > So there are days/times when the SID isn't embedded in the URL (and in the
> > > links of the page), and days/times when it is, regardless of what value
> > > $_SESSION["logged_in"] has.
> > > I tested the value returned by ini_set and it's always different from
> > > false.
> > > What gives ???
> > >
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
>

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



Re: [PHP] Finding one line in a Variable?

2004-10-11 Thread Nick Wilson

* and then Minuk Choi declared
> If you don't mind NOT using regex or regular expression searching commands, 
> you can try it this way.
> 
> Assuming that there is a carriage break(e.g. "\r\n" if windows, and I'm 
> assuming the HTML file was written in windows, otherwise, just "\n" for 



thanks so much! - that looks just great, im sure if it's not perfect I
can make it work! thankyou again...
-- 
Nick W

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



[PHP] Quick file_get_contents() questions...your opinion needed

2004-10-11 Thread Mag
Hi,
I am using a statement like this

$url=file_get_contents("http://www.yahoo.com/";);

The thing is, it takes quite some time (2-5 secs)
before the contents are in my program (I am using my
local webserver on my desktop for testing...not a
webserver)

My questions are for you more experienced guys...
is there anyway to 'quicken' the process or is this
normal?
do you recommend anything other than
file_get_contents() ? 
and lastly, is this a resource intensive hog?

Thanks,
Mag

=
--
- The faulty interface lies between the chair and the keyboard.
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)



___
Do you Yahoo!?
Declare Yourself - Register online to vote today!
http://vote.yahoo.com

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



[PHP] Encoding Question for getting pages

2004-10-11 Thread Nick Wilson
Hello, 

If im using cURL to grab pages, i like to set a $referer and $userAgent
string. Easy enough right?

If I do not encode the referer and ua strings my cURL functions do not
seem to work, BUT, if I *do* encode them, they come out looking like
this in the server logs..

Mozilla%2F4.0%20%28compatible%3B%20MSIE%206.0%3B%20Windows%20NT%205.1%0A

that one is using rawurlencode() but it's just as bad with urlencode -
How *should* I be doing this?

thx!
-- 
Nick W

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



[PHP] spaces in select

2004-10-11 Thread Angelo Zanetti
Hi all, 

I have a select/option that gets populated with countries. The value of
these option are also set to the country name. The problem i have is
that some countries have spaces in them

eg: United States of America.

When the form is posted and I echo the country variable out that has
been posted. It only shows the first word IE:
United.

Is there a way to ensure that I can get all the words that the value is
set to?IE: United States of America, when the form is posted?

Thanks in advance.

Angelo

Disclaimer 
This e-mail transmission contains confidential information,
which is the property of the sender.
The information in this e-mail or attachments thereto is 
intended for the attention and use only of the addressee. 
Should you have received this e-mail in error, please delete 
and destroy it and any attachments thereto immediately. 
Under no circumstances will the Cape Technikon or the sender 
of this e-mail be liable to any party for any direct, indirect, 
special or other consequential damages for any use of this e-mail.
For the detailed e-mail disclaimer please refer to 
http://www.ctech.ac.za/polic or call +27 (0)21 460 3911

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



Re: [PHP] Encoding Question for getting pages

2004-10-11 Thread Matt M.
> Mozilla%2F4.0%20%28compatible%3B%20MSIE%206.0%3B%20Windows%20NT%205.1%0A
> 
> that one is using rawurlencode() but it's just as bad with urlencode -
> How *should* I be doing this?

is this how you tried to do it?

$userAgent = "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)";
curl_setopt($ch, CURLOPT_USERAGENT, $userAgent);

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



Re: [PHP] Encoding Question for getting pages

2004-10-11 Thread Nick Wilson

* and then Matt M. declared
> > Mozilla%2F4.0%20%28compatible%3B%20MSIE%206.0%3B%20Windows%20NT%205.1%0A
> > 
> > that one is using rawurlencode() but it's just as bad with urlencode -
> > How *should* I be doing this?
> 
> is this how you tried to do it?
> 
> $userAgent = "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)";
> curl_setopt($ch, CURLOPT_USERAGENT, $userAgent);

Yep, but like this:

$userAgent = urlencode("Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)");
curl_setopt($ch, CURLOPT_USERAGENT, $userAgent);


-- 
Nick W

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



Re: [PHP] spaces in select

2004-10-11 Thread Matt M.
> I have a select/option that gets populated with countries. The value of
> these option are also set to the country name. The problem i have is
> that some countries have spaces in them
> 
> eg: United States of America.

what doe your select loo like?  something like this should work


United States of America


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



Re: [PHP] spaces in select

2004-10-11 Thread Dan Joseph
> I have a select/option that gets populated with countries. The value of
> these option are also set to the country name. The problem i have is
> that some countries have spaces in them
>
> eg: United States of America.
>
> When the form is posted and I echo the country variable out that has
> been posted. It only shows the first word IE:
> United.
>
> Is there a way to ensure that I can get all the words that the value is
> set to?IE: United States of America, when the form is posted?

Make sure in your  lines that you're putting
the quotes around the words, example, .

-Dan Joseph

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



RE: [PHP] spaces in select

2004-10-11 Thread Nunners
Another suggestion is to use country codes - generally accepted by most i.e.
uk, us, ch, cn, za etc

> -Original Message-
> From: Matt M. [mailto:[EMAIL PROTECTED]
> Sent: 11 October 2004 15:42
> To: Angelo Zanetti
> Cc: [EMAIL PROTECTED]
> Subject: Re: [PHP] spaces in select
> 
> > I have a select/option that gets populated with countries. The value of
> > these option are also set to the country name. The problem i have is
> > that some countries have spaces in them
> >
> > eg: United States of America.
> 
> what doe your select loo like?  something like this should work
> 
> 
> United States of America
> 
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 

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



Re: [PHP] spaces in select-SOLVED

2004-10-11 Thread Angelo Zanetti
ok thanks to those who responded:

this is how i got it working:

echo("" .
trim($row['location']) . "");  

Angelo

>>> Dan Joseph <[EMAIL PROTECTED]> 10/11/2004 4:43:56 PM >>>
> I have a select/option that gets populated with countries. The value
of
> these option are also set to the country name. The problem i have is
> that some countries have spaces in them
>
> eg: United States of America.
>
> When the form is posted and I echo the country variable out that has
> been posted. It only shows the first word IE:
> United.
>
> Is there a way to ensure that I can get all the words that the value
is
> set to?IE: United States of America, when the form is posted?

Make sure in your  lines that you're putting
the quotes around the words, example, .

-Dan Joseph

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


Disclaimer 
This e-mail transmission contains confidential information,
which is the property of the sender.
The information in this e-mail or attachments thereto is 
intended for the attention and use only of the addressee. 
Should you have received this e-mail in error, please delete 
and destroy it and any attachments thereto immediately. 
Under no circumstances will the Cape Technikon or the sender 
of this e-mail be liable to any party for any direct, indirect, 
special or other consequential damages for any use of this e-mail.
For the detailed e-mail disclaimer please refer to 
http://www.ctech.ac.za/polic or call +27 (0)21 460 3911

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



[PHP] Lost in query... Trying to get output from query....

2004-10-11 Thread GH
Greetings:

 I am having a problem with trying to get data out of my mySql database.

I run my query which works fine and everything... 

I use: 

$admin_get_options_query_text = "Select * from adminpage";

$admin_get_options_results_reference =
mysql_query($admin_get_options_query_text,$db_access) or die("Admin
Get Options: ". mysql_error());

$admin_get_options_result =
mysql_fetch_assoc($admin_get_options_results_reference);


-

When I run the query in mysql directly the results are. 

mysql> Select * from adminpage;
+-++--+
| adminpageid | file_name  | description  |
+-++--+
| 101 | nycalertstatus.php | Change New York City Threat Alert Status |
+-++--+
1 row in set (0.00 sec)



my problem is that I would like to get that output into my php
codeI would like to have something that goes like this for each
record..

The api# $adminpageid allows you to $description, and uses the file #file_name


can anyone please assist.

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



Re: [PHP] Lost in query... Trying to get output from query....

2004-10-11 Thread Greg Donald
On Mon, 11 Oct 2004 10:58:45 -0400, GH <[EMAIL PROTECTED]> wrote:
> my problem is that I would like to get that output into my php
> codeI would like to have something that goes like this for each
> record..
> 
> The api# $adminpageid allows you to $description, and uses the file #file_name
> 
> can anyone please assist.

Does $admin_get_options_result['description'] not give you the data you need?

If not, I must not be understanding your question.


-- 
Greg Donald
Zend Certified Engineer
http://gdconsultants.com/
http://destiney.com/

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



RE: [PHP] Lost in query... Trying to get output from query....

2004-10-11 Thread Murray @ PlanetThoughtful
Hi,

You need to loop through the returned recordset and use the returned
result(s).

Instead of:

$admin_get_options_result =
mysql_fetch_assoc($admin_get_options_results_reference);

Try:

While ($admin_get_options_result =
mysql_fetch_assoc($admin_get_options_results_reference)){

echo " The api# ".$admin_get_options_result["adminpageid"]."
allows you to ".$admin_get_options_result["description"].", and uses the
file ".$admin_get_options_result["filename"]."";
}

Mysql_free_result($admin_get_options_results_reference);

Hope this helps...

Much warmth,

Murray


-Original Message-
From: GH [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, 12 October 2004 12:59 AM
To: PHP General; [EMAIL PROTECTED]
Subject: [PHP] Lost in query... Trying to get output from query

Greetings:

 I am having a problem with trying to get data out of my mySql database.

I run my query which works fine and everything... 

I use: 

$admin_get_options_query_text = "Select * from adminpage";

$admin_get_options_results_reference =
mysql_query($admin_get_options_query_text,$db_access) or die("Admin
Get Options: ". mysql_error());

$admin_get_options_result =
mysql_fetch_assoc($admin_get_options_results_reference);


-

When I run the query in mysql directly the results are. 

mysql> Select * from adminpage;
+-++
--+
| adminpageid | file_name  | description
|
+-++
--+
| 101 | nycalertstatus.php | Change New York City Threat Alert
Status |
+-++
--+
1 row in set (0.00 sec)



my problem is that I would like to get that output into my php
codeI would like to have something that goes like this for each
record..

The api# $adminpageid allows you to $description, and uses the file
#file_name


can anyone please assist.

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

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



Re: [PHP] spaces in select

2004-10-11 Thread John Nichel
Angelo Zanetti wrote:
Hi all, 

I have a select/option that gets populated with countries. The value of
these option are also set to the country name. The problem i have is
that some countries have spaces in them
eg: United States of America.
When the form is posted and I echo the country variable out that has
been posted. It only shows the first word IE:
United.
Is there a way to ensure that I can get all the words that the value is
set to?IE: United States of America, when the form is posted?
Thanks in advance.
Make sure your  has a value, ie...
United States of American
Instead of...
United States of America
--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
[EMAIL PROTECTED]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Quick file_get_contents() questions...your opinion needed

2004-10-11 Thread Greg Donald
On Mon, 11 Oct 2004 07:24:03 -0700 (PDT), Mag <[EMAIL PROTECTED]> wrote:
> $url=file_get_contents("http://www.yahoo.com/";);
> 
> The thing is, it takes quite some time (2-5 secs)
> before the contents are in my program (I am using my
> local webserver on my desktop for testing...not a
> webserver)
> 
> My questions are for you more experienced guys...
> is there anyway to 'quicken' the process or is this
> normal?
> do you recommend anything other than
> file_get_contents() ?
> and lastly, is this a resource intensive hog?

The 2-5 seconds is most likely a DNS lookup.  You can speed it up by
using a local caching DNS server or the IP address, or possibly a DNS
server under less load.

file_get_contents() is fairly new and and therefore not very backwards
compatible with older PHP installs as a result.  It's handy and all,
but I found our production servers were running a PHP too old to use
it one day last week when I tried.


-- 
Greg Donald
Zend Certified Engineer
http://gdconsultants.com/
http://destiney.com/

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



Re: [PHP] Lost in query... Trying to get output from query....

2004-10-11 Thread John Nichel
GH wrote:
Greetings:
 I am having a problem with trying to get data out of my mySql database.
I run my query which works fine and everything... 

I use: 

$admin_get_options_query_text = "Select * from adminpage";
$admin_get_options_results_reference =
mysql_query($admin_get_options_query_text,$db_access) or die("Admin
Get Options: ". mysql_error());
$admin_get_options_result =
mysql_fetch_assoc($admin_get_options_results_reference);
If the query is going to return multiple rows, you need to loop thru the 
result set...

while ( $admin_get_options_result = 
mysql_fetch_assoc($admin_get_options_results_reference) ) {
	// do stuff with each row returned
}

--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
[EMAIL PROTECTED]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Lost in query... Trying to get output from query....

2004-10-11 Thread GH
Thank You Murray's suggestion worked


On Mon, 11 Oct 2004 11:20:57 -0400, John Nichel <[EMAIL PROTECTED]> wrote:
> GH wrote:
> > Greetings:
> >
> >  I am having a problem with trying to get data out of my mySql database.
> >
> > I run my query which works fine and everything...
> >
> > I use:
> >
> > $admin_get_options_query_text = "Select * from adminpage";
> >
> > $admin_get_options_results_reference =
> > mysql_query($admin_get_options_query_text,$db_access) or die("Admin
> > Get Options: ". mysql_error());
> >
> > $admin_get_options_result =
> > mysql_fetch_assoc($admin_get_options_results_reference);
> 
> If the query is going to return multiple rows, you need to loop thru the
> result set...
> 
> while ( $admin_get_options_result =
> mysql_fetch_assoc($admin_get_options_results_reference) ) {
>// do stuff with each row returned
> }
> 
> --
> John C. Nichel
> ÜberGeek
> KegWorks.com
> 716.856.9675
> [EMAIL PROTECTED]
> 
> 
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
>

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



[PHP] Lost in PHP (part 1) ---- Sequle to Lost in Query

2004-10-11 Thread GH
Now I m perplexed time 10!

   I run the code that follows this time providing a query string
of admin_template.php?api=101

I have an if statement that tests if $_GET['api'] == 0  if it is
true I have it listing options, else it queries the database with that
ID and loads the associated file.

However it does not seem to execute the else 

I: thought that the value may of been wrong so I usedecho 
$_GET['api']; and it returned 101

what am i doing wrong?




CODE-


CB12M CERT TEAM ADMINISTRATION SCREEN





'. $_GET["api"] ;

if(!isset($_GET['api']) || (isset($_GET['api']) &&
((strlen(trim(urldecode($_GET['api']))) == 0) ||
(!is_int($_GET['api'])
$_GET['api']=0;

if((isset($_GET['api']) && ((strlen(trim(urldecode($_GET['api']))) ==
0) || (!is_int($_GET['api'])
echo ' ERROR:  the page identifier provided is not
valid. Please try again.';


if($_GET['api'] == 0)
{
$admin_get_options_query_text = "Select * from adminpage";
$admin_get_options_results_reference =
mysql_query($admin_get_options_query_text,$db_access) or die("Admin
Get Options: ". mysql_error());

if(mysql_num_rows($admin_get_options_results_reference)>0)
{   
?>


  Link   DESCRIPTION 
 ';
echo '
Click Here  ';
echo 
''.$admin_get_options_result['description'].'';
}

Mysql_free_result($admin_get_options_results_reference);

?>



 0)
  {
require "mod/admin/".trim(strtolower($admin_get_page_result[1]));
  }
  else
  {
echo "ERROR: Invalid Admin Page Requested ";
echo 'Please Try Again ...  Click
Here ';
  }
  
}   
?>



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



Re: [PHP] Quick file_get_contents() questions...your opinion needed

2004-10-11 Thread Mag

Hey,

> On Mon, 11 Oct 2004 07:24:03 -0700 (PDT), Mag
> <[EMAIL PROTECTED]> wrote:
> > $url=file_get_contents("http://www.yahoo.com/";);
> > 
> > The thing is, it takes quite some time (2-5 secs)
> > before the contents are in my program (I am using
> my
> > local webserver on my desktop for testing...not a
> > webserver)
> > 
> > My questions are for you more experienced guys...
> > is there anyway to 'quicken' the process or is
> this
> > normal?
> > do you recommend anything other than
> > file_get_contents() ?
> > and lastly, is this a resource intensive hog?


 
> The 2-5 seconds is most likely a DNS lookup.  You
> can speed it up by
> using a local caching DNS server or the IP address,
> or possibly a DNS
> server under less load.


Thats kind of what I thought, but wanted to confirm.

 
> file_get_contents() is fairly new and and therefore
> not very backwards
> compatible with older PHP installs as a result. 
> It's handy and all,
> but I found our production servers were running a
> PHP too old to use
> it one day last week when I tried.

Interesting, so what is more backwards compatable? or
to put it in another way, what did you change on your
servers so that your app worked without
file_get_contents?

Thanks,
Mag

=
--
- The faulty interface lies between the chair and the keyboard.
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)



__
Do you Yahoo!?
Yahoo! Mail Address AutoComplete - You start. We finish.
http://promotions.yahoo.com/new_mail 

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



[PHP] Problem of varible

2004-10-11 Thread edwardspl
Dear You,

When disable the globals varibles function, the following php can't be
good for working :

upload1.htm







getfile1.php

";
echo "File Size:$upfile_size";
echo "File Type:$upfile_type";
echo "Temp File:$upfile";

copy($upfile, "/tmp/$upfile_name");
?>

Thank for your help !

Edward.

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



Re: [PHP] Quick file_get_contents() questions...your opinion needed

2004-10-11 Thread lists
I"m kinda bummed, I tried to us it last night and discovered I could 
not use it because Pair Networks disables the ability, can't include 
either.

from their newsletter:
"Lately, the most common method of exploit has been to pass a variable 
to a PHP script which does not sufficiently check the variable's value. 
The variable is then used in a "require" or "include" statement, and 
the variable contents cause malicious code to be fetched from a remote 
location instead of from a local file, as the author intended. This 
type of exploit is easily blocked by setting the allow_fopen_url 
configuration value to "Off." We have recently adopted this change 
globally; if you have a script that requires the ability to open remote 
URLs, you can re-enable this functionality. Before doing so, please 
make sure you are checking all user-supplied data carefully."


On Oct 11, 2004, at 8:17 AM, Greg Donald wrote:
On Mon, 11 Oct 2004 07:24:03 -0700 (PDT), Mag <[EMAIL PROTECTED]> wrote:
$url=file_get_contents("http://www.yahoo.com/";);
The thing is, it takes quite some time (2-5 secs)
before the contents are in my program (I am using my
local webserver on my desktop for testing...not a
webserver)
My questions are for you more experienced guys...
is there anyway to 'quicken' the process or is this
normal?
do you recommend anything other than
file_get_contents() ?
and lastly, is this a resource intensive hog?
The 2-5 seconds is most likely a DNS lookup.  You can speed it up by
using a local caching DNS server or the IP address, or possibly a DNS
server under less load.
file_get_contents() is fairly new and and therefore not very backwards
compatible with older PHP installs as a result.  It's handy and all,
but I found our production servers were running a PHP too old to use
it one day last week when I tried.
--
Greg Donald
Zend Certified Engineer
http://gdconsultants.com/
http://destiney.com/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Re: php and print

2004-10-11 Thread raditha dissanayake
Harlequin wrote:
Bruno
I'm still rather new to PHP so I use client side Java:
 

you are not using java you are using javascript.
[CODE]

Click Here To Print This Page: 
[/CODE]

That may be os use to you...
 


--
Raditha Dissanayake.

http://www.radinks.com/sftp/ | http://www.raditha.com/megaupload
Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader
Graphical User Inteface. Just 128 KB | with progress bar.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] config.php

2004-10-11 Thread bigmark
Is there anyway of creating a config.php file on the fly using a form.

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



Re: [PHP] Problem of varible

2004-10-11 Thread Matt M.
> When disable the globals varibles function, the following php can't be
> good for working :

this should point you in the right direction

http://us2.php.net/manual/en/features.file-upload.php

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



RE: [PHP] Problem of varible

2004-10-11 Thread Jay Blanchard
[snip]
(Bgetfile1.php
(B
(B";
(Becho "File Size$B!'(J$upfile_size";
(Becho "File Type$B!'(J$upfile_type";
(Becho "Temp File$B!'(J$upfile";
(B
(Bcopy($upfile, "/tmp/$upfile_name");
(B?>
(B[/snip]
(B
(Becho "File Name$B!'(J$_POST['upfile_name']";
(Becho "File Size$B!'(J$_POST['upfile_size']";
(Becho "File Type$B!'(J$_POST['upfile_type']";
(Becho "Temp File$B!'(J$_POST['upfile']";
(B
(B-- 
(BPHP General Mailing List (http://www.php.net/)
(BTo unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] Best practise for resolving potential conflicts when editing db content?

2004-10-11 Thread raditha dissanayake
Murray @ PlanetThoughtful wrote:
Hi All,

I'm developing a wiki-esque application for an in-house project and am
wondering how others go about resolving potential conflicts when multiple
users are editing the same content drawn from a MySQL database?
 

You might want to ask in a mysql group about table locking.
--
Raditha Dissanayake.

http://www.radinks.com/sftp/ | http://www.raditha.com/megaupload
Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader
Graphical User Inteface. Just 128 KB | with progress bar.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Question about array_search

2004-10-11 Thread Brian Dunning
Say I'm trying to add a value to an array, only if it's not already in 
there somewhere; so I do an array_search to see. The problem is that if 
the item is at index 0 in the array, array_search gives the same answer 
as if it's not in there at all. How does one circumvent this potential 
pitfall?

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


Re: [PHP] Quick file_get_contents() questions...your opinion needed

2004-10-11 Thread Greg Donald
On Mon, 11 Oct 2004 08:40:09 -0700 (PDT), Mag <[EMAIL PROTECTED]> wrote:
> Interesting, so what is more backwards compatable? or
> to put it in another way, what did you change on your
> servers so that your app worked without
> file_get_contents?

I used the usual fopen(), fgets(), fclose() combination which has been
available since PHP3.


-- 
Greg Donald
Zend Certified Engineer
http://gdconsultants.com/
http://destiney.com/

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



Re: [PHP] config.php

2004-10-11 Thread Dan Joseph
> Is there anyway of creating a config.php file on the fly using a form.

There is...  however, that's kind of a broad question.  What sort of
config file are you trying to build?

-Dan Joseph

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



RE: [PHP] Re: php and print

2004-10-11 Thread Steve Murphy
Why not just use CSS?

http://www.alistapart.com/articles/goingtoprint/

Steve

-Original Message-
From: raditha dissanayake [mailto:[EMAIL PROTECTED]
Sent: Monday, October 11, 2004 12:23 PM
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] Re: php and print


Harlequin wrote:

>Bruno
>
>I'm still rather new to PHP so I use client side Java:
>  
>
you are not using java you are using javascript.

>[CODE]
>
>Click Here To Print This Page: src="../images/Icon_Printer.gif" border="0" alt="Print This Page">
>[/CODE]
>
>That may be os use to you...
>
>  
>


-- 
Raditha Dissanayake.

http://www.radinks.com/sftp/ | http://www.raditha.com/megaupload
Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader
Graphical User Inteface. Just 128 KB | with progress bar.

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


Re: [PHP] config.php

2004-10-11 Thread Greg Donald
On Mon, 11 Oct 2004 11:59:56 -0400, bigmark <[EMAIL PROTECTED]> wrote:
> Is there anyway of creating a config.php file on the fly using a form.

Sure.  fopen() can write new files easy enough.  And the data from the
form submission is available via the $_POST array.


-- 
Greg Donald
Zend Certified Engineer
http://gdconsultants.com/
http://destiney.com/

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



Re: [PHP] config.php

2004-10-11 Thread raditha dissanayake
bigmark wrote:
Is there anyway of creating a config.php file on the fly using a form.
 

yes there is
--
Raditha Dissanayake.

http://www.radinks.com/sftp/ | http://www.raditha.com/megaupload
Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader
Graphical User Inteface. Just 128 KB | with progress bar.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] config.php

2004-10-11 Thread Jay Blanchard
[snip]
Is there anyway of creating a config.php file on the fly using a form.
[/snip]


Yes.

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



Re: [PHP] Question about array_search

2004-10-11 Thread Matt M.
> Say I'm trying to add a value to an array, only if it's not already in
> there somewhere; so I do an array_search to see. The problem is that if
> the item is at index 0 in the array, array_search gives the same answer
> as if it's not in there at all. How does one circumvent this potential
> pitfall?

I think this would work (I could be wrong)

$array = array(0 => 'blue', 1 => 'red', 2 => 'green', 3 => 'red');

if(($key = array_search('bluesf', $array)) !== FALSE) {
echo $key;
}

if(($key = array_search('blue', $array)) !== FALSE) {
echo $key;
}

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



Re: [PHP] Quick file_get_contents() questions...your opinion needed

2004-10-11 Thread Mag
Oops, sorry to hear that.

Some scumbag always spoils it for everyone :-(

Looks like you can enable it if you really need it
though..

Mag

--- lists <[EMAIL PROTECTED]> wrote:

> I"m kinda bummed, I tried to us it last night and
> discovered I could 
> not use it because Pair Networks disables the
> ability, can't include 
> either.
> 
> from their newsletter:
> 
> "Lately, the most common method of exploit has been
> to pass a variable 
> to a PHP script which does not sufficiently check
> the variable's value. 
> The variable is then used in a "require" or
> "include" statement, and 
> the variable contents cause malicious code to be
> fetched from a remote 
> location instead of from a local file, as the author
> intended. This 
> type of exploit is easily blocked by setting the
> allow_fopen_url 
> configuration value to "Off." We have recently
> adopted this change 
> globally; if you have a script that requires the
> ability to open remote 
> URLs, you can re-enable this functionality. Before
> doing so, please 
> make sure you are checking all user-supplied data
> carefully."
> 
> 
> 
> 
> On Oct 11, 2004, at 8:17 AM, Greg Donald wrote:
> 
> > On Mon, 11 Oct 2004 07:24:03 -0700 (PDT), Mag
> <[EMAIL PROTECTED]> wrote:
> >> $url=file_get_contents("http://www.yahoo.com/";);
> >>
> >> The thing is, it takes quite some time (2-5 secs)
> >> before the contents are in my program (I am using
> my
> >> local webserver on my desktop for testing...not a
> >> webserver)
> >>
> >> My questions are for you more experienced guys...
> >> is there anyway to 'quicken' the process or is
> this
> >> normal?
> >> do you recommend anything other than
> >> file_get_contents() ?
> >> and lastly, is this a resource intensive hog?
> >
> > The 2-5 seconds is most likely a DNS lookup.  You
> can speed it up by
> > using a local caching DNS server or the IP
> address, or possibly a DNS
> > server under less load.
> >
> > file_get_contents() is fairly new and and
> therefore not very backwards
> > compatible with older PHP installs as a result. 
> It's handy and all,
> > but I found our production servers were running a
> PHP too old to use
> > it one day last week when I tried.
> >
> >
> > -- 
> > Greg Donald
> > Zend Certified Engineer
> > http://gdconsultants.com/
> > http://destiney.com/
> >
> > -- 
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit:
> http://www.php.net/unsub.php
> >
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 


=
--
- The faulty interface lies between the chair and the keyboard.
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)



___
Do you Yahoo!?
Declare Yourself - Register online to vote today!
http://vote.yahoo.com

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



Re: [PHP] Question about array_search

2004-10-11 Thread Greg Donald
On Mon, 11 Oct 2004 09:07:13 -0700, Brian Dunning
<[EMAIL PROTECTED]> wrote:
> Say I'm trying to add a value to an array, only if it's not already in
> there somewhere; so I do an array_search to see. The problem is that if
> the item is at index 0 in the array, array_search gives the same answer
> as if it's not in there at all. How does one circumvent this potential
> pitfall?

Do not use array_search() as a boolean test, it returns mixed results,
it will cause issues withthe zero index as younoted.  Instead use it
to match an array key, then see if the key exists with isset() and
compare it to the item you mean to add to the array.

There lots of other ways too, possibly more overhead, but less code. 
For example you could just add the item to the array blindly, then run
array_unique() on the array.


-- 
Greg Donald
Zend Certified Engineer
http://gdconsultants.com/
http://destiney.com/

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



Re: [PHP] config.php

2004-10-11 Thread John Nichel
bigmark wrote:
Is there anyway of creating a config.php file on the fly using a form.
Yes.
http://www.catb.org/~esr/faqs/smart-questions.html
--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
[EMAIL PROTECTED]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Encoding Question [NOT RESOVED]

2004-10-11 Thread Nick Wilson

* and then Nick Wilson declared
> > > that one is using rawurlencode() but it's just as bad with urlencode -
> > > How *should* I be doing this?
> > 
> > is this how you tried to do it?
> > 
> > $userAgent = "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)";
> > curl_setopt($ch, CURLOPT_USERAGENT, $userAgent);
> 
> Yep, but like this:
> 
> $userAgent = urlencode("Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)");
> curl_setopt($ch, CURLOPT_USERAGENT, $userAgent);

just a *bump* if anyone thought the thread was resloved ;-)

-- 
Nick W

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



RE: [PHP] Best practise for resolving potential conflicts when editing db content?

2004-10-11 Thread Murray @ PlanetThoughtful
Hi Raditha,

I'm not sure table locking is the answer. I'm not talking about concurrency
in the sense of 'simultaneous' updates and selects, but in the sense of an
'open record edit session' that predictably will overwrite the value of a
record that may have been changed, after the edit session began, but before
the edit session is committed.

So, User A clicks on an edit link on a page which retrieves that record's
content from the db, and begins editing.

User B performs a page rename, which enacts an update similar to:

UPDATE mytable set content = replace(content, 'old val', 'new val') where
content like '%old val%'

User A finishes his or her page edit and commits the changes, but the
underlying record was already changed by User B's page rename. User A's edit
changes overwrite this update in the record in question, and now that record
still shows 'old val' instead of 'new val', since that was what was in the
content when User A began editing the page.

I'm just wondering how others go about handling these circumstances. One way
I can think of is to have a 'beingedited' field in the table, and to update
this to a 1 when a user requests a page edit, and set it back to 0 when a
user commits the changes, and then to check whether or not any of the rows
affected by the page rename are currently 'locked' (beingedited=1). Still,
this doesn't account for the possibility that a user might request a page
edit, 'locking' the record, and then simply navigate to some other page, or
close their browser etc, thus leaving the record locked. 

I'd be surprised if others hadn't encountered this issue previously?

Much warmth,

Murray


-Original Message-
From: raditha dissanayake [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, 12 October 2004 2:27 AM
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] Best practise for resolving potential conflicts when
editing db content?

Murray @ PlanetThoughtful wrote:

>Hi All,
>
> 
>
>I'm developing a wiki-esque application for an in-house project and am
>wondering how others go about resolving potential conflicts when multiple
>users are editing the same content drawn from a MySQL database?
>
>  
>
You might want to ask in a mysql group about table locking.

-- 
Raditha Dissanayake.

http://www.radinks.com/sftp/ | http://www.raditha.com/megaupload
Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader
Graphical User Inteface. Just 128 KB | with progress bar.

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

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



Re: [PHP] Quick file_get_contents() questions...your opinion needed

2004-10-11 Thread Mag
I did look at the fopen option...but it just seemed a
little longer and more complicated to do that plus
according to this benchmark
(http://force-elite.com/~chip/projects/php/benchmarks/file-vs-fgets/)
using file_get_contents is upto 6 times faster (?) in
some cases..

I think I'll stick with this, and specify that anybody
running this code should have php 4.3.x or higher 

Most webhosts too I think will have a 4.3 or above
version...if they are a good host anyway, ornot?
I mean I have been running php on my desktop for
months and have 4.3.1..

Feel free to correct me :-)

Cheers,
Mag


--- Greg Donald <[EMAIL PROTECTED]> wrote:

> On Mon, 11 Oct 2004 08:40:09 -0700 (PDT), Mag
> <[EMAIL PROTECTED]> wrote:
> > Interesting, so what is more backwards compatable?
> or
> > to put it in another way, what did you change on
> your
> > servers so that your app worked without
> > file_get_contents?
> 
> I used the usual fopen(), fgets(), fclose()
> combination which has been
> available since PHP3.
> 
> 
> -- 
> Greg Donald
> Zend Certified Engineer
> http://gdconsultants.com/
> http://destiney.com/
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 


=
--
- The faulty interface lies between the chair and the keyboard.
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)



___
Do you Yahoo!?
Declare Yourself - Register online to vote today!
http://vote.yahoo.com

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



Re: [PHP] Question about array_search

2004-10-11 Thread Robin Vickery
On Mon, 11 Oct 2004 09:07:13 -0700, Brian Dunning
<[EMAIL PROTECTED]> wrote:

> The problem is that if the item is at index 0 in the array, array_search gives the 
> same answer as if it's not in there at all. 

No it doesn't.

If it's in index 0 it returns 0, if it's not there at all it returns FALSE.

you need to use something like:

   if (array_search($needle, $haystack) === false) {
 // add $needle to $haystack
   }

http://lv.php.net/array-search
http://php.net/manual/en/language.operators.comparison.php

  -robin

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



[PHP] Working out the image path...

2004-10-11 Thread Mag
Hey!
Am having a little problem working out the logic in
this, basically I pass a graphics path to a function
and it should give/retrun me the URL path.

http://x.com/t1/t2/t3/blah.html';

function ret_url($rel_path)
{ }

?>

so I pass a relitive url like this
$a=ret_url('/blah.jpg';)

and (using the above sample url) it should return me:
http:// www.x.com/blah.jpg, which seems easy enough
except that there are some other combinations...

So far these are the combinations I could think of
that will be used...correct me if I am wrong by adding
or subtracting:

/blah.jpg // should return http://x.com/blah.jpg

/imgs/blah.jpg // return http://x.com/imgs/ blah.jpg

imgs/blah.jpg //return
http://x.com/t1/t2/t3/imgs/blah.jpg

../imgs/blah.jpg // etc

/../imgs/blah.jpg //etc

http://some-site-blah.com/imgs/blah.jpg // return the
same url

To try and do the above I was fooling around with
parse_url() and explode() but cant work out the logic,
if it helps, heres what i did so far in my
"experiments"


$parsed_url = parse_url($url);
$thissite = $parsed_url['host'];
$thispath = $parsed_url['path'];

echo "$thissite  $thispath";

$pieces= explode("/",$thispath);
print_r($pieces);




ANY help appreciated.

Thanks!
Mag

=
--
- The faulty interface lies between the chair and the keyboard.
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)



__
Do you Yahoo!?
Yahoo! Mail Address AutoComplete - You start. We finish.
http://promotions.yahoo.com/new_mail 

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



[PHP] Is there any way of knowing User Currently Logged On?

2004-10-11 Thread Mulley, Nikhil
Hi Guys,
 
Is there any way of finding the current user logged on the remote system
 
I have a perl script which gets the user name who is currently logged on a remote 
Windows Machine
 
 
 
 
 
#LoggedOnUsers(server, userRef).pl
use Win32::NetAdmin;
use strict;
use vars qw($server @users_list);
if(@ARGV>0){
$server=$ARGV[0];
}
else{
print "\n\nEnter a valid Hostname  or IP Address : ";
chomp($server=);
}
Win32::NetAdmin::LoggedOnUsers($server,[EMAIL PROTECTED]);
foreach(@users_list) {
print "\n$server-- $_";
}
 
 
This one gets the users logged in on a remote Windows machine , Is there a similar way 
of finding / doing the same regardless of an OS, Can it be done through a Web Browser 

 
Any Clues ??
 
--Nikhil.


Re: [PHP] Question about array_search

2004-10-11 Thread John Holmes
Brian Dunning wrote:
Say I'm trying to add a value to an array, only if it's not already in 
there somewhere; so I do an array_search to see. The problem is that if 
the item is at index 0 in the array, array_search gives the same answer 
as if it's not in there at all. 
No it doesn't. If the value is not there, it returns FALSE. If it's at 
index zero, then it returns zero.

if($a === FALSE)
{ echo 'a is false'; }
elseif($a === 0)
{ echo 'a is zero'; }
Read here for an explanation of the above: 
http://us2.php.net/manual/en/language.operators.comparison.php

--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
php|architect: The Magazine for PHP Professionals – www.phparch.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] config.php

2004-10-11 Thread John Holmes
bigmark wrote:
Is there anyway of creating a config.php file on the fly using a form.
House fly or bar fly?
--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
php|architect: The Magazine for PHP Professionals – www.phparch.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Problem of varible

2004-10-11 Thread John Holmes
Jay Blanchard wrote:
[snip]
getfile1.php
";
echo "File Sizeï$upfile_size";
echo "File Typeï$upfile_type";
echo "Temp Fileï$upfile";
copy($upfile, "/tmp/$upfile_name");
?>
[/snip]
echo "File Nameï$_POST['upfile_name']";
echo "File Sizeï$_POST['upfile_size']";
echo "File Typeï$_POST['upfile_type']";
echo "Temp Fileï$_POST['upfile']";
You mean $_FILES, not $_POST.
$_FILES['upfile']['name'], etc...
http://us2.php.net/manual/en/features.file-upload.php
--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
php|architect: The Magazine for PHP Professionals â www.phparch.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Question about array_search

2004-10-11 Thread John Holmes
Greg Donald wrote:
On Mon, 11 Oct 2004 09:07:13 -0700, Brian Dunning
<[EMAIL PROTECTED]> wrote:
Say I'm trying to add a value to an array, only if it's not already in
there somewhere; so I do an array_search to see. The problem is that if
the item is at index 0 in the array, array_search gives the same answer
as if it's not in there at all. How does one circumvent this potential
pitfall?

Do not use array_search() as a boolean test, it returns mixed results,
it will cause issues withthe zero index as younoted.  Instead use it
to match an array key, then see if the key exists with isset() and
compare it to the item you mean to add to the array.
You don't need all that, as it's already been pointed out.
$a = array_search('John',$names);
if($a === FALSE)
{ echo 'John is not in the array'; }
else
{ echo "John is at position $a in the array."; }
--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
php|architect: The Magazine for PHP Professionals – www.phparch.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] textarea vs. type="text" data difference?

2004-10-11 Thread Gryffyn, Trevor
Just wanted to point out something little.   "text" types are all
single-line data items.  "textarea" can contain line breaks.  Looks like
you may have solved your problem already, but wanted to fill in some
info that didn't seem to be mentioned.

-TG

> -Original Message-
> From: Sam Smith [mailto:[EMAIL PROTECTED] 
> Sent: Sunday, October 10, 2004 3:29 PM
> To: PHP
> Subject: [PHP] textarea vs. type="text" data difference? 
> 
> 
> 
> I have a form with both textarea and text type fields.
> 
> I submit it and do some processing on identical data and get different
> results.
> 
> What's up with that.
> 
> Thank you.

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



RE: [PHP] PHP gurus...how are they doing this?

2004-10-11 Thread Gryffyn, Trevor
I can't check this out from work (for obvious reasons) but web server
logs should record all the incoming requests and what hosts requested
what files.

Also, search engines like Google provide an API for programmers that
could potentially be used to get data like "how many people are linked
to this page".

Or it could be like what was already mentioned, a middle-man thing, or
deals using cookies or.. What did they call them? BrowserBugs or
something?  Little things that keep track of where your browse.

There are lots of little tricks for recording incoming and outgoing
requests and links.

-TG

> -Original Message-
> From: Mag [mailto:[EMAIL PROTECTED] 
> Sent: Sunday, October 10, 2004 7:18 PM
> To: php php
> Subject: [PHP] PHP gurus...how are they doing this?
> 
> 
> Hi,
> Am totally puzzled as to how they are doing this.
> The site is at
> http://www.teeniesxxx.com/madtgp/submit.php (please
> note its an adult site so you might not want to go
> there, also note I am in NO way connected with that
> site...AT ALL)
> 
> once a person submits a site, they are doing 2 things
> that totally puzzle me, 
> 1.showing the number of "outgoing links"
> 2. counting the number of linked to pictures (eg:
> href='blah.jpg') and movies (eg: href='blah,mpg') and
> also giving the size of each movie (this i figured
> out) and the resulation!!
> 
> I would like to do the same thing for a cartoon site,
> can anybody tell me where to begin or some sample
> code?
> 
> Thanks,
> Mag
> 
> =
> --
> - The faulty interface lies between the chair and the keyboard.
> - Creativity is great, but plagiarism is faster!
> - Smile, everyone loves a moron. :-)
> 
> 
>   
> __
> Do you Yahoo!?
> Y! Messenger - Communicate in real time. Download now. 
> http://messenger.yahoo.com
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 

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



Re: [PHP] Lost in PHP (part 1) ---- Sequle to Lost in Query

2004-10-11 Thread John Holmes
GH wrote:
Now I m perplexed time 10!
   I run the code that follows this time providing a query string
of admin_template.php?api=101
I have an if statement that tests if $_GET['api'] == 0  if it is
true I have it listing options, else it queries the database with that
ID and loads the associated file.
You have a lot more tests than that...
However it does not seem to execute the else 

I: thought that the value may of been wrong so I usedecho 
$_GET['api']; and it returned 101
use var_dump($_GET['api']) and it may give you a clue. Your is_int() 
test is going to fail each time because anything passed through $_GET or 
 $_POST is a string.

FYI, you could essentially replace all of those tests you do on 
$_GET['api'] with

if(empty($_GET['api']))
{
  echo 'bad value';
  //or select everything from table ?
}
else
{
  $input['api'] = (int)$_GET['api'];
  $query = "SELECT * FROM yourtable WHERE api = {$input['api']}";
  ...
}
--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
php|architect: The Magazine for PHP Professionals – www.phparch.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Lost in PHP (part 1) ---- Sequle to Lost in Query

2004-10-11 Thread GH
How can I convert it to an integer aslong as it is only a number in the string?



On Mon, 11 Oct 2004 13:19:40 -0400, John Holmes
<[EMAIL PROTECTED]> wrote:
> GH wrote:
> 
> > Now I m perplexed time 10!
> >
> >I run the code that follows this time providing a query string
> > of admin_template.php?api=101
> >
> > I have an if statement that tests if $_GET['api'] == 0  if it is
> > true I have it listing options, else it queries the database with that
> > ID and loads the associated file.
> 
> You have a lot more tests than that...
> 
> > However it does not seem to execute the else
> >
> > I: thought that the value may of been wrong so I usedecho
> > $_GET['api']; and it returned 101
> 
> use var_dump($_GET['api']) and it may give you a clue. Your is_int()
> test is going to fail each time because anything passed through $_GET or
>  $_POST is a string.
> 
> FYI, you could essentially replace all of those tests you do on
> $_GET['api'] with
> 
> if(empty($_GET['api']))
> {
>   echo 'bad value';
>   //or select everything from table ?
> }
> else
> {
>   $input['api'] = (int)$_GET['api'];
>   $query = "SELECT * FROM yourtable WHERE api = {$input['api']}";
>   ...
> }
> 
> --
> 
> ---John Holmes...
> 
> Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
> 
> php|architect: The Magazine for PHP Professionals â www.phparch.com
> 
>

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



Re: [PHP] config.php

2004-10-11 Thread John Nichel
John Holmes wrote:
bigmark wrote:
Is there anyway of creating a config.php file on the fly using a form.

House fly or bar fly?
You got something against a fly on the wall???
--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
[EMAIL PROTECTED]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] Is there any way of knowing User Currently Logged On?

2004-10-11 Thread Vail, Warren
If you code in php something like the following, you just might be able to
use the perl script;

$ok = exec("path/to/Perl myperscriptname.pl server", $result);   // you may
have to straighten out syntax
Foreach($result as $line) {
echo $line;   // or you could process the results
}

Hope this helps,

Warren Vail


-Original Message-
From: Mulley, Nikhil [mailto:[EMAIL PROTECTED] 
Sent: Monday, October 11, 2004 9:52 AM
To: [EMAIL PROTECTED]
Subject: [PHP] Is there any way of knowing User Currently Logged On?


Hi Guys,
 
Is there any way of finding the current user logged on the remote system
 
I have a perl script which gets the user name who is currently logged on a
remote Windows Machine
 
 
 
 
 
#LoggedOnUsers(server, userRef).pl
use Win32::NetAdmin;
use strict;
use vars qw($server @users_list);
if(@ARGV>0){
$server=$ARGV[0];
}
else{
print "\n\nEnter a valid Hostname  or IP Address : ";
chomp($server=); }
Win32::NetAdmin::LoggedOnUsers($server,[EMAIL PROTECTED]);
foreach(@users_list) {
print "\n$server-- $_";
}
 
 
This one gets the users logged in on a remote Windows machine , Is there a
similar way of finding / doing the same regardless of an OS, Can it be done
through a Web Browser 
 
Any Clues ??
 
--Nikhil.

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



Re: [PHP] Lost in PHP (part 1) ---- Sequle to Lost in Query

2004-10-11 Thread John Holmes
GH wrote:
How can I convert it to an integer aslong as it is only a number in the string?
Does it _really_ matter if only a number is passed? If someone passes 
"abcd" and it's converted to an integer, it'll be zero. Then your query 
will not return any rows (which you're already testing for, anyhow, 
right?) and be handled accordingly. Who cares if they pass "104abcd"? 
It'll just be converted to 104 and see if a matching record exists.

I think you're getting caught up in too many tests. If you're expecting 
an integer, MAKE it an integer, then run your query. 99.9% of your 
values are going to come through correct if they are coming from your 
program, right? Just silently ignore the rest because it's someone 
screwing around.

If, however, you _really_ want to ensure $_GET['api'] is _only_ numbers, 
then you can use

if(!isset($_GET['api']) || preg_match('/[^0-9]/',$_GET['api']))
{ echo 'API is not all numbers'; }
or
if(isset($_GET['api']) && preg_match('/^[0-9]+$/',$_GET['api']))
{ echo 'API is a number only'; }
--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
php|architect: The Magazine for PHP Professionals – www.phparch.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Program that does registration, rsvp, reminders, etc??

2004-10-11 Thread John Holmes
Does anyone know of a program that does event and user registration, 
sends RSVPs, reminders, etc?? I'm basically looking for a _simple_ 
evite.com clone I can use on a site.

The only one I've found in a quick search is iVITE at 
http://www.hotscripts.com/Detailed/31859.html. Does anyone have any 
recommendations on that script or any other ideas?

Thanks.
--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
php|architect: The Magazine for PHP Professionals – www.phparch.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] PHP gurus...how are they doing this?

2004-10-11 Thread John Holmes
Mag wrote:
1.showing the number of "outgoing links"

Middle man. You have them click on a link containing
an ID, increment 
the counter for that ID, then forward them to the
requested link.

I'm not sure I understand what you mean here.
Actually, I misunderstood what you meant by outgoing links. You're 
looking for the number of links on the supplied page that go to another 
site, right (not tracking clicks through to the site)? And you're 
looking for the number of links going to a jpg or mpg?

The only way I can imagine they are doing this is just loading the file 
into a string, like you are already doing, and parsing it with regular 
expressions. You'll just have to play around with your patterns until 
they work and realize you'll probably never be able to get it 100% 
correct with the variety of ways people code HTML out there.

If you read the manual notes for the preg_* functions, there are a lot 
of examples given there on how to match/replace things like this.

--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
php|architect: The Magazine for PHP Professionals – www.phparch.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] 1000+ character POSTed strings get mangled

2004-10-11 Thread Jonny Roller
Thanks for the info!  Based on the "Apache2" reference and dug into the 
problem a little more.  Bug 18648 (http://bugs.php.net/bug.php?id=18648) 
contains a long thread from folks with similar problems.  It seems that 
the Apache2 setup creates a conf.d/php.conf file with this in it:


SetOutputFilter PHP
SetInputFilter PHP
LimitRequestBody 524288

I got rid of that code, restarted Apache and now all is well!
John Holmes wrote:
Jonny Roller wrote:
If I POST a string greater than 1000 character through a form, the 
resulting string gets mangled.  What I get back is the first 1000 
characters of the string, then the name of the form variable, an equal 
sign (=) and then the entire string again.  If I change the form to a 
GET, this problem does not occur.
[snip]
I'm running PHP 4.3.8 with Apache 2.0.50 on Linux but it also occurred 
with PHP 4.3.9 on Apache 2.0.52.  However, a similarly configured (but 
not identical) server running the same versions of PHP and Apache does 
not exhibit this behavior.

I remember an Apache2/PHP bug that caused issues like this with any 
request variables, but I couldn't find it on bugs.php.net. Have you 
reported this there, yet?

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


Re: [PHP] sending SMS messages to mobile phones from PHP

2004-10-11 Thread Andrew Cowles
Hi Jordi,

What's wrong with British Pounds? It's a good currency - been around for a
long time.
We have customers all over the world and can send SMS messages to over 500
networks in 200+ countries.
We have MANY clients in the USA, across Europe, Australia & Africa.
However we are based in the UK; which means our prices are in pounds... but
you can pay using most major credit cards, so it shouldn't be a big problem.
There is a good currency converter at http://www.xe.com/ if you need it, or
I'm sure our Sales staff will happily give you the current rates.
Best regards,

Andy

Andrew Cowles

KAPOW! SMS Communication Solutions
WEB: http://www.kapow.co.uk/
EMAIL: [EMAIL PROTECTED]
TEL: 0870 757 1610 or FAX: 0870 757 1615

Cygnet Internet Services Ltd ( http://www.cygnet.co.uk/ )


> Unfoturnately your price list is only in pounds: No Euros, No Dollars
> :( It Looks like you only accept British Customers.
>
> Regards,
> Jordi.

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



RE: [PHP] Meaningful Subject

2004-10-11 Thread php-list


-Original Message-
From: Jason Wong [mailto:[EMAIL PROTECTED] 
Sent: Monday, October 11, 2004 8:09 AM
To: [EMAIL PROTECTED]
Subject: Re: [PHP]

On Monday 11 October 2004 19:41, [EMAIL PROTECTED] wrote:
> Never mind guys, I figured it out. I appreciate your help. Thanks for
> everything!

Next time you start a thread please give it a meaningful subject.

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
--
/*
The three best things about going to school are June, July, and August.
*/

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

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



Re: [PHP] Is there any way of knowing User Currently Logged On?

2004-10-11 Thread John Holmes
Mulley, Nikhil wrote:
Is there any way of finding the current user logged on the remote system
You can try $_SERVER['LOGON_USER'], but I think the "remote" computer 
has to be in the same domain as the server...

--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
php|architect: The Magazine for PHP Professionals – www.phparch.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] config.php

2004-10-11 Thread Michal Migurski
Is there anyway of creating a config.php file on the fly using a form.
To obtain verbose output, include the keyword "how" at the beginning of 
your query.

--
michal migurski- contact info, blog, and pgp key:
sf/cahttp://mike.teczno.com/contact.html
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Best practise for resolving potential conflicts when editing db content?

2004-10-11 Thread Michal Migurski
I'm not sure table locking is the answer. I'm not talking about 
concurrency
in the sense of 'simultaneous' updates and selects, but in the sense 
of an
'open record edit session' that predictably will overwrite the value 
of a
record that may have been changed, after the edit session began, but 
before
the edit session is committed.
Martin Fowler's book, "Patterns of Enterprise Application Architecture" 
(dull name, I know) has an excellent chapter which describes various 
kinds of locks. The main applicable distinction in your case is whether 
you want your lock to be Optimistic or Pessimistic, in other words - do 
you expect that such conflicts will happen frequently, or no?

If you expect conflicts often, make your lock pessimistic: when user A 
opens ups a record to edit, a flag gets set on the server which 
prevents user B from modifying the same record. This form of locking is 
also good when the change process is coarse, and losing edits would be 
a major inconvenience. In the case of editing a wiki page, you don't 
want user B to spend 20 minutes modifying a page, only to be told that 
there's a conflict and they should try again later, wasting all that 
work. You want them to know ahead of time. Your "beingedited" field in 
the DB is an example of a pessimistic lock.

If you don't expect conflicts often, or the cost of a conflict is low, 
make your lock optimistic: when user A and user B both have a record 
open, the first one to commit wins, and the second one gets an error 
message. This is an easy one to implement if you version your changes 
in some way, perhaps by indicating which version a user started with at 
commit time. CVS works this way, as does my wiki software of choice, 
Tavi Wiki. For these applications, the cost of a conflict is high 
(which would indicate that a pessimistic lock might be better), but 
there is a clean method provided to resolve them when they come up.

--
michal migurski- contact info, blog, and pgp key:
sf/cahttp://mike.teczno.com/contact.html
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Quick file_get_contents() questions...your opinion needed

2004-10-11 Thread Curt Zirzow
* Thus wrote lists:
> I"m kinda bummed, I tried to us it last night and discovered I could 
> not use it because Pair Networks disables the ability, can't include 
> either.
> 
> from their newsletter:
> 
> "Lately, the most common method of exploit has been to pass a variable 
> to a PHP script which does not sufficiently check the variable's value. 
> The variable is then used in a "require" or "include" statement, and 
> the variable contents cause malicious code to be fetched from a remote 
> location instead of from a local file, as the author intended. This 
> type of exploit is easily blocked by setting the allow_fopen_url 
> configuration value to "Off." We have recently adopted this change 
> globally; if you have a script that requires the ability to open remote 
> URLs, you can re-enable this functionality. Before doing so, please 
> make sure you are checking all user-supplied data carefully."

Pair is only turning this off by default so users are aware of the
security implications. It looks like you still have the power to
turn it on if you wish.

Curt
-- 
Quoth the Raven, "Nevermore."

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



Re: [PHP] Quick file_get_contents() questions...your opinion needed

2004-10-11 Thread Curt Zirzow
* Thus wrote Mag:
> I did look at the fopen option...but it just seemed a
> little longer and more complicated to do that plus
> according to this benchmark
> (http://force-elite.com/~chip/projects/php/benchmarks/file-vs-fgets/)
> using file_get_contents is upto 6 times faster (?) in
> some cases..

You certaintly dont want to do a file() on a 20MB file.  There are
times when you'll want to use fopen vs file/file_get_contents. 

file_get_contents will be much faster for a couple of reasons. for
one, getting the same results as file_get_contents you have to do
something like:
  $string = implode("\n", file($file));

Another reson file_get_contents() will be faster is because it uses
(when available on the OS) a special memory allocation that is much
more efficiant, than other file reading tools.


Curt
-- 
Quoth the Raven, "Nevermore."

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



Re: [PHP] Problem of varible

2004-10-11 Thread Curt Zirzow
* Thus wrote [EMAIL PROTECTED]:
> 
> 
> 
> 
> 
> 
> 
> getfile1.php
> ...
> 
> copy($upfile, "/tmp/$upfile_name");
> ?>

Also use move_uploaded_file() instead.

http://php.net/move_uploaded_file


Curt
-- 
Quoth the Raven, "Nevermore."

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



RE: [PHP] Is there any way of knowing User Currently Logged On?

2004-10-11 Thread Gryffyn, Trevor
It does and Windows Integrated Authentication has to be turned on (and
Anonymous access turned off).

I just got my company to configure that so my PHP scripts could grab the
authenticated user for logging purposes.

-TG

> -Original Message-
> From: John Holmes [mailto:[EMAIL PROTECTED] 
> Sent: Monday, October 11, 2004 2:49 PM
> To: Mulley, Nikhil
> Cc: [EMAIL PROTECTED]
> Subject: Re: [PHP] Is there any way of knowing User Currently 
> Logged On?
> 
> 
> Mulley, Nikhil wrote:
> 
> > Is there any way of finding the current user logged on the 
> remote system
> 
> You can try $_SERVER['LOGON_USER'], but I think the "remote" computer 
> has to be in the same domain as the server...
> 
> -- 
> 
> ---John Holmes...
> 
> Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
> 
> php|architect: The Magazine for PHP Professionals - www.phparch.com
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 

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



Re: [PHP] Best practise for resolving potential conflicts when editing db content?

2004-10-11 Thread Andrew Kreps
On Tue, 12 Oct 2004 02:41:10 +1000, Murray @ PlanetThoughtful
<[EMAIL PROTECTED]> wrote:
> User A finishes his or her page edit and commits the changes, but the
> underlying record was already changed by User B's page rename. User A's edit
> changes overwrite this update in the record in question, and now that record
> still shows 'old val' instead of 'new val', since that was what was in the
> content when User A began editing the page.
> 

This is a bit of a quandary, but I've run into it before with multiple
developers working on the same source tree.  I'm going to try to
translate my knowledge of that scenario to a web application.

I would have a timestamp in the database that contains the last time
the row was edited , which would be stored in a hidden field on the
edit page.  On submit, compare the timestamp to the row you're editing
(find it by using the primary key, rather than content).  If the
timestamp in the DB is newer than the edited content, you'll need to
force a content merge.

As for the merge:  Display User A's content next to what is now in the
database (User B's edits).  You'll also want the new timestamp in a
hidden field at this point.  Allow User A to make changes to the final
content, trusting that they'll do the right thing.  Then once you hit
save, compare the (new) timestamp to the one in the DB.  If the
database has been edited yet again, do another merge.  If not, save,
update the timestamp, and you're good to go.

That should handle the 'unfinished edit' problem.  If the user takes a
day off, and wanted to continue with the same edit, they'll be
presented with the updated content at the end of the process, which
they can then work into their version.

How does that sound?

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



Re: [PHP] Working out the image path...

2004-10-11 Thread Curt Zirzow
* Thus wrote Mag:
> Hey!
> Am having a little problem working out the logic in
> this, basically I pass a graphics path to a function
> and it should give/retrun me the URL path.
> 
>  $url='http://x.com/t1/t2/t3/blah.html';
> 
> function ret_url($rel_path)
> { }
> 
> ?>
> 
> so I pass a relitive url like this
> $a=ret_url('/blah.jpg';)
>...
> 
> /blah.jpg // should return http://x.com/blah.jpg
> 
> /imgs/blah.jpg // return http://x.com/imgs/ blah.jpg

Basic concating a file:
  return $base_url . $rel_path;

> 
> imgs/blah.jpg //return
> http://x.com/t1/t2/t3/imgs/blah.jpg

ensure first char is absolute:
  if ($rel_path{0} != '/') {
$rel_path = '/' . $rel_path;
  }

> 
> ../imgs/blah.jpg // etc
> 
> /../imgs/blah.jpg //etc

I tend to use str_replace to remove this.

  /* remove .. and translate // to /  */
  $rel_path = str_replace(array('..', '//', array('', '/'), $rel_path);

> 
> http://some-site-blah.com/imgs/blah.jpg // return the
> same url

check for http://
  if(substr($rel_path, 0, 6) == 'http://') )
return $rel_path;


Put those all together and you'll have your function.


Curt
-- 
Quoth the Raven, "Nevermore."

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



[PHP] Re: [PHP-INSTALL] Impossibility

2004-10-11 Thread Andrew Kreps
On Mon, 11 Oct 2004 15:20:11 -0400, Scott Hamm <[EMAIL PROTECTED]> wrote:
> I know it's impossible, but is there a way php can read something from excel
> file?
> 

If you really believe it's impossible, why ask the question?  :)

Start with the first link here, and work your way down.  Thankfully,
you aren't the first person to try to do the impossible.

http://www.google.com/search?q=PHP+read+excel

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



[PHP] Working out the image path...partly solved, please have a look at my code

2004-10-11 Thread Mag
Hi,
I wrote this to the list a little while back and have
been working on it...i have come 95% of the way but
for some reason cant work the other 5% out...can
somebody help please?

Basically I need to figure out the URL or a image from
a relitive path...something like this:


/blah.jpg // should return http://x.com/blah.jpg

/imgs/blah.jpg // return http://x.com/imgs/ blah.jpg

imgs/blah.jpg //return
http://x.com/t1/t2/t3/imgs/blah.jpg

../imgs/blah.jpg // etc

/../imgs/blah.jpg //etc

http://some-site-blah.com/imgs/blah.jpg // return the
same url



running the below code will show you how far i have
come and how only 2 examples are not working for some
damn reason.


* code start **

http://www.textx.com/t1/t2/t3/blah.html';

function ret_url($rel_path, $base = '')
{
 $base_path = substr($base, 0, strpos($base, '/',7));

if(substr($rel_path,0,1)=='/' &&
!strpos($rel_path,'/../'))
 {  return $base_path.$rel_path; }

 elseif(strpos($rel_path,'://') > 0)
 {  return $rel_path; }

 else {  return
collapse(dirname($base).'/'.$rel_path); }

 return $rel_path;
}

/* this function removes the /../ parts */
function collapse($path)
{
 
 while(strpos($path,'/../') !== false)
 {$p2 = ereg_replace('/([^/]*)/\.\./','/',$path);
  if($p2==$path)
   break;
  $path = $p2;
 }
 
 return $path;
}

$uris = array();
$uris[] = '/blah.jpg';
$uris[] ='/imgs/blah.jpg';
$uris[] ='imgs/blah.jpg';
$uris[] ='../imgs/blah.jpg';
$uris[] ='/../imgs/blah.jpg';  // ## not working ##
$uris[] ='/../../imgs/blah.jpg'; // ## not working ##
$uris[] ='http://some-site-blah.com/imgs/blah.jpg';

echo '';
foreach($uris as $uri)
{
echo ''.htmlspecialchars($uri).''.htmlspecialchars(ret_url($uri,$url)).'';
}
echo '';
?>

*** code end ***

Thanks,
Mag

=
--
- The faulty interface lies between the chair and the keyboard.
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)



___
Do you Yahoo!?
Express yourself with Y! Messenger! Free. Download now. 
http://messenger.yahoo.com

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



Re: [PHP] Working out the image path...partly solved, please have a look at my code

2004-10-11 Thread Matt M.
>  
> $url='http://www.textx.com/t1/t2/t3/blah.html';
> 
> function ret_url($rel_path, $base = '')
> {
>  $base_path = substr($base, 0, strpos($base, '/',7));
> 
> if(substr($rel_path,0,1)=='/' &&
> !strpos($rel_path,'/../'))
>  {  return $base_path.$rel_path; }
> 
>  elseif(strpos($rel_path,'://') > 0)
>  {  return $rel_path; }
> 
>  else {  return
> collapse(dirname($base).'/'.$rel_path); }
> 
>  return $rel_path;
> }
> 
> /* this function removes the /../ parts */
> function collapse($path)
> {
> 
>  while(strpos($path,'/../') !== false)
>  {$p2 = ereg_replace('/([^/]*)/\.\./','/',$path);
>   if($p2==$path)
>break;
>   $path = $p2;
>  }
> 
>  return $path;
> }
> 
> $uris = array();
> $uris[] = '/blah.jpg';
> $uris[] ='/imgs/blah.jpg';
> $uris[] ='imgs/blah.jpg';
> $uris[] ='../imgs/blah.jpg';
> $uris[] ='/../imgs/blah.jpg';  // ## not working ##
> $uris[] ='/../../imgs/blah.jpg'; // ## not working ##
> $uris[] ='http://some-site-blah.com/imgs/blah.jpg';
> 
> echo '';
> foreach($uris as $uri)
> {
> echo ''.htmlspecialchars($uri).' td>'.htmlspecialchars(ret_url($uri,$url)).'';
> }
> echo '';
> ?>

try this:

function ret_url($rel_path, $base = '')
{
$base_path = substr($base, 0, strpos($base, '/',7));

if(substr($rel_path,0,1)=='/' && strpos($rel_path,'/../') === false)
{  return $base_path.$rel_path; }

elseif(strpos($rel_path,'://') > 0)
{  return $rel_path; }

else {  return
collapse(dirname($base).'/'.$rel_path); }

return $rel_path;
}

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



Re: [PHP] Working out the image path...partly solved, please have a look at my code

2004-10-11 Thread Mag
Hey Matt,
Thanks for replying.


> >  > 
> > $url='http://www.textx.com/t1/t2/t3/blah.html';
> > 
> > function ret_url($rel_path, $base = '')
> > {
> >  $base_path = substr($base, 0, strpos($base,
> '/',7));
> > 
> > if(substr($rel_path,0,1)=='/' &&
> > !strpos($rel_path,'/../'))
> >  {  return $base_path.$rel_path; }
> > 
> >  elseif(strpos($rel_path,'://') > 0)
> >  {  return $rel_path; }
> > 
> >  else {  return
> > collapse(dirname($base).'/'.$rel_path); }
> > 
> >  return $rel_path;
> > }
> > 
> > /* this function removes the /../ parts */
> > function collapse($path)
> > {
> > 
> >  while(strpos($path,'/../') !== false)
> >  {$p2 = ereg_replace('/([^/]*)/\.\./','/',$path);
> >   if($p2==$path)
> >break;
> >   $path = $p2;
> >  }
> > 
> >  return $path;
> > }
> > 
> > $uris = array();
> > $uris[] = '/blah.jpg';
> > $uris[] ='/imgs/blah.jpg';
> > $uris[] ='imgs/blah.jpg';
> > $uris[] ='../imgs/blah.jpg';
> > $uris[] ='/../imgs/blah.jpg';  // ## not working
> ##
> > $uris[] ='/../../imgs/blah.jpg'; // ## not working
> ##
> > $uris[]
> ='http://some-site-blah.com/imgs/blah.jpg';
> > 
> > echo '';
> > foreach($uris as $uri)
> > {
> > echo ''.htmlspecialchars($uri).' >
>
td>'.htmlspecialchars(ret_url($uri,$url)).'';
> > }
> > echo '';
> > ?>



> try this:
> 
> function ret_url($rel_path, $base = '')
> {
> $base_path = substr($base, 0, strpos($base, '/',7));
> 
> if(substr($rel_path,0,1)=='/' &&
> strpos($rel_path,'/../') === false)
> {  return $base_path.$rel_path; }
> 
> elseif(strpos($rel_path,'://') > 0)
> {  return $rel_path; }
> 
> else {  return
> collapse(dirname($base).'/'.$rel_path); }
> 
> return $rel_path;
> }

Close, but its not giving the correct paths.
eg:
/../imgs/blah.jpg should return
http://www.textx.com/t1/t2/imgs/blah.jpg

but its returning:
http://www.textx.com/t1/t2/t3/imgs/blah.jpg

and this: /../../imgs/blah.jpg
should return: http://www.textx.com/t1/imgs/blah.jpg

but its returning:
http://www.textx.com/t1/t2/imgs/blah.jpg


in both cases one extra level directory :-(

Any ideas?

Thanks,
Mag


=
--
- The faulty interface lies between the chair and the keyboard.
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)



___
Do you Yahoo!?
Declare Yourself - Register online to vote today!
http://vote.yahoo.com

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



[PHP] OOP -- passing messages between objects

2004-10-11 Thread Sandy Keathley
Can someone tell me the proper syntax for accessing a method in 
one class from another class?

I used this, where $obj and $page are instantiated objects:

(From the $page class)

obj::getData($id);

It worked in an application on one server, failed in another 
application on another server.

Thanks,

Sandy Keathley

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



[PHP] ezmlm-sub or alternative

2004-10-11 Thread Mark Hubert
 I'm writing a little script (my 3rd) that takes name (first, last) and 
email address
and writes it to txt file and submits the email address to an EZMLM 
list server.

All is well but I'm not sure where to go for the submission.
The command line - ezmlm-sub works (from the shell)... if the user is 
root or vpopmail.

 Is there a safe way to run the shell command via a php script?
Or can someone suggest another way to submit an address to ezmlm.
Thanks!
Mark
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] ezmlm-sub or alternative

2004-10-11 Thread Jason Wong
On Tuesday 12 October 2004 08:29, Mark Hubert wrote:
>   I'm writing a little script (my 3rd) that takes name (first, last) and
> email address
> and writes it to txt file and submits the email address to an EZMLM
> list server.
>
> All is well but I'm not sure where to go for the submission.
>
> The command line - ezmlm-sub works (from the shell)... if the user is
> root or vpopmail.
>
>   Is there a safe way to run the shell command via a php script?
> Or can someone suggest another way to submit an address to ezmlm.

You can enable remote administration then have php send mail to:

  [EMAIL PROTECTED]

This will subscribe [EMAIL PROTECTED] to the list 
[EMAIL PROTECTED]

Make sure you use the 5th parameter in mail() to specify the remote 
admin/moderators email address.

NB if you do not allow any other methods of subscribing to the list you may 
want to disable subscription moderation so the remote admin don't have to 
confirm each subscription request.

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
--
/*
The two things that can get you into trouble quicker than anything else
are fast women and slow horses.
*/

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



Re: [PHP] ezmlm-sub or alternative

2004-10-11 Thread James McGlinn
Hi Mark,
 I'm writing a little script (my 3rd) that takes name (first, last) 
and email address
and writes it to txt file and submits the email address to an EZMLM 
list server.

All is well but I'm not sure where to go for the submission.
The command line - ezmlm-sub works (from the shell)... if the user is 
root or vpopmail.

 Is there a safe way to run the shell command via a php script?
Or can someone suggest another way to submit an address to ezmlm.
You can make use of the public interface to ezmlm-sub by sending an 
email to [EMAIL PROTECTED]

You'll need to set the 'From:' header of your emails to the address of 
your subscriber.

You can find information on the mail() function at 
http://www.php.net/mail

James McGlinn
Project Manager
BCom, BSc, Zend Certified Engineer (PHP)
Servers.co.nz Ltd
68 Shortland St, Auckland	PO Box 3688 Shortland St, Auckland, New 
Zealand
Phone: 0800 4 SERVERS	Fax: +64 9 358 5187

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


[PHP] Re: ezmlm-sub or alternative

2004-10-11 Thread Manuel Lemos
Hello,
On 10/11/2004 09:29 PM, Mark Hubert wrote:
>  I'm writing a little script (my 3rd) that takes name (first, last) and
> email address
> and writes it to txt file and submits the email address to an EZMLM list
> server.
>
> All is well but I'm not sure where to go for the submission.
>
> The command line - ezmlm-sub works (from the shell)... if the user is
> root or vpopmail.
>
>  Is there a safe way to run the shell command via a php script?
> Or can someone suggest another way to submit an address to ezmlm.
You may want to try this ezmlm management PHP class. It provides 
functions for subscribing, unsubscribing, counting subscribers and 
verify whether a subscriber is present in a list. It even provides a Web 
user interface and SOAP interface for remote list manipulation, but I 
guess you do not need that part.

http://www.phpclasses.org/ezmlmmanager
--
Regards,
Manuel Lemos
PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/
PHP Reviews - Reviews of PHP books and other products
http://www.phpclasses.org/reviews/
Metastorage - Data object relational mapping layer generator
http://www.meta-language.net/metastorage.html
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: OOP -- passing messages between objects

2004-10-11 Thread Matthew Weier O'Phinney
* Sandy Keathley <[EMAIL PROTECTED]>:
> Can someone tell me the proper syntax for accessing a method in 
> one class from another class?
>
> I used this, where $obj and $page are instantiated objects:
>
> (From the $page class)
>
> obj::getData($id);

if $obj is instantiated, you'd call it like any other method:
$obj->getData($id);

if 'obj' is the NAME of a class, and getData is the name of a STATIC
METHOD, obj::getData($id) would work fine. If 'obj' is a PROPERTY of the
page class that happens to be an object, $page->obj->getData($id) would
likely work.

> It worked in an application on one server, failed in another 
> application on another server.

Please give some more details of your code -- the context in which the
call is being made would be helpful.

-- 
Matthew Weier O'Phinney   | mailto:[EMAIL PROTECTED]
Webmaster and IT Specialist   | http://www.garden.org
National Gardening Association| http://www.kidsgardening.com
802-863-5251 x156 | http://nationalgardenmonth.org

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



Re: [PHP] Lost in PHP (part 1) ---- Sequle to Lost in Query

2004-10-11 Thread GH
Re: "Does it _really_ matter if only a number is passed? "
 I would think so since if someone is trying to pass a string that is
not proper it should be treated as such and not as if they are just
take the first set of numbers and Throw away all the rest.

 Maybe I am over thinking this or I am being paranoid

  I am trying to make this work good and hope to design it to be
secure since this is my first PHP endevor

Thanks
G


On Mon, 11 Oct 2004 14:02:08 -0400, John Holmes
<[EMAIL PROTECTED]> wrote:
> GH wrote:
> 
> > How can I convert it to an integer aslong as it is only a number in the string?
> 
> Does it _really_ matter if only a number is passed? If someone passes
> "abcd" and it's converted to an integer, it'll be zero. Then your query
> will not return any rows (which you're already testing for, anyhow,
> right?) and be handled accordingly. Who cares if they pass "104abcd"?
> It'll just be converted to 104 and see if a matching record exists.
> 
> I think you're getting caught up in too many tests. If you're expecting
> an integer, MAKE it an integer, then run your query. 99.9% of your
> values are going to come through correct if they are coming from your
> program, right? Just silently ignore the rest because it's someone
> screwing around.
> 
> If, however, you _really_ want to ensure $_GET['api'] is _only_ numbers,
> then you can use
> 
> if(!isset($_GET['api']) || preg_match('/[^0-9]/',$_GET['api']))
> { echo 'API is not all numbers'; }
> 
> or
> 
> if(isset($_GET['api']) && preg_match('/^[0-9]+$/',$_GET['api']))
> { echo 'API is a number only'; }
> 
> 
> 
> --
> 
> ---John Holmes...
> 
> Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
> 
> php|architect: The Magazine for PHP Professionals â www.phparch.com
> 
>

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



RE: [PHP] Is there any way of knowing User Currently Logged On?

2004-10-11 Thread Mulley, Nikhil
No Holmes ,Its not working , is there any other way ...

And My specific would be something that by Giving an IP or a hostname ,the script 
should fetch the user logged in currently,,

like when we use the nbtstat command on a Windows Domain with the argument as the 
hostname , it would fetch the details something like this.

P:\nikhil\userloggedon> nbtstat -an hydws00014

Local Area Connection:
Node IpAddress: [10.103.6.22] Scope Id: []

   NetBIOS Remote Machine Name Table

   Name   Type Status
-
HYDWS00014 <00>  UNIQUE  Registered
JUNOHYD<00>  GROUP   Registered
HYDWS00014 <03>  UNIQUE  Registered
HYDWS00014$<03>  UNIQUE  Registered
HYDWS00014 <20>  UNIQUE  Registered
JUNOHYD<1E>  GROUP   Registered
MSASI  <03>  UNIQUE  Registered   =>=> He is the actual user 
currenly logged on.
HYDWS00014 <01>  UNIQUE  Registered

MAC Address = 00-B0-D0-2D-DF-6F


Regards,
Nikhil.



-Original Message-
From: John Holmes [mailto:[EMAIL PROTECTED]
Sent: Tuesday, October 12, 2004 12:19 AM
To: Mulley, Nikhil
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] Is there any way of knowing User Currently Logged On?


Mulley, Nikhil wrote:

> Is there any way of finding the current user logged on the remote system

You can try $_SERVER['LOGON_USER'], but I think the "remote" computer 
has to be in the same domain as the server...

-- 

---John Holmes...

Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/

php|architect: The Magazine for PHP Professionals – www.phparch.com

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



RE: [PHP] Is there any way of knowing User Currently Logged On?

2004-10-11 Thread Mulley, Nikhil
Hi Vail,

My Worry is that If a remote OS is not Windows, then this would throw out garbage,
Where as this Perl Script would work well at a Windows Side ,Bcoz I am using the 
'Win32'  Module ,is there any other module such that .
We cannot even predict ( or I believe there is no exact way ) what the remote OS could 
be :(



Nikhil.

-Original Message-
From: Vail, Warren [mailto:[EMAIL PROTECTED]
Sent: Monday, October 11, 2004 11:33 PM
To: 'Mulley, Nikhil'; [EMAIL PROTECTED]
Subject: RE: [PHP] Is there any way of knowing User Currently Logged On?


If you code in php something like the following, you just might be able to
use the perl script;

$ok = exec("path/to/Perl myperscriptname.pl server", $result);   // you may
have to straighten out syntax
Foreach($result as $line) {
echo $line;   // or you could process the results
}

Hope this helps,

Warren Vail


-Original Message-
From: Mulley, Nikhil [mailto:[EMAIL PROTECTED] 
Sent: Monday, October 11, 2004 9:52 AM
To: [EMAIL PROTECTED]
Subject: [PHP] Is there any way of knowing User Currently Logged On?


Hi Guys,
 
Is there any way of finding the current user logged on the remote system
 
I have a perl script which gets the user name who is currently logged on a
remote Windows Machine
 
 
 
 
 
#LoggedOnUsers(server, userRef).pl
use Win32::NetAdmin;
use strict;
use vars qw($server @users_list);
if(@ARGV>0){
$server=$ARGV[0];
}
else{
print "\n\nEnter a valid Hostname  or IP Address : ";
chomp($server=); }
Win32::NetAdmin::LoggedOnUsers($server,[EMAIL PROTECTED]);
foreach(@users_list) {
print "\n$server-- $_";
}
 
 
This one gets the users logged in on a remote Windows machine , Is there a
similar way of finding / doing the same regardless of an OS, Can it be done
through a Web Browser 
 
Any Clues ??
 
--Nikhil.

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



RE: [PHP] Is there any way of knowing User Currently Logged On?

2004-10-11 Thread Mulley, Nikhil
How do I turn on the Integrated Authentication turned on.


Ours is a mixed heterogenous network which has Windows,Linux,Solaris,BSD 
Lindows,Linspire and many other OS all together,So How Do I?

-Original Message-
From: Gryffyn, Trevor [mailto:[EMAIL PROTECTED]
Sent: Tuesday, October 12, 2004 1:07 AM
To: [EMAIL PROTECTED]
Cc: John Holmes; Mulley, Nikhil
Subject: RE: [PHP] Is there any way of knowing User Currently Logged On?


It does and Windows Integrated Authentication has to be turned on (and
Anonymous access turned off).

I just got my company to configure that so my PHP scripts could grab the
authenticated user for logging purposes.

-TG

> -Original Message-
> From: John Holmes [mailto:[EMAIL PROTECTED] 
> Sent: Monday, October 11, 2004 2:49 PM
> To: Mulley, Nikhil
> Cc: [EMAIL PROTECTED]
> Subject: Re: [PHP] Is there any way of knowing User Currently 
> Logged On?
> 
> 
> Mulley, Nikhil wrote:
> 
> > Is there any way of finding the current user logged on the 
> remote system
> 
> You can try $_SERVER['LOGON_USER'], but I think the "remote" computer 
> has to be in the same domain as the server...
> 
> -- 
> 
> ---John Holmes...
> 
> Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
> 
> php|architect: The Magazine for PHP Professionals - www.phparch.com
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 

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



  1   2   >