php-general Digest 10 Nov 2004 13:42:06 -0000 Issue 3104

Topics (messages 201647 through 201666):

Re: page redirect question
        201647 by: Zareef Ahmed
        201652 by: M Saleh EG

basic script
        201648 by: a.garcia.imb.uq.edu.au
        201649 by: Zareef Ahmed
        201662 by: Matthew Weier O'Phinney

Do You Need addslashes() When Using Bind Variables
        201650 by: Francis Chang

Re: Auto Form Fill on option select
        201651 by: dellylix

newbie: string to char array
        201653 by: Horst Jäger
        201654 by: Marek Kilimajer
        201658 by: Ford, Mike

Shell Script error
        201655 by: Rui Francisco
        201661 by: Angelo Zanetti
        201663 by: Matthew Weier O'Phinney

Re: [PHP-DB] Do You Need addslashes() When Using Bind Variables
        201656 by: Simon Rees

link in ModalDialog
        201657 by: vlad georgescu

Re: POST losing SESSION vars?
        201659 by: Ford, Mike

php mail() error
        201660 by: Garth Hapgood - Strickland

RDF/XML Parser: SimpleRDF
        201664 by: elixon

Simple(?) array of form input data needs to get into MySQL
        201665 by: Rev. AppaRattus Norvegicus

Does anyone have a valid magic.mime file?
        201666 by: Björn Wiberg

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:
        [EMAIL PROTECTED]


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

   Alas there is no any other way to redirect the page without sending
headers in PHP. 
You may use javascript for this purpose.

Well it is matter of programming practice.
We must do processing before presenting the content to users.
It will be helpful in many situations.

So instead of doing 

1.Draw header
2. Draw middle bar upon user input and according to business logic.
3. Draw footer

We Must Use
1. Make Business logic and process user input  and  do required task
such as redirection
2. Store result of step 1 in any entities like variables.
3. Draw Header
4. Make Middle bar using set entities.
5. Draw footer.


This is just a overview of approach. You may need to process more things
along with middle bar, but it is good idea to do logical  processing
before presentation.

Zareef Ahmed 









