[PHP-DB] test

2003-06-20 Thread fazla
login test




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



Re: [PHP-DB] Renaming all pages to .php

2003-06-20 Thread Ronan Chilvers
Hi David

Comments inline...

On Thu,Jun 19, 2003 at 08:31:40PM -0700, David Blomstrom wrote : 
 At 09:16 PM 6/19/2003 -0500, Joshua Stein wrote:
 

snip
 I don't know exactly what you mean, but I just renamed one of my pages 
 (using Dreamweaver) with a .php extension, previewed it in Mozilla, and it 
 worked fine. This is the address displayed in the browser:
 
 file:///C:/sites/geosymbols/birds.php
 
 However, when I pasted the URL into Internet Explorer. So I linked to the 
 page from page X, previewed page X in IE and clicked the link and was taken 
 to C:\sites\geosymbols\waldman.php
 
 That's weird. I never even realized my two browsers displayed localhost 
 links differently - file:///c versus C:, and forward slashes versus 
 back slashes.
 
 But I assume that means my server is set up properly. As long as I can 
 preview my pages, I can't complain!
 
 * * * * * * * * * *
 
/snip

This doesn't mean your server is set up correctly.  The file:// scheme
or the c:\... means that the browser is reading the file directly from
the hard disk.  The page is not being served by your web server (which I
assume you have setup on your local machine).  When the browser reads a
file from the hard drive, it will display the contents (if it can), 
parsing out and rendering HTML as it goes.

For example, create a file with a php extension with the following
contents:-

?php
phpinfo();
?
H1This bit is html/H1

