[PHP-DB] download php headers?

2003-07-10 Thread Steve B.
I'm trying to get a php page to go into a name/password header authenticated site and 
it doens't
work (even though the same code works on a php auth site I post online)
So I'm trying to find out how to print the headers receieved from a web page so I can 
go from
there.
How do I get http headers for somesite.com?
I am doing the file method of getting the site currently.
thanks


__
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] Re: How to get PHP to download web contents

2003-07-07 Thread Steve B.
Yes I had tried all those below before posting.
It sounds like this is the only way to deal with authentication from what I see.
In windows it works fine from the browser to include name and pass in url.
In Linux it comes back and asks for the pw again.
I'd think the only difference would be in headers.
Is there any header info todo with authentication which come from the client which are 
not set by
doing the url name and pw?

Thanks,
Steve

--- Ognyan Bankov <[EMAIL PROTECTED]> wrote:
> "Steve B." <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
> > Hi Nadim,
> > It works but not for sites with password window that pops up.
> I see.
> That is HTTP Basic Authentication
> You should use this line:
> $filename = 'http://someuser:[EMAIL PROTECTED]/';
> instead of:
> $filename = "http://somesite.com?user=someuser&pwd=somepwd;
> 
> and source will look like:
>  // get contents of a file into a string
> $filename = 'http://someuser:[EMAIL PROTECTED]/';
> $handle = fopen ($filename, "r");
> $contents = fread ($handle, filesize ($filename));
> fclose ($handle);
> ?>
> 
> nadim's solution will look like this:
> $html = implode ('', file ('http://someuser:[EMAIL PROTECTED]/'));
> 
> 
> 
> 
> 
> -- 
> 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



[PHP-DB] stripping a get variable out of url string

2003-07-05 Thread Steve B.
I have an online tutorial build into a web page.
It has button next step.
If you are on page index.php?abc=123 for instance
the code is smart enough to make it index.php?abc=123&step=x

The problem is how to remove step=x from the old url string so that steps don't pile 
up.
index.php?abc=123&step=1&step=2
I'm trying ereg but could use a nudge with the wild card aspect of searching and 
replacing.

The code below builds the get string.

$stepnum = $_GET["step"];

$laststep=$stepnum-1;
$nextstep=$stepnum+1;

$args = $_SERVER["REQUEST_URI"];
if ($_SERVER["argc"]>0) $args.="&";
else $args.="?";

if ($stepnum>1)
 {
 echo "step 1";
 }
 
 if ($laststep>0)
 {
 echo "backup 1 step";
 }
 
 echo "next step";

thx


__
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] Re: How to get PHP to download web contents

2003-07-03 Thread Steve B.
Hi Nadim,
It works but not for sites with password window that pops up.
It is not the html based password but the browser window kind.
Do you know what this kind is called?
I've been searching 'php get html password' etc...
Thanks
Just a note the other example posted causes my computer to overload.

--- Nadim Attari <[EMAIL PROTECTED]> wrote:
> > How would you get PHP to download a file such as a web page and put it in
> a string?
> 
> From the manual:
> $html = implode ('', file ('http://www.example.com/'));
> 
> Note: As of PHP 4.3.0 you can use file_get_contents() to return the contents
> of a file as a string.
> 
> 
> 
> -- 
> 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



[PHP-DB] How to get PHP to download web contents

2003-07-02 Thread Steve B.
How would you get PHP to download a file such as a web page and put it in a string?

What keywords would relate to this (besides php download)

I need a user to be able to put in a name and pass and have PHP go to a cetain site.
The site can take the user/pass in the url so I do not need a form submit.
Then I need the site contents to be in a php variable.
Any tips on parsing html out of it would be great.

Thanks



__
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



[PHP-DB] php admin text edit then crash question

2003-06-26 Thread Steve B.
I can post some source code by form to db and it all looks good in the db.

When using phpadmin and adding "wow" to the end of the source phpadmin gets a quote 
error.

The db field holding this is text.

Why would it get a quote error from that?
Is this a server issue or my fault? (its hosted)
Thanks


__
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



[PHP-DB] add source code from form to DB - quote error- tried addslashes..

2003-06-26 Thread Steve B.
Hi I spent my 6+ hours trying yesterday to get a form to submit source code to the db.
The data gets in the db fine if it is just plain ascii.

The server has Magic Quotes on and this is bad according to most but should not stop 
it from
working- in fact it should just work.