-----Original Message-----
From: Victor C. [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, November 09, 2004 9:37 PM
To: [EMAIL PROTECTED]
Subject: [PHP] page redirect question


Hi,

Is there anyway to redirect php page other than using
HEADER("LOCATION:URL") ?
Header can only be called if nothing is written to HTML... Is there
anyway around it?

Thanks,

-- 

------------------------------------------------------------------------
--
Zareef Ahmed :: A PHP develoepr in Delhi ( India )
Homepage :: http://www.zasaifi.com

--- End Message ---
--- Begin Message ---
The keyword you are looking for is ob_start()
Or Output Buffering ! Check that out.


On Wed, 10 Nov 2004 09:39:06 +0530, Zareef Ahmed <[EMAIL PROTECTED]> wrote:
> 
> Hi,
> 
>   Alas there is no any other way to redirect the page without sending
> headers in PHP.
> You may use javascript for this purpose.
> 
> Well it is matter of programming practice.
> We must do processing before presenting the content to users.
> It will be helpful in many situations.
> 
> So instead of doing
> 
> 1.Draw header
> 2. Draw middle bar upon user input and according to business logic.
> 3. Draw footer
> 
> We Must Use
> 1. Make Business logic and process user input  and  do required task
> such as redirection
> 2. Store result of step 1 in any entities like variables.
> 3. Draw Header
> 4. Make Middle bar using set entities.
> 5. Draw footer.
> 
> This is just a overview of approach. You may need to process more things
> along with middle bar, but it is good idea to do logical  processing
> before presentation.
> 
> Zareef Ahmed
> 
> -----Original Message-----
> From: Victor C. [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, November 09, 2004 9:37 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP] page redirect question
> 
> Hi,
> 
> Is there anyway to redirect php page other than using
> HEADER("LOCATION:URL") ?
> Header can only be called if nothing is written to HTML... Is there
> anyway around it?
> 
> Thanks,
> 
> --
> 
> ------------------------------------------------------------------------
> --
> Zareef Ahmed :: A PHP develoepr in Delhi ( India )
> Homepage :: http://www.zasaifi.com
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 


-- 
M.Saleh.E.G
97150-4779817

--- End Message ---
--- Begin Message --- I just want the URL that is on the navigator bar be printed... this is my script but it just does not do it... why,.. please help, cheers
<HTML>
<TITLE>First Variables Example</TITLE>
<BODY>


<?php echo "VALUE IS: $x";?>

</BODY>

</HTML>
--- End Message ---
--- Begin Message ---
Hi,
Use 
 print $_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'];

Zareef Ahmed 

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, November 10, 2004 9:56 AM
To: [EMAIL PROTECTED]
Subject: [PHP] basic script


I just want the URL that is on the navigator bar be 
printed... this is my script but it just does not do it... 
why,.. please help, cheers
<HTML>
<TITLE>First Variables Example</TITLE>
<BODY>

<?php echo "VALUE IS: $x";?>

>> Well where you set the $x????


</BODY>

</HTML>

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




------------------------------------------------------------------------
--
Zareef Ahmed :: A PHP develoepr in Delhi ( India )
Homepage :: http://www.zasaifi.com

--- End Message ---
--- Begin Message ---
* A Garcia <[EMAIL PROTECTED]>:
> I just want the URL that is on the navigator bar be 
> printed... this is my script but it just does not do it... 
> why,.. please help, cheers
> <HTML>
> <TITLE>First Variables Example</TITLE>
> <BODY>
>
> <?php echo "VALUE IS: $x";?>
>
> </BODY>
>
> </HTML>

Not exactly sure what you're trying to accomplish here, but if you're
trying to get something like:

    http://localhost/script.php?x=2

to then print

    VALUE IS: 2

it most likely won't work with recent versions of PHP (e.g., PHP >= 4).
This is because the default settings in the php.ini file have
register_globals turned off for security reasons. You can still
accomplish that you want to do; simply change the php line to:

    <?php echo "VALUE IS: " . $_GET['x']; ?>

If that's not what you're trying to do... explain in more detail.

-- 
Matthew Weier O'Phinney           | mailto:[EMAIL PROTECTED]
Webmaster and IT Specialist       | http://www.garden.org
National Gardening Association    | http://www.kidsgardening.com
802-863-5251 x156                 | http://nationalgardenmonth.org

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

I'm using the Oracle database though I think this question is generic to all 
databases.

If you're using bind variables and preparing the SQL statements ahead of 
time, do you still need to call addslashes() before binding the strings to 
the bind variables?

Thanks in advance.

Francis

--- End Message ---
--- Begin Message ---
It's Sorted Now,

It got Java'd.


"Kevin Dell" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
Hi all,
    I have a question that I can't get my head around and was hoping someone
could answer for me.

I have a form with a number of fields.

Field one is a <td><select name="thisSteamField"></td>
The option fields are built from an sql statement and a where clause builds
the options fields
                    ...
                    <option value="<? echo $teamname; ?>"><? echo $teamname;
?></option>
                    ....
etc...

When I select one of the options, the form automatically goes off and does
another sql select a with the WHERE value of the selected $teamname,  and
then populates the next field, but I can't think how.

Any pointers?

TIA
K

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

I wonder if it is possible to convert a given string into an array of chars without using a separator.

That is, is there a function

mySplit

with

mySplit('example') == array('e', 'x', 'a', 'm', 'p' 'l' 'e') ?




Thanks

Horst





Horst Jäger
Schaafenstr. 25
50676 Köln
Tel: 0221/93187015

--- End Message ---
--- Begin Message --- Horst Jäger wrote:
Hi,

I wonder if it is possible to convert a given string into an array of chars without using a separator.

That is, is there a function

mySplit

with

mySplit('example') == array('e', 'x', 'a', 'm', 'p' 'l' 'e') ?

$chars_array = preg_split('//', 'example', -1, PREG_SPLIT_NO_EMPTY);

--- End Message ---
--- Begin Message ---
To view the terms under which this email is distributed, please go to 
http://disclaimer.leedsmet.ac.uk/email.htm



> -----Original Message-----
> From: Horst Jäger [mailto:[EMAIL PROTECTED] 
> Sent: 10 November 2004 09:51
> 
> I wonder if it is possible to convert a given string into an 
> array of chars 
> without using a separator.
> 
> That is, is there a function
> 
> mySplit
> 
> with
> 
> mySplit('example') == array('e', 'x', 'a', 'm', 'p' 'l' 'e') ?

Do you absolutely need it as an array?  If indexing by character would
suffice, just use PHP's {} syntax:

  $s = 'example';
  echo $s{0};    // e
  echo $s{1};    // x
  // etc.

Cheers!

Mike

---------------------------------------------------------------------
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning & Information Services, JG125, James
Graham Building, Leeds Metropolitan University, Headingley Campus, LEEDS,
LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730      Fax:  +44 113 283 3211

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

I have a small problem with a PHP script with Pear DB

The problem is the following: I'm creating a shell script in  PHP that
access one interbase database.

The problem is that if i run it on a webserver the script run correctly
but if i runit in the command line it reports one error (DB Error:
connect failed).

Does anybody know what is the problem ?

Thanks in advance
Rui Francisco

--- End Message ---
--- Begin Message ---
well maybe you are trying to connect to localhost which could be fine
for the server but not from commandline... send more info.

>>> Rui Francisco <[EMAIL PROTECTED]> 11/10/2004 2:06:09 PM >>>
Hi,

I have a small problem with a PHP script with Pear DB

The problem is the following: I'm creating a shell script in  PHP that
access one interbase database.

The problem is that if i run it on a webserver the script run
correctly
but if i runit in the command line it reports one error (DB Error:
connect failed).

Does anybody know what is the problem ?

Thanks in advance
Rui Francisco

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

--------------------------------------------------------------------
Disclaimer 
This e-mail transmission contains confidential information,
which is the property of the sender.
The information in this e-mail or attachments thereto is 
intended for the attention and use only of the addressee. 
Should you have received this e-mail in error, please delete 
and destroy it and any attachments thereto immediately. 
Under no circumstances will the Cape Technikon or the sender 
of this e-mail be liable to any party for any direct, indirect, 
special or other consequential damages for any use of this e-mail.
For the detailed e-mail disclaimer please refer to 
http://www.ctech.ac.za/polic or call +27 (0)21 460 3911

--- End Message ---
--- Begin Message ---
* Rui Francisco <[EMAIL PROTECTED]>:
> I have a small problem with a PHP script with Pear DB
>
> The problem is the following: I'm creating a shell script in  PHP that
> access one interbase database.
>
> The problem is that if i run it on a webserver the script run correctly
> but if i runit in the command line it reports one error (DB Error:
> connect failed).
>
> Does anybody know what is the problem ?

Are you running the script on the same server as the webserver process?
If not, you may need to set up additional permissions on the database to
run it from the new machine.

-- 
Matthew Weier O'Phinney           | mailto:[EMAIL PROTECTED]
Webmaster and IT Specialist       | http://www.garden.org
National Gardening Association    | http://www.kidsgardening.com
802-863-5251 x156                 | http://nationalgardenmonth.org

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

No. Thats one of the great things about bind variables.

cheers Simon

On Wednesday 10 November 2004 05:45, Francis Chang wrote:
> Hi,
>
> I'm using the Oracle database though I think this question is generic to
> all databases.
>
> If you're using bind variables and preparing the SQL statements ahead of
> time, do you still need to call addslashes() before binding the strings
> to the bind variables?
>
> Thanks in advance.
>
> Francis

-- 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Simon Rees  |  [EMAIL PROTECTED]  |
ORA-03113: end-of-file on communication channel
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

--- End Message ---
--- Begin Message ---
i'm working at some kind of HTLM editor for a web-page, 

and have in page, some js code which showModalDialog('upload_img.php')
and read the window return values and paste-it in page (text area).
the upload_img.php uploads img and returns the value to pe paste in
page (remote location of uploaded file).

the problem is any link, redirect I do in ModalDialog, a new page is open ...

any ideea .. how to resolve this .. ?

PS: question is a little bit offtopic, but pls help

--- End Message ---
--- Begin Message ---
To view the terms under which this email is distributed, please go to 
http://disclaimer.leedsmet.ac.uk/email.htm



> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
> Sent: 09 November 2004 18:21
> 
> Pass your session along with your form action...
> 
> i.e....
> 
> $s = SID;
> echo "<form action=\".$_SERVER['PHP_SELF']."?$s\" method=post>

You shouldn't need to do this, unless you've changed your PHP configuration
to not add the session ID to a form submission.  Contrariwise, you *should*
add the SID to all Location: headers:

    header("Location: index.php?" . SID);

Cheers!

Mike

---------------------------------------------------------------------
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning & Information Services, JG125, James
Graham Building, Leeds Metropolitan University, Headingley Campus, LEEDS,
LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730      Fax:  +44 113 283 3211

--- End Message ---
--- Begin Message ---
Im using the php mail() function to try send an email to a user that has
just registered.

mail($HTTP_POST_VARS['emailaddress1'], 'Matchmakers Website Registration' ,
'Welcome');

But when I get the following error back.:
  Warning: mail(): SMTP server response: 550 5.7.1 Unable to relay for
[EMAIL PROTECTED]

Can someone help me out, by telling me what it means or what Im doing wrong?

Thanx
Garth

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

I was looking for an easy RDF parser writen in PHP but I failed. There are some parsers out there but I could not find the right one for me...

I decided to write an RDF parser by myself... not easy ;-)...

I created SimpleRDF parser on sourceforge.net under BSD license and I'd like to ask you guys for help.

If you have time to play little bit with RDF or you are looking for RDF/PHP parser - test mine (even if you don't expect to use it - just try it, please). I'm currently working on version 0.2 that has the ability to save (for now it can only read/parse and save N-Triples) RDF/XML documents.

SimpleRDF is based on PHP5/XSL. XSL part simplifies the RDF/XML source to allow easy parsing (XSL part can be used as standalone XSL stylesheet if you need). PHP5 part provides really simple API - my goal was really "KISS" (keep it simple, stupid). It is well commented.

Thanks for any testing/feedback...

Link: sf.net/projects/simplerdf

elixon
--- End Message ---
--- Begin Message ---
I have a problem (the core of it being that I am VERY new at PHP and
MySQL), wondering if anyone can suggest solutions.

I've been charged with handling creation of new web pages for entering
kids' data into a database for a local parents' club, for babysitting
co-ops and such.  What we want to do:

a) The registration form will ask for parents' name and contact info
(I'm not having any problem handling that), and ask them how many
children they have.

b) After submitting this, PHP puts these values into a MySQL database
(again, no problem) and will give them a second form, with one set of
form inputs for each child (I haven't figured out how to do this yet;
it sounds simple enough though). For example, if you said you have 3
kids, the next form might look like this:

Child #   First Name    Middle Name   Last Name  Gender  DoB     School Name

 1       _____________  ___________   _________   ____  _________ ___________
 2       _____________  ___________   _________   ____  _________ ___________
 3       _____________  ___________   _________   ____  _________ ___________

Where the fields will be named "Child1Number", "Child1FirstName", etc.,
all the way through "Child3SchoolName".

The PHP script that processes this form after it is submitted needs to
a) create a childID for each child (this is simply main
account-holder's ID with "c", "d", "e", etc., appended, and b) enter
the data for each child into the database, in the "child" table.

I have *THREE* PHP & MySQL books, and so far cannot figure out how to
do this in a sensible way, which I understand should be an array.  The
array chapters and examples all give sample code that is completely
useless for my purposes (generally the examples are of pre-determined
data, like tires and spark plugs and oil cans in an automotive catalog,
and how to print them out of the array into a web page).  Me, I'm
trying to take fresh input from the user, put it into an array somehow,
and have a loop (that I don't know how to write yet), generate a
"childID" for each child in turn, and enter each child's information in
turn into the database, keyed to that childID, and do so in an
efficient way.  (The inefficient way would be to, say, assume a maximum
of 15 children, and, not using an array, then have the script ask,
"Does child #1 exist in the form?  Yes?  Then create its user ID; now
enter its data in the database.  Does child #2 exist?...."  Hardly good
program design.  Even I know that, and I can't program my way out of
paper bag (I'm an HTML/CSS guy, not a programmer.  Yet.)  And, this
should be an associative array, not a numerically indexed one, since
other people who probably won't be programmers will need to be able to
look at this down the road and understand precisely what it does with
what data and why.

The other issue would be how to create the child form so that it only
has the number of fields required for the number of children they say
they have.  The whole for and each loop construction stuff is very,
very fuzzy in my head, in the absence of good examples.

PS: AFTER registration and login, if people want to be able to edit
this info, e.g. to add a new child in the family, there needs to be a
form that will load all of their existing family data and allow them to
edit it. No problem. But is there a way with PHP to have the "how many
children do you have" selector auto-reload the page with a new, empty
field for an additional child, if they had 3 kids but go to this
profile editing form and change it to say 4 kids?  I could do this with
Javascript, but if PHP itself can do it, that would be cool.  I suspect
that without JS, the best I can do is either a) always have a blank
child field just in case (but what if they just had twins?; not such a
great solution) or b) allow them to edit everything so far entered into
the DB, and if they change the number of kids have the form come back
after they submit it, with a new line of form fields for a new child
and a note at the top to add the new child's info.

--- End Message ---
--- Begin Message ---
Hi everyone!

I've been trying to get mime_magic to work with PHP 5.0.2, but it seems to complain about the magic file being valid. I've tried both with the Apache 2.0.52 version of "magic" and with the PHP5 Win32 version of "magic.mime", but it still says that they're invalid.

Please, does anyone have a magic.mime file which is known to be working with PHP 5 on some variant of UNIX/Linux? If so, I'd very much appreciate getting a copy to try with.

Many thanks in advance!

Best regards,
Björn

--- End Message ---

Reply via email to