Re: [PHP] How do you do the ? mark after a filename

2006-11-12 Thread Thomas Bonham

Thank you for that, it was a big help.

Can I also call function that way?

Again thank you for your help.

Thomas

Tom Chubb wrote:

On 12/11/06, Thomas Bonham [EMAIL PROTECTED] wrote:

Hi All,

I keep seeing the ? mark after many file names index.php?id=234.

So what I would like to know is how do you make them. I have heard that
they can make a programs life sampler when doing somethings with a 
database.


Thank you,

Thomas

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



You can retrieve variables from the URL using the GET method. This is
similar to using the POST method with data from forms.
A typical url with something like
www.domain.com/index.php?id=35format=html would provide the page with
two variables, id  format.
It's the equivalent of putting the following in the page.
$id = 35;
$format = 'html';

This is popular with simple CMS/Templating systems where you use a
standard page and the id variable loads the relevant article text.

Hope that helps.

Tom


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



[PHP] How do you do the ? mark after a filename

2006-11-11 Thread Thomas Bonham

Hi All,

I keep seeing the ? mark after many file names index.php?id=234.

So what I would like to know is how do you make them. I have heard that 
they can make a programs life sampler when doing somethings with a database.


Thank you,

Thomas

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



[PHP] LDAP Authentication

2006-05-12 Thread Thomas Bonham

Hello,

I'm trying to do a ldap authentication page. I can get there username 
and I don't know how to get the password from ldap. It didn't show up in 
the the search for the command line. So how do I get the password of the 
users?


Thomas

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



[PHP] PHP Links

2006-03-25 Thread Thomas Bonham

I'm trying to find out how make following happen

Example:
http://www.example.com/test.php?id=20

What makes this happen and how do I make it.

Thanks

Thomas

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



[PHP] Email Form

2006-01-19 Thread Thomas Bonham

Hello All,

I don't remember how to do email with php. I have all of it done, except 
for I can't get it to show the senders email address. All I get it from 
[EMAIL PROTECTED]


If some one has a example that they can post that would be great.

Thank You

Thomas

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



[PHP] Send in a form there email

2005-07-24 Thread Thomas Bonham
Hello All,
I'm trying to format a the variables for the form to send them there
email. What I need is how do I put a new line in the string that is be
send.

Thanks 
Thomas
-- 
--
Thomas Bonham RHCT (Red Hat Certified Technician)
[EMAIL PROTECTED]
bonhamlinux.org
Cell 602-402-9786

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



[PHP] Re: Send in a form there email

2005-07-24 Thread Thomas Bonham

I fond the fix.

When you use \n in the string and then try to echo it back it doesn't 
echo back right. But when you send it the \n works.


Thomas


Thomas Bonham wrote:

Hello All,
I'm trying to format a the variables for the form to send them there
email. What I need is how do I put a new line in the string that is be
send.

Thanks 
Thomas


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



Re: [PHP] Re: Session warning

2005-07-17 Thread Thomas Bonham
Thanks is for the help.
That is a very good command.

Here is what I have now.
[EMAIL PROTECTED] property]$ od -c adminlogin.php | head
000  ?   p   h   p   s   e   s   s   i   o   n   _   s
020   t   a   r   t   (   )   ;   r   e   q   u   i   r   e   (
040  f   u   n   c   t   l   i   b   .   p   h   p  )   ;
060   ? \r  \n  h   t   m   l \r  \n
100  h   e   a   d \r  \n  \t  t   i
120   t   l   e  L   o   g   i   n  /   t   i   t   l   e
140 \r  \n  \t  l   i   n   k   r   e   l   =   
160   s   t   y   l   e   s   h   e   e   t  t   y   p   e
200   =  t   e   x   t   /   c   s   s  h   r   e   f
220   =  .   .   /   .   .   /   c   s   s   /   t   a   b   l
[EMAIL PROTECTED] property]$

Also I gess I can't have the null line at the top of my file.

Again Thanks of the help.
Thomas

On 7/16/05, Rasmus Lerdorf [EMAIL PROTECTED] wrote:
 Thomas Bonham wrote:
  Ok that is some help.
 
  The first five lines of the file are the following.
 
 
 ?php
 session_start();
 require(functlib.php);
 ?
 
  od -c adminlogin.php | head out put the folowing.
 
  [EMAIL PROTECTED] property]$ od -c adminlogin.php | head
  000  \r  \n  ?   p   h   p  \r  \n  \t   s
  020   e   s   s   i   o   n   _   s   t   a   r   t   (   )   ;  \r
  040  \n  \t   r   e   q   u   i   r   e   (  f   u   n   c
  060   t   l   i   b   .   p   h   p  )   ;  \r  \n
  100   ? \r  \n  h   t   m   l \r  \n
  120  h   e   a   d \r  \n  \t  t   i
  140   t   l   e  C   I   S   1   6   6   A   E   -   A
  160   d   m   i   n   L   o   g   i   n  /   t   i   t   l
  200   e \r  \n  \t  l   i   n   k   r   e   l   =
  220  s   t   y   l   e   s   h   e   e   t  t   y   p
 
 well, there is your answer.  Your file starts with \r\n
 So your PHP tag is not the first thing in your file and PHP will output
 that leading \r\n.
 
 -Rasmus
 


