Re: [PHP] Session Vars and Performance

2005-02-18 Thread Marek Kilimajer
Greg Donald wrote:
On Wed, 16 Feb 2005 09:36:26 -0800 (PST), Richard Lynch [EMAIL PROTECTED] 
wrote:
It's literally an hour's work to alter the code to use MySQL to store the
sessions instead of the hard drive.

Not really, maybe 5 minutes.. here's the code:
The code misses one important thing - row locking. For concurent 
requests, sess_open must block until the first request does 
sess_close(). So you need to use InnoDB's row locking or 
application-level GET_LOCK() and RELEASE_LOCK().

Make the table in your database:
CREATE TABLE `sessions` (
`id` varchar(32) NOT NULL default '',
`data` text NOT NULL,
`expire` int(11) unsigned NOT NULL default '0',
PRIMARY KEY (`id`)
);
Make a sessions.php file:
?php
// MySQL database connection parameters:
$dbhost = 'localhost';
$dbuser = 'dbuser';
$dbpasswd   = 'dbpassword';
$dbname = 'dbname';
// Sessions table name:
$tb_sessions = 'sessions';
// Session lifetime in seconds:
$online_expire = 900;
// Use transparent sessions:
ini_set( 'session.use_trans_sid', 1);
// Below here should not require any changes
$sdbh = '';
function sess_open( $save_path, $session_name )
{
global $sdbh;

if( ! $sdbh = mysql_pconnect( $dbhost, $dbuser, $dbpasswd ) )
{
echo mysql_error();

exit();
}

return true;
}
function sess_close()
{
return true;
}
function sess_read( $key )
{
global $sdbh, $dbname, $tb_sessions;

$sql = 
SELECT data
FROM $tb_sessions
WHERE id = '$key'
AND expire  UNIX_TIMESTAMP()
;

$query = mysql_query( $sql ) or die( mysql_error() );

if( mysql_num_rows( $query ) )
{
return mysql_result( $query, 0, 'data' );
}
return false;
}
function sess_write( $key, $val )
{
global $tb_sessions, $online_expire;

$value = addslashes( $val );

$sql = 
REPLACE INTO $tb_sessions (
id,
data,
expire
) VALUES (
'$key',
'$value',
UNIX_TIMESTAMP() + $online_expire
)
;

return mysql_query( $sql ) or die( mysql_error() );
}
function sess_destroy( $key )
{
global $tb_sessions;

$sql = 
DELETE FROM $tb_sessions
WHERE id = '$key'
;

return mysql_query( $sql ) or die( mysql_error() );
}
function sess_gc()
{
global $tb_sessions;

$sql = 
DELETE FROM $tb_sessions
WHERE expire  UNIX_TIMESTAMP()
;

$query = mysql_query( $sql ) or die( mysql_error() );

return mysql_affected_rows();
}
session_set_save_handler(
'sess_open',
'sess_close',
'sess_read',
'sess_write',
'sess_destroy',
'sess_gc'
);
session_start();
$sn = session_name();
$sid= session_id();
?
Then you just do include( 'sessions.php' );
http://wiki.destiney.com/DBSessions/Install

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


Re: [PHP] My FIRST php atempt

2005-02-18 Thread Bret Hughes
On Fri, 2005-02-18 at 01:47, David Freedman wrote:
 I am trying my FIRST php file with an attempt to connect
 to my mySql server.
 
 ?php
 // Connecting, selecting database
 $link = mysql_connect('localhost', 'host', 'my_passqword')
or die('Could not connect: ' . mysql_error());
 echo 'Connected successfully';
 mysql_select_db('eatc7402') or die('Could not select database');
 
 // Performing SQL query
 $query = 'SELECT * FROM my_table';
 $result = mysql_query($query) or die('Query failed: ' . mysql_error());
 ==
 more code to print results.
 ..
 ..
 
 // Free resultset
 mysql_free_result($result);
 
 // Closing connection
 mysql_close($link);
 ?
 
 The problem is it won't connect to the database. The server IS running. The
 host, username,
 and password are the exact same thing I use to connect the mySqlAdmin tool
 to the database.
 Doesn't seem like this should be that difficult. How can I discover why it
 doesn't
 seem to connect.
 

what is in the mysql log?  chances are it is a db permission issue since
you are not running as the same user as the server is.

There was a thread like this earlier this week maybe even today?

look in the archives of this list.

Bret

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



Re: [PHP] My FIRST php atempt

2005-02-18 Thread M. Sokolewicz
Bret Hughes wrote:
On Fri, 2005-02-18 at 01:47, David Freedman wrote:
I am trying my FIRST php file with an attempt to connect
to my mySql server.
?php
// Connecting, selecting database
$link = mysql_connect('localhost', 'host', 'my_passqword')
  or die('Could not connect: ' . mysql_error());
echo 'Connected successfully';
mysql_select_db('eatc7402') or die('Could not select database');
// Performing SQL query
$query = 'SELECT * FROM my_table';
$result = mysql_query($query) or die('Query failed: ' . mysql_error());
==
more code to print results.
..
..

// Free resultset
mysql_free_result($result);
// Closing connection
mysql_close($link);
?
The problem is it won't connect to the database. The server IS running. The
host, username,
and password are the exact same thing I use to connect the mySqlAdmin tool
to the database.
Doesn't seem like this should be that difficult. How can I discover why it
doesn't
seem to connect.

what is in the mysql log?  chances are it is a db permission issue since
you are not running as the same user as the server is.
There was a thread like this earlier this week maybe even today?
look in the archives of this list.
Bret
actually, I'd suggest he first take another look at his mysql_connect() 
call... I can't recall mysql_connect taking the hostname argument 
*twice*! as in mysql_connect('localhost', 'host', 'password'); I'd bet 
host should be replaced with password

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


Re: [PHP] My FIRST php atempt

2005-02-18 Thread M. Sokolewicz
M. Sokolewicz wrote:
Bret Hughes wrote:
On Fri, 2005-02-18 at 01:47, David Freedman wrote:
I am trying my FIRST php file with an attempt to connect
to my mySql server.
?php
// Connecting, selecting database
$link = mysql_connect('localhost', 'host', 'my_passqword')
  or die('Could not connect: ' . mysql_error());
echo 'Connected successfully';
mysql_select_db('eatc7402') or die('Could not select database');
// Performing SQL query
$query = 'SELECT * FROM my_table';
$result = mysql_query($query) or die('Query failed: ' . mysql_error());
==
more code to print results.
..
..

// Free resultset
mysql_free_result($result);
// Closing connection
mysql_close($link);
?
The problem is it won't connect to the database. The server IS 
running. The
host, username,
and password are the exact same thing I use to connect the mySqlAdmin 
tool
to the database.
Doesn't seem like this should be that difficult. How can I discover 
why it
doesn't
seem to connect.


what is in the mysql log?  chances are it is a db permission issue since
you are not running as the same user as the server is.
There was a thread like this earlier this week maybe even today?
look in the archives of this list.
Bret
actually, I'd suggest he first take another look at his mysql_connect() 
call... I can't recall mysql_connect taking the hostname argument 
*twice*! as in mysql_connect('localhost', 'host', 'password'); I'd bet 
host should be replaced with password
of course I mean username, not password [stupid me]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Password Protection] -- My solution

