Re: [PHP] cookie secure argument?

2003-03-04 Thread Hans Prins
thank you :)

"Rasmus Lerdorf" <[EMAIL PROTECTED]> schreef in bericht
news:[EMAIL PROTECTED]
> Means the cookie will only be sent over an HTTPS connection.
>
> On Wed, 5 Mar 2003, Hans Prins wrote:
>
> > Can anyone tell me what the secure argument in the setcookie() function
> > does?
> >
> > setcookie ( string name [, string value [, int expire [, string path [,
> > string domain [, int secure])
> >
> >
> > thx
> >
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >



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



[PHP] cookie secure argument?

2003-03-04 Thread Hans Prins
Can anyone tell me what the secure argument in the setcookie() function
does?

setcookie ( string name [, string value [, int expire [, string path [,
string domain [, int secure])


thx



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



Re: [PHP] ICQ # validation

2003-03-04 Thread Hans Prins
Also, don't forget to escape the $ character in your expression, since it is
reserved for variable declaration.


"Ales KrajníK" <[EMAIL PROTECTED]> schreef in bericht
news:[EMAIL PROTECTED]
> Well ...
>
> - the {7,9} means that the previous char/group should repeat 7 to 9 times
> ...
> - ^ means the beginning of the string
> - $ means the end of the string
>
> So everything, that validates, is 7 to 9 numbers.
>
> "123456789 This is a test" won't validate - it contains chars instead of $
> (end of string) after [0-9]{7,9} = 7 to 9 numbers.
>
> And yes, you can use something like [[:digit:]] but I must admit I don't
use
> that much.
>
> Ales
>
> <[EMAIL PROTECTED]> wrote in message
>
news:[EMAIL PROTECTED]
> .
> > > if(ereg("^[0-9]{7,9}$", $_REQUEST["icqnumber"])) {
> > > >> print("a-okay!");
> > > >> } else {
> > > >> print("error msg");
> > > >> }
> >
> > Although I'm not too familiar with regexp I'd say the code validates
> > because the icq number you are providing actually confimrs to the
pattern.
> > The first seven to nine digits contain only numbers so the pattern is
> > true. Th ce pattern does not check the length of your provided string.
> > If I'm correct than "123456789 This is a test" will also proof to be
> > correct. So you have to do two things first check the whole argument for
> > digits like ereg('^[0-9]{'.strlen($_REQUEST['icqnumber']).'}',
> > $_REQUEST['icqnumber']) and check length separatly. (U can also use
> > [[:digit:]]) Or use the code as mentioned before.
> > In your place I would not assume anything about the length of the icq
> > number.
> >
> > Hope that helps
> > Stefan
> >
> > P.S.: Please correct me if I'm wrong with the above
>
>



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



[PHP] Re: Image Resize

2003-02-23 Thread Hans Prins
You will need the GD library of image functions for this to work.
You can find more information at the following page:
http://www.php.net/manual/en/ref.image.php

gl

"Randum Ian" <[EMAIL PROTECTED]> schreef in bericht
news:[EMAIL PROTECTED]
> Hi guys,
>
> Is it possible to resize an uploaded file to 10% of it's size and rename
> it accordingly?
>
> I have the filename for the full-size image as "filename-WWWxHHH.jpg"
> where WWW is the width and HHH is the height.
>
> I want the re-sized image to have the filename
> "filename-thumb-WWWxHHH.jpg" where WWW is the resized width and HHH is
> the resized height.
>
> Does this make any sense, would it be possible automatically?
>
> I am grateful for any help, Ian.
>
>



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



Re: [PHP] table width problems

2003-02-23 Thread Hans Prins
If your html table is too wide that is useually due to a pixel size or a
percentage which is too large. You could try playing around with those
values and calculate how much columns you have and maybe how much of a
percentage size they should have relative to the screen width
tables can be a bit tricky though especially when nesting them..
if wordwrap( ) doesnt help you, you could post your html source, and we can
take a look at it

gl
"Dennis Cole" <[EMAIL PROTECTED]> schreef in bericht
news:[EMAIL PROTECTED]
> You can use the code below to trim a string to a specified number of
> charecters. Change 64 to how long you want the string to be. This won't
cut
> words in half.
>
>  wordwrap( $text, 64, "", 0);
>
> -Original Message-
> From: Adriaan Nel [mailto:[EMAIL PROTECTED]
> Sent: Sunday, February 23, 2003 10:27 AM
> To: [EMAIL PROTECTED]
> Subject: [PHP] table width problems
>
>
> Hi,
>
> I've got a table that gets it's contents from a database, the problem is
> that even though I specify the width of the table, it is still wider than
> it's supposed to be, cause some of the info from the table doesn't
> wrap.my question is if there is a way to force td wrapping when it
> exceeds the allowed width??
>
> Please help
> thanks
> Adriaan
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>



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



[PHP] Re: Question about str_replace()

2003-02-22 Thread Hans Prins
Assuming that you do want to replace "[p]" with "", the code you posted
worked for me. The following printed: "leadingtexttrailingtext" to the
screen

');
$text = "leadingtext[p]trailingtext";
$words = str_replace ($find, $replace, $text);
print $words;
?>

"Al" <[EMAIL PROTECTED]> schreef in bericht
news:[EMAIL PROTECTED]
> I have a simple str_replace function that obviously has a syntax
> problem.  The [p] in the $find array ignores the brackets.  Every "p" in
> my text is replaced by a .  Just for the heck of it, I've tried "
> instead of ', and preg_replace(), etc.
>
> $find= array('& ','W&OD', '"&"', chr(146), '[p]');
> $replace= array("& ","W&OD", '"&"', "'", '');
>
> $words= str_replace ($find, $replace, $text);
>
> Thanks.
>



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



Re: [PHP] Re: including in shtml

2003-02-22 Thread Hans Prins
thank you |Tom :)
That helped me out a lot

"Tom Rogers" <[EMAIL PROTECTED]> schreef in bericht
news:[EMAIL PROTECTED]
> Hi,
>
> Saturday, February 22, 2003, 12:29:36 PM, you wrote:
> HP> Im trying to write a poll script that is easy to intergrate into other
> HP> documents of a site and thought that since shtml is a much used
method, I
> HP> want to make it available.
>
> HP> "Hans Prins" <[EMAIL PROTECTED]> schreef in bericht
> HP> news:[EMAIL PROTECTED]
> >> Hello,
> >>
> >> I have a problem with including a "test.php" into a "test.shtml" and
> HP> passing
> >> a variable to the "test.shtml" which should be processed in the
"test.php"
> >>
> >> the "test.php" document includes the following:
> >> ---
> >>
> >>  >>
> >> if ($HTTP_GET_VARS['theValue']) {
> >> print $HTTP_GET_VARS['theValue'];
> >> } else {
> >> print"
> >> 
> >> 
> >> 
> >> 
> >> ";
> >> }
> >>
> >> ?>
> >>
> >> the "test.shtml" document includes the following:
> >> -
> >>
> >> 
> >> 
> >> poll
> >> 
> >> 
> >> 
> >> 
> >> 
> >>
> >> I've also tried using the POST method but I got an error stating that
post
> >> is not a valid method in shtml.
> >>
> >> I have also considered a session variable but since a session needs to
> >> initiated or continued before anything is output to the browser that
wont
> >> work (I think).
> >>
> >> does anyone have a solution to get this to work?
> >>
> >> thanks,
> >> Hans
> >>
> >>
>
> POST won't work easily with .shtml files so you are limited to GET and its
> length limitations but the following works for me:
>
>
>
>
> //test.php
> 
> if(isset($_SERVER['QUERY_STRING_UNESCAPED'])){
> parse_str($_SERVER['QUERY_STRING_UNESCAPED']);
> if(!empty($theValue)){
> echo 'Value = '.stripslashes($theValue).'';
> }
> }
> print'
> 
> 
> 
> 
> ';
>
> ?>
>
> (parse string seems to like adding slashes)
>
> To use post you will have to post to a .php file to do the processing and
> redirect to the .shtml file.
>
> --
> regards,
> Tom
>



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



[PHP] Re: including in shtml

2003-02-21 Thread Hans Prins
Im trying to write a poll script that is easy to intergrate into other
documents of a site and thought that since shtml is a much used method, I
want to make it available.

"Hans Prins" <[EMAIL PROTECTED]> schreef in bericht
news:[EMAIL PROTECTED]
> Hello,
>
> I have a problem with including a "test.php" into a "test.shtml" and
passing
> a variable to the "test.shtml" which should be processed in the "test.php"
>
> the "test.php" document includes the following:
> ---
>
> 
> if ($HTTP_GET_VARS['theValue']) {
> print $HTTP_GET_VARS['theValue'];
> } else {
> print"
> 
> 
> 
> 
> ";
> }
>
> ?>
>
> the "test.shtml" document includes the following:
> -
>
> 
> 
> poll
> 
> 
> 
> 
> 
>
> I've also tried using the POST method but I got an error stating that post
> is not a valid method in shtml.
>
> I have also considered a session variable but since a session needs to
> initiated or continued before anything is output to the browser that wont
> work (I think).
>
> does anyone have a solution to get this to work?
>
> thanks,
> Hans
>
>



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



[PHP] ssi problem

2003-02-21 Thread Hans Prins
Could anyone please shed some light on the following issue?

I have a problem with including a "test.php" into a "test.shtml" and passing
a variable to the "test.shtml" which should be available and processed in
the "test.php"

the "test.php" document includes the following:
---





";
}

?>

the "test.shtml" document includes the following:
-



poll






I've also tried using the POST method but I got an error stating that post
is not a valid method in shtml.

I have also considered a session variable but since a session needs to
initiated or continued before anything is output to the browser that wont
work (I think).

does anyone have a solution to get this to work?

thanks,
Hans



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



[PHP] Re: including in shtml

2003-02-21 Thread Hans Prins
anyone?

"Hans Prins" <[EMAIL PROTECTED]> schreef in bericht
news:[EMAIL PROTECTED]
> Hello,
>
> I have a problem with including a "test.php" into a "test.shtml" and
passing
> a variable to the "test.shtml" which should be processed in the "test.php"
>
> the "test.php" document includes the following:
> ---
>
> 
> if ($HTTP_GET_VARS['theValue']) {
> print $HTTP_GET_VARS['theValue'];
> } else {
> print"
> 
> 
> 
> 
> ";
> }
>
> ?>
>
> the "test.shtml" document includes the following:
> -
>
> 
> 
> poll
> 
> 
> 
> 
> 
>
> I've also tried using the POST method but I got an error stating that post
> is not a valid method in shtml.
>
> I have also considered a session variable but since a session needs to
> initiated or continued before anything is output to the browser that wont
> work (I think).
>
> does anyone have a solution to get this to work?
>
> thanks,
> Hans
>
>



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



Re: [PHP] Re: Mysql DB connect failure

2003-02-21 Thread Hans Prins
> Would you care to explain to the rest of the list how you intend to use
> mysql_error () to return connection failure information?
>
> It returns the text of the error message from previous MySQL operation
> Description: string mysql_error ( [resource link_identifier])
>
> Seems to me that without a connection, we wouldn't have a valid
> link_identifier.

maybe so, but it works nonetheless.

if for example the username stated in the connection initialization was
wrong it will print an error like:

"Access denied for user: 'username@localhost' (Using password: YES)"

MI,

my code would look somethign like this:

$link = @mysql_pconnect("localhost", "test1", "test1");

// If connection failed...
if (!$link) {
// Inform user of error and quit
print "Couldn't connect to database server\n";
print mysql_error();
exit;
}



"Jason K Larson" <[EMAIL PROTECTED]> schreef in bericht
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Would you care to explain to the rest of the list how you intend to use
> mysql_error () to return connection failure information?
>
> It returns the text of the error message from previous MySQL operation
> Description: string mysql_error ( [resource link_identifier])
>
> Seems to me that without a connection, we wouldn't have a valid
> link_identifier.
>
> What you probably should attempt going for is getting something back
> from PHP itself regarding the error returned when the mysql_connect
failed.
>
> Here's a snippet from:
> http://www.php.net/manual/en/language.operators.errorcontrol.php
>
> If the track_errors feature is enabled, any error message generated by
> the expression will be saved in the global variable $php_errormsg. This
> variable will be overwritten on each error, so check early if you want
> to use it.
>
> Hope that clears things up a bit.
>
> Regards,
> Jason k Larson
>
>
>
> Hans Prins wrote:
> > did you try:
> > print mysql_error();
> >
> > "Ml" <[EMAIL PROTECTED]> schreef in bericht
> > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> >
>
>



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




[PHP] Re: Mysql DB connect failure

2003-02-21 Thread Hans Prins
did you try:
print mysql_error();

"Ml" <[EMAIL PROTECTED]> schreef in bericht
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Currently I have some php code that displays a message if a connect to my
> database fails. Is there anyway I
> can get a more descriptive error message? So I can see exactly why my php
> can't connect to the Database?
> I am pretty sure that the username and password are correct and the
username
> exists as a mysql user...
>
>
>



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




Re: [PHP] Re: session expiration

2003-02-21 Thread Hans Prins
I think a database session would be of more use to you since you would have
more control over the lifetime of the session etc


"Lowell Allen" <[EMAIL PROTECTED]> schreef in bericht
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > From: "Hans Prins" <[EMAIL PROTECTED]>
> >
> > can you show us the PHP code that you use to manage your session?
>
> Sure. You say in a following post:
>
> > I am asking because if you are using: session_set_cookie_params(), the
> > effect of this function only lasts for the duration of the script.
>
> I'm not using session_set_cookie_params(). The session.cookie_lifetime
> setting is 0; I don't specify anything about cookies.
>
> I have a login function that checks username/password against database
> values, then on the content management system index page I do:
>
> if (login($username, $password) {
> $user = $username;
> session_register("user");
> }
>
> All pages within the cms have session_start(); following a require_once()
> statement, output some HTML, then call check_valid_user(), shown below:
>
> function check_valid_user() {
> global $user;
> if (session_is_registered("user")) {
> echo("Logged in as $user.");
> } else {
> ?>
> Problem: You are not logged in.
> Login
> 
> 
>  exit;
> }
> }
>
> That's it.
>
> --
> Lowell Allen
>
>
> > "Lowell Allen" <[EMAIL PROTECTED]> schreef in bericht
> > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> >> I'm using sessions for authentication in a content management system
and
> >> experiencing rare but occasional problems with the session apparently
> >> expiring unexpectedly. I've checked the manual and I've reviewed the
> > session
> >> configuration on the commericial host I'm using. I don't see anything
> > wrong,
> >> but there are some settings that I don't understand:
> >>
> >> session.gc_maxlifetime 1440 -- Garbage collection after 24 minutes?
Does
> >> this mean that the session id and session variables will be cleared
after
> > 24
> >> minutes of inactivity? (Surely not; that doesn't make sense.) And
cleared
> >> from where, the directory specified in session.save_path?
> >>
> >> session.save_path /tmp -- The session id and session variables are
stored
> > in
> >> this directory, and it's more secure to specify a different directory.
Is
> > it
> >> more stable to specify a different directory? Is it more stable to use
a
> >> database?
> >>
> >> session.cache_expire 180 -- The cache expires after 3 hours? If
> >> session.cache_limiter is set to nocache, is session.cache_expire
relevant?
> >>
> >> Basically, I want users to be able to stay logged in to the content
> >> management system indefinitely, but my tests show that after about 2
hours
> >> of inactivity, the session expires. (Going to a different page causes
the
> >> session variable that identifies the user to be checked with
> >> session_is_registered(), and access is denied if the variable isn't
> >> registered.) Some users have reported this happening after about 30
> > minutes.
> >>
> >> I'm on LInux, PHP 4.1.2, session.cookie_lifetime setting is 0,
> >> session.use_cookies setting is On, session.use_trans_sid setting is 1,
and
> >> other configurations as mentioned above. Why are sessions expiring?
> > Comments
> >> and directions to more information are appreciated.
> >>
> >> --
> >> Lowell Allen
>



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




[PHP] Re: how to get the array

2003-02-21 Thread Hans Prins
$globalArray = $_POST['yourPostArray'];

$arrayCount = count($globalArray);

// this loops and prints all array values for the amount
// of values found with the count function above
for ($count = 0; $count < $arrayCount; $count++) {
print $globalArray[$count];
}

goodluck :)

"Pei_world" <[EMAIL PROTECTED]> schreef in bericht
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> if my post variable is
> $_POST[array]
> How can I get the individual element of that array?
> I found one way to do this is $two_array=$_POST[array],
> but is there any other way to do so?
>
> thx
>
> --
> Sincerely your;
>
> pei_world ( .::IT::. )
>
>



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




[PHP] Re: session expiration

2003-02-21 Thread Hans Prins
I am asking because if you are using: session_set_cookie_params(), the
effect of this function only lasts for the duration of the script.


"Lowell Allen" <[EMAIL PROTECTED]> schreef in bericht
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> I'm using sessions for authentication in a content management system and
> experiencing rare but occasional problems with the session apparently
> expiring unexpectedly. I've checked the manual and I've reviewed the
session
> configuration on the commericial host I'm using. I don't see anything
wrong,
> but there are some settings that I don't understand:
>
> session.gc_maxlifetime 1440 -- Garbage collection after 24 minutes? Does
> this mean that the session id and session variables will be cleared after
24
> minutes of inactivity? (Surely not; that doesn't make sense.) And cleared
> from where, the directory specified in session.save_path?
>
> session.save_path /tmp -- The session id and session variables are stored
in
> this directory, and it's more secure to specify a different directory. Is
it
> more stable to specify a different directory? Is it more stable to use a
> database?
>
> session.cache_expire 180 -- The cache expires after 3 hours? If
> session.cache_limiter is set to nocache, is session.cache_expire relevant?
>
> Basically, I want users to be able to stay logged in to the content
> management system indefinitely, but my tests show that after about 2 hours
> of inactivity, the session expires. (Going to a different page causes the
> session variable that identifies the user to be checked with
> session_is_registered(), and access is denied if the variable isn't
> registered.) Some users have reported this happening after about 30
minutes.
>
> I'm on LInux, PHP 4.1.2, session.cookie_lifetime setting is 0,
> session.use_cookies setting is On, session.use_trans_sid setting is 1, and
> other configurations as mentioned above. Why are sessions expiring?
Comments
> and directions to more information are appreciated.
>
> --
> Lowell Allen
>



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




[PHP] Re: session expiration

2003-02-21 Thread Hans Prins
can you show us the PHP code that you use to manage your session?


"Lowell Allen" <[EMAIL PROTECTED]> schreef in bericht
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> I'm using sessions for authentication in a content management system and
> experiencing rare but occasional problems with the session apparently
> expiring unexpectedly. I've checked the manual and I've reviewed the
session
> configuration on the commericial host I'm using. I don't see anything
wrong,
> but there are some settings that I don't understand:
>
> session.gc_maxlifetime 1440 -- Garbage collection after 24 minutes? Does
> this mean that the session id and session variables will be cleared after
24
> minutes of inactivity? (Surely not; that doesn't make sense.) And cleared
> from where, the directory specified in session.save_path?
>
> session.save_path /tmp -- The session id and session variables are stored
in
> this directory, and it's more secure to specify a different directory. Is
it
> more stable to specify a different directory? Is it more stable to use a
> database?
>
> session.cache_expire 180 -- The cache expires after 3 hours? If
> session.cache_limiter is set to nocache, is session.cache_expire relevant?
>
> Basically, I want users to be able to stay logged in to the content
> management system indefinitely, but my tests show that after about 2 hours
> of inactivity, the session expires. (Going to a different page causes the
> session variable that identifies the user to be checked with
> session_is_registered(), and access is denied if the variable isn't
> registered.) Some users have reported this happening after about 30
minutes.
>
> I'm on LInux, PHP 4.1.2, session.cookie_lifetime setting is 0,
> session.use_cookies setting is On, session.use_trans_sid setting is 1, and
> other configurations as mentioned above. Why are sessions expiring?
Comments
> and directions to more information are appreciated.
>
> --
> Lowell Allen
>



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




[PHP] Re: selection in form-field

2003-02-21 Thread Hans Prins
I think javascript would be your best option Michiel.

"Michiel Van Heusden" <[EMAIL PROTECTED]> schreef in bericht
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> i have quite an easy question:
>
> is there a way in PHP to trace the selection in a certain form-field?
> i need this for building a simple html-edit application,
> which allows a user to select his/her text within a field, and then click
> 'bold' for instance..the PHP should insert  before the selection, and
>  after the selection.
>
> 1) should i use PHP or is this a typical JavaScript-thing? (or a
> combination?)
> 2) if you could help with a function or small script I would me most
> grateful
>
> grace
> michiel
>
>



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




[PHP] including in shtml

2003-02-21 Thread Hans Prins
Hello,

I have a problem with including a "test.php" into a "test.shtml" and passing
a variable to the "test.shtml" which should be processed in the "test.php"

the "test.php" document includes the following:
---





";
}

?>

the "test.shtml" document includes the following:
-



poll






I've also tried using the POST method but I got an error stating that post
is not a valid method in shtml.

I have also considered a session variable but since a session needs to
initiated or continued before anything is output to the browser that wont
work (I think).

does anyone have a solution to get this to work?

thanks,
Hans



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




[PHP] Re: server side including

2003-02-20 Thread Hans Prins
$HTTP_SERVER_VARS['REQUEST_URI'] did the trick

"Hans Prins" <[EMAIL PROTECTED]> schreef in bericht
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Im have a "script.php" which needs to be able to tell if it has been
> included in an .shtml file or not...
>
> e.g. if included is true: do this, else: do something else
>
> I could ofcourse do something like this:
>
> 
>
> but it would be nice to totally let the php check if it has been
> included
>
> Anyone have any ideas?
>
> hans
>
>



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




[PHP] server side including

2003-02-20 Thread Hans Prins
Im have a "script.php" which needs to be able to tell if it has been
included in an .shtml file or not...

e.g. if included is true: do this, else: do something else

I could ofcourse do something like this:



but it would be nice to totally let the php check if it has been
included

Anyone have any ideas?

hans



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




[PHP] Re: Redirect without header or javascipt

2003-02-19 Thread Hans Prins
I'd say no.. but if this is about limitations of for example the
header() function (where it needs to be called before anything should be
output to the browser) then you could buffer your output with: ob_start()
and ob_end_flush()

Hans

"Daniel Guerrier" <[EMAIL PROTECTED]> schreef in bericht
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Is there any to redirect in php with using header()
> and without the use of javascript?
>
> __
> Do you Yahoo!?
> Yahoo! Shopping - Send Flowers for Valentine's Day
> http://shopping.yahoo.com



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




Re: [PHP] Javascript function

2003-02-19 Thread Hans Prins
There are a lot of other handlers that can call your function:

onChange, onFocus, onBlur, onMouseOver, onKeyDown, etc..

gl :)

"Van Andel" <[EMAIL PROTECTED]> schreef in bericht
news:[EMAIL PROTECTED]
m...
Try this.

void function MyExampleFunction(theelement) {
theelement.focus()
}




The variable theelement will refer to "document.form_name.element_name"
so there is no reason to repeat that portion in the function.

Robbert van Andel


-Original Message-
From: Christian Ista [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, February 19, 2003 7:48 AM
To: [EMAIL PROTECTED]
Subject: [PHP] Javascript function


Hello,

Example, I have this function :

void function MyExampleFunction(){
 document.form_name.element_name.focus();
}

I'd like do something like that, I call the function like that :
MyExampleFunction('form_name.element_name');

And do that :
void function MyExampleFunction(theelement){
 document.theelement.focus();
}

but that's not work ?

An idea ?

Christian,




--
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] DB row selection

2003-02-19 Thread Hans Prins
Thanks a lot guys, the feedback so far has been most usefull

Hans

"Joel Colombo" <[EMAIL PROTECTED]> schreef in bericht
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> same thing
>
> $query = "SELECT * FROM polls ORDER BY pollID DESC LIMIT 1";
>
> dont need both params for LIMIT. just the num of rows u want back works
too.
>
> Joel
>
>
> "Hans Prins" <[EMAIL PROTECTED]> wrote in message
> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > That's weird.. that was the first thing I tried (DESC), but
it
> > gave me a syntax error at runtime.. however, when I tried it now, it
> > worked..
> >
> > I probably had another error that confused me.
> >
> > Thx a bunch :-)
> >
> > "Ernest E Vogelsinger" <[EMAIL PROTECTED]> schreef in bericht
> > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > > At 10:57 19.02.2003, you said:
> > > [snip]
> > > >Hello,
> > > >I recently learnt that with the code as stated below, I can select
one
> > row:
> > > >
> > > >$query = "SELECT * FROM polls ORDER BY pollID ASC LIMIT 0,1";
> > > >
> > > >However as far as I could figure out, I can only select the top row
or
> > tell
> > > >it at what rownumber to start and end. What if I wanted to select the
> > bottom
> > > >row? Would I have to do an extra query to count the rows and then
> select
> > it
> > > >with LIMIT?
> > > [snip]
> > >
> > > $query = "SELECT * FROM polls ORDER BY pollID DESC LIMIT 0,1";
> > >
> > >
> > > --
> > >>O Ernest E. Vogelsinger
> > >(\)ICQ #13394035
> > > ^ http://www.vogelsinger.at/
> > >
> > >
> >
> >
>
>



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




Re: [PHP] DB row selection

2003-02-19 Thread Hans Prins
That's weird.. that was the first thing I tried (DESC), but it
gave me a syntax error at runtime.. however, when I tried it now, it
worked..

I probably had another error that confused me.

Thx a bunch :-)

"Ernest E Vogelsinger" <[EMAIL PROTECTED]> schreef in bericht
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> At 10:57 19.02.2003, you said:
> [snip]
> >Hello,
> >I recently learnt that with the code as stated below, I can select one
row:
> >
> >$query = "SELECT * FROM polls ORDER BY pollID ASC LIMIT 0,1";
> >
> >However as far as I could figure out, I can only select the top row or
tell
> >it at what rownumber to start and end. What if I wanted to select the
bottom
> >row? Would I have to do an extra query to count the rows and then select
it
> >with LIMIT?
> [snip]
>
> $query = "SELECT * FROM polls ORDER BY pollID DESC LIMIT 0,1";
>
>
> --
>>O Ernest E. Vogelsinger
>(\)ICQ #13394035
> ^ http://www.vogelsinger.at/
>
>



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




[PHP] DB row selection

2003-02-19 Thread Hans Prins
Hello,
I recently learnt that with the code as stated below, I can select one row:

$query = "SELECT * FROM polls ORDER BY pollID ASC LIMIT 0,1";

However as far as I could figure out, I can only select the top row or tell
it at what rownumber to start and end. What if I wanted to select the bottom
row? Would I have to do an extra query to count the rows and then select it
with LIMIT?

Or is there a way to do this without an extra query?

thx,

Hans



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




[PHP] Re: database selection

2003-02-17 Thread Hans Prins
One more question about this:

If I wanted to select the last row, would I use this code?

$query = "SELECT * FROM polls ORDER BY pollID DESC LIMIT 0,1";





"Hans Prins" <[EMAIL PROTECTED]> schreef in bericht
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> thank you,
>
> that did the trick :)
>
> "Thomas Seifert" <[EMAIL PROTECTED]> schreef in bericht
> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > On Sun, 16 Feb 2003 12:51:58 +0100 [EMAIL PROTECTED] (Hans Prins) wrote:
> >
> > > Hello,
> > >
> > > Im trying to select only one row in a mysql database (in this case a
> poll
> > > with the smallest pollID)...
> > > Each row has a field called "pollID" which is the primary key and is
> auto
> > > incremented when a new row is inserted.
> > >
> > > I could possible do the following but I think its a bit extensive:
> > >
> > > $query = "SELECT * FROM polls ORDER BY pollID ASC";
> > > $result = mysql_query($query);
> > > for ($count = 0; $count < 1 $count++) {
> > > $data = mysql_fetch_array($result);
> > > $pollID = $data['pollID'];
> > > }
> > > $query = "SELECT * FROM polls WHERE pollID = $pollID";
> > >
> > > Does anyone now a solution for this that requires less code?
> > >
> > > Thx
> > >
> > >
> >
> > $query = "SELECT * FROM polls ORDER BY pollID ASC LIMIT 1";
> >
> >
> > Thats the only row.
> >
> >
> >
> > Regards,
> > --
> > Thomas Seifert
> >
> > mailto:[EMAIL PROTECTED]
> > http://www.MyPhorum.de
>
>



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




[PHP] Re: database selection

2003-02-16 Thread Hans Prins
thank you,

that did the trick :)

"Thomas Seifert" <[EMAIL PROTECTED]> schreef in bericht
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> On Sun, 16 Feb 2003 12:51:58 +0100 [EMAIL PROTECTED] (Hans Prins) wrote:
>
> > Hello,
> >
> > Im trying to select only one row in a mysql database (in this case a
poll
> > with the smallest pollID)...
> > Each row has a field called "pollID" which is the primary key and is
auto
> > incremented when a new row is inserted.
> >
> > I could possible do the following but I think its a bit extensive:
> >
> > $query = "SELECT * FROM polls ORDER BY pollID ASC";
> > $result = mysql_query($query);
> > for ($count = 0; $count < 1 $count++) {
> > $data = mysql_fetch_array($result);
> > $pollID = $data['pollID'];
> > }
> > $query = "SELECT * FROM polls WHERE pollID = $pollID";
> >
> > Does anyone now a solution for this that requires less code?
> >
> > Thx
> >
> >
>
> $query = "SELECT * FROM polls ORDER BY pollID ASC LIMIT 1";
>
>
> Thats the only row.
>
>
>
> Regards,
> --
> Thomas Seifert
>
> mailto:[EMAIL PROTECTED]
> http://www.MyPhorum.de



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




[PHP] database selection

2003-02-16 Thread Hans Prins
Hello,

Im trying to select only one row in a mysql database (in this case a poll
with the smallest pollID)...
Each row has a field called "pollID" which is the primary key and is auto
incremented when a new row is inserted.

I could possible do the following but I think its a bit extensive:

$query = "SELECT * FROM polls ORDER BY pollID ASC";
$result = mysql_query($query);
for ($count = 0; $count < 1 $count++) {
$data = mysql_fetch_array($result);
$pollID = $data['pollID'];
}
$query = "SELECT * FROM polls WHERE pollID = $pollID";

Does anyone now a solution for this that requires less code?

Thx



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




Re: [PHP] form variables

2002-09-09 Thread Hans Prins

thank you very much :-)

"Chris Shiflett" <[EMAIL PROTECTED]> schreef in bericht
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> I am guessing you mean the input is a textarea.
>
> At any rate, I believe what you want is nl2br()
>
> Happy hacking.
>
> Chris
>
> Hans Prins wrote:
>
> >Hello,
> >
> >I have a form field of the type "scrolling text box" it lets users input
a
> >multiline string. I then pass this string as a variable to a php document
> >that prints this string to the screen:
> >
> >print "$mailingAddress";
> >
> >however. this outputs it all in one line.
> >Does anyone have an idea as to how I can print this to the screen in the
> >same way the user has input the info: in multiple lines?
> >
>



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




[PHP] form variables

2002-09-09 Thread Hans Prins

Hello,

I have a form field of the type "scrolling text box" it lets users input a
multiline string. I then pass this string as a variable to a php document
that prints this string to the screen:

print "$mailingAddress";

however. this outputs it all in one line.
Does anyone have an idea as to how I can print this to the screen in the
same way the user has input the info: in multiple lines?

Thanks in advance :-)



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