-- 
--
Thomas Bonham
[EMAIL PROTECTED]
bonhamlinux.org
Cell 602-402-9786

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



[PHP] Session warning

2005-07-16 Thread Thomas Bonham
Hello All,
I'm working on session and I'm getting this warning. Maybe someone can
help fixing this problem. Below is the following code.

Warning: 
Warning: session_start() [function.session-start]: Cannot send session
cookie - headers already sent by (output started at
/var/www/html/bonham/cornerstone-data/property/adminlogin.php:2) in
/var/www/html/bonham/cornerstone-data/property/adminlogin.php on line
3

Warning: session_start() [function.session-start]: Cannot send session
cache limiter - headers already sent (output started at
/var/www/html/bonham/cornerstone-data/property/adminlogin.php:2) in
/var/www/html/bonham/cornerstone-data/property/adminlogin.php on line
3


Then I get my login fields.

Code:
?php 
 session_start();
 require(functlib.php); 
   ?
   html
   head
 titleCIS166AE - Admin Login/title
 link rel=stylesheet type=text/css href=/../../css/table.css
   /head
   body
   
   
   ?php
 if(isset($_POST['txtUser'])  isset($_POST['txtPass']))
 {  
  if(CheckUser($_POST['txtUser'],$_POST['txtPass']))
$_SESSION['valid_user']=$_POST['txtUser'];  
 }
 
 if(CheckAuth()==false)
 {
 //Code to make authentication
 ?
form method=post action=adminlogin.php name=login
Please Login
Username:
input name=txtUser type=text
Password:
input name=txtPass type=password
input type=submit value=Login
input type=reset value=Clear
/form
?php
}
else
{
//Code if authenticated
echo Thank you, you have been authenticated as
b.$_SESSION['valid_user']./bbr;
  
}
?

?php if(isset($_SESSION['valid_user'])){echo a
href=\adminlogout.php\Logout/a;}?

/body
/html

Function FIle:
?php
//PHP Functions that can be included in pages

function CheckAuth()
{
if(isset($_SESSION['valid_user']))
return true;
else
return false;
}

function CheckUser($username, $password)
{
$db = new mysqli('localhost','bonham','password_goes 
here','bonham');

$sql=Select * from auth where username = '.$username.' and
password = '.$password.';
$result=$db-query($sql);
$db-close();
if($result-num_rows0)
return true;
else
return false;
}

?

Thank for the help.
Thomas
-- 
--
Thomas Bonham
[EMAIL PROTECTED]
bonhamlinux.org
Cell 602-402-9786

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



[PHP] Re: Session warning

2005-07-16 Thread Thomas Bonham

Jasper Bryant-Greene wrote:

Thomas Bonham wrote:


Hello All,
I'm working on session and I'm getting this warning. Maybe someone can
help fixing this problem. Below is the following code.

Warning: Warning: session_start() [function.session-start]: Cannot 
send session

cookie - headers already sent by (output started at
/var/www/html/bonham/cornerstone-data/property/adminlogin.php:2) in
/var/www/html/bonham/cornerstone-data/property/adminlogin.php on line
3



Are you absolutely sure that there is *no* output before the 
session_start() in adminlogin.php?


If there is it won't work. Even a space before the first ?php, or a 
Unicode BOM, or any kind of output can screw it up.


Jasper


The first thing at is in my code is the start session command.

Thomas

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



Re: [PHP] Re: Session warning

2005-07-16 Thread Thomas Bonham
Ok that is some help.

The first five lines of the file are the following.


   ?php 
 session_start();
 require(functlib.php); 
   ?

od -c adminlogin.php | head out put the folowing.

[EMAIL PROTECTED] property]$ od -c adminlogin.php | head
000  \r  \n  ?   p   h   p  \r  \n  \t   s
020   e   s   s   i   o   n   _   s   t   a   r   t   (   )   ;  \r
040  \n  \t   r   e   q   u   i   r   e   (  f   u   n   c
060   t   l   i   b   .   p   h   p  )   ;  \r  \n
100   ? \r  \n  h   t   m   l \r  \n
120  h   e   a   d \r  \n  \t  t   i
140   t   l   e  C   I   S   1   6   6   A   E   -   A
160   d   m   i   n   L   o   g   i   n  /   t   i   t   l
200   e \r  \n  \t  l   i   n   k   r   e   l   =
220  s   t   y   l   e   s   h   e   e   t  t   y   p
[EMAIL PROTECTED] property]$