Short Source is here can anyone tell my what 
addslash/addquote/removequote/htmlentities thing I
need to do? I've tried a few.

if (!empty($HTTP_POST_VARS["cname"]))
{
$cname= $HTTP_POST_VARS["cname"];
$source= $HTTP_POST_VARS["source"];

echo "

Form Source =
".htmlspecialchars($source)."
"; // try to make it insert right. // not getting insert error but only getting partial data inserted for source. //$source= "'.mysql_escape_string($source).'"; //$source = addslashes($source); //$source = "'.mysql_escape_string(stripslashes($source)).'"; $sql = "INSERT INTO classes set cname='$cname', source='$source'"; // the query prints on the screen fine print "
".htmlspecialchars($sql)."
"; mysql_connect("a", "b", "c"); mysql_select_db("codepost"); mysql_query($sql); echo "New code added!!!"; } ?>

Class name:
Source:
__ 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 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...
> 
>  would become  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



[PHP-DB] addslashes, stripslashes, htmlspecialchars

2003-06-13 Thread Steve B.
Hi this is about PHP commands even though has mysql too. 
I go to mysql board when I find one they said MySQL is not necessarily PHP driven and 
if I want
PHP specific questions to go to a PHP list.

How do you deal with forms, db storage of the data and calling it up in a form to edit?

The online tutorials I have covered to not address this except with addslashes on one 
of them.
My web page broke when I added a hyperlink in the description because of the '

Previously:
used .asp and always set the db in a way similar to parameters? in MySQL
Sometimes I did urlencode() on a get string to make the spaces and other characters 
work.

tried addslashes and noticed it does add them, right in the db.
Is this the standard? add and remove slashes?
other thing confusing me is the htmlentities which may do this better?

Thanks,
Steve


__
Do you Yahoo!?
Yahoo! Calendar - Free online calendar with sync to Outlook(TM).
http://calendar.yahoo.com

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



[PHP-DB] PHP/MySQL beginner group project

2003-06-11 Thread Steve B.
Site:
http://www.handheldspecs.com
 
Benefit for helping:
Better your PHP/MySQL
Know what color/java/phone/game/handheld/mp3/radio/bluetooth to buy 
(yes Nokia-Ngage does all this)
Link on front page of your choice
 
MySQL people aren't necessarily PHP programmers.
The site is in PHP so I picked here. If this project is not welcome here pls tell me 
where to post since it is php/mysql and in php and I apologize now to hope stop the 
abuse :)
 
If you see the site you know it has sorry db design.
My friend suggested this:
 
use three tables. At first glance, it
may seem more complicated, but will make your work much easier in the
long run.

HandHeldNames
ID (integer, automatically assigned)
Name (String, unique)

Fields
ID (integer, automatically assigned)
Name (String, unique)
Type (if necessary. There are several ways of doing this)

HandHeldSpecs
Name (integer, joined to the ID of HandHeldNames)
Field (integer, joined to the ID of Fields table)
Value (String. There are several ways of doing this, actually)

For instance, what you currently have on the handheldspecs.com site
would have the following values

HandHeldNames
ID  | Name
1   | Motorola T720
2   | Nokia
3   | Emerson

Fields
ID | Name
1  | Screen Width
2  | Screen Height
3  | Pixelsx
4  | Pixelsy
5  | Java Support
6  | Color
7  | Bandwidth
8  | image

HandHeldSpecs
Name | Field | Value
1|   1   |   1
1|   2   |   2
1|   3   |   320
1|   4   |   200
1|   5   |   yes (or 1 or however you want to represent booleans)
1|   6   |   yes
1|   7   |   19
1|   8   |   (the image file name, for instance)
...

I like this very much.
It relates to the posts about generated select boxes.
It would be real easy to add info to it and it is a fun newbie project for me to learn 
php/mysql as I can barely connect and make queries. thx. please lets be happy friends.
 
 
 


-
Do you Yahoo!?
Free online calendar with sync to Outlook(TM).

[PHP-DB] PHP web templates?

2003-06-11 Thread Steve B.
Hi I'm working on the site http://www.handheldwarez.com
I really like these sites style of table cells and borders etc...
http://tribes.sierra.com/
http://www.planetrenegades.com/modules.php?name=Web_Links&l_op=MostPopular
http://www.tribes2maps.com/

I've seen PHP nuke templates and am thinking that is what these sites are?
 