2005-02-18 Thread Christophe Chisogne
Mailit, LLC a écrit :
   $userName = $_POST[userName];
   $passw= $_POST[passw]; 
(...)
   $cmd = SELECT * FROM theTable 
   .  WHERE userName='$userName' ;
   $res = mysql_query( $cmd ) or die( Password search failed. );
Without validating userName in $_POST, that code is vulnerable
to SQL injection, by example if userName starts by a single quote...
See the PHP Security Guide on 'SQL Injection'
http://phpsec.org/projects/guide/3.html#3.2
   $passe = crypt( $passw, $rec[ePass] );
   if( $passe == $rec[ePass] ) 
I seems that the above vulnerability cant be exploited,
but I think it's better to be aware of it.
Christophe
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] [php] -help me

2005-02-18 Thread Tyler Replogle
$str_array = explode(/, /home/karthik/welcome.php/view.php);
// $str_array[4] shoud be view.php
From: K Karthik [EMAIL PROTECTED]
To: php-general@lists.php.net
Subject: [PHP] [php] -help me
Date: Fri, 18 Feb 2005 11:20:29 +0530
MIME-Version: 1.0
Received: from lists.php.net ([216.92.131.4]) by MC8-F21.hotmail.com with 
Microsoft SMTPSVC(6.0.3790.211); Thu, 17 Feb 2005 21:49:59 -0800
Received: from ([216.92.131.4:8115] helo=lists.php.net)by pb1.pair.com 
(ecelerity 1.2 (r4437)) with SMTPid CA/4E-28819-70285124 for 
[EMAIL PROTECTED]; Fri, 18 Feb 2005 00:49:59 -0500
Received: (qmail 87241 invoked by uid 1010); 18 Feb 2005 05:49:25 -
Received: (qmail 87119 invoked by uid 1010); 18 Feb 2005 05:49:22 -
X-Message-Info: JGTYoYF78jHVyuGSbP1BO8du3qnIwzSNq7BOh4Qcf90=
Return-Path: [EMAIL PROTECTED]
X-Host-Fingerprint: 216.92.131.4 lists.php.net  Mailing-List: contact 
[EMAIL PROTECTED]; run by ezmlm
Precedence: bulk
list-help: mailto:[EMAIL PROTECTED]
list-unsubscribe: mailto:[EMAIL PROTECTED]
list-post: mailto:php-general@lists.php.net
Delivered-To: mailing list php-general@lists.php.net
Delivered-To: [EMAIL PROTECTED]
Delivered-To: [EMAIL PROTECTED]
X-Host-Fingerprint: 203.193.155.110 alps.manageengine.org Linux 2.4/2.6
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.3) 
Gecko/20040913
X-Accept-Language: en-us, en
X-OriginalArrivalTime: 18 Feb 2005 05:50:00.0026 (UTC) 
FILETIME=[AEF42BA0:01C5157D]

i have got string as /home/karthik/welcome.php/view.php
i just need view.php how shall i remove rest of the string.
please do help me.i am new to php.
-thanks,
karthik
--
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] PHP to C interface?

2005-02-18 Thread N Deepak
Hi,

  Is there a way to invoke C functions in a library (.so) from PHP?
  Like Xs in Perl?

Thanks,
Deepak

-- 
N Deepak || http://www.ndeepak.info/

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



Re: [PHP] PHP to C interface?

2005-02-18 Thread Zareef Ahmed
Hi,

 Please Visit

http://pear.php.net/package/Inline_C

may be usefull

zareef ahmed 



On Fri, 18 Feb 2005 01:19:19 -0800, N Deepak [EMAIL PROTECTED] wrote:
 Hi,
 
   Is there a way to invoke C functions in a library (.so) from PHP?
   Like Xs in Perl?
 
 Thanks,
 Deepak
 
 --
 N Deepak || http://www.ndeepak.info/
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 


-- 
Zareef Ahmed :: A PHP Developer in India ( Delhi )
Homepage :: http://www.zareef.net

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



Re: [PHP] create forum

2005-02-18 Thread AdamT
On Fri, 18 Feb 2005 07:35:02 +0100, Stefan [EMAIL PROTECTED] wrote:
 Hi.
 Are there some code-examples how to build a forum
 with php and xml?
 
Why yes, there are...

A quick google of: http://www.justfuckinggoogleit.com/?q=forum+php+xml

reveals the top result to be a page called 'PHP/XML forum' where 'You
can download the source to this free, thread-oriented PHP/XML based
news forum'


-- 
AdamT
Justify my text?  I'm sorry, but it has no excuse.

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



Re: [PHP] PHP security

2005-02-18 Thread AdamT
On Thu, 17 Feb 2005 20:47:28 -0600, .hG [EMAIL PROTECTED] wrote:
 
 It makes me wonder how secure in reallity it is to place your UN and
 Passwords on a PHP file.
 
Best idea is to place such information in an include file, which you
can call using the include() or require() statements - and place it
someplace outside of the document root.

Eg: /users/~yourname/public_html/ might be where www.example.com maps
to on the local file system, so put your includes in
/users/~yourname/somewhere_else/