Thanks
Thomas


On 7/16/05, Rasmus Lerdorf [EMAIL PROTECTED] wrote:
 On Sat, 16 Jul 2005, Thomas Bonham wrote:
  Jasper Bryant-Greene wrote:
   Thomas Bonham wrote:
  
   Hello All,
   I'm working on session and I'm getting this warning. Maybe someone can
   help fixing this problem. Below is the following code.
  
   Warning: Warning: session_start() [function.session-start]: Cannot
   send session
   cookie - headers already sent by (output started at
   /var/www/html/bonham/cornerstone-data/property/adminlogin.php:2) in
   /var/www/html/bonham/cornerstone-data/property/adminlogin.php on line
   3
  
  
   Are you absolutely sure that there is *no* output before the
   session_start() in adminlogin.php?
  
   If there is it won't work. Even a space before the first ?php, or a
   Unicode BOM, or any kind of output can screw it up.
  
   Jasper
 
  The first thing at is in my code is the start session command.
 
 The error message indicates that your start_session() call is on line 3
 and that output was started at line 2.  Try pasting the first 5 lines of
 that adminlogin.php script here.  The other thing that is normally useful
 is to have a look at the raw bytes in the file.  Try this:
 
   od -c adminlogin.php | head
 
 from your command line.  That will tell you exactly what is in the file.
 Sometimes editors try to be a little bit too smart for their own good.
 
 -Rasmus
 


-- 
--
Thomas Bonham
[EMAIL PROTECTED]
bonhamlinux.org
Cell 602-402-9786

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



Re: [PHP] SESSION

2005-07-15 Thread Thomas Bonham
Thanks for all of the help. It is working now(On one page).

Thomas

On 7/11/05, Richard Lynch [EMAIL PROTECTED] wrote:
 On Sun, July 10, 2005 7:50 pm, Thomas Bonham said:
  I have been trying to update  fix the errors.
  With the new code (That I will post at the end), I'm only getting one
  error and that is that it can't start the session because that it has
  been started.
 
 Whoops!
 
 If you've set php.ini to ALWAYS start a session, then you don't need
 session_start() after all. Sorry!
 
 You may still be experiencing the bug where session data comes back as
 string references
 
 var_dump($_SESSION);
 
 in several places.
 
 If you see  in front of your strings, then that's your problem.
 
 --
 Like Music?
 http://l-i-e.com/artists.htm
 
 
 


-- 
--
Thomas Bonham
[EMAIL PROTECTED]
bonhamlinux.org
Cell 602-402-9786

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



Re: [PHP] SESSION

2005-07-10 Thread Thomas Bonham

Using the examples for php and my book.
This is the error that I get with the following code.

ERROR:
[client 127.0.0.1] PHP Warning:  session_start(): Cannot send session 
cookie - headers already sent by (output started at 
/var/www/html/thomas/cis166ae/data/login.php:2) in 
/var/www/html/thomas/cis166ae/data/login.php on line 3, referer: 
http://localhost/thomas/cis166ae/data/
[client 127.0.0.1] PHP Warning:  session_start(): Cannot send session 
cache limiter - headers already sent (output started at 
/var/www/html/thomas/cis166ae/data/login.php:2) in 
/var/www/html/thomas/cis166ae/data/login.php on line 3, referer: 
http://localhost/thomas/cis166ae/data/
[client 127.0.0.1] PHP Warning:  session_start(): Cannot send session 
cookie - headers already sent by (output started at 
/var/www/html/thomas/cis166ae/data/login.php:2) in 
/var/www/html/thomas/cis166ae/data/login.php on line 3, referer: 
http://localhost/thomas/cis166ae/data/login.php
[client 127.0.0.1] PHP Warning:  session_start(): Cannot send session 
cache limiter - headers already sent (output started at 
/var/www/html/thomas/cis166ae/data/login.php:2) in 
/var/www/html/thomas/cis166ae/data/login.php on line 3, referer: 
http://localhost/thomas/cis166ae/data/login.php
[client 127.0.0.1] PHP Fatal error:  Call to a member function on a 
non-object in /var/www/html/thomas/cis166ae/data/login.php on line 23, 
referer: http://localhost/thomas/cis166ae/data/login.php
[Sun Jul 10 18:33:02 2005] [error] [client 127.0.0.1] File does not 
exist: /var/www/html/favicon.ico

[EMAIL PROTECTED] httpd]#


