php-general Digest 8 Mar 2005 04:52:22 -0000 Issue 3325

Topics (messages 210172 through 210202):

Re: Improving a MySQL Search
        210172 by: Jay Blanchard

GET vs POST (was: Preventing data from being reposted?)
        210173 by: Christophe Chisogne

using javascript within php
        210174 by: Ross Hulford
        210175 by: John Nichel
        210176 by: Jay Blanchard

Re: A general question
        210177 by: zzapper
        210178 by: Stephen Johnson
        210181 by: zzapper

'Open Base' with PHP
        210179 by: François-Xavier LACROIX

Open Base with PHP
        210180 by: François-Xavier LACROIX

Sessions
        210182 by: db
        210186 by: Jason Barnett
        210191 by: db

Re: FTP functions
        210183 by: Tim Boring

Re: mac os x - not getting headers already sent error
        210184 by: Jonathan Haddad

Re: Problem with ftp_get and ftp_put over SSL--SOLVED
        210185 by: Tim Boring

ftp upload via web form - problem getting the file name correct
        210187 by: Steve Turnbull

call anchor from php
        210188 by: Ross Hulford
        210190 by: Chris W. Parker
        210193 by: Chris W. Parker

Using switch() to process a set of forms
        210189 by: Greg Dotts
        210192 by: kjohnson.zootweb.com
        210198 by: Greg Dotts

Re: Open source portal systems???
        210194 by: Alan Fullmer

Re: Randomize an array?
        210195 by: Rick Fletcher
        210199 by: Brian Dunning

get image from browser url.
        210196 by: buck Wheat
        210201 by: Jochem Maas

Re: SOLVED: Re: [PHP] Document root, preferred way to find it???
        210197 by: Tom Rogers

Newbie Question re substr
        210200 by: Jackson Linux
        210202 by: Zareef Ahmed

Administrivia:

To subscribe to the digest, e-mail:
        [EMAIL PROTECTED]

To unsubscribe from the digest, e-mail:
        [EMAIL PROTECTED]

To post to the list, e-mail:
        php-general@lists.php.net


----------------------------------------------------------------------
--- Begin Message ---
[snip]
Further to my email last week, I've now indexed all the fields that get
searched
on (i.e. sql statement is similar to "select x, y from table where
x='blah'" - x
is the indexed field).

Is that the correct field to index?
[/snip]

Yes, have you tried an EXPLAIN on your SELECT?

[snip]
Sorry for it being so long, but that's the table!
[/snip]

Have you considered the MySQL mailing list?

[snip]
Currently there are 1.5 million (1,500,00) records, and searching the
table for
the last 10 records is taking up to 40 seconds.
e.g. select unixtime, type, subtype, src, dst, msg, pri from syslog
where
type='ips' ORDER BY unixtime DESC LIMIT 10
Does anyone have any suggestions for improving the search?
[/snip]

Bigger, faster hardware....really, what are you running this on? I have
some tables nearing the 500,000,000 (half a billion) records mark
running on multi-processor servers that do searches in under a minute. 

--- End Message ---
--- Begin Message --- Richard Lynch a écrit :
POST versus GET is an aesthetic choice, not Security, not Performance.

Of course, I agree it's not really a 'security' choice.

But another think you can think of can be found in the HTTP/1.1 spec
(rfc 2616) in the 'Safe Methods' section [1]. To summarize:

- GET (and HEAD) should only retreive things, with no side effect
- POST (and others) means taking action (with side effects)

It's 'sould', not 'must' or 'must not'. Anyway, I think its worth
a few seconds to think about it.

Christophe

From [1] :

------------------------------------------------------------------------

9.1.1 Safe Methods

   Implementors should be aware that the software represents the user in
   their interactions over the Internet, and should be careful to allow
   the user to be aware of any actions they might take which may have an
   unexpected significance to themselves or others.

   In particular, the convention has been established that the GET and
   HEAD methods SHOULD NOT have the significance of taking an action
   other than retrieval. These methods ought to be considered "safe".
   This allows user agents to represent other methods, such as POST, PUT
   and DELETE, in a special way, so that the user is made aware of the
   fact that a possibly unsafe action is being requested.

   Naturally, it is not possible to ensure that the server does not
   generate side-effects as a result of performing a GET request; in
   fact, some dynamic resources consider that a feature. The important
   distinction here is that the user did not request the side-effects,
   so therefore cannot be held accountable for them.