Save this in your webroot.  Here we have a page that has both html 
and php in it.  If you view this using the file:// or c:\ methods 
(as used by dreamweaver's preview by default) you will see the H1 
rendered and none of the php code, but the php code will not have 
executed.  Compare that with browsing via http://localhost/mytest.php.
You'll find that the php has executed and you have the html rendered out
below.

When testing pages locally the best way to do it is to have a browser
open and explicitly browse to http://localhost/dirname/pagename.php

/snip
 Alright, it sounds like a go. Thanks for all the tips.
snip

I think you'll find that having every page in a separate folder will
create an internal link nightmare.  I would be inclined to structure
your site in a more standard way and use Apache's rewrite module
to create the http://site.com/dirname/ style urls you are talking about.
You could also use the rewrite module to allow people to request a page
with an htm extension, which is translated into, eg: a page with a php
extension, a query string passed to a specfic php page, etc.  That way
you keep search engines and bookmarkers happy but retain your
development freedom.  It effectively inserts a configurable layer between 
the browser and the server where you can manage the type and appearance
of urls that apply to the site.

ISAPI url rewrite filters are available for IIS if that's your server 
flavour.

Hope this helps.

Ronan

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



Re: [PHP-DB] Renaming all pages to .php

2003-06-20 Thread Thorsten Körner
Hi David
Am Freitag, 20. Juni 2003 04:13 schrieb David Blomstrom:
 I joined this list a few weeks ago because I wanted to learn about php.
 Unfortunately, I still haven't found time to study it in any depth. Thus,
 my question might be a bit amateurish, but it's fairly urgent, so I'd
 appreciate any feedback anyone cares to offer.

 I'm working on a new website that I need to get online by the end of this
 month. I had wanted to do some stuff with php on it, but there's no way I
 can learn php and apply it before the July 1 deadline. No problem - I'll
 just add the php later.

 The catch is that my pages will be registered in search engines with URLs
 ending in .htm, something I'll have to address when I switch to php.

 Then I saw a discussion on another forum about a guy who was planning on
 changing all the .htm extensions on his webpages to .php, whether those
 pages use php or not. The general consensus was that that the pages would
 work just fine even without php, and they'd be all set up if and when he
 got around to adding php.

 I'd like to get some feedback from this forum. Do you agree that a page
 without php functions or server side includes can be put online with either
 a .htm or .php function? If I never add a php function to a page with a
 .php extension, could that cause some kind of problems?

This will run, and I think almost without problems. But IMHO it makes no 
sense. And I don't know, if all the searchengines out there will be able or 
willing to read *.php files (google works fine).
You should know that renaming all that files is not all, you have to do. you 
have also to change every single link in your pages, that points to your 
pages. I don't know how large your project is, but it can be much work, and 
if you do not add lines of PHP-Code to that pages, you can save much time by 
not doing so.
But if you are coding new pages, and you are planning to add dynamic contents 
by using PHP-Code, than IMHO it will be a good decision to use *.php 
file-extensions, because you can save that time later.

 Also, I'm thinking of naming all my pages index and sticking them inside
 folders. That way, visitors can reach a page by typing in
 www.geobop.com/birds/ , whether the full URL is
 www.geobop.com/birds/index.htm or www.geobop.com/birds/index.php  Is this a
 good plan, or do you see any problems?
Surely there will be no problem, but see above.

CU
Thorsten

BTW. It is not a good idea to start a new thread by replying to an old one.

-- 
Thorsten Körner http://www.123tkShop.org

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



[PHP-DB] apache, mysql, php4 for windows.

2003-06-20 Thread JeRRy
Hi,

I have apache, mysql and php4 for windows installed.  

I grabbed all my webapages and mysql databases to my
pc.  But my login cookies/script fails to work at all.
 It wont let me login.  Is anyone aware of a fix for
this?

I am only using a basic login script/cookie that looks
for a username and password combination in a database.
 If one is found than it updates the database with a
sid entry and logs a cookie on the users pc.

Works fine in linux but not under Windows.  Anyone
come accross this and knows a fix?

If you would like my code and see what I have please
ask.  I am not sure if it's really needed though as I
am sure you guys have come accross it also.

Thanks!



http://mobile.yahoo.com.au - Yahoo! Mobile
- Check  compose your email via SMS on your Telstra or Vodafone mobile.

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



[PHP-DB] Re: apache, mysql, php4 for windows.

2003-06-20 Thread Cristian MARIN
Are you sure the cookie is set on your machine? What is your IE setting
about what cookie should accept? Because this is generaly the problem

-- 
-
Cristian MARIN - Developer
InterAKT Online (www.interakt.ro)
Tel: +4021 312.53.12
Tel/Fax:  +4021 312.51.91
[EMAIL PROTECTED]
Jerry [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Hi,

 I have apache, mysql and php4 for windows installed.

 I grabbed all my webapages and mysql databases to my
 pc.  But my login cookies/script fails to work at all.
  It wont let me login.  Is anyone aware of a fix for
 this?

 I am only using a basic login script/cookie that looks
 for a username and password combination in a database.
  If one is found than it updates the database with a
 sid entry and logs a cookie on the users pc.

 Works fine in linux but not under Windows.  Anyone
 come accross this and knows a fix?

 If you would like my code and see what I have please
 ask.  I am not sure if it's really needed though as I
 am sure you guys have come accross it also.

 Thanks!



 http://mobile.yahoo.com.au - Yahoo! Mobile
 - Check  compose your email via SMS on your Telstra or Vodafone mobile.



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



RE: [PHP-DB] Two-column display of data, second method

2003-06-20 Thread Gary . Every
You could always use the % operand

snip
$cols_wanted = 2;
if(($faculty_found % $cols_wanted) == 0) {
// Then do a TR
echo 'tr';
} else {
// Then it's the first column, and don't end the row
}
/snip

This also simplifies it so that you can decide to use three, four or five
columns, just by changing the $cols_wanted variable




Gary Every
Sr. UNIX Administrator
Ingram Entertainment
(615) 287-4876
Pay It Forward
mailto:[EMAIL PROTECTED]
http://accessingram.com


 -Original Message-
 From: Becoming Digital [mailto:[EMAIL PROTECTED]
 Sent: Thursday, June 19, 2003 5:01 PM
 To: [EMAIL PROTECTED]
 Subject: Re: [PHP-DB] Two-column display of data, second method
 
 
 Nice job.  There's a fair bit of room for optimization, but 
 unless your data
 sets are very large, it's probably not necessary.  However, 
 if you're compulsive
 (as I tend to be), you'll optimize every bit of code to the 
 best of your
 abilities.  And yes, I know I'm crazy. ;P
 
 Edward Dudlik
 Becoming Digital
 www.becomingdigital.com
 
 
 - Original Message -
 From: David Shugarts [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Thursday, 19 June, 2003 17:43
 Subject: [PHP-DB] Two-column display of data, second method
 
 
 When I went looking for a script that would give me a 
 two-column layout that
 would list my faculty members in two roughly equal columns, 
 alphabetized
 down the first column and then the second, I did not find 
 such a script.
 [There was indeed a two-column script, but it fed the data 
 row-by-row.]
 
 I wrote this one and am glad to share it. The math statements 
 could surely
 be condensed, but I was using them to confirm the results. This script
 either creates two equal columns if the total number of items 
 is even, or it
 makes the first column the longer if the total number of items is odd.
 
 --Dave Shugarts
 
 
 ?php
 
 /* *** Now selects the Faculty names ** */
 
 $sql =SELECT FirstName, Middle, LastName
 FROM $table_name
 ORDER BY LastName, FirstName;
 
 
 /* ** Now passes the result of the search ** */
 
 $faculty_result = @mysql_query($sql, $connection) or die(Error #.
 mysql_errno() . :  . mysql_error());
 
 $faculty_found = @mysql_num_rows($faculty_result);
 $faculty_half = $faculty_found / 2;
 $faculty_round = round($faculty_found / 2);
 $faculty_remain = $faculty_found - $faculty_round;
 
 
 echo table border=0
 
 trtd colspan=2 align=centerb
 Two-Column header
 /bbr/td/tr
 
 trtd width=49%\n;
 
 for ($rownum = 1; $rownum = $faculty_round; $rownum++)
 
 {
 $row = mysql_fetch_array($faculty_result);
 
 
 $FirstName=$row['FirstName'];
 $Middle=$row['Middle'];
 $LastName=$row['LastName'];
 
 $faculty_block = 
 font class=facultydoc
 $FirstName $Middle $LastName
 /font
 br
 ;
 
 echo $faculty_blockbr;
 }
 
 echo /tdtd\n;
 
 
 for ($rownum = 1; $rownum = $faculty_remain; $rownum++)
 
 {
 $row = mysql_fetch_array($faculty_result);
 
 
 $FirstName=$row['FirstName'];
 $Middle=$row['Middle'];
 $LastName=$row['LastName'];
 
 $faculty_block = 
 font class=facultydoc
 $FirstName $Middle $LastName
 /font
 br
 ;
 
 echo $faculty_blockbr;
 }
 
 echo /td/trbr/table;
 
 ?
 
 
 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 
 
 
 -- 
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 


Re: [PHP-DB] Renaming all pages to .php

2003-06-20 Thread David Blomstrom
At 02:19 PM 6/20/2003 +0200, Thorsten Körner wrote:

This will run, and I think almost without problems. But IMHO it makes no
sense. And I don't know, if all the searchengines out there will be able or
willing to read *.php files (google works fine).
Are you saying that some search engines might not register pages with php 
extensions? That would be a MAJOR problem.

You should know that renaming all that files is not all, you have to do. you
have also to change every single link in your pages, that points to your
pages. I don't know how large your project is, but it can be much work, and
if you do not add lines of PHP-Code to that pages, you can save much time by
not doing so.
Hm... it would be nice if I could use a search and replace function, 
but that would be tricky. If I replaced every instance of .htm with 
.php, then that would also change links to other websites. For example...

a href=htttp://www.50states.com/history.htm would become a 
href=http://www.50states.com/history.php;

I wonder if there's an advanced search and replace technique that would 
target only internal links on my website. On the other hand, I am doing an 
extensive overhaul that will require recoding on every single page, so 
maybe I could just manually change the links as well.

Thanks for the tips. The comment about the search engines is especially 
interesting (or alarming). I'll have to give this some more thought if .php 
links might affect my site's visibility in search engines. Do you know if 
the same applies to .asp and ColdFusion?

BTW. It is not a good idea to start a new thread by replying to an old one.
I wasn't aware that I did.



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


Re: [PHP-DB] Renaming all pages to .php

2003-06-20 Thread Steve B.
I've heard of a Apache server setting or update that makes for example:

.com/shoes.html returns page /index.php?site=shoes
or
.com/shoes.html returns page /shoes.php

Just like you have virtual folders you can have wildcard serach and replaced virtual 
file names. 
I believe this would solve your problem below and knowing this would make my PHP 
driven site
appear to be a collection of html pages.

Does anyone know how to do this or what it is called so I can research it?
-Steve

--- David Blomstrom [EMAIL PROTECTED] wrote:
 At 02:19 PM 6/20/2003 +0200, Thorsten Körner wrote:
 
 This will run, and I think almost without problems. But IMHO it makes no
 sense. And I don't know, if all the searchengines out there will be able or
 willing to read *.php files (google works fine).
 
 Are you saying that some search engines might not register pages with php 
 extensions? That would be a MAJOR problem.
 
 You should know that renaming all that files is not all, you have to do. you
 have also to change every single link in your pages, that points to your
 pages. I don't know how large your project is, but it can be much work, and
 if you do not add lines of PHP-Code to that pages, you can save much time by
 not doing so.
 
 Hm... it would be nice if I could use a search and replace function, 
 but that would be tricky. If I replaced every instance of .htm with 
 .php, then that would also change links to other websites. For example...
 
 a href=htttp://www.50states.com/history.htm would become a 
 href=http://www.50states.com/history.php;
 
 I wonder if there's an advanced search and replace technique that would 
 target only internal links on my website. On the other hand, I am doing an 
 extensive overhaul that will require recoding on every single page, so 
 maybe I could just manually change the links as well.
 
 Thanks for the tips. The comment about the search engines is especially 
 interesting (or alarming). I'll have to give this some more thought if .php 
 links might affect my site's visibility in search engines. Do you know if 
 the same applies to .asp and ColdFusion?
 
 BTW. It is not a good idea to start a new thread by replying to an old one.
 
 I wasn't aware that I did.
 
 
 
 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 


__
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com

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



Re: [PHP-DB] Renaming all pages to .php

2003-06-20 Thread Ronan Chilvers
Hi Steve

Comments inline...

On 20 Jun,2003 at 10:06 Steve B. wrote:
snip
 I've heard of a Apache server setting or update that makes for example:
 
 .com/shoes.html returns page /index.php?site=shoes
 or
 .com/shoes.html returns page /shoes.php
 
/snip

See my previous post on this thread ... the module you want is mod_rewrite.  If you're 
a dab hand with regexps you shouldn't have any trouble with it !?!?!

;-)

Ronan
e: [EMAIL PROTECTED]
t: 01903 739 997
w: www.thelittledot.com

The Little Dot is a partnership of
Ronan Chilvers and Giles Webberley

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



RE: [PHP-DB] Limit return Size

2003-06-20 Thread Hutchins, Richard
Try:

$sql = SELECT LEFT(columnName,255) FROM tableName;

Using that syntax should return the first 255 characters from the selected
column, reading LEFT to right. I tested it in the command line and it worked
just fine.

Hope that helps.

Rich

 -Original Message-
 From: Marie Osypian [mailto:[EMAIL PROTECTED]
 Sent: Friday, June 20, 2003 3:06 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP-DB] Limit return Size
 
 
 I would like to know how I limit my answer from a mysql 
 database query to
 display only a limited size?  Is this done in the query or the php?
 
 i.e.  Our Performance Results area includes First Quarter 
 2003 investment
 returns for virtually every 529 savings programs. See how 
 your 529 plan
 performed...
 
 This question is alot longer but it was stopped and ... added when it
 reached the desired size.
 
 Thanks
 
 MAO
 
 
 
 -- 
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 

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



RE: [PHP-DB] Limit return Size

2003-06-20 Thread Gary . Every
Or 
$sql = SELECT concat(LEFT(columnName,255),...) FROM tableName;


Gary Every
Sr. UNIX Administrator
Ingram Entertainment
(615) 287-4876
Pay It Forward
mailto:[EMAIL PROTECTED]
http://accessingram.com


 -Original Message-
 From: Hutchins, Richard [mailto:[EMAIL PROTECTED]
 Sent: Friday, June 20, 2003 2:46 PM
 To: [EMAIL PROTECTED]
 Subject: RE: [PHP-DB] Limit return Size
 
 
 Try:
 
 $sql = SELECT LEFT(columnName,255) FROM tableName;
 
 Using that syntax should return the first 255 characters from 
 the selected
 column, reading LEFT to right. I tested it in the command 
 line and it worked
 just fine.
 
 Hope that helps.
 
 Rich
 
  -Original Message-
  From: Marie Osypian [mailto:[EMAIL PROTECTED]
  Sent: Friday, June 20, 2003 3:06 PM
  To: [EMAIL PROTECTED]
  Subject: [PHP-DB] Limit return Size
  
  
  I would like to know how I limit my answer from a mysql 
  database query to
  display only a limited size?  Is this done in the query or the php?
  
  i.e.  Our Performance Results area includes First Quarter 
  2003 investment
  returns for virtually every 529 savings programs. See how 
  your 529 plan
  performed...
  
  This question is alot longer but it was stopped and ... 
 added when it
  reached the desired size.
  
  Thanks
  
  MAO
  
  
  
  -- 
  PHP Database Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
  
 
 -- 
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 


Re: [PHP-DB] Limit return Size

2003-06-20 Thread CPT John W. Holmes
 I would like to know how I limit my answer from a mysql database query to
 display only a limited size?  Is this done in the query or the php?

 i.e.  Our Performance Results area includes First Quarter 2003 investment
 returns for virtually every 529 savings programs. See how your 529 plan
 performed...

 This question is alot longer but it was stopped and ... added when it
 reached the desired size.

Here is a great thread on Devshed that discusses various PHP and MySQL
methods to accomplish this:

http://forums.devshed.com/showthread.php?s=threadid=23711perpage=15highlight=limit%20text%20from%20databasepagenumber=1

Enjoy.

---John Holmes...


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



[PHP-DB] newby question

2003-06-20 Thread Alvaro Rosales R.
Hi guys is there a function or a command in php to load an external 
html or a php page.
Sorryb for the stupid question

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



[PHP-DB] Re: test

2003-06-20 Thread David Robley
In article [EMAIL PROTECTED], [EMAIL PROTECTED] says...
 login test
Login/Password mismatch
Connection failed

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



Re: [PHP-DB] Two-column display of data, second method

2003-06-20 Thread Becoming Digital
That was actually my primary point of optimization.  Unfortunately, I've been
feeling a bit lazy, so I didn't bother going into things. :)

Edward Dudlik
Becoming Digital
www.becomingdigital.com


- Original Message -
From: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Friday, 20 June, 2003 10:39
Subject: RE: [PHP-DB] Two-column display of data, second method


You could always use the % operand

snip
$cols_wanted = 2;
if(($faculty_found % $cols_wanted) == 0) {
// Then do a TR
echo 'tr';
} else {
// Then it's the first column, and don't end the row
}
/snip

This also simplifies it so that you can decide to use three, four or five
columns, just by changing the $cols_wanted variable




Gary Every
Sr. UNIX Administrator
Ingram Entertainment
(615) 287-4876
Pay It Forward
mailto:[EMAIL PROTECTED]
http://accessingram.com


 -Original Message-
 From: Becoming Digital [mailto:[EMAIL PROTECTED]
 Sent: Thursday, June 19, 2003 5:01 PM
 To: [EMAIL PROTECTED]
 Subject: Re: [PHP-DB] Two-column display of data, second method


 Nice job.  There's a fair bit of room for optimization, but
 unless your data
 sets are very large, it's probably not necessary.  However,
 if you're compulsive
 (as I tend to be), you'll optimize every bit of code to the
 best of your
 abilities.  And yes, I know I'm crazy. ;P

 Edward Dudlik
 Becoming Digital
 www.becomingdigital.com


 - Original Message -
 From: David Shugarts [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Thursday, 19 June, 2003 17:43
 Subject: [PHP-DB] Two-column display of data, second method


 When I went looking for a script that would give me a
 two-column layout that
 would list my faculty members in two roughly equal columns,
 alphabetized
 down the first column and then the second, I did not find
 such a script.
 [There was indeed a two-column script, but it fed the data
 row-by-row.]

 I wrote this one and am glad to share it. The math statements
 could surely
 be condensed, but I was using them to confirm the results. This script
 either creates two equal columns if the total number of items
 is even, or it
 makes the first column the longer if the total number of items is odd.

 --Dave Shugarts


 ?php

 /* *** Now selects the Faculty names ** */

 $sql =SELECT FirstName, Middle, LastName
 FROM $table_name
 ORDER BY LastName, FirstName;


 /* ** Now passes the result of the search ** */

 $faculty_result = @mysql_query($sql, $connection) or die(Error #.
 mysql_errno() . :  . mysql_error());

 $faculty_found = @mysql_num_rows($faculty_result);
 $faculty_half = $faculty_found / 2;
 $faculty_round = round($faculty_found / 2);
 $faculty_remain = $faculty_found - $faculty_round;


 echo table border=0

 trtd colspan=2 align=centerb
 Two-Column header
 /bbr/td/tr

 trtd width=49%\n;

 for ($rownum = 1; $rownum = $faculty_round; $rownum++)

 {
 $row = mysql_fetch_array($faculty_result);


 $FirstName=$row['FirstName'];
 $Middle=$row['Middle'];
 $LastName=$row['LastName'];

 $faculty_block = 
 font class=facultydoc
 $FirstName $Middle $LastName
 /font
 br
 ;

 echo $faculty_blockbr;
 }

 echo /tdtd\n;


 for ($rownum = 1; $rownum = $faculty_remain; $rownum++)

 {
 $row = mysql_fetch_array($faculty_result);


 $FirstName=$row['FirstName'];
 $Middle=$row['Middle'];
 $LastName=$row['LastName'];

 $faculty_block = 
 font class=facultydoc
 $FirstName $Middle $LastName
 /font
 br
 ;

 echo $faculty_blockbr;
 }

 echo /td/trbr/table;

 ?


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





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




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



[PHP-DB] Re: apache, mysql, php4 for windows.

2003-06-20 Thread JeRRy

Are you sure the cookie is set on your machine? What
is your IE setting
about what cookie should accept? Because this is
generaly the problem

Okay maybe it's best I post my code here and explain a
bit about it.

--my login code--

?php

error_reporting (E_ALL ^ E_NOTICE);


//Put in your own info for username, password, DB,
[EMAIL PROTECTED], Cookiename,
//the name of this page (currently login.php) and the
name of your subscribe
//or new user page (currently new.php).  I went ahead
and included all the HTML
//so this page should work as is, with only the
changes described above needed
// - Lysander ([EMAIL PROTECTED])

$dblink = mysql_pconnect(localhost,usr,pass);
mysql_select_db(tassie_tipping);

$headers=0; //Make Sure HTML Headers are in place
before the form

//after Authenticating the script automatically sends
the browser to
//the webpage of your choice (note if your page calls
this
//script with ?redirect=foobar.php it will
automatically
//redirect to foobar.php after authenticating.  Set
the default
//redirect page here

if ( !isset($redirect))
   {
 $redirect = tip.php;
   }

if (isset($Username)  isset($Password)) {

  $query = select * from tipping where nickname =
\$Username\ and password = \$Password\;

  if ( !($dbq = mysql_query($query, $dblink))) {
echo Unable to query database.  Please Contact a
href=\[EMAIL PROTECTED]mailto:[EMAIL PROTECTED]/a.\n;
exit;
  }

  $lim = mysql_num_rows( $dbq );

  if ($lim != 1) {

  $headers=1; //HTML headers in place
  echo HTMLHEADTITLELogin
Page/TITLE/HEADBODY;
  echo Bcenterfont color=redInvalid User ID or
Password. Please Try again/BBR/font/center;

  }

  if ($lim == 1) {

//make unique session id and store it in Database
  $timer = md5(time());
  $sid = $Username . + . $timer;
  SetCookie(login,$sid,time()+3600); //Set Cookie
for 30 days
  $query = update tipping set sid=\$timer\ where
nickname=\$Username\;

  if( !($dbq = mysql_query( $query, $dblink))) {
echo Unable to update database.  Please contact
a
href=\[EMAIL PROTECTED]mailto:[EMAIL PROTECTED]/a.\n;
  exit;
  }

  header(Location: $redirect);
  exit;

}

if (isset($login)) {
  $headers=1;
  $sidarray = explode(+, $login);
  $query = select * from tipping where nickname =
\$sidarray[0]\ and sid = \$sidarray[1]\;

  if ( !($dbq = mysql_query($query, $dblink))) {
echo Unable to find database.  Please Contact a
href=\mailto:[EMAIL PROTECTED][EMAIL PROTECTED]/a.\n;
exit;
  }

  if (mysql_num_rows( $dbq ) == 1) {
echo HTMLHEADTITLELogin
Page/TITLE/HEADBODY;
echo centerYou are already logged in as
$sidarray[0].BR;
echo You may logon as another user or simply
begin using our services with your current
session.BR;
echo Click A
Href=\http://www.tassiedemononline.org.au/tiplogin.php\;Here/A
to return to our homepage./center;
  }
}
if ($headers == 0) {
echo  ;
}
}

echo Form Action=\tiplogin.php\ METHOD=POST;
echo H2User Name/H2;
echo Input TYPE=\text\ Name=\Username\
Value=,$Username,;
echo BR;
echo H2Password/H2;
echo Input TYPE=\password\ Name=\Password\;
echo BR;
echo Input Type=\submit\ Value=\Submit\;
echo Input Type=\hidden\ Name=\redirect\
Value=\tip.php\;
echo /FORM;

?

--end--

Okay as you can see in the code there are some
//comments.  Will help explain what each function
does, or what it's meant to do.

A quick overview is that you are shown a login form. 
(no cookies loaded onto the users PC as of yet)  The
user must input a username and password which must
match in the database.  If there is a match the user
is given a cookie on their PC with an expiry period
which than loads onto the next page $redirect which
the $redirect page checks to see if the user still
matches in the database and see's if the cookie (id)
or sid matches with the database.  If matches it
allows you to see the page, if not it says your
session has times out and to try again.

It works fine under my linux machine, no problems. 
But as soon as I tried under windows after I installed
all my programs I needed it failed badly.

What it does under windows is show the form and input
my username and password (does not matter if they are
correct or not because the results are the same) and I
click the submit button and all it does is reload the
form.

What it appears to be doing is not even doing the
mysql query.  (form the looks of it)  It seems to loop
through the page again as if your loading it the first
time.  Either that or my form is not submitting the
data at all.

If I don't enter data on my linux server on the login
I get a error message (which is in the code) but if I
do it on windows it does nothing.  Just loads the form
again.

So I am going to try something new later today and
have the form and the logn process on two different
pages and see what happens.  Not sure if this will do
anything different but I will try.  Anyone got any
suggestions?

My other PHP pages under windows work fine, they query
my mysql database(s) fine and output the results as
they should.  This 

[PHP-DB] Re: Password generator

2003-06-20 Thread Manuel Lemos
Hello,

On 06/17/2003 06:45 AM, Davy Obdam wrote:
I have to make a password generator, but i have a little problem.
You may also want to try any of these classes:

http://www.phpclasses.org/password%20generation

--

Regards,
Manuel Lemos
Free ready to use OOP components written in PHP
http://www.phpclasses.org/
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP-DB] (can't remember my original subject) - php4, apache and mysql????

2003-06-20 Thread JeRRy
Hi,

I posted a few hours ago a problem I had with a login
function that loaded the form over and over again when
trying to login to my site off windows.  (locally)

I found out what the problem was and have fixed the
problem.  In the end it had nothing to do with my code
but rather incorrect configuration in my setup.

I thought it was a bit odd it would work on linux and
not a similar thing on windows.  Now I know why.

FYI information the problem was with register_globals
being off.  When I installed it had this off by
default so I needed to change it.  I thought it would
of been defaulted as On rather than Off so I never
considered that as a problem until just recently. :P

Anyways all is fixed now, very happy now.  Dispite
this has taken some time to work out.

Thanks for the help people have given me, despite most
of you thought it was my code rather than anything
else.  I did not think it would be my code that is why
I did not post in my first post.  (my code)

Anyways thanks again for being helpful.  I have learnt
from this experience. :)

Jerry

http://mobile.yahoo.com.au - Yahoo! Mobile
- Check  compose your email via SMS on your Telstra or Vodafone mobile.

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