CODE:


   ?php
   session_start();

   if(isset($_POST['username'])  isset($_POST['passwd']))
   {
   $username = $_POST['username'];
   $passwd = $_POST['passwd'];

   /* Connecting to database */
   $db = pg_connect (
dbname=auth
user=auth
hostaddr=127.0.01
);
   $query = SELECT * FROM auth_user
WHERE name='$username'
AND
password='$passwd';


   /* Running query */
   $result-pg_query($query);
   $rows = pg_num_rows($result);
   if($rows  0)
   {

   $_SESSION['valid_user'] = $name;

   }
   else
   {
   echo 'Failed';
   }
   }
   ?
   htmlheadtitleLogin/title
   link rel=stylesheet type=text/css href=../css/table.css
   link rel=stylesheet type=text/css href=../css/font.css
   /head
   body
   table class=center_100
   tr
   td class=td_100_center

   ?php

if(isset($_SESSION['valid_user']))
{
echo 'You are logged in as: '.$_SESSION['valid_user'].'br';
}
else
{
if(isset($username))
{
echo 'Could not log you in';
}
else
{
echo 'You are not login in.br';
}

echo 'form method=post action=login.php';
echo 'User Name:';
echo 'input type=text name=username';
echo 'Password:';
echo 'input type=text name=passwd';
echo 'input type=submit value=Log in';
echo '/font';
}
?



   /td
   /tr
   /table

   /body
   /html


Thanks
Thomas



Richard Lynch wrote:

On Sat, July 9, 2005 8:27 pm, Thomas Bonham said:


If someone can send me a example of a login sesson.



http://php.net/session_start



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



Re: [PHP] SESSION

2005-07-10 Thread Thomas Bonham
Using the examples for php and my book.
This is the error that I get with the following code.

ERROR:
[client 127.0.0.1] PHP Warning:  session_start(): Cannot send session
cookie - headers already sent by (output started at
/var/www/html/thomas/cis166ae/data/login.php:2) in
/var/www/html/thomas/cis166ae/data/login.php on line 3, referer:
http://localhost/thomas/cis166ae/data/
[client 127.0.0.1] PHP Warning:  session_start(): Cannot send session
cache limiter - headers already sent (output started at
/var/www/html/thomas/cis166ae/data/login.php:2) in
/var/www/html/thomas/cis166ae/data/login.php on line 3, referer:
http://localhost/thomas/cis166ae/data/
[client 127.0.0.1] PHP Warning:  session_start(): Cannot send session
cookie - headers already sent by (output started at
/var/www/html/thomas/cis166ae/data/login.php:2) in
/var/www/html/thomas/cis166ae/data/login.php on line 3, referer:
http://localhost/thomas/cis166ae/data/login.php
[client 127.0.0.1] PHP Warning:  session_start(): Cannot send session
cache limiter - headers already sent (output started at
/var/www/html/thomas/cis166ae/data/login.php:2) in
/var/www/html/thomas/cis166ae/data/login.php on line 3, referer:
http://localhost/thomas/cis166ae/data/login.php
[client 127.0.0.1] PHP Fatal error:  Call to a member function on a
non-object in /var/www/html/thomas/cis166ae/data/login.php on line 23,
referer: http://localhost/thomas/cis166ae/data/login.php
[Sun Jul 10 18:33:02 2005] [error] [client 127.0.0.1] File does not
exist: /var/www/html/favicon.ico
[EMAIL PROTECTED] httpd]#


CODE:

   
   ?php
   session_start();
   
   if(isset($_POST['username'])  isset($_POST['passwd']))
   {
   $username = $_POST['username'];
   $passwd = $_POST['passwd'];
   
   /* Connecting to database */
   $db = pg_connect (
dbname=auth
user=auth
hostaddr=127.0.01
);
   $query = SELECT * FROM auth_user 
WHERE name='$username' 
AND
password='$passwd';

   
   /* Running query */
   $result-pg_query($query);
   $rows = pg_num_rows($result);
   if($rows  0)
   {
   
   $_SESSION['valid_user'] = $name;
   
   }
   else
   {
   echo 'Failed';
   }
   }
   ?
   htmlheadtitleLogin/title
   link rel=stylesheet type=text/css href=../css/table.css
   link rel=stylesheet type=text/css href=../css/font.css
   /head
   body
   table class=center_100
   tr
   td class=td_100_center
   
   ?php

if(isset($_SESSION['valid_user']))
{
echo 'You are logged in as: '.$_SESSION['valid_user'].'br';
}
else
{
if(isset($username))
{
echo 'Could not log you in';
}
else
{
echo 'You are not login in.br';
}

echo 'form method=post action=login.php';
echo 'User Name:';
echo 'input type=text name=username';
echo 'Password:';
echo 'input type=text name=passwd';
echo 'input type=submit value=Log in';
echo '/font';
}
?



   /td
   /tr
   /table
   
   /body
   /html
   

Thanks
Thomas