Also - do not name these files with a .inc extension.  If you need to
signify the fact that they are to be included in other pages, call
give them .inc.php extensions.  So if your webserver ever has a
vulnerability whereby people can read files outside the document root
(eg by typing http://www.example_site.com/../includes/dbpassword.inc.php)
- the file will be parsed by PHP before being sent to the browser,
thus hiding any mysql connect statements or $username variable
declarations.

The other type of exploit you might need to guard against is one where
people can trick the server into not parsing PHP files, but sending
them straight to the browser as plain text.  This might be done by
sending unicode chars, or by putting an extra . on the end of the
filename.  Eg: requesting
http://www.example_site.com/includes/dbpassword.inc.php.
This is more of a problem if you place such files within the document root.
If you don't have access to space outside of the document root, then
a) rattle your hosting provider's cage a little bit and b) protect
these files with .htaccess and .htpasswd files (google for it if you
haven't used .htaccess before).  At least this way, if somebody does
try to request the files directly with their web browser, they'll be
prompted for a username and password.  PHP, meanwhile will still be
able to read the contents.

If you're running some script which does have a load of files named
.inc, and you don't want to go grepping every file, and changing all
instances of .inc to .inc.php, and renaming all the files - then use
.htaccess files to add php as a handler for all .inc files - so any
file with a .inc extension will be treated exactly the same as if it
had a .php extension - ie - it will be parsed by PHP, rather than
being sent to the browser as plaintext.

If you're really, really, really paranoid, you can add a file to the
includes directory, called, say rootpassword_backdoor.php, which, when
accessed will add the remote IP address to a blacklist, which other
scripts consult, and if they find it matches any sites requesting
them, they ignore.

My 2 bits.

-- 
AdamT
Justify my text?  I'm sorry, but it has no excuse.

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



Re: [PHP] PHP to C interface?

2005-02-18 Thread N Deepak
On Fri, Feb 18, 2005 at 02:56:05PM +0530, Zareef Ahmed wrote:
 Hi,
 
  Please Visit
 
 http://pear.php.net/package/Inline_C
 
Thanks very much.  Have you tried using it?  How mature is it?  I found
no documentation or installation guide.

Best regards,
Deepak

 On Fri, 18 Feb 2005 01:19:19 -0800, N Deepak [EMAIL PROTECTED] wrote:
  Hi,
  
Is there a way to invoke C functions in a library (.so) from PHP?
Like Xs in Perl?
  
  Thanks,
  Deepak
  

-- 
N Deepak || http://www.ndeepak.info/

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



Re: [PHP] [php] -help me

2005-02-18 Thread M. Sokolewicz
Tyler Replogle wrote:
$str_array = explode(/, /home/karthik/welcome.php/view.php);
// $str_array[4] shoud be view.php
From: K Karthik [EMAIL PROTECTED]
To: php-general@lists.php.net
Subject: [PHP] [php] -help me
Date: Fri, 18 Feb 2005 11:20:29 +0530
MIME-Version: 1.0
Received: from lists.php.net ([216.92.131.4]) by MC8-F21.hotmail.com 
with Microsoft SMTPSVC(6.0.3790.211); Thu, 17 Feb 2005 21:49:59 -0800
Received: from ([216.92.131.4:8115] helo=lists.php.net)by pb1.pair.com 
(ecelerity 1.2 (r4437)) with SMTPid CA/4E-28819-70285124 for 
[EMAIL PROTECTED]; Fri, 18 Feb 2005 00:49:59 -0500
Received: (qmail 87241 invoked by uid 1010); 18 Feb 2005 05:49:25 -
Received: (qmail 87119 invoked by uid 1010); 18 Feb 2005 05:49:22 -
X-Message-Info: JGTYoYF78jHVyuGSbP1BO8du3qnIwzSNq7BOh4Qcf90=
Return-Path: [EMAIL PROTECTED]
X-Host-Fingerprint: 216.92.131.4 lists.php.net  Mailing-List: contact 
[EMAIL PROTECTED]; run by ezmlm
Precedence: bulk
list-help: mailto:[EMAIL PROTECTED]
list-unsubscribe: mailto:[EMAIL PROTECTED]
list-post: mailto:php-general@lists.php.net
Delivered-To: mailing list php-general@lists.php.net
Delivered-To: [EMAIL PROTECTED]
Delivered-To: [EMAIL PROTECTED]
X-Host-Fingerprint: 203.193.155.110 alps.manageengine.org Linux 2.4/2.6
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.3) 
Gecko/20040913
X-Accept-Language: en-us, en
X-OriginalArrivalTime: 18 Feb 2005 05:50:00.0026 (UTC) 
FILETIME=[AEF42BA0:01C5157D]

i have got string as /home/karthik/welcome.php/view.php
i just need view.php how shall i remove rest of the string.
please do help me.i am new to php.
-thanks,
karthik
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
or use basename()
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] PHP security

2005-02-18 Thread John Cage
you could also encrypt the file using one of the encoders that are out 
there. Some are free and some are paid for

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


[PHP] a better way for the array

2005-02-18 Thread Merlin
Hi there,
I am wondering if there is a nicer way to save the data into an array than I do.
I do have a 2 dimensional array $para.
Currently I go like this:
$para[1][txt]   = 'Europe'.$continent[name];
$para[1][link]  = '/'.$continent[name].'.htm';
$para[1][title] = 'Europe - Continent overview';
$para[2][txt]   = $country;
$para[2][link]  = '/'.$continent[name].'.htm';
$para[2][title] = $country;
That becomes really difficult if you have more of them, and you want to 
reorganize the ordering. Then you have to rename all numbers.

Is there a nicer way to do that?
Thank you for any hint,
Merlin
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] a better way for the array

2005-02-18 Thread Marek Kilimajer
Merlin wrote:
Hi there,
I am wondering if there is a nicer way to save the data into an array 
than I do.

I do have a 2 dimensional array $para.
Currently I go like this:
$para[1][txt] = 'Europe'.$continent[name];
$para[1][link] = '/'.$continent[name].'.htm';
$para[1][title] = 'Europe - Continent overview';
$para[2][txt] = $country;
$para[2][link] = '/'.$continent[name].'.htm';
$para[2][title] = $country;
That becomes really difficult if you have more of them, and you want to 
reorganize the ordering. Then you have to rename all numbers.

Is there a nicer way to do that?
Thank you for any hint,
Merlin
$para = array();
$para[] = array('txt' = 'Europe'.$continent['name'],
'link' = '/'.$continent[name].'.htm',
'title' = 'Europe - Continent overview');
$para[] = array('txt' = $country,
'link' = '/'.$continent[name].'.htm',
'title' = $country);
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] PHP security

2005-02-18 Thread AdamT
On Fri, 18 Feb 2005 11:42:36 +, John Cage [EMAIL PROTECTED] wrote:
 you could also encrypt the file using one of the encoders that are out
 there. Some are free and some are paid for

Never thought of that ;-)

http://www.zend.com/store/products/zend-encoder.php?home (Commercial)
http://www.ioncube.com/ (Commercial - free eval available)
http://www.rssoftlab.com/phpenc.php (Commercial - free version available)


-- 
AdamT
Justify my text?  I'm sorry, but it has no excuse.

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



Re: [PHP] a better way for the array

2005-02-18 Thread Merlin
Marek Kilimajer wrote:
Merlin wrote:
Hi there,
I am wondering if there is a nicer way to save the data into an array 
than I do.

I do have a 2 dimensional array $para.
Currently I go like this:
$para[1][txt] = 'Europe'.$continent[name];
$para[1][link] = '/'.$continent[name].'.htm';
$para[1][title] = 'Europe - Continent overview';
$para[2][txt] = $country;
$para[2][link] = '/'.$continent[name].'.htm';
$para[2][title] = $country;
That becomes really difficult if you have more of them, and you want 
to reorganize the ordering. Then you have to rename all numbers.

Is there a nicer way to do that?
Thank you for any hint,
Merlin
$para = array();
$para[] = array('txt' = 'Europe'.$continent['name'],
'link' = '/'.$continent[name].'.htm',
'title' = 'Europe - Continent overview');
$para[] = array('txt' = $country,
'link' = '/'.$continent[name].'.htm',
'title' = $country);
Thanx that is much better.
However I have to start the array with 1 instead of 0
and I cant remember and find the proper syntax. It was something like: array(=1
What was that again?
Thanx, Merlin
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] a better way for the array

2005-02-18 Thread Pablo M. Rivas
Hello Merlin:
take a look to http://www.php.net/manual/en/language.types.array.php

$para[5]=array('txt' = 'Europe'.$continent['name'],
'link' = '/'.$continent[name].'.htm',
'title' = 'Europe - Continent overview');
$para[]=array('txt' = 'America'.$continent['name'],
'link' = '/'.$continent[name].'.htm',
'title' = 'America- Continent overview');
$para[] will be 6,7,8,9... and so on