Does anyone have a favorite open source template spot?
I'd like a nice metal look like those sites.
In the past I took graphics from php nuke free site and make my own tablecell.php that 
prints nice boxes.
That is in use at http://www.northcountyrc.com if you wonder what I'm talking about.
 
Please don't burn me I'm newb and have little art skill but decent photoshop knowledge.
 
Any help, links is much appreciated thanks!
 


-
Do you Yahoo!?
Free online calendar with sync to Outlook(TM).

[PHP-DB] simple date formatting?

2003-06-11 Thread Steve B.
Hi I'm looking to format a date but all I find is this date() function and it appears 
to be for
current date?

My variable $dbrec["ListDate"] is printing:
4/30/2003 0:00:00

It needs to print
4/30/2003

Am I on the right track to try to do a (with right parameters)

$formatted_date = date("M D Y",$dbrec["ListDate"]);
or
$formatted_date = date_format("M D Y",$dbrec["ListDate"]);

Thanks
Current code just chops it off:
print "".substr($dbrec["ListDate"],0,9)."";
  

__
Do you Yahoo!?
Yahoo! Calendar - Free online calendar with sync to Outlook(TM).
http://calendar.yahoo.com

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



[PHP-DB] Way to update field thx Digital

2003-06-09 Thread Steve B.
This souce generates a form for editing a database record.
It 'manually' puts code for the most important fields at top.
It worked in asp despite repeating fields in array list.



Streetnum: 

Streetname: 



Complex Name: 

(this is printed for address under active listings)

Subdivision: 

Beds: 

BathsTotal: 

SqFtTotal: 

ListPriceLow: 

ListStatus: (Active=act,
Pending=pend, Sold=closd)







Detailed info for this item is below";



} 



while (list($k,$v)=each($dbrec)) {

  echo "$k ";

}



?>




The asp code now converted to php came out like this:



where updrec is jibberish now- in .asp it looped the form and set the db fields then 
executed
dbrec.update()

Yes I could make a form that loops the db fields and an update page that loops the 
form fields and
creates an UPDATE string. This is the correct way yes?

The reason I'm asking is because I have more sites and this will take a lot of editing 
and also
I'd like to understand the differences here- for instance if it is all asp objects 
doing this for
me then it is possible to write ones in php that do same?

Sorry if I get php/mysql terms confused. 
I see linux running a mysql server and a php interpreter that calls mysql server right?
 

--- Becoming Digital <[EMAIL PROTECTED]> wrote:
> I'm sorry, but that is the most confusing question I've heard in some time.
> 
> The operating system has nothing to do with your ability to update the DB.  That
> is a user permissions issue.  If you're referring to PHP as Linux, I can see
> where the confusion came from.
> 
> I'd like to help you.  So I can attempt to do that, let's see the ASP code
> you're trying to convert to PHP.
> 
> Edward Dudlik
> Becoming Digital
> www.becomingdigital.com
> 
> 
> - Original Message -
> From: "Steve B." <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Monday, 09 June, 2003 22:14
> Subject: Re: [PHP-DB] how to update field without using UPDATE query? you are
> kidding?
> 
> 
> Hi
> in asp it lets me say
> ~get a record into dbrec which is a database object.
> dbrec['field1'] = 'wow'
> dbrec.update;
> 
> is there no way to do this in linux?
> thats lame if it is then that means my 25 web sites have to be re-written to
> work on Linux.
> 
> 
> --- Becoming Digital <[EMAIL PROTECTED]> wrote:
> > I assume you lack update permissions, which means you probably don't have the
> > other permissions necessary to change data.  Assuming you actually do, you
> could
> > use REPLACE or DELETE followed by INSERT.
> >
> > Edward Dudlik
> > Becoming Digital
> > www.becomingdigital.com
> >
> >
> > - Original Message -
> > From: "Steve B." <[EMAIL PROTECTED]>
> > To: <[EMAIL PROTECTED]>
> > Sent: Monday, 09 June, 2003 19:29
> > Subject: [PHP-DB] how to update field without using UPDATE query?
> >
> >
> > how to update field without using UPDATE query?
> >
> > I open the db at a certain ID then set
> > $dbrec['field'] = new value
> > How do you update the db?
> > Thanks
> > -steve
> >
> >
> >
> > -
> > Do you Yahoo!?
> > Free online calendar with sync to Outlook(TM).
> >
> >
> > --
> > PHP Database Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> 
> 
> __
> Do you Yahoo!?
> Yahoo! Calendar - Free online calendar with sync to Outlook(TM).
> http://calendar.yahoo.com
> 
> --
> 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
> 