On 7/10/05, Richard Lynch [EMAIL PROTECTED] wrote:
 On Sat, July 9, 2005 8:27 pm, Thomas Bonham said:
  If someone can send me a example of a login sesson.
 
 http://php.net/session_start
 
 --
 Like Music?
 http://l-i-e.com/artists.htm
 
 
 


-- 
--
Thomas Bonham
[EMAIL PROTECTED]
bonhamlinux.org
Cell 602-402-9786

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



Re: [PHP] SESSION

2005-07-10 Thread Thomas Bonham
I have been trying to update  fix the errors.
With the new code (That I will post at the end), I'm only getting one 
error and that is that it can't start the session because that it has 
been started.

CODE:

   ?php
   session_start();

   if(isset($_POST['username'])  isset($_POST['passwd']))
   {
   $username = $_POST['username'];
   $passwd = $_POST['passwd'];

   /* Connecting to database */
   $db = pg_connect (
dbname=auth
user=auth
hostaddr=127.0.01
);
   $query = SELECT * FROM auth_user
WHERE name='$username'
AND
password='$passwd';


   /* Running query */
   $result = pg_query($db,$query);
   //$rows = pg_num_rows($result);
   //$rows-pg_num_rows($result);
   if($rows = pg_num_rows($result)  0)
   {

   $_SESSION['valid_user'] = $name;

   }
   else
   {
   echo 'Failed';
   }
   }
   ?
   htmlheadtitleLogin/title
   link rel=stylesheet type=text/css href=../css/table.css
   link rel=stylesheet type=text/css href=../css/font.css
   /head
   body
   table class=center_100
   tr
   td class=td_100_center

   ?php

if(isset($_SESSION['valid_user']))
{
echo 'You are logged in as: '.$_SESSION['valid_user'].'br';
}
else
{
if(isset($username))
{
echo 'Could not log you in';
}
else
{
echo 'You are not login in.br';
}

echo 'form method=post action=login.php';
echo 'User Name:';
echo 'input type=text name=username';
echo 'Password:';
echo 'input type=text name=passwd';
echo 'input type=submit value=Log in';
echo '/font';
}
?



   /td
   /tr
   /table

   /body
   /html


ERROR:
[client 127.0.0.1] PHP Notice:  A session had already been started - 
ignoring session_start() in /var/www/html/thomas/cis166ae/data/login.php 
on line 3, referer: http://localhost/thomas/cis166ae/data/
[client 127.0.0.1] PHP Notice:  A session had already been started - 
ignoring session_start() in /var/www/html/thomas/cis166ae/data/login.php 
on line 3, referer: http://localhost/thomas/cis166ae/data/login.php
[client 127.0.0.1] PHP Notice:  Undefined variable:  name in 
/var/www/html/thomas/cis166ae/data/login.php on line 29, referer: 
http://localhost/thomas/cis166ae/data/login.php
[Sun Jul 10 19:44:57 2005] [error] [client 127.0.0.1] File does not 
exist: /var/www/html/favicon.ico

Thx
Thomas




On 7/10/05, Thomas Bonham [EMAIL PROTECTED] wrote:
 Using the examples for php and my book.
 This is the error that I get with the following code.
 
 ERROR:
 [client 127.0.0.1] PHP Warning:  session_start(): Cannot send session
 cookie - headers already sent by (output started at
 /var/www/html/thomas/cis166ae/data/login.php:2) in
 /var/www/html/thomas/cis166ae/data/login.php on line 3, referer:
 http://localhost/thomas/cis166ae/data/
 [client 127.0.0.1] PHP Warning:  session_start(): Cannot send session
 cache limiter - headers already sent (output started at
 /var/www/html/thomas/cis166ae/data/login.php:2) in
 /var/www/html/thomas/cis166ae/data/login.php on line 3, referer:
 http://localhost/thomas/cis166ae/data/
 [client 127.0.0.1] PHP Warning:  session_start(): Cannot send session
 cookie - headers already sent by (output started at
 /var/www/html/thomas/cis166ae/data/login.php:2) in
 /var/www/html/thomas/cis166ae/data/login.php on line 3, referer:
 http://localhost/thomas/cis166ae/data/login.php
 [client 127.0.0.1] PHP Warning:  session_start(): Cannot send session
 cache limiter - headers already sent (output started at
 /var/www/html/thomas/cis166ae/data/login.php:2) in
 /var/www/html/thomas/cis166ae/data/login.php on line 3, referer:
 http://localhost/thomas/cis166ae/data/login.php
 [client 127.0.0.1] PHP Fatal error:  Call to a member function on a
 non-object in /var/www/html/thomas/cis166ae/data/login.php on line 23,
 referer: http://localhost/thomas/cis166ae/data/login.php
 [Sun Jul 10 18:33:02 2005] [error] [client 127.0.0.1] File does not
 exist: /var/www/html/favicon.ico
 [EMAIL PROTECTED] httpd]#
 
 
 CODE:
 
 