On Fri, 18 Feb 2005 13:52:29 +0100, Merlin [EMAIL PROTECTED] wrote:
 Marek Kilimajer wrote:
  Merlin wrote:
 
  Hi there,
 
  I am wondering if there is a nicer way to save the data into an array
  than I do.
 
  I do have a 2 dimensional array $para.
 
  Currently I go like this:
 
  $para[1][txt] = 'Europe'.$continent[name];
  $para[1][link] = '/'.$continent[name].'.htm';
  $para[1][title] = 'Europe - Continent overview';
  $para[2][txt] = $country;
  $para[2][link] = '/'.$continent[name].'.htm';
  $para[2][title] = $country;
 
  That becomes really difficult if you have more of them, and you want
  to reorganize the ordering. Then you have to rename all numbers.
 
  Is there a nicer way to do that?
 
  Thank you for any hint,
 
  Merlin
 
 
  $para = array();
 
  $para[] = array('txt' = 'Europe'.$continent['name'],
  'link' = '/'.$continent[name].'.htm',
  'title' = 'Europe - Continent overview');
 
  $para[] = array('txt' = $country,
  'link' = '/'.$continent[name].'.htm',
  'title' = $country);
 
 Thanx that is much better.
 
 However I have to start the array with 1 instead of 0
 and I cant remember and find the proper syntax. It was something like: 
 array(=1
 
 What was that again?
 
 Thanx, Merlin
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 


-- 
Pablo M. Rivas. http://www.pmrivas.com http://www.r3soft.com.ar
---

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



[PHP] How to open a URL directly ?

2005-02-18 Thread Vaibhav Sibal
Hey ppl,
I have a scenario wherein the people logging into the system have
different kinds of status as in a person can either be a admin, a
user, or a supervisor etc. Now I have different web interfaces for all
these kind of people. What I want to know is what function do i use to
go to a URL directly in a case where status of the person is something
like admin or user etc. For ex. if a person Robert is the admin and
his name and password correctly matches from the database and the
status of Robert as stored in the database is admin then as soon as he
pressed the login button he should automatically be forwarded to a
page, eg. admin.php, where he can access his stuff. Please tell me
what function should I use ?

Thanks
Vaibhav

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



Re: [PHP] help me

2005-02-18 Thread Pablo M. Rivas
http://www.php.net/date


On Fri, 18 Feb 2005 12:07:14 +0530, K Karthik [EMAIL PROTECTED] wrote:
 i am so surprised for the immediate reply.thank you so much.
 i'll be thank ful again if you could help me finding the current date
 and time using php.
 thanks,
 karthik
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 


-- 
Pablo M. Rivas. http://www.pmrivas.com http://www.r3soft.com.ar
---

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



[PHP] fgetcsv() excel data missing

2005-02-18 Thread Binoy AV
Hi all,

   I used fgetcsv() function to get the data from a excel file.
 While reading the data it shows some special characters . 
 I found the same problems in 
  http://bugs.php.net/bug.php?id=12127edit=2 
  Is it a bug?

 Plz help me. 

Binoy 

 
__ __ __ __
Sent via the WebMail system at softwareassociates.co.uk


 
   
---
Scanned by MessageExchange.net (13:31:20 SPITFIRE)

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



RE: [PHP] fgetcsv() excel data missing

2005-02-18 Thread Jay Blanchard
[snip]
   I used fgetcsv() function to get the data from a excel file.
 While reading the data it shows some special characters . 
 I found the same problems in 
  http://bugs.php.net/bug.php?id=12127edit=2 
  Is it a bug?
[/snip]

What special characters does it show?

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



[PHP] Re: How to open a URL directly ?

2005-02-18 Thread Matthew Weier O'Phinney
* Vaibhav Sibal [EMAIL PROTECTED]:
 I have a scenario wherein the people logging into the system have
 different kinds of status as in a person can either be a admin, a
 user, or a supervisor etc. Now I have different web interfaces for all
 these kind of people. What I want to know is what function do i use to
 go to a URL directly in a case where status of the person is something
 like admin or user etc. For ex. if a person Robert is the admin and
 his name and password correctly matches from the database and the
 status of Robert as stored in the database is admin then as soon as he
 pressed the login button he should automatically be forwarded to a
 page, eg. admin.php, where he can access his stuff. Please tell me
 what function should I use ?

header(Location: http://server.tld/path/to/admin/script.php;);

Make sure you don't have any output happening before you try and use
this, though.

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

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



Re: [PHP] Session Vars and Performance

2005-02-18 Thread Greg Donald
On Fri, 18 Feb 2005 08:56:59 +0100, Marek Kilimajer [EMAIL PROTECTED] wrote:
 The code misses one important thing - row locking. For concurent
 requests, sess_open must block until the first request does
 sess_close(). So you need to use InnoDB's row locking or
 application-level GET_LOCK() and RELEASE_LOCK().

InnoDB wasn't available in MySQL when I put that code together.  I got
the base code from:

http://php.net/manual/en/function.session-set-save-handler.php

and tweaked it to use MySQL.  If you need a row level locking capable
version, have at it.


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

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



RE: [PHP] fgetcsv() excel data missing

2005-02-18 Thread Binoy AV

 Hi,

Thanks for the reply.

 It shows  ÐÏࡱá\\þÿ etc.

 source code I used is

  $handle = fopen (file.xls,r);
  while ($data = fgetcsv ($handle, 1000, ,))
  {
   $num = count($data);
   for ($c=0; $c  $num ; $c++)
   {
$str_email = $data[$c];
 echo $str_email;

   }
  }

 Binoy


__ __ __ __
Sent via the WebMail system at softwareassociates.co.uk





---
Scanned by MessageExchange.net (13:55:17 SPITFIRE)

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



RE: [PHP] fgetcsv() excel data missing

2005-02-18 Thread Jay Blanchard
[snip]
Thanks for the reply.

 It shows  ÐÏࡱá\\þÿ etc.

 source code I used is

  $handle = fopen (file.xls,r); 
  while ($data = fgetcsv ($handle, 1000, ,)) 
  { 
   $num = count($data); 
   for ($c=0; $c  $num ; $c++) 
   { 
$str_email = $data[$c];
 echo $str_email;

   }
  }

[/snip]

You have to save the .xls file as a .csv file, then you can open and getcsv

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



Re: [PHP] Crontab for Windows

2005-02-18 Thread Jochem Maas
bob wrote:
Hi,
I am trying to schedule the running of some PHP scripts on my Win2K PC 
at home.

On my live server I use Linux, so am fully familiar with Crontab. I am 
not that familiar with running scripts using the scheduler in Win2K though.

So far what I have is:
C:\php\php.exe -q c:\path\to\php\file.php
what happens if you quote everything?:
C:\php\php.exe -q c:\path\to\php\file.php
But this doesn't seem to do anything..the task manager in the windows 
scheduler just keeps saying that the task has not been run.

Any suggestions?
Also, one thing I would like my script to do is to send out an email, 
but I don't have a mail server set up on my home PC..is there anyway to 
run a script from a server on a different machine, using Windows 
scheduler, and if so, what form would the 'path' to the file/server take?

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


RE: [PHP] fgetcsv() excel data missing

2005-02-18 Thread Binoy AV
 Thanks Jay.
  
  Could anybody please tell me how to read the data from an excel file ? It 
should work independent of the operating system. I don't want the csv format. 


Binoy
   

 
__ __ __ __
Sent via the WebMail system at softwareassociates.co.uk


 
   
---
Scanned by MessageExchange.net (14:20:44 SPITFIRE)

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



RE: [PHP] fgetcsv() excel data missing

2005-02-18 Thread Jay Blanchard
[snip]
  Could anybody please tell me how to read the data from an excel file ?
It should work independent of the operating system. I don't want the csv
format. 
[/snip]

Start here http://us4.php.net/com

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



Re: [PHP] Crontab for Windows

2005-02-18 Thread pjn
On W3K you could use this as the run line in
Scheduled Tasks and probably the same in XP
although I have not tested this. The same
components exist in the W2K version although
may be in different locations/names.
Run: cmd /c c:\php\php.exe -q c:\path\to\php\file.php
Start in: C:\path\to\php\file\
Run as: username/pass with security acess to
both php.exe and the file.php
YMMV
pjn
- Original Message - 
From: Jochem Maas [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Cc: php-general@lists.php.net
Sent: Friday, February 18, 2005 10:06 PM
Subject: Re: [PHP] Crontab for Windows


bob wrote:
Hi,
I am trying to schedule the running of some PHP scripts on my Win2K PC at 
home.

On my live server I use Linux, so am fully familiar with Crontab. I am 
not that familiar with running scripts using the scheduler in Win2K 
though.

So far what I have is:
C:\php\php.exe -q c:\path\to\php\file.php
what happens if you quote everything?:
C:\php\php.exe -q c:\path\to\php\file.php
But this doesn't seem to do anything..the task manager in the windows 
scheduler just keeps saying that the task has not been run.

Any suggestions?
Also, one thing I would like my script to do is to send out an email, but 
I don't have a mail server set up on my home PC..is there anyway to run a 
script from a server on a different machine, using Windows scheduler, and 
if so, what form would the 'path' to the file/server take?

Many thanks
Alexis
--
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] Re: How to open a URL directly ?

2005-02-18 Thread M. Sokolewicz
Vaibhav Sibal wrote:
Hey ppl,
I have a scenario wherein the people logging into the system have
different kinds of status as in a person can either be a admin, a
user, or a supervisor etc. Now I have different web interfaces for all
these kind of people. What I want to know is what function do i use to
go to a URL directly in a case where status of the person is something
like admin or user etc. For ex. if a person Robert is the admin and
his name and password correctly matches from the database and the
status of Robert as stored in the database is admin then as soon as he
pressed the login button he should automatically be forwarded to a
page, eg. admin.php, where he can access his stuff. Please tell me
what function should I use ?
Thanks
Vaibhav
try
header('Location: $url');
or
header('Refresh: $timeout; URL=$path);
or output some JS to redirect.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] fgetcsv() excel data missing

2005-02-18 Thread M. Sokolewicz
Binoy AV wrote:
 Thanks Jay.
  
  Could anybody please tell me how to read the data from an excel file ? It should work independent of the operating system. I don't want the csv format. 
excel files aren't independent of the OS, csv files are. Excel files 
need to be parsed, because they contain heaps of formatting data. If 
you're using php on a windows OS, then you can use COM or .NET to read 
it in. On other systems however, you'll likely run into problems pretty 
quickly, and will most probably need to write your own parser routine

Binoy
   

 
__ __ __ __
Sent via the WebMail system at softwareassociates.co.uk

 
   
---
Scanned by MessageExchange.net (14:20:44 SPITFIRE)
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] Problem connecting to MySQL with PEAR::DB and mysqli

2005-02-18 Thread Denis Gerasimov

Hello,

I suspect that all is OK in your code. I had a very similar problem three
days ago. Try connecting to FQDN like [EMAIL PROTECTED] via TCP/IP, not to
localhost via UNIX socket. It works in my case at least.

BTW it seems to be a DB package bug... write a simple test script with
mysqli_* functions and look if it will work.

And, of course, check MySQL user priviliges/hosts twice!

Best regards, Denis Gerasimov
Outsourcing Services Manager,
VEKOS, Ltd.
www.vekos.ru


 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
 Sent: Thursday, February 17, 2005 11:47 AM
 To: php-general@lists.php.net
 Subject: [PHP] Problem connecting to MySQL with PEAR::DB and mysqli
 
 hello
 
 
 when connecting to MySQL 4.1 using PHP 5 and PEAR::DB I get this error:
 
 DB Error: connect failed
 
 a closer look gets this:
 
 Can't connect to local MySQL server through socket 'localhost' (2)
 
 the code for the connection is like this::
 
 
 public static function getConnection() {
 $mysql_user=myname;
 $mysql_password=secret;
 $mysql_host=localhost;
  $db_name=mydb;
  $dsn=mysqli://$mysql_user:[EMAIL PROTECTED]/$db_name;
 echo$dsn;
 $db=DB::connect($dsn);
 if(DB::isError($db)){
 echo$db-getMessage();
 }
 return$db;
 }
 ===
 
 the DSN looks correct:
 and in the php.ini I set the following option:
 
 mysqli.default_socket = /var/lib/mysql/mysql.sock
 
 this is where the socket for mysql access is.
 then I restarted apache and mysqld.
 
 the MySQL Server is running. I can connect via mysql on the command line
 but not with PEAR::DB.
 
 I am using PHP 5, the latest PEAR::DB, Apache 1.3 on a Redhat 7.3 System.
 
 any ideas what's wrong here ?
 
 Markus
 
 --
 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] fgetcsv() excel data missing