__
Do you Yahoo!?
Yahoo! Calendar - Free online calendar with sync to Outlook(TM).
http://calendar.yahoo.com

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



RE: [PHP-DB] how to update field without using UPDATE query? you are kidding?

2003-06-09 Thread Steve B.
It sounds like you are crying John.
Perhaps you know this function?
I'm trying to learn PHP holmes.
Keep the insults to yourself and help out if you know the answer.

--- "John W. Holmes" <[EMAIL PROTECTED]> wrote:
> > in asp it lets me say
> > ~get a record into dbrec which is a database object.
> > dbrec['field1'] = 'wow'
> > dbrec.update;
> > 
> > is there no way to do this in linux?
> > thats lame if it is then that means my 25 web sites have to be
> re-written
> > to work on Linux.
> 
> Okay, you're still confused. This has nothing to do with Linux. It's PHP
> vs. ASP. ASP has provided you a function to use instead of making an
> UPDATE query yourself. Learn some PHP so you can write your own update()
> query. Don't cry because someone hasn't done it for you already. 
> 
> ---John W. Holmes...
> 
> Amazon Wishlist: http://www.amazon.com/o/registry/3BEXC84AB3A5E
> 
> PHP Architect - A monthly magazine for PHP Professionals. Get your copy
> today. http://www.phparch.com/
> 
> 
> 
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 


__
Do you Yahoo!?
Yahoo! Calendar - Free online calendar with sync to Outlook(TM).
http://calendar.yahoo.com

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



Re: [PHP-DB] how to update field without using UPDATE query? you are kidding?

2003-06-09 Thread Steve B.
Hi
in asp it lets me say 
~get a record into dbrec which is a database object.
dbrec['field1'] = 'wow'
dbrec.update;

is there no way to do this in linux?
thats lame if it is then that means my 25 web sites have to be re-written to work on 
Linux.


--- Becoming Digital <[EMAIL PROTECTED]> wrote:
> I assume you lack update permissions, which means you probably don't have the
> other permissions necessary to change data.  Assuming you actually do, you could
> use REPLACE or DELETE followed by INSERT.
> 
> Edward Dudlik
> Becoming Digital
> www.becomingdigital.com
> 
> 
> - Original Message -
> From: "Steve B." <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Monday, 09 June, 2003 19:29
> Subject: [PHP-DB] how to update field without using UPDATE query?
> 
> 
> how to update field without using UPDATE query?
> 
> I open the db at a certain ID then set
> $dbrec['field'] = new value
> How do you update the db?
> Thanks
> -steve
> 
> 
> 
> -
> Do you Yahoo!?
> Free online calendar with sync to Outlook(TM).
> 
> 
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 


__
Do you Yahoo!?
Yahoo! Calendar - Free online calendar with sync to Outlook(TM).
http://calendar.yahoo.com

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



[PHP-DB] how to update field without using UPDATE query?

2003-06-09 Thread Steve B.
how to update field without using UPDATE query?
 
I open the db at a certain ID then set
$dbrec['field'] = new value
How do you update the db?
Thanks
-steve
 


-
Do you Yahoo!?
Free online calendar with sync to Outlook(TM).

[PHP-DB] php to make form field for each column then update page.

2003-06-08 Thread Steve B.
Hi,
I have used asp2php to convert an asp site and the update page does not iterate the 
form contents.
This part saves me making a giant form by making it dynamically-

$dbrec=getrec($result);


";


...

I've spent the day looking around the net and haven't found it.
Mainly I don't know what to search for - mostly tried 'dynamic forms' in google...
Any help making update page iterate form contents and update db?
I'd like to know a way to do it without an update statement- by opening that record, 
setting the
fields then updating it. Do you know example of this?
Thanks
-Steve


__
Do you Yahoo!?
Yahoo! Calendar - Free online calendar with sync to Outlook(TM).
http://calendar.yahoo.com

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



[PHP-DB] Printing date as 04-06-03

2003-06-05 Thread Steve B.
Hi all,
M-D-Y with leading 0 is how I would like to print dates at my exciting web page.
I am trying DATE_FORMAT and my provider locked up?? :(=

How would you print this?
thx
steve
http://www.aifiles.com


__
Do you Yahoo!?
Yahoo! Calendar - Free online calendar with sync to Outlook(TM).
http://calendar.yahoo.com

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