?php
session_start();
 
if(isset($_POST['username'])  isset($_POST['passwd']))
{
$username = $_POST['username'];
$passwd = $_POST['passwd'];
 
/* Connecting to database */
$db = pg_connect (
 dbname=auth

Re: [PHP] SESSION

2005-07-10 Thread Thomas Bonham

I have been trying to update  fix the errors.
With the new code (That I will post at the end), I'm only getting one 
error and that is that it can't start the session because that it has 
been started.


CODE:

   ?php
   session_start();

   if(isset($_POST['username'])  isset($_POST['passwd']))
   {
   $username = $_POST['username'];
   $passwd = $_POST['passwd'];

   /* Connecting to database */
   $db = pg_connect (
dbname=auth
user=auth
hostaddr=127.0.01
);
   $query = SELECT * FROM auth_user
WHERE name='$username'
AND
password='$passwd';


   /* Running query */
   $result = pg_query($db,$query);
   //$rows = pg_num_rows($result);
   //$rows-pg_num_rows($result);
   if($rows = pg_num_rows($result)  0)
   {

   $_SESSION['valid_user'] = $name;

   }
   else
   {
   echo 'Failed';
   }
   }
   ?
   htmlheadtitleLogin/title
   link rel=stylesheet type=text/css href=../css/table.css
   link rel=stylesheet type=text/css href=../css/font.css
   /head
   body
   table class=center_100
   tr
   td class=td_100_center

   ?php

if(isset($_SESSION['valid_user']))
{
echo 'You are logged in as: '.$_SESSION['valid_user'].'br';
}
else
{
if(isset($username))
{
echo 'Could not log you in';
}
else
{
echo 'You are not login in.br';
}

echo 'form method=post action=login.php';
echo 'User Name:';
echo 'input type=text name=username';
echo 'Password:';
echo 'input type=text name=passwd';
echo 'input type=submit value=Log in';
echo '/font';
}
?



   /td
   /tr
   /table

   /body
   /html


ERROR:
[client 127.0.0.1] PHP Notice:  A session had already been started - 
ignoring session_start() in /var/www/html/thomas/cis166ae/data/login.php 
on line 3, referer: http://localhost/thomas/cis166ae/data/
[client 127.0.0.1] PHP Notice:  A session had already been started - 
ignoring session_start() in /var/www/html/thomas/cis166ae/data/login.php 
on line 3, referer: http://localhost/thomas/cis166ae/data/login.php
[client 127.0.0.1] PHP Notice:  Undefined variable:  name in 
/var/www/html/thomas/cis166ae/data/login.php on line 29, referer: 
http://localhost/thomas/cis166ae/data/login.php
[Sun Jul 10 19:44:57 2005] [error] [client 127.0.0.1] File does not 
exist: /var/www/html/favicon.ico


Thx
Thomas




Thomas Bonham wrote:

Using the examples for php and my book.
This is the error that I get with the following code.

ERROR:
[client 127.0.0.1] PHP Warning:  session_start(): Cannot send session
cookie - headers already sent by (output started at
/var/www/html/thomas/cis166ae/data/login.php:2) in
/var/www/html/thomas/cis166ae/data/login.php on line 3, referer:
http://localhost/thomas/cis166ae/data/
[client 127.0.0.1] PHP Warning:  session_start(): Cannot send session
cache limiter - headers already sent (output started at
/var/www/html/thomas/cis166ae/data/login.php:2) in
/var/www/html/thomas/cis166ae/data/login.php on line 3, referer:
http://localhost/thomas/cis166ae/data/
[client 127.0.0.1] PHP Warning:  session_start(): Cannot send session
cookie - headers already sent by (output started at
/var/www/html/thomas/cis166ae/data/login.php:2) in
/var/www/html/thomas/cis166ae/data/login.php on line 3, referer:
http://localhost/thomas/cis166ae/data/login.php
[client 127.0.0.1] PHP Warning:  session_start(): Cannot send session
cache limiter - headers already sent (output started at
/var/www/html/thomas/cis166ae/data/login.php:2) in
/var/www/html/thomas/cis166ae/data/login.php on line 3, referer:
http://localhost/thomas/cis166ae/data/login.php
[client 127.0.0.1] PHP Fatal error:  Call to a member function on a
non-object in /var/www/html/thomas/cis166ae/data/login.php on line 23,
referer: http://localhost/thomas/cis166ae/data/login.php
[Sun Jul 10 18:33:02 2005] [error] [client 127.0.0.1] File does not
exist: /var/www/html/favicon.ico
[EMAIL PROTECTED] httpd]#


CODE:

   
   ?php

   session_start();
   
   if(isset($_POST['username'])  isset($_POST['passwd']))

   {
   $username = $_POST['username'];
   $passwd = $_POST['passwd'];
	   
	   /* Connecting to database */

   $db = pg_connect (
dbname=auth
user=auth
hostaddr

[PHP] SESSION

2005-07-09 Thread Thomas Bonham

Hello All,
If someone can send me a example of a login sesson.

Thomas

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



[PHP] Re: Can someone help me build a regular expression?

2005-05-02 Thread Thomas Bonham
[EMAIL PROTECTED] wrote:
Hi All,
I've sucessfully got a JavaScript validating some text boxes to make
sure that only numbers exist.I cheated and downloaded a regular
expression someon else had used and that works nicely.  I wish to
validate the text box in the format of:
xXX.X
With the upper case Xs being a required number and the lower case x
being allowed but not needed.
Can anybody help me?

Ta
Matthew



You mite try this. I know that this work with perl.
=~ m/^[0-9][A-Z][a-z]{2-3} \.[0-9]+$/
I'm still very new to this. But I'm trying to help.
Thomas
[EMAIL PROTECTED]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Newbie Help

2005-05-02 Thread Thomas Bonham
Hello,
Thank for the information.

If that is not a good idea then how would you do it.

Thomas
--- Richard Collyer [EMAIL PROTECTED] wrote:
 Hello,
 
 ?php
if(isset($_GET['page']))
{include($_GET['page'] .
 .php);}
   else
{echo(Page Not Set.);}
 ?
 
 Should work if you use ?page=index
 
 Might I suggest that what you are doing is a bad
 idea. Not only will it 
 look bad becuase of people seeing stuff like
 ?page=/review/review23.php 
 in the URL. Also its a security risk allowing people
 to call php scripts 
 from the URL.
 
 Cheers
 Richard
 
 Thomas Bonham wrote:
  Hello All,
  
  First of I'm new to this a hop I'm doing this
 right.
  
  If some one can help me with my web site page. I'm
 trying to make it
  call a page and I get a error line 42. Error:
 
 http://bonhamlinux.org/idex.php?page=links/index.php
  
  The code that I'm trying to do this is the
 following:
  ?php
   if(isset($_GET ['page']))
   {include($_GET ['page']..php);}
   else
   {echo(Page Not Set.);}
  ?
  
  My site is: http://bonhamlinux.org
  My email is: [EMAIL PROTECTED]
  
  Thanks for all the help.
  Thomas
  
 
 

Thomas Bonham
Linux Rocks
http://www.bonhamlinux.org
Cell 602 402 9786
E-mail [EMAIL PROTECTED]
YIM freeswimfreak

__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

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



Re: [PHP] Newbie Help

2005-05-02 Thread Thomas Bonham
Thanks for the help.

It works, for the most part.

Now I'm going to write the links page.

Thanks agin for all the great help.

Thomas
--- Mark Cain [EMAIL PROTECTED] wrote:
 Also, after I looked at more of your code you will
 need to specify the php
 extension in only one of two places.  Currently you
 are specifying it in 1)
 the code below and in 2) nav.php and in nav.php you
 don't have it specified
 for the main but you do for the other links.  That
 means that the code
 supplies the .php extension for main (which it needs
 to because it is simply
 main and not main.php) but the other pages are
 specified as name.ext
 with the .php.  Then when that page name gets to the
 script, the script is
 adding .php onto the variable -- resulting in
 main.php, links/index.php.php,
 email/email.php.php and so forth.
 
 Do it one place or the other -- but do it
 consistently.
 
 Looks like you're close to getting it to work and
 I'm close to going to bed.
 
 Mark Cain
 
 
 
  The code that I'm trying to do this is the
 following:
  ?php
if(isset($_GET ['page']))
{include($_GET ['page']..php);}
else
{echo(Page Not Set.);}
  ?
  
  My site is: http://bonhamlinux.org
  My email is: [EMAIL PROTECTED]
  
  Thanks for all the help.
  Thomas
  
  --
  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
 
 
 
 

Thomas Bonham
Linux Rocks
http://www.bonhamlinux.org
Cell 602 402 9786
E-mail [EMAIL PROTECTED]
YIM freeswimfreak

__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

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



[PHP] Newbie Help

2005-05-01 Thread Thomas Bonham
Hello All,
First of I'm new to this a hop I'm doing this right.
If some one can help me with my web site page. I'm trying to make it 
call a page and I get a error line 42. Error: 
http://bonhamlinux.org/idex.php?page=links/index.php

The code that I'm trying to do this is the following:
?php
 if(isset($_GET ['page']))
{include($_GET ['page']..php);}
 else
{echo(Page Not Set.);}
?
My site is: http://bonhamlinux.org
My email is: [EMAIL PROTECTED]
Thanks for all the help.
Thomas
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Newbie Help

2005-05-01 Thread Thomas Bonham
Hello All,
First of I'm new to this a hop I'm doing this right.
If some one can help me with my web site page. I'm trying to make it
call a page and I get a error line 42. Error:
http://bonhamlinux.org/idex.php?page=links/index.php
The code that I'm trying to do this is the following:
?php
 if(isset($_GET ['page']))
 {include($_GET ['page']..php);}
 else
 {echo(Page Not Set.);}
?
My site is: http://bonhamlinux.org
My email is: [EMAIL PROTECTED]
Thanks for all the help.
Thomas
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Newbie Help

2005-05-01 Thread Thomas Bonham
Andre Dubuc wrote:
On Sunday 01 May 2005 10:39 pm, Thomas Bonham wrote:
Hello All,
First of I'm new to this a hop I'm doing this right.
If some one can help me with my web site page. I'm trying to make it
call a page and I get a error line 42. Error:
http://bonhamlinux.org/idex.php?page=links/index.php
The code that I'm trying to do this is the following:
?php
 if(isset($_GET ['page']))
{include($_GET ['page']..php);}
 else
{echo(Page Not Set.);}
?
My site is: http://bonhamlinux.org
My email is: [EMAIL PROTECTED]
Thanks for all the help.
Thomas

I spot perhaps a typo in 
http://bonhamlinux.org/idex.php?page=links/index.php
Might that be 'index' instead?
Hth,
Andre
   ^^   
Thanks for replying so fast.
That is not a typo because the index.php pages is the following:
?php
header(Location: idex.php?page=main);
?
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Newbie Help

2005-05-01 Thread Thomas Bonham
I Think the .php.php is the problem but I don't know have to fix it.
Let me know if you won't to see the full src page.
Thomas
Mark Cain wrote:
Perhaps the path to the included files is incomplete:
according to your error message you are trying to open
links/index.php.php
Does it need both of the dot php's ??
Would it help to include the full path to the includes such as:
/home/bonhamli/public_html/links/index.php.php
so something like that.
Mark Cain
- Original Message - 
From: Thomas Bonham [EMAIL PROTECTED]
To: php-general@lists.php.net
Sent: Sunday, May 01, 2005 10:39 PM
Subject: [PHP] Newbie Help 


Hello All,
First of I'm new to this a hop I'm doing this right.
If some one can help me with my web site page. I'm trying to make it 
call a page and I get a error line 42. Error: 
http://bonhamlinux.org/idex.php?page=links/index.php

The code that I'm trying to do this is the following:
?php
 if(isset($_GET ['page']))
 {include($_GET ['page']..php);}
 else
 {echo(Page Not Set.);}
?
My site is: http://bonhamlinux.org
My email is: [EMAIL PROTECTED]
Thanks for all the help.
Thomas
--
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] Newbie Help