2005-02-18 Thread Bret Hughes
On Fri, 2005-02-18 at 09:12, M. Sokolewicz wrote:
 Binoy AV wrote:
 
   Thanks Jay.

Could anybody please tell me how to read the data from an excel
file ? It should work independent of the operating system. I don't want
the csv format. 


 excel files aren't independent of the OS, csv files are. Excel files 
 need to be parsed, because they contain heaps of formatting data. If 
 you're using php on a windows OS, then you can use COM or .NET to read 
 it in. On other systems however, you'll likely run into problems pretty 
 quickly, and will most probably need to write your own parser routine
  

Not to mention the different versions of excel that alter the format.

Bret

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



Re: [PHP] PHP security

2005-02-18 Thread .....hG
Thanks everyone for your input. I was just curios since everyone is so 
concern about security, yet some messageboards/CMS use passwords for their 
databases on the index page or an include.

-- 
...hG

http://www.helmutgranda.com


Robby Russell [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
: On Thu, 2005-02-17 at 20:47 -0600, .hG wrote:
:  While back I read in an article that placing UN and PASSwords in a PHP 
was
:  not secure. couple of open source programs that I have seen they have 
for
:  example
: 
:  $database = ;
:  $username = ;
:  $password = ;
: 
:  It makes me wonder how secure in reallity it is to place your UN and
:  Passwords on a PHP file.
: 
:  Thanks for your input
: 
:
: Well, what do you suggest we do? We could ask the code you write to
: guess the username and password?
:
: From the web, if you do it right, there is no way to really find out
: what the user/pass is. Don't keep it in your webroot if you can help it
: is a good way to avoid any issues. The only people who should have
: access to the file are you and your webserver process.
:
: if you put a file in your directory called, db.inc.php and it looks like
: so:
:
: ?php
:
: // robbys secret password
: $super_secret_password = noonewillguessthisone;
:
: ?
:
: .. if php is properly configured, this will never be displayed
: at /db.inc.php ... will just show a blank page
:
:
: -- 
: /***
: * Robby Russell | Owner.Developer.Geek
: * PLANET ARGON  | www.planetargon.com
: * Portland, OR  | [EMAIL PROTECTED]
: * 503.351.4730  | blog.planetargon.com
: * PHP/PostgreSQL Hosting  Development
: * --- Now hosting Ruby on Rails Apps ---
: / 

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



[PHP] Re: Help with SQL statement

2005-02-18 Thread .....hG
Im a begininer at PHP but how about session?

-- 
...hG

http://www.helmutgranda.com


Jacques [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
: How can I determine which users have signed in and are still on-line 
during
: the first minute after they have signed in? My sql statement currently
: reads:
:
: SELECT * FROM tblusers WHERE usignedin = yes AND utimesignedin = 
(time() -
: 60)
:
: Hoe does one indicate seconds in a SQL statement? Can I use the time()
: function or should I use the now() function rather?
:
: Thanks
: Jacques 



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



Re: [PHP] MySQL and MySQLi compiling

2005-02-18 Thread Marek Kilimajer
Chris wrote:
Hi, I've been trying to get these 2 compiled together for a while, and 
have had no luck.

WHere my problem lies, I think, is that I'm not sure what directory 
should be specified on the --with-mysql part

./configure --with-apxs2=/usr/local/apache/bin/apxs 
--with-mysql=/usr/include/mysql/ --with-mysqli=/usr/bin/mysql_config
./configure --with-apxs2=/usr/sbin/apxs2 
--with-mysql=/usr/include/mysql/  --with-mysqli=shared,/usr/bin/mysql_config

Build either one as shared.
I have my own compiled Apache (It is Apache 2) , and MySQL 4.1.9 
installed (the packages off mysql.com). The PHP documentation jsut says 
point it to the install dir. I'm nto sure what counts as the install dir 
for the MySQL packages.

Any advice would be appreciated.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Weird Error Help

2005-02-18 Thread Joe Harman
Thanks for your help guys... I can't seem to locate the culprut though...

here is my line of code it refers to: 
echo 
/tr.$nav_bar_end;

all it does is close a table though... i hate to blame this error on
the PHP processor... but I am wondering if there could be a corrupt
install of PHP on my web server this site has been up for about 6
months and all that brought it on was a server change... I also did
try uploading the files file a couple different ftp clients... in
binary and ascii... but i still get the intermitant error...

I did add ob_start() and ob_flush() to the site... that seemed to
reduce the occurance of the error though...

Thanks!
Joe



On Thu, 17 Feb 2005 15:41:10 -0800 (PST), Richard Lynch [EMAIL PROTECTED] 
wrote:
 Joe Harman wrote:
  Hey has anyone had an error like this one? and have a solution
 
  ---
  Warning: Unexpected character in input: '' (ASCII=1) state=1 in
  **/_eid_page_functions.php on line
  173
  
 
  it appears to be very random... could be my PHP code... but the only
  thing that has happened since this error occured is that we moved the
  site to a new server
 
 Perhaps the file got garbled in the move...
 
 Check that there isn't an ASCII 1 character (control-A) in there in a hex
 editor or something.
 
 Also re-copy over some files using a different mechanism and do some diff
 to be SURE the files are the same.
 
 --
 Like Music?
 http://l-i-e.com/artists.htm
 


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



[PHP] FATAL: emalloc()

2005-02-18 Thread George Balanos
Durring the middle of the day our website stopped woking when I checked the 
error logs in Apache I found this error:

FATAL: emalloc() : Unable to allocate 1073741824 bytes

Spammed three times, since then nothing we have tried has worked, played 
with memory_limit and shutting down our gallery.

Our info is here:

http://www.precisionstrike.net/phpinfo.php

When going to our site http://www.precisionstrike.net all we see is a blank 
page.

Researching this problem we found numerous entries about SQL and data table 
settings to have them changed from ntext We have not done this yet as to 
not make this problem even worse by modifing the SQL database tables.

If anyone has any input it would be greatly appreciated. I am a noob at this 
as the person who built this server is no longer with us and we are trying 
to put it back together.

Thank you.


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



[PHP] Code Analyzer Needed ..can somebody suggest ?

2005-02-18 Thread Ramya Ramaswamy
Hey people,

Am in the look out for a code analyzer for PHP...can somebody help me
out with that?Please...

Many Thankx
Ramya

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



Re: [PHP] FATAL: emalloc()

2005-02-18 Thread Matt M.
 FATAL: emalloc() : Unable to allocate 1073741824 bytes

I found this at http://us4.php.net/odbc_exec

I kept getting FATAL: emalloc() errors when using select statements
via odbc for MS SQL.

I had no control over the DB as it is a commercial CRM system.

I found that by 1st issuing an SQL query of set textsize ;'
within my PHP script is has resolved the issue..

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



Re: [PHP] FATAL: emalloc()

2005-02-18 Thread Richard Lynch
George Balanos wrote:
 Durring the middle of the day our website stopped woking when I checked
 the
 error logs in Apache I found this error:

 FATAL: emalloc() : Unable to allocate 1073741824 bytes

What you have to figure out is why you are trying to allocate a GIGABYTE
of RAM on your homepage.  That's not something you want to be doing. 
Ever.

Do you have some kind of RSS feed, blog, or forum on the home page?

Check to see if you have anything in the database where somebody put in a
GIGABYTE in a single field -- like the blog comments field or forum post
or...

 Spammed three times, since then nothing we have tried has worked, played
 with memory_limit and shutting down our gallery.

Gallery?

Go look at the files in your gallery images directory, if you have one --
Perhaps somebody uploaded a GIGABYTE jpeg.

Or, worse, maybe your developer decided to put all your images into the
database itself -- so now you've got a GIGABYTE jpeg crammed into a 'text'
field.  That's not good.

 http://www.precisionstrike.net/phpinfo.php

 When going to our site http://www.precisionstrike.net all we see is a
 blank
 page.

But you *DO* manage to send out two (2) cookies before that page loads...

Which at lesat means you can narrow down the problem a tiny bit.

 Researching this problem we found numerous entries about SQL and data
 table
 settings to have them changed from ntext We have not done this yet as to
 not make this problem even worse by modifing the SQL database tables.

I don't even know what ntext is, but suspect it allows even LARGER jpegs
to be crammed into your database -- which is the exact opposite of what
you want to do.

You want to fix the code so if somebody puts an image over size X in the
gallery, you just don't accept it.  Or you scale it down before you store
it.  Or you do *something* more intelligent than trying to sent a GIGABYTE
image out on your homepage.

 If anyone has any input it would be greatly appreciated. I am a noob at
 this
 as the person who built this server is no longer with us and we are trying
 to put it back together.

You may want to hire a professional developer to fix what that other guy
built... :-v

-- 
Like Music?
http://l-i-e.com/artists.htm

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



[PHP] Referer parsing functions?

2005-02-18 Thread Brian Dunning
I've found a number of PHP classes for parsing server logs, but I just 
want to parse a single referer at a time. Anyone know of a class that 
will do this?

1) Extract just the site from the full referer string,
2) Extract the query keyword (if any) no matter what search engine the 
referer is from.