------------------------------------------------------------------------

[1] 9.1.1 Safe Methods (pg 51)
ftp://ftp.rfc-editor.org/in-notes/rfc2616.txt

--- End Message ---
--- Begin Message ---
I want to set focus on a text area with javascript if the entry by the user 
is not what I want.

This is what i have so far.....
<?php

if (isset($submitted){

if(empty($name)) {
$fname_error = " *Please Enter your firstname or initial";
//the code to set focus to the textbox should go here
}

}

?>

--- End Message ---
--- Begin Message ---
Ross Hulford wrote:
<snip>

PHP == Server Side
HTML/JavaScript == Client Side

--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
[EMAIL PROTECTED]

--- End Message ---
--- Begin Message ---
[snip]
I want to set focus on a text area with javascript if the entry by the
user 
is not what I want.

if (isset($submitted){

if(empty($name)) {
$fname_error = " *Please Enter your firstname or initial";
//the code to set focus to the textbox should go here
}
[/snip]

if(empty($name)) {
$fname_error = " *Please Enter your firstname or initial";
//the code to set focus to the textbox should go here
echo "window.document.YOURFORMNAME.name.focus();";
}

--- End Message ---
--- Begin Message ---
On Mon, 7 Mar 2005 19:55:37 +0530,  wrote:

>How can I click on a link which is linked to a JPG file and instead of
>displaying it in the browser save it somewhere on the local machine or
>open in a different software ?
>
>Please help very urgent
>
>Thanks
>vaibhav

<a href="/img/some.jpg">Some</a>

zzapper (vim, cygwin, wiki & zsh)
-- 

vim -c ":%s%s*%CyrnfrTfcbafbeROenzSZbbyranne%|:%s)[R-T]) )Ig|:norm G1VGg?"

http://www.vim.org/tips/tip.php?tip_id=305  Best of Vim Tips

--- End Message ---
--- Begin Message ---
You have to trick the browser into thinking that the jpg file is something
other then a jpg.  This is sketchy and does not always work.

Something like this maybe
             $len = filesize($file_path);
             header("Content-Type: application/force-download");
             header("Content-Type: application/octet-stream");
             header("Content-Disposition: attachment; filename=$file");
             header("Content-Title: $file_path");
             header("Content-Length: $len");
             readfile($file_path);

            $fh=fopen($file_path,'rt');
             @fclose($fh);

HTH

<?php
/*

Stephen Johnson c | eh
The Lone Coder

http://www.thelonecoder.com
[EMAIL PROTECTED]

562.924.4454 (office)
562.924.4075 (fax) 

continuing the struggle against bad code

*/ 
?>

> From: zzapper <[EMAIL PROTECTED]>
> Date: Mon, 07 Mar 2005 17:19:30 +0000
> To: php-general@lists.php.net
> Subject: [PHP] Re: A general question
> 
> 
>> How can I click on a link which is linked to a JPG file and instead of
>> displaying it in the browser save it somewhere on the local machine or
>> open in a different software ?
>> 
>> Please help very urgent
>> 
>> Thanks
>> vaibhav

--- End Message ---
--- Begin Message ---
On Mon, 07 Mar 2005 09:32:56 -0800,  wrote:

Regards my previous post in this thread,

Sorry for not reading the OP correctly!!

zzapper

--- End Message ---
--- Begin Message ---
hello,
I am totally new to this list,

I just want to know if someone have ever use a driver ODBC to access a database 'Open Base' with PHP.

I know where to buy an ODBC dll on http://www.actualtechnologies.com/Product_OpenBase.php
but I don't know if it could really work...

look forward to hearing your suggestions...
fx

--
François-Xavier LACROIX - http://www.clever-age.com
Clever Age - conseil en architecture technique
Tél: +33 1 53 34 66 10  Fax: +33 1 53 34 65 20

Clever Age lance son blog de veille permanente
http://www.clever-age.com/veille/weblog/
--- End Message ---
--- Begin Message ---
hello,
I am totally new to this list,

I just want to know if someone have ever use a driver ODBC to access a database 'Open Base' with PHP.

I know where to buy an ODBC dll on http://www.actualtechnologies.com/Product_OpenBase.php
but I don't know if it could really work...

look forward to hearing your suggestions...
fx

--
François-Xavier LACROIX - http://www.clever-age.com
Clever Age - conseil en architecture technique
Tél: +33 1 53 34 66 10  Fax: +33 1 53 34 65 20

Clever Age lance son blog de veille permanente
http://www.clever-age.com/veille/weblog/
--- End Message ---
--- Begin Message ---
Hi all

I'm writing a C++ CGI lib and I want to support php(5) sessions. Is there some 
API I should use or can I just create/delete/read/write the sess_ files 
in /tmp?

br
db

--- End Message ---
--- Begin Message ---
Db wrote:
> Hi all
> 
> I'm writing a C++ CGI lib and I want to support php(5) sessions. Is there 
> some 
> API I should use or can I just create/delete/read/write the sess_ files 
> in /tmp?

You are probably best off searching the PHP source for
session_set_save_handler.  It will be something like
PHP_FUNCTION('session_set_save_handler', ... )

-- 
Teach a man to fish...

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

Attachment: signature.asc
Description: OpenPGP digital signature


--- End Message ---
--- Begin Message ---
On Monday 07 March 2005 21:36, Jason Barnett wrote:
> You are probably best off searching the PHP source for
> session_set_save_handler.  It will be something like
> PHP_FUNCTION('session_set_save_handler', ... )

Found it and some other functions in php-5.0.3/ext/session/session.c
I could however not find any documentation of the code, so I think I'll have 
to contact Sascha and/or Andrei.

Thanks for the reply!

br
db

--- End Message ---
--- Begin Message ---
Hello!

On Mon, 2005-03-07 at 18:20 +0530, Vaibhav Sibal wrote:
> Hi
> I checked ou the ftp functions of PHP, what I wanted to ask was that
> if I connect to a remote server and issue and ftp_fget() command the
> file will be downloaded to the server running the PHP code and Apache
> webserver or the client machine from which we are calling it ? In the
> sense for example I have a client machine running on windows XP, I
> launch the mozilla firefox browser in that and call for the
> ftp_code.php on my server (http://server). The ftp_code.php contains a
> code which connects to a remote ftp server and then using the
> ftp_fget() function downloads a file from the remote server. Now where
> will this file be downloaded ?

The short answer is it would download it to the server, not the client
on which Firefox is running.  But if you were wanting to transfer the
file to the client, I'd think you could do something creative like this:

1. Have your script download the file from the remote server.
2. Once the file has been downloaded, display a new page to the browser
with a link to the file.
3. Then the user can click the link to retrieve/open the file.

Now this may not be the best solution, it just happens to be what I
could think of off the top of my head.  There may be better ways to
accomplish the same thing.

Hope that helps!

Tim

--- End Message ---
--- Begin Message --- The problem is more of my own output sticking around (echo $query) and the test server still going to the next page, despite the echoed text.

I'm not sure how to use output buffering to fix this..

Jon

On Mar 7, 2005, at 2:01 AM, Burhan Khalid wrote:

Jonathan Haddad wrote:
I do all my development on mac os x. sometimes, to debut a script, i output the query to the page. quite often the page sends headers to go to another page. When i do this, i comment out the header() function and read the results. When i'm done i remove the comment
Sometimes I've forgotten to take out the debugging output. Now, on my server here, the page redirects and loads fine. But in the live environment, it craps out and people are left staring at a blank page.

This means that on the live server, error_reporting is at such a level that the Warning that is generated by php -- the "Cannot modify header information output started at ...." line isn't displayed, and since there is output to the client, the header() call fails, which is why you are left with a white screen.

You can use output buffering to avoid such a problem; there is also the header_sent() function.

HTH

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


--- End Message ---
--- Begin Message ---
On Wed, 2005-02-23 at 15:58 -0500, Tim Boring wrote:
> Hi, Richard!
> 
> On Wed, 2005-02-23 at 08:45 -0800, Richard Lynch wrote:
> > Maybe try the active/passive thing...
> >
> > Often-times, the client/server will/won't allow one or the other, based on
> > their idea of what's safe/fast.
> 
> Yes, I tried that, too.  Sorry, I didn't mention that in my original
> post.  I appreciate the suggestion!

It was in fact the active/passive thing!  Being a newbie to phpunit2, I
didn't realize that each test creates a new object; thus, although I had
a test to test the passive function, the passive connection to the ftp
server got destroyed with the object at the end of that test.  So, I had
to modify my test code to set the active connection to passive within
each test.  

Tim

--- End Message ---
--- Begin Message ---
Hi

I have tried creating a script which will allow our core staff to upload
files to our FTP server.

I don't have a problem with the uploading of a local file to our FTP server
with the correct authentication etc, the problem I am having, is that the
file which gets uploaded always has the filename of 'www.ourdomain.net'
which is the destination web server name.

I have a form, which has a file 'browse' element. PHP stores the local file
in /tmp/ as with a temporary file name (I can see this with
$_FILES['$file']['tmp_name']), but I don't know why it gets converted to
'www.ourdomain.net' in the final stages?

My code (rough, but you get the idea);

Thanks for any help
Steve

<?php>

$ftp_server = '<OUR FTP SERVER>';
$un         = $_REQUEST['ftp_un'];
$pw         = $_REQUEST['ftp_pw'];
$tmp_file   = $_FILES['ftp_f']['tmp_name'];
$file       = $_FILES['ftp_f']['name'];
?>

<html>
<head>
<title>FTP Interface</title>
</head>

<body>

<div id="topHeader">
<h1>FTP Interface</h1></td>
</div>

<?php

if (is_null($file)) {
?>

<div>
You need a username & password to upload files to the FTP area.<br /><br />

<form enctype="multipart/form-data" action="<?php echo $_SERVER
['PHP_SELF'] ?>" method="post">

<div>
    <span>Username: </span>
    <span style="position:absolute; left:150px;"><input type="text"
name="ftp_un" /></span>
</div>

<div>
    <span>Password: </span>
    <span style="position:absolute; left:150px;"><input type="password"
name="ftp_pw" /></span>
</div>

<div>
    <span>Browse for file: </span>
    <input type="hidden" name="MAX_FILE_SIZE" value="100000" />
    <span style="position:absolute; left:150px;"><input type="file"
name="ftp_f" /></span>
</div>

<div>
    <input type="submit" value="Upload File Now" />
</div>

</form>
</div>

<?php
}
else {



$c = ftp_connect($ftp_server, 21)   or die("Can't connect");


if (!ftp_login($c, $un, $pw)){
    echo 'Login details incorrect, please try again...';
} else {
    if (ftp_put($c, $ftp_server, $tmp_file, FTP_ASCII)){
        ftp_rename($c, "<OUR FTP SERVER>", $file) or die("ftp rename didn't
work");
        echo 'your file has transfered successfully!';
    } else {
        echo 'There was a problem, please retry...';
    }
}


ftp_close($c);

}

?>

<body>

</html>

--- End Message ---
--- Begin Message ---
Is it possible to call a named anchor from within a php script?? I need my 
page to go to the point in the page where the form is and bypass all the 
rubbish.

Thanks y'all 

--- End Message ---
--- Begin Message ---
Ross Hulford <mailto:[EMAIL PROTECTED]>
    on Monday, March 07, 2005 2:48 PM said:

> Is it possible to call a named anchor from within a php script?? I
> need my page to go to the point in the page where the form is and
> bypass all the rubbish.

Since that is a client-side issue and PHP is server-side the best you
could do is to redirect to the page putting the anchor in the URL.
Whether or not the browser will actually pay attention to your anchor
and move the page is another story.


Chris.

--- End Message ---
--- Begin Message ---
[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>
    on Monday, March 07, 2005 3:09 PM said:

Ross,

Please don't send emails off list unless there is a specific reason to
do so. In this case, there's not.

Now on to your issue.

> What I want to do is something like this although this doesn't work

What about it is not working?



Chris.

p.s. Read this! If you read this and apply the principles found therein
you can get questions answered much more quickly.
http://www.catb.org/~esr/faqs/smart-questions.html

--- End Message ---
--- Begin Message ---
Hi All,

I'm new to PHP, but have read my "Beginning PHP 5 and MySQL" manual and have searched the net for a solution to my (presumably simple) problem.

I have a series of HTML forms that need to be processed. I am tring to build a "process.php" file which will evaluate the FORM variable and select the proper code from a SWITCH statement. I have processed these forms using a different construct with IF ELSE statments, but it's getting messy and SWITCH looked like a good solution. The problem is that it doesn't work - isn't that always the problem! I can't find anything but simple examples of SWITCH usage on the net. Would someone be good enough to evaluate this script? Much thanks!!

Below is the "process.php" script and the form tags go something like this:

<FORM action="process.php" method="post" name="form" value="addcontact">
   Some fields go here...
</FORM>

<FORM action="process.php method="post" name="form" value="addletter">
   More fields go here...
</FORM>

<?php
//Include database access info
include("setup.php");
//Connect to the database server
@mysql_connect($dbhost, $dbuser, $dbpass)or die(mysql_error());
@mysql_select_db ($db) or die(mysql_error());

//<------ Begin Main Script ------>
$x = $_POST['form'];
//Evaluate which form we are receiving and process the results
switch ($x) {
case "addcontact":
//Get the form variables
$cgroup = $_POST['cgroup'];
$fname = $_POST['fname'];
$lname = $_POST['lname'];
$address = $_POST['address'];
$city = $_POST['city'];
$state = $_POST['state'];
$zipcode = $_POST['zipcode'];
$phone = $_POST['phone'];
$email = $_POST['email'];
//Insert form data into the database
$query = "INSERT INTO contacts SET cgroup='$cgroup', fname='$fname', lname='$lname', address='$address', city='$city', state='$state', zipcode='$zipcode', phone='$phone', email='$email'";
$result = mysql_query($query) or die (mysql_error());
break;

case "addletter":
//Get the form variables
$lgroup = $_POST['lgroup'];
$lname = $_POST['lname'];
$content = $_POST['lcontent'];
//Insert form data into the database
$query = "INSERT INTO letters SET lgroup='$lgroup', lname='$lname', lcontent='$lcontent'";
$result = mysql_query($query) or die (mysql_error());
break;
}
mysql_close();
?>
//END SCRIPT


-- Best regards, Greg Dotts

If quitters never win, and winners never quit,
what fool came up with, "Quit while you're ahead"?

--- End Message ---
--- Begin Message ---
I think the problem is that the name and value attributes of the <form> 
tag aren't posted with the rest of the data, i.e., $_POST['form'] isn't 
defined.

You will need to code the form identifier a different way, e.g., either a 
<hidden> field, or, unique name and value attributes in a <submit> button.

Kirk


Greg Dotts <[EMAIL PROTECTED]> wrote on 03/07/2005 03:47:55 PM:

> Hi All,
> 
> I'm new to PHP, but have read my "Beginning PHP 5 and MySQL" manual and 
> have searched the net for a solution to my (presumably simple) problem.
> 
> I have a series of HTML forms that need to be processed.  I am tring to 
> build a "process.php" file which will evaluate the FORM variable and 
> select the proper code from a SWITCH statement.  I have processed these 
> forms using a different construct with IF ELSE statments, but it's 
> getting messy and SWITCH looked like a good solution.  The problem is 
> that it doesn't work - isn't that always the problem!  I can't find 
> anything but simple examples of SWITCH usage on the net.  Would someone 
> be good enough to evaluate this script?  Much thanks!!
> 
> Below is the "process.php" script and the form tags go something like 
this:
> 
> <FORM action="process.php" method="post" name="form" value="addcontact">
>     Some fields go here...
> </FORM>
> 
> <FORM action="process.php method="post" name="form" value="addletter">
>     More fields go here...
> </FORM>
> 
> <?php
> //Include database access info
> include("setup.php");
> //Connect to the database server
> @mysql_connect($dbhost, $dbuser, $dbpass)or die(mysql_error());
> @mysql_select_db ($db) or die(mysql_error());
> 
> //<------ Begin Main Script ------>
> $x = $_POST['form'];
> //Evaluate which form we are receiving and process the results
> switch ($x) {
> case "addcontact":
> //Get the form variables
> $cgroup = $_POST['cgroup'];
> $fname = $_POST['fname'];
> $lname = $_POST['lname'];
> $address = $_POST['address'];
> $city = $_POST['city'];
> $state = $_POST['state'];
> $zipcode = $_POST['zipcode'];
> $phone = $_POST['phone'];
> $email = $_POST['email'];
> //Insert form data into the database
> $query = "INSERT INTO contacts SET cgroup='$cgroup', fname='$fname', 
> lname='$lname', address='$address', city='$city', state='$state', 
> zipcode='$zipcode', phone='$phone', email='$email'";
> $result = mysql_query($query) or die (mysql_error());
> break;
> 
> case "addletter":
> //Get the form variables
> $lgroup = $_POST['lgroup'];
> $lname = $_POST['lname'];
> $content = $_POST['lcontent'];
> //Insert form data into the database
> $query = "INSERT INTO letters SET lgroup='$lgroup', lname='$lname', 
> lcontent='$lcontent'";
> $result = mysql_query($query) or die (mysql_error());
> break;
> }
> mysql_close();
> ?>
> //END SCRIPT
> 
> 
> -- 
> Best regards,
> Greg Dotts
> 
> If quitters never win, and winners never quit,
> what fool came up with, "Quit while you're ahead"?
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 

--- End Message ---
--- Begin Message --- Sure enough Kirk! That was it. Seems strange that you can set a name/value pair on the <form> tag, but they aren't used. Guess they were just kidding ;-)

Greg



Greg Dotts wrote:

Sure enough Kirk! That was it. Seems strange that you can set a name/value pair on the <form> tag, but they aren't used. Guess they were just kidding ;-)

Greg


[EMAIL PROTECTED] wrote:

I think the problem is that the name and value attributes of the <form> tag aren't posted with the rest of the data, i.e., $_POST['form'] isn't defined.

You will need to code the form identifier a different way, e.g., either a <hidden> field, or, unique name and value attributes in a <submit> button.

Kirk


Greg Dotts <[EMAIL PROTECTED]> wrote on 03/07/2005 03:47:55 PM:



Hi All,

I'm new to PHP, but have read my "Beginning PHP 5 and MySQL" manual and have searched the net for a solution to my (presumably simple) problem.

I have a series of HTML forms that need to be processed. I am tring to build a "process.php" file which will evaluate the FORM variable and select the proper code from a SWITCH statement. I have processed these forms using a different construct with IF ELSE statments, but it's getting messy and SWITCH looked like a good solution. The problem is that it doesn't work - isn't that always the problem! I can't find anything but simple examples of SWITCH usage on the net. Would someone be good enough to evaluate this script? Much thanks!!

Below is the "process.php" script and the form tags go something like

this:


<FORM action="process.php" method="post" name="form" value="addcontact">
Some fields go here...
</FORM>

<FORM action="process.php method="post" name="form" value="addletter">
   More fields go here...
</FORM>

<?php
//Include database access info
include("setup.php");
//Connect to the database server
@mysql_connect($dbhost, $dbuser, $dbpass)or die(mysql_error());
@mysql_select_db ($db) or die(mysql_error());

//<------ Begin Main Script ------>
$x = $_POST['form'];
//Evaluate which form we are receiving and process the results
switch ($x) {
case "addcontact":
//Get the form variables
$cgroup = $_POST['cgroup'];
$fname = $_POST['fname'];
$lname = $_POST['lname'];
$address = $_POST['address'];
$city = $_POST['city'];
$state = $_POST['state'];
$zipcode = $_POST['zipcode'];
$phone = $_POST['phone'];
$email = $_POST['email'];
//Insert form data into the database
$query = "INSERT INTO contacts SET cgroup='$cgroup', fname='$fname', lname='$lname', address='$address', city='$city', state='$state', zipcode='$zipcode', phone='$phone', email='$email'";
$result = mysql_query($query) or die (mysql_error());
break;

case "addletter":
//Get the form variables
$lgroup = $_POST['lgroup'];
$lname = $_POST['lname'];
$content = $_POST['lcontent'];
//Insert form data into the database
$query = "INSERT INTO letters SET lgroup='$lgroup', lname='$lname', lcontent='$lcontent'";
$result = mysql_query($query) or die (mysql_error());
break;
}
mysql_close();
?>
//END SCRIPT


-- Best regards, Greg Dotts

If quitters never win, and winners never quit,
what fool came up with, "Quit while you're ahead"?

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







--- End Message ---
--- Begin Message ---


I must concur.   PHP nuke has never even been the slightest resource hog
on any of my machines.   



 <http://www.xnote.com/>        
Alan Fullmer    
Owner / Administrator   
[EMAIL PROTECTED]       





-----Original Message-----
From: Warren Vail [mailto:[EMAIL PROTECTED]
Sent: Friday, February 25, 2005 3:26 PM
To: Kostyantyn Shakhov; php-general@lists.php.net
Subject: RE: [PHP] Open source portal systems???

Where did you hear that PHP Nuke required a powerful server?  I personally
implemented PHP Nuke on a Windoz box (one strike there), that ran on a 166
mmx box (a big second strike), and benchmarked it handling 90 concurrent
users, with no noticeable delays.  If I were you, I'd dig deeper into what
you heard and you may find that someone had another agenda in mind when
they passed along that info.  It's unfortunate, but there are lots of
people in the IT field that distort results to justify an already
conceived opinion.

go figure,
Warren Vail

> -----Original Message-----
> From: Kostyantyn Shakhov [mailto:[EMAIL PROTECTED]
> Sent: Friday, February 25, 2005 9:34 AM
> To: php-general@lists.php.net
> Subject: [PHP] Open source portal systems???
>
>
> I've got an order for the media portal. Thus, I'm looking for an open
> source portal systems. First that comes to my mind is PHP-Nuke, but I
> heared that it requires a powerful server and i'll have just a
> middle-level one. So, could someone knows another PHP-based open
> source portal systems? Thank you in advance.
>
> --
> Best regards,
>  Kostyantyn                          mailto:[EMAIL PROTECTED]
>
>
> --
> PHP General Mailing List (http://www.php.net/) To unsubscribe, visit:
> http://www.php.net/unsub.php
>
>
>

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

--- End Message ---
--- Begin Message --- Brian Dunning wrote:
On Mar 7, 2005, at 7:40 AM, M. Sokolewicz wrote:

array_rand()


But that's likely to give me the same element more than once. I want to output the entire array but in a random order, like a shuffled deck of cards.

like a shuffled deck of cards?

http://www.php.net/shuffle
--- End Message ---
--- Begin Message ---
http://www.php.net/shuffle

Boy do I feel stupid. Thanks!! :)

I always RTFM and STFW before posting - but somehow did not search the PHP site for the word "shuffle."
--- End Message ---
--- Begin Message ---
Hello all,

I am writing a script that uses curl to access a
webpage that is password protected and uses cookies. 
The webpage displays a graph on my browser and I would
like to capture and save that graph to a file.

This is the url I am using in curlopt_url :

http://10.10.10.22:8080/NetPerfMon/ViewChart.asp?Chart=AVGRTLOSS&NetObject=N:4&Period=Today&SampleSize=30M&ReBuild=TRUE&FontSize=Medium&Width=640&Height=0";)

If I cut and paste this to my browser the graph gets
displayed but when I use my sript this is the ouput of
the curl_exec:

<img
src="/NetPerfMon/Chart.asp?Chart=AVGRTLOSS&NetObject=N:4&Period=Today&SampleSize=30M&ReBuild=TRUE&FontSize=Medium&Width=640&Height=0"
border="0">

Which is not what I want, I actually want to grab and
save the image that I see on my browser. 

Can this be done and can someone help me out ?

Thanks,

--
buck



---
Emanuele Buttice


        
                
__________________________________ 
Celebrate Yahoo!'s 10th Birthday! 
Yahoo! Netrospective: 100 Moments of the Web 
http://birthday.yahoo.com/netrospective/

--- End Message ---
--- Begin Message --- buck Wheat wrote:
Hello all,

I am writing a script that uses curl to access a
webpage that is password protected and uses cookies. The webpage displays a graph on my browser and I would
like to capture and save that graph to a file.

This is the url I am using in curlopt_url :

http://10.10.10.22:8080/NetPerfMon/ViewChart.asp?Chart=AVGRTLOSS&NetObject=N:4&Period=Today&SampleSize=30M&ReBuild=TRUE&FontSize=Medium&Width=640&Height=0";)

If I cut and paste this to my browser the graph gets
displayed but when I use my sript this is the ouput of
the curl_exec:

<img
src="/NetPerfMon/Chart.asp?Chart=AVGRTLOSS&NetObject=N:4&Period=Today&SampleSize=30M&ReBuild=TRUE&FontSize=Medium&Width=640&Height=0"
border="0">

from the output of curl_exec extract the url:

/NetPerfMon/Chart.asp?Chart=AVGRTLOSS&NetObject=N:4&Period=Today&SampleSize=30M&ReBuild=TRUE&FontSize=Medium&Width=640&Height=0

then make another call with curl_exec() using that url
the data you get back should be the image, save it to disk.


...thats basically what you browser would do.

or just use that url iso the url that you are currently
using (the one that outputs a page with (only!?) an img tag in it.)


Which is not what I want, I actually want to grab and
save the image that I see on my browser.

Can this be done and can someone help me out ?

Thanks,

--
buck



---
Emanuele Buttice




__________________________________ Celebrate Yahoo!'s 10th Birthday! Yahoo! Netrospective: 100 Moments of the Web http://birthday.yahoo.com/netrospective/


--- End Message ---
--- Begin Message ---
Hi,

Tuesday, March 8, 2005, 12:03:54 AM, you wrote:
LG> Hello Tom,

LG> Sunday, March 6, 2005, 11:20:04 PM, you wrote:
T>> I do this for security as I have things in include that I don't
T>> want to be avaiable directly to the browser Also you don't need a
T>> path for include files you can just do:

LG> Don't necessarily disagree with you there other than if you place the
LG> includes outside the web accessible folders how do you address the
LG> managers of virtual hosts for the ability to modify, delete or add to
LG> their particular include file? Additionally, how do you address
LG> the naming convention of the include file.

LG> i.e.
LG> Site 'A' is using config.php
LG> Site 'B' is using config.inc.php
LG> Site 'C' wants to use config.php



T>> include('somefile.php');
T>> and it will be found regardless of where the script is located.

LG> That's true enough..

LG> BTW, good to see another TheBat! user here.

LG> Thanks again.

I only do stuff for my own server which actually creates a couple
 of server variables called:

 SERVER["DOMAIN_ROOT"] and SERVER["PHPINCDIR"] which have the same
 values as the script we just cobbled together for each virtual
 domain.
 I don't suffer from the problem of lack of access to the
 include directory, So all my domains follow this layout:

/usr/local/apache/domains/domain1.com //root and chroot for ftp
 access
/usr/local/apache/domains/domain1.com/www web document root

/usr/local/apache/domains/domain1.com/include for all include files

If a hosting provider locks you in to the document root it's time to
change provider :)
As for naming convention I use .inc and stop apache from serving .inc
files.

-- 
regards,
Tom

--- End Message ---
--- Begin Message ---
Hi,
I'm really new and getting lots of help but need some assistance.

I'm running a script which gets specific articles from a database if they're entered in the URL after the ? . For instance if someone asks for

www.foo.com/index.htm?a=1234

then the script would look for an database entry with the id of 1234 and display it in the page.

If there's no number specified (www.foo.com/index.htm) or if the number given is to an article which doesn't exist, it gets the titles of all the articles available and prints them as links to the proper article number.

I'd also like it to grab the first 200 characters of text from the $content field of the entry.

With help I have the title link part and I suspect I'm close but I keep messing up the syntax

The code is:

<snip>

if (!empty($where)) {

echo "
 <ul>";
$article = mysql_fetch_assoc($result);
} else {
while ($article = mysql_fetch_assoc($result)) {
$table_of_contents[] = "
<li><a href='{$_SERVER['PHP_SELF']}?a={$article['article_id']}' title='{$article['title']}'>{$article['title']}</a><br />
$article['content'] = substr($article['content'], 0 200);</li>";
}
}

echo "
 </ul>";

</snip>

Can anyone help ?

Thanks in advance!

--- End Message ---
--- Begin Message ---
On Mon, 7 Mar 2005 22:23:19 -0500, Jackson Linux
<[EMAIL PROTECTED]> wrote:
> Hi,
> I'm really new and getting lots of help but need some assistance.
> 
> I'm running a script which gets specific articles from a database if
> they're entered in the URL after the ? . For instance if someone asks
> for
> 
> www.foo.com/index.htm?a=1234
> 
> then the script would look for an database entry with the id of 1234
> and display it in the page.
> 
> If there's no number specified (www.foo.com/index.htm) or if the number
> given is to an article which doesn't exist, it gets the titles of all
> the articles available and prints them as links to the proper article
> number.
> 
> I'd also like it to grab the first 200 characters of text from the
> $content field of the entry.
> 
> With help I have the title link part and I suspect I'm close but I keep
> messing up the syntax
> 
> The code is:
> 
> <snip>
> 
> if (!empty($where)) {
> 
> echo "
>  <ul>";
>   $article = mysql_fetch_assoc($result);
> } else {
> while ($article = mysql_fetch_assoc($result)) {
>   $table_of_contents[] = "
> <li><a href='{$_SERVER['PHP_SELF']}?a={$article['article_id']}'

> title='{$article['title']}'>{$article['title']}</a><br />
> $article['content'] = substr($article['content'], 0 200);</li>";

change these two lines to 

title='{$article['title']}'>{$article['title']}</a><br />".
substr($article['content'], 0, 200)."</li>";

zareef ahmed 


> }
> }
> 
> echo "
>  </ul>";
> 
> </snip>
> 
> Can anyone help ?
> 
> Thanks in advance!
> --
> 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

--- End Message ---

Reply via email to