2005-05-01 Thread Thomas Bonham
Here is all of the page, except one or two and the
images.

Thomas
--- Mark Cain [EMAIL PROTECTED] wrote:
 YES let see the src
 
 - Original Message - 
 From: Thomas Bonham [EMAIL PROTECTED]
 To: php-general@lists.php.net
 Sent: Sunday, May 01, 2005 11:31 PM
 Subject: Re: [PHP] Newbie Help 
 
 
  I Think the .php.php is the problem but I don't
 know have to fix it.
  
  Let me know if you won't to see the full src page.
  
  Thomas
  
  Mark Cain wrote:
   Perhaps the path to the included files is
 incomplete:
   
   according to your error message you are trying
 to open
   links/index.php.php
   
   Does it need both of the dot php's ??
   
   Would it help to include the full path to the
 includes such as:
   /home/bonhamli/public_html/links/index.php.php
   
   so something like that.
   
   Mark Cain
   
   
   - Original Message - 
   From: Thomas Bonham [EMAIL PROTECTED]
   To: php-general@lists.php.net
   Sent: Sunday, May 01, 2005 10:39 PM
   Subject: [PHP] Newbie Help 
   
   
   
  Hello All,
  
  First of I'm new to this a hop I'm doing this
 right.
  
  If some one can help me with my web site page.
 I'm trying to make it 
  call a page and I get a error line 42. Error: 
 

http://bonhamlinux.org/idex.php?page=links/index.php
  
  The code that I'm trying to do this is the
 following:
  ?php
if(isset($_GET ['page']))
{include($_GET ['page']..php);}
else
{echo(Page Not Set.);}
  ?
  
  My site is: http://bonhamlinux.org
  My email is: [EMAIL PROTECTED]
  
  Thanks for all the help.
  Thomas
  
  -- 
  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
  
  
 

Thomas Bonham
Linux Rocks
http://www.bonhamlinux.org
Cell 602 402 9786
E-mail [EMAIL PROTECTED]
YIM freeswimfreak

__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

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