I may be asking too much, but one never knows unless one asks...  :)
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] fgetcsv() excel data missing

2005-02-18 Thread Richard Lynch
Binoy AV wrote:
   Could anybody please tell me how to read the data from an excel file ?
 It should work independent of the operating system. I don't want the csv
 format.

For your first step, you'll have to convince Microsoft to OpenSource their
code...

Oh, yeah.

You can't do that.

:-)

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] How to open a URL directly ?

2005-02-18 Thread Richard Lynch
Vaibhav Sibal wrote:
 Hey ppl,
 I have a scenario wherein the people logging into the system have
 different kinds of status as in a person can either be a admin, a
 user, or a supervisor etc. Now I have different web interfaces for all
 these kind of people. What I want to know is what function do i use to
 go to a URL directly in a case where status of the person is something
 like admin or user etc. For ex. if a person Robert is the admin and
 his name and password correctly matches from the database and the
 status of Robert as stored in the database is admin then as soon as he
 pressed the login button he should automatically be forwarded to a
 page, eg. admin.php, where he can access his stuff. Please tell me
 what function should I use ?

?php
  if ($access == 'admin'){
require 'admin.php';
  }
  elseif ($access == 'supervisor'){
require 'supervisor.php';
  }
  .
  .
  .
?

http://php.net/require


No need to waste an HTTP connection and clog up the network with redirects.

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] PHP to C interface?

2005-02-18 Thread Richard Lynch
N Deepak wrote:
   Is there a way to invoke C functions in a library (.so) from PHP?
   Like Xs in Perl?

Yes.

EVERYTHING in PHP, except for the core syntax of if/else/while can be
loaded this way.

Many times, it's compiled in static, but you can make most of the modules
be shared.

By definition, then, all you have to do is learn how to write a PHP
extension, which Rasmus tells you how to do in a one-hour lecture at any
PHP/Linux/Apache/OpenSource conference you care to name :-)

But rather than spend hundreds to attend a conference, you can access his
talk on this topic at:

http://talks.php.net


-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] My FIRST php atempt

2005-02-18 Thread Richard Lynch
David Freedman wrote:
 I am trying my FIRST php file with an attempt to connect
 to my mySql server.

 ?php
 // Connecting, selecting database
 $link = mysql_connect('localhost', 'host', 'my_passqword')
or die('Could not connect: ' . mysql_error());

Does this print out anything?

Is it more than just 'Could not connect: '?

What does it say?

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] MySQL and MySQLi compiling

2005-02-18 Thread Richard Lynch
Chris wrote:
 Hi, I've been trying to get these 2 compiled together for a while, and
 have had no luck.

 WHere my problem lies, I think, is that I'm not sure what directory
 should be specified on the --with-mysql part

Here's the deal:

configure needs to find *BOTH* 'mysql.h' files and
'mysql.so'/'mysql.lib' files *UNDER* the directory you feed it.

Figure out where your mysql.h files are.
Figure out where your mysql.lib/mysql.so files are.

Whatever directory structure they have in common, that's what you want.

In your case, since you were trying to use '/usr/include/mysql' I'm
betting that your mysql.lib and mysql.so are in '/usr/lib/mysql'

Which means that the only part in common those two directories have is
'/usr' and *THAT* is what you should use.

Again -- 'configure' has to start at the directory you feed it, and it has
to walk down the sub-directories, and it has to find both the 'mysql.h'
files and the 'mysql.lib/mysql.so' files.

Hope that helps.

PS This is true of all the extensions, and other configure scripts in
general.

PPS After you do a make install do an ldconfig if you are on a system
that uses ldconfig -- man ldconfig will tell you more, including show
you a 'verbose' option so you can confirm your software really really got
installed.

-- 
Like Music?
http://l-i-e.com/artists.htm

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



[PHP] Destroying the Session Object

2005-02-18 Thread Jacques
I am developing an application. When the user signs in a Session ID is 
created (for argument sake: 123). I have a sign out page that has the script 
session_destroy() on it. This page directs me to the sign in page. When I 
sign the same or any other user in again I get the same session id (123).

However, when I close the browser window and sign in again as any member, 
the session id changes.

How does this work and how can I ensure that a unique session id is 
allocated to every new user that signs in?

Jacques 

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



Re: [PHP] Help with SQL statement

2005-02-18 Thread Bret Hughes
On Thu, 2005-02-17 at 23:21, Jacques wrote:
 How can I determine which users have signed in and are still on-line during 
 the first minute after they have signed in? My sql statement currently 
 reads:
 
 SELECT * FROM tblusers WHERE usignedin = yes AND utimesignedin = (time() - 
 60)
 
 Hoe does one indicate seconds in a SQL statement? Can I use the time() 
 function or should I use the now() function rather?
 
 Thanks
 Jacques 

I almost do not know where to begin.

What database are you using?  The functions you need to be looking at
are going to be executed by the dbms not php.  Look in the dbms docs for
the time functions available.  Are you really interested in users who
logged in exactly 60 seconds ago ( you are using = afterall )?

if course this also depends on what type of data is stored in
utimesignedin if it is a timestamp with the resolution in seconds then
you should be good to go with the
whatever_database_function_returns_the_current_timestamp() - 60 deal.

Bret

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



[PHP] I got it working

2005-02-18 Thread David Freedman
I created a new user, and assigned privileges. Then tried to connect to the
server
and was denied access, because of a conflict between the mysql CLIENT
version
and the mysql server code due to the password encryption scheme installed in
version
4.1 of mysql. Running the following line fixed the problem

SET PASSWORD FOR 'my_username'@'my_host' = OLD_PASSWORD(\my_pass');

Thanks

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



Re: [PHP] Destroying the Session Object

2005-02-18 Thread Matt M.
 I am developing an application. When the user signs in a Session ID is
 created (for argument sake: 123). I have a sign out page that has the script
 session_destroy() on it. This page directs me to the sign in page. When I
 sign the same or any other user in again I get the same session id (123).
 
 However, when I close the browser window and sign in again as any member,
 the session id changes.
 
 How does this work and how can I ensure that a unique session id is
 allocated to every new user that signs in?


some good reading
http://us2.php.net/session

you could use http://us2.php.net/session_regenerate_id to create new ids

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



Re: [PHP] Crontab for Windows

2005-02-18 Thread Jason Barnett
[EMAIL PROTECTED] wrote:
 On W3K you could use this as the run line in
 Scheduled Tasks and probably the same in XP
 although I have not tested this. The same
 components exist in the W2K version although
 may be in different locations/names.
 
 Run: cmd /c c:\php\php.exe -q c:\path\to\php\file.php

This is *very* close to what I use with Windows XP (actually I use this
for file types so that I can right click and run a PHP file on the
command line).

cmd /K C:\php\php.exe -f %1

The %1 is a variable that gets replaced.  If you set this up for the
file type then the %1 is the name of the file.

So to apply this knowledge to scheduled tasks, you can do:
cmd /K C:\php\php.exe -f C:\path\to\your\file.php

 
 Start in: C:\path\to\php\file\
 
 Run as: username/pass with security acess to
 both php.exe and the file.php

Agreed... it is much easier to manage it this way although it is
*possible* to use the command runas to execute PHP as a different user.

For help on these commands, just use:
cmd /?
runas /?

 
 YMMV
 
 pjn
 


-- 
Teach a man to fish...

NEW? | http://www.catb.org/~esr/faqs/smart-questions.html
STFA | http://marc.theaimsgroup.com/?l=php-generalw=2
STFM | http://www.php.net/manual/en/index.php
STFW | http://www.google.com/search?q=php
LAZY |
http://mycroft.mozdev.org/download.html?name=PHPsubmitform=Find+search+plugins


signature.asc
Description: OpenPGP digital signature


[PHP] Newbie question

2005-02-18 Thread Adams, Tom
Does anyone know how to force PHP to require all local variables to be declared 
prior to use or if this is even possible?

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



Re: [PHP] MySQL and MySQLi compiling

2005-02-18 Thread Chris
Chris wrote:
./configure --with-apxs2=/usr/local/apache/bin/apxs --with-mysql=/usr 
--with-mysql-include-dir=/usr/include/mysql 
--with-mysql-lib-dir=/usr/lib/mysql --with-mysqli=/usr/bin/mysql_config

it might work. I've managed to stave of the need for the mysql 
extension for a week or two, but I have a good feeling about that one, 
and am hopeful it will work. I'll probably end up trying that one this 
weekend.

It didn't work. :(
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Newbie question

2005-02-18 Thread Adrian
error_reporting(E_ALL);
Then you will get a notice when you try to read a variable which
doesn't exist.

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



Re: [PHP] MySQL and MySQLi compiling

2005-02-18 Thread Chris
Richard Lynch wrote:
Here's the deal:
configure needs to find *BOTH* 'mysql.h' files and
'mysql.so'/'mysql.lib' files *UNDER* the directory you feed it.
Figure out where your mysql.h files are.
Figure out where your mysql.lib/mysql.so files are.
.
 

Thanks for the response, in fact I can't find any mysql.lib files, and 
the only mysql.so I found is under perl directory.

I had tried /usr as the argument to --with-mysql , but it made no 
obvious change.

I'm including  some file paths that seem like the could be important below.
Thanks,
Chris
[The only mysql.so that locate could find]
/usr/lib/perl5/vendor_perl/5.8.0/i386-linux-thread-multi/auto/DBD/mysql/mysql.so
[EMAIL PROTECTED] php]# rpm -q --filesbypkg MySQL-devel
MySQL-devel   /usr/bin/comp_err
MySQL-devel   /usr/bin/mysql_config
MySQL-devel   /usr/include/mysql
MySQL-devel   /usr/include/mysql/chardefs.h
MySQL-devel   /usr/include/mysql/errmsg.h
MySQL-devel   /usr/include/mysql/history.h
MySQL-devel   /usr/include/mysql/keycache.h
MySQL-devel   /usr/include/mysql/keymaps.h
MySQL-devel   /usr/include/mysql/m_ctype.h
MySQL-devel   /usr/include/mysql/m_string.h
MySQL-devel   /usr/include/mysql/my_alloc.h
MySQL-devel   /usr/include/mysql/my_config.h
MySQL-devel   /usr/include/mysql/my_dbug.h
MySQL-devel   /usr/include/mysql/my_dir.h
MySQL-devel   /usr/include/mysql/my_getopt.h
MySQL-devel   /usr/include/mysql/my_global.h
MySQL-devel   /usr/include/mysql/my_list.h
MySQL-devel   /usr/include/mysql/my_net.h
MySQL-devel   /usr/include/mysql/my_no_pthread.h
MySQL-devel   /usr/include/mysql/my_pthread.h
MySQL-devel   /usr/include/mysql/my_semaphore.h
MySQL-devel   /usr/include/mysql/my_sys.h
MySQL-devel   /usr/include/mysql/my_xml.h
MySQL-devel   /usr/include/mysql/mysql.h
MySQL-devel   /usr/include/mysql/mysql_com.h
MySQL-devel   /usr/include/mysql/mysql_embed.h
MySQL-devel   /usr/include/mysql/mysql_time.h
MySQL-devel   /usr/include/mysql/mysql_version.h
MySQL-devel   /usr/include/mysql/mysqld_error.h
MySQL-devel   /usr/include/mysql/raid.h
MySQL-devel   /usr/include/mysql/readline.h
MySQL-devel   /usr/include/mysql/rlmbutil.h
MySQL-devel   /usr/include/mysql/rlprivate.h
MySQL-devel   /usr/include/mysql/rlshell.h
MySQL-devel   /usr/include/mysql/rltypedefs.h
MySQL-devel   /usr/include/mysql/sql_common.h
MySQL-devel   /usr/include/mysql/sql_state.h
MySQL-devel   /usr/include/mysql/sslopt-case.h
MySQL-devel   /usr/include/mysql/sslopt-longopts.h
MySQL-devel   /usr/include/mysql/sslopt-vars.h
MySQL-devel   /usr/include/mysql/tilde.h
MySQL-devel   /usr/include/mysql/typelib.h
MySQL-devel   /usr/include/mysql/xmalloc.h
MySQL-devel   /usr/lib/mysql
MySQL-devel   /usr/lib/mysql/libdbug.a
MySQL-devel   /usr/lib/mysql/libheap.a
MySQL-devel   /usr/lib/mysql/libmerge.a
MySQL-devel   /usr/lib/mysql/libmygcc.a
MySQL-devel   /usr/lib/mysql/libmyisam.a
MySQL-devel   /usr/lib/mysql/libmyisammrg.a
MySQL-devel   /usr/lib/mysql/libmysqlclient.a
MySQL-devel   /usr/lib/mysql/libmysqlclient.la
MySQL-devel   /usr/lib/mysql/libmysqlclient_r.a
MySQL-devel   /usr/lib/mysql/libmysqlclient_r.la
MySQL-devel   /usr/lib/mysql/libmystrings.a
MySQL-devel   /usr/lib/mysql/libmysys.a
MySQL-devel   /usr/lib/mysql/libnisam.a
MySQL-devel   /usr/lib/mysql/libvio.a
MySQL-devel   /usr/share/doc/packages/MySQL-devel
MySQL-devel   
/usr/share/doc/packages/MySQL-devel/EXCEPTIONS-CLIENT

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


Re: [PHP] XHTML 1.1 + php sessions = :(

2005-02-18 Thread Your Name
Thank you very much for that solution however I need something slitely 
different.  This is a CMS for distribution... not everybody that's 
going to use it can go in and edit the config files.  I've heard of a 
command called ini_set(); which temporarily changes it just for the 
script.  Would you mind letting me know how to use ini_set(); with the 
use only sessions command?  Thank-you very very much!


 On Wed, 2005-02-16 at 19:07, b1nary Developement Team wrote:
  Hi there guys... First time caller here ;).
  
  I'm currently developing a content management system.  One of it's 
  features is that it's going to be completely standards compliant 
(XHTML 
  1.1).
  
  I'm having some troubles however, and they come in the form of 
  sessions.  When I use session_start(), it throws the PHPSESSID 
into the 
  URL of all of my links and form actions and what not.  This is a 
problem 
  because in my forms it throws in a hidden input, which doesn't 
validate 
  right, plus they don't use amp; insteand of just .  Is there any 
way 
  to stop a session from being passed through the URL?
  
 
 Sure enable session.use_only_cookies in php.cfg and cookies will be
 used. nothing in the page sent to the browser at all as far as I 
know.
 
 http://us4.php.net/session
 
 Bret
  -- 
  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