Consider the following:
page1.php
test\n";
$retval = serialize( domxml_open_mem( $xml ));
return $retval;
}
?>
page2.php
http://somepage.php' );
$xml = $soapclient->call( 'test', $parameters );
$xml = unserialize( $xml );
$xml->dump_mem();
?>
In the test function, if I ju
I'm switching from a MySQL environment to PGSQL and I'm
going through and trying to learn the differences between the
two. I've come across some issues that I can't seem to find the
answers to in the docs or on the web. I'm hoping someone can
help me out.
* MySQL has a function to reset the resu
> pg_result_seek() should perform a similar function. In most cases
> you wouldn't need to use that because if you're going to be using
> the results more than once you could store them in an array.
Sometimes yes, sometimes no. But a valid point nonetheless.
> > * For PGSQL, you can get the da
> Sorry, you've lost me. In your OP you say you wanted the
> "table name", but now you're talking about the "dbname"?
> For dbname, you can use (oddly enough) pg_dbname().
Eeep, I'm ever so sorry. That's what I get for responding
at 4:30a when trying to battle insomnia.
Yes, I am looking for th
> Try encoding like this:
> $retval = base64_encode(serialize( domxml_open_mem( $xml )));
> and on the next page:
> $xml = unserialize(base64_decode($xml));
> It works via html but don't know enough about soap
Well, you don't have to use soap - you can use sessions and get the
same result.
As for
> Using PHP with cURL, I am currently able to dynamically
> create XML documents and HTTP POST to a remote server,
> receive an XML response, and parse XML as needed.
> What I am having trouble finding information on is doing
> the reverse. Basically, I am trying to create a PHP script
> that a
How does this function really work? I've been
beating my head against the wall for the last
8 hours trying to figure it out. This is what
I'm trying and it isn't working:
{this is a very simplified version}
class MyClass {
function myFunc( $stringVar, $arrayVar ) {
echo "$stringVar\n";
> On my system, the function works as expected (at least as I
> understand it): myFunc receives the parameters "Hello!" and
> array("this"=>"that"), which is what you pass to it in the
> first place.
See, that's not what I'm getting... :|
> Were you expecting it to expand $myArrayVar into ind
> > >Personally, my team and I use HomeSite 4.5.x from Allaire.
> > You did not mention the price (compared to HoTMetaL at $70).
> my two cents on price. who cares! if an editor makes one
> happy then pay as much as it takes to get it. consider how many
> hours are spent with the editor. 18
> agreed, 4.5.2 still contains pretty old bugs.
> UltraEdit is bugfree (at least I haven't encountered any), has
> project management capabilities (but cannot make use of a
> version control system, AFAIK).
And that is definitely the most important feature I need,
unfortunately...
Chris
I know that if you compile PHP4 with --enable-trans-sid
(as we have), it will automagically append SID to all href
links. This is supposed to make it so that if a client's browser
does not accept cookies, the session ID gets sent to any
subsequent pages that the user gets to by clicking on links.
> "allow per session cookies(not stored)" will enable cookies,
> IE just does some garbage collection when its closed thats all.
> so php realizes that IE is accepting cookies in this case and
> uses cookies vs trans-sid.
Ok. Makes sense.
However, when this option is enabled, I see PHPSESSI
> make sure of course too that session_start() is called from
> in your code too. else your not using sessions :)
These are the 3 files I'm using; they all reside in the same dir:
"index.php"
session_start();
header( "location: page1.php?" . SID );
exit();
"page1.php
sessio
> Ive gotto format a date such as 30/12/1956 to format 30-Dec-1956,
> I can not use mktime cause that only provides the timestamp from 1970.
> Is there any other method of getting this right.
mktime() can be used for this. 0 is from 1970. Negative values are used
for dates prior.
Chris
> Try looking at register_shutdown_function at
> http://www.php.net/manual/en/function.register-shutdown-function.php
>From the documentation:
"int register_shutdown_function (string func)
Registers the function named by func to be executed when script processing
is complete."
What qualifies a
> What is the syntax for dividing 7 by 2 and getting 3; not 3.5?
you can use:
$intVar = ((int)( 7 / 2 ));
Chris
>echo "...are you logged in: $LoggedIn()";> //
outputs:...are you logged in: ()
>
> Function is:
> function LoggedIn(){
> global $HTTP_POST_VARS
> if ($HTTP_POST_VARS["Login"] == "PHPIsCool")
> {return "YES";}
> else
> {return "NO";}
> }
Change your
> What if I want the function to be processed within the " "
> quotes? Same as a variable might be interopelated? IOW,
> can I call a function without concantenating the function
> together with the string?
> *being a little stubborn*
No. Why would you want to?
You *might* be able to do it
> It won't work even with single quotes. It'll just echo out
> LoggedIn() as part of the string.
Yeah, I didn't think so. But I knew that '' behaves differently
than "". I just wasn't sure of the exact details of the differences.
Chris
I've been charged with trying to find out how something
like this can be done if it is at all in fact possible. The info
I'm hoping to get is what would be involved and where I
can find information on it. I'm not asking for code or
examples unless you really want to provide them. :P
Anyways,
> Have the user log in to/authenticate against the first server.
> That server generates a key, based on combining the username
> and a private key known to the authenticating server and your
> servers.
> Pass that back to your servers in a URL - cookie wouldn't
> work, but the key in the URL s
> Also, you can check the value of $HTTP_REFERER for the ip of
> the trusted host, to further eliminate the potential.
How do you get the IP out of $HTTP_REFERER? As far as I know,
that only tells you the referring url, not the ip address. And couldn't
that value be messed with?
Chris
> Does anyone know a function to give me the mySql field types?
> I saw the function mysql_field_type, but that returns php types not
> mysql. What I wanna do is if the type of the field is "Text" then I
> wanna make a "textarea" to edit and add stuff. Thanks.
If you have phpMySql, take a l
> If you have phpMySql, take a look at the file:
> /mysqladmin/tbl_properties.php
> That code is doing something to return the type of the field. It's a
> little hard to follow so I don't know exactly how he's doing it and
> unfortunately, didn't have the time to decipher. :p However, I'm
> sure
Are there any tutorials on how to use Sockets in PHP?
If so, where can I find them? I've looked on several of
the sites that are linked from the main php.net site but
found nothing... :/
Thanks.
Chris
I'm having intermittent problems with this function.
Most of the time, it returns the proper value. However,
sometimes it doesn't return anything at all even when
the insert query executes without error and I can see the
new data in the database. I try to get the last insert id
both by supplying
> When you are using mysql_insert_id, you don't want to pass it
> the result of your previous SQL statement as in:
> $result = mysql"mydb", "My SQL statement", $my_connect) ;
> $last_id = mysql_insert_id($result)
This is what it sounds like it's looking for in the documentation. It
could be jus
> You probably stated this in your previous post, but what is
> the result from your call to mysql() ? Is this call failing so
> that when you get to mysql_insert_id(), the id doesn't exist?
I did. It's returning a numerical one (1).
What I'm doing now is as follows. It's getting me the val
> Instead of checking if(!$id), perhaps you would be better off to check the
> result of your query (which in this example was successful, since you got
> a return from mysql() ).
I am. I just didn't include it in my previous message as it as I was trying
to
keep extraneous code down to a mini
> I have a variable(s) that hold the string:
> "name"
> and I'd like to kill the quotes so it contains:
> name
> I am aware of the strlen() function but can find the concant
$newVar = eregi_replace( "\"", "", $varWithAboveData );
Chris
We need something to where we can poll a service and
pull the exchange rates for various currencies against
the dollar to our database for later use. Is there a PHP
library/class that does something like this already? Just
so I'm not reinventing the wheel? :p
Chris
Is it possible to pull an image, stored as binary data in a
mySQL table, and display it on a page inline? So it acts
as if the image was pulled from the file system normally?
If it is possible, could you point me to some online resources
that would give information on how this is done? I've trie
> I came across this:
> $confidential = 0;
> echo "$confidential " . ($confidential == "yes");
> In which "0 1" was printed.
> Is there something I'm missing?
Yes. When comparing types, PHP generally typcasts one side
of the operand to the type of what is on the other side. So in
th
> My problem is:
> I wanna know the names of the variables that my actual page
> recives from the last page (using the POST method).
while( list( $formVarName, $formVarValue = each( $HTTP_POST_VARS )) {
echo "$formVarName = $formVarValue\n";
}
Chris
I'm trying to fopen a URL that I have no problems getting to
if I just past it into the address field of my browser. However,
when I use it in my fopen() function call, I'm getting an "Error
0" (zero) message.
I've looked all over the documentation and I could not find what
'Error 0' means.
Any
> 1. sleep(300) would mean pause by 300 mins, right? That's
> why i thought you mean usleep(300) - 300 microseconds.
No, 300 seconds - 5 minutes.
Chris
Is it possible, in PHP, for a page to determine if it
was accessed via a form's submission (POST/GET)?
IOW, if you click on a link to get to a page, you can
find out (usually; I know it's not 100%) what page
the user was at before when s/he clicked the link by
accessing the $HTTP_REFERER variable
I'm wondering how I can do the following (if it is possible at
all):
I have 2 values. The first is a constant while the second is not.
The second value, in this case, is a unix time stamp and as such
will change every time it is set, down to the second.
I need to somehow merge the two values s
> on 3/1/01 02:34 PM, [EMAIL PROTECTED] split open and melted thusly:
> > I was thinking I could do something like this:
> > ( var1 & var2 )
> i think what you want is:
> ${$var1$var2}
But that would give me a value of a variable variable.
And I need a numerical value so
$var1 ="joe";
$var2 = da
It is possible (I've done it) to find out all the variables
that make up a form on a particular site, generate a
similar form on your site with that form's action being
the CGI/PHP script that the particular site uses to process
the form once submitted, modify the values for the form
variables to
> Is there any way to defend against this? Is there any way
> to ensure that when a form is submitted that the submission
> request originated from your site/domain and not somewhere
> else?
Knowing that $HTTP_REFERER cannot be relied on as containing
valid data (as some browsers don't support i
> I can think of one way that you can take in an attempy to prevent
> this. It is not totally fool proof but it will make it more difficult
> to send spoof data:
> 1) Check your HTTP refereer when the form is submitted. If the
> referer is not from your host then don't process the form.
> Of cours
> Don't bother with checking the HTTP_REFERER - it can be easily forged.
> There is a very simple solution to this problem -- validate the data from
> the form!
[snip]
> You should be doing this anyway, since who knows what the user could
> type in your input box. Nevermind if somebody makes a c
> > I'm already doing this. However, if I have a hidden
> > variable containing a value of the current user I'm
> > working with, that value can be changed to something
> > else and it would pass the test. However, I need to find a
> > way to determine if something like that has happened.
>
I know I've been posing some funky wierd questions
all day, but today has just been one of those days...
I'm just trying to get a sense of other possibilities.
And to find out what's plausable and what's not.
Ok, here's my situation. I've a script that generates
a variable number of HREFs/anchor
>> Here
>> There
>> This Place
>> That Place
>> ---
>> As you know, those variables are being passed to the
>> linked page via GET variables. Now, here comes the
>> oddball question:
>> How can I (is it even possible) pass those variables
>> to each page w/o using GETs and w/o using Cooki
> Just include the SID as a hidden input. It'll be POSTED to
> the next page right along with your other variables.
Right.
> There's even a way to configure your php.ini file so that PHP
> includes the hidden SID for you. I forget which setting it
> is--maybe "trans-id" or something like
> > I have 2 values. The first is a constant while the second is not.
> Is the first value a numerical value (real/integer?) or a
> string value?
String.
This is what I've come up with and it seems to work pretty ok.
What do you guys think?
(test code to illustrate a point; other than the XOR
> There are only three places you can pass data without using forms, and
> using buttons, or images to trigger a POST of the data.
> 1. Get parameters after a ?
> 2. Cookies.
> 3. In the URL itself.
How is 3 different from 1?
> Why do you want to eliminate all get params and cookies? That mi
> > That won't work. Clicking on a link does not trigger
> > sending of fields (hidden or not).
> No? How about:
>
>
>
> Click here
> or here
This would require a form for every link and that was something I
illustrated earlier as one of the possibilities I had come up with. But
it was a po
> > This would require a form for every link and that was something I
> > illustrated earlier as one of the possibilities I had come
> > up with. But it was a possibility that I was trying to avoid...
> No, you could do following:
> href="javascript:document.myForm.action='theLink';document.myF
> Well, anything you get back from the client will be as GET
> variables, I think. So, if your forms only use POST variables,
> and you've turned on track_vars, then you can get your variables
> through $HTTP_POST_VARS() like $foo=$HTTP_POST_VARS('foo');
> If I'm wrong on this, I'm sure some
> [snip]
> >It is "--enable-trans-sid" and it is turned on. However, the
> >problem is that it doesn't work. :( If the user does not have
> >cookies turned on, the SID will not be sent through to the next
> >page on HREFs (I know you have to do it manually
> > How is 3 different from 1?
> 1: http://www.somedomain.com/program.php?parm1=value1
> 3: http://www.somedomain.com/program.php/value1
> $PATF_INFO now contains '/value1'
Ahh.
> This is pretty much acceptable to search engines. Even better add:
>
> ForceType application/x-httpd-php
>
> to h
> Is there a way for me to tell my php script to start over? I
> want to have an if then statement to check if something is
> done. Then if it isn't I want the php script to start over.
header( "location: $PHP_SELF" );
OR
header( "location: $REQUEST_URI" );
if you are using a query string/G
> Is there an easy way to check and see if a number is odd or even?
if( $num % 2 ) {
echo "Odd";
} else {
echo "Even";
}
Chris
> That won't work. % returns the remainder from a division of
> the number divided by the mod number.
Yours:
> if($num %2 == 0){
> echo "even";
> }else{
> echo "odd";
> }
Mine:
> > if( $num % 2 ) {
> > echo "Odd";
> >
> > } else {
> > echo "Even";
> >
> > }
Ours are identical, just the
> Color me confused because I though true was any non zero
> value and false was zero.
Right. And
if( $num % 2 ) {
echo "it's odd";
}
means that the operation returned a remainder - a non zero value.
> I know I am using the following code:
> if (!($num % 4){ do something}
> and it does s
> I am trying to let a user build a form, so on the first page they
> decide on the number of fields , when they submit that number
> it names them field1 2 3 etc,now I then want them to name the
> fields but the problem is because the number of fields varies how
> do I pass all the variables
Based on what I read, I believe the answer to this question
is "No", but am hoping for confirmation because someone
might have been able to find a way to make this work.
Is it possible to use the auto prepend/append directives to
prepend/append particular files only to files with a particular
ext
> >Is it possible to use the auto prepend/append directives to
> >prepend/append particular files only to files with a particular
> >extension?
> I don't believe you can do this directly with PHP but you
> probably can with
> Apache:
>
> php_value prepend_file "foo.php"
>
> Try putting
>
> php_value auto_prepend_file "foo.php"
>
> in your httpd.conf file. Once you put this in the conf file
> for Apache, restart Apache and see if the changes take place.
> That should do what you want it to.
Unfortunately, no.
Here is what we have in our httpd.conf file:
I need to set up a link that has both. However, IE/NS isn't
liking this:
www.mydomain.com/thispage.php#joe?thisvar=thatvalue
I need to pass "thisvar" into thispage.php and use it to determine
information to display. I also need to pass the anchor name "joe"
so the page jumps down to that ancho
> > As a quick caveat you need to be *very* careful you're not
> > obfuscating the target site copyright infringement, anyone?
> We wont.. Their banners, logos, URL's etc. appear on the
> pages, so even if it is in the frameset, it will be fine..
Yes, but their URL won't be in the address l
> To make it a little cleaner I would prefer to do something like:
> my_func( {
>'fname' => 'joe'
> , 'lname'=>'coder'
> , 'zip'=>'12345'
> } );
> an not pollute the code with one-time vars
Unless I'm misunderstanding what you are asking, you can
do this:
my_func( array( 'fna
> What should I put in for the parameter jvs_name of the
> oohform->start? Is that a name of another javascript file?
> Where can I get a sample script?
> I would like to make sure the clients put in something in the textbox.
If you are talking about Jay Bloodworth's FormClass (one
of the most
> I am trying to create an associative array dynamically.
> Here's what I did first:
> $form_val_list =
> "firstname,lastname,address,address2,city,state,zip,phone,emai
> l,resume";
> $form_arr = explode (",", $form_val_list);
> while (list ($key, $val) = each ($form_arr))
> {
>ech
> how do I write a Not isset as in:
> if != isset($order)
> {
> $order=$Table."ID";
> }
if( !( isset( $order ))) {
}
I'm big on parens. :p
OR
if( empty( $order )) {
}
Chris
> How to people typically integrate payment processors with PHP?
> And what processors are used most often? I know that a number
> of people are scrambling after cybercash died. There is a site out
> there www.opay.com that says it supports payment processors
> on any platform, anyone ever use i
> > Ive been using editpad up till now but my code is starting
> > to get so large that ill need syntax highlighting soon...
> HomeSite is great. www.allaire.com
> - not totally free I'm afraid, but there is an eval version.
> - runs under Windows yes
> - supports syntax highlighting for lots of
> How can one get the next record to compare two
> fields... I want to check if the date of the first record
> matches the date of the next record with the least amount
> of code...
You are going to have to work with row pointers. If you are
using mySQL, look at the function:
mysql_res
> > Has the worst memory management of any software I've ever used.
> > I have to reboot at lest 10 times a day when I use it. The support
> > forum on their site is filled with complaints on this issue. Their
> > response to this issue was not to fix the memory leak (or whatever
> > it is) but
> I use editplus. It has a feature that lets you add in auto
> completion files, syntax files. It does have an eval version,
> and it is not that expensive.
The main feature I need of any editor is project management.
Of all (and there have been *alot*) the editors I've looked at,
Homesite is t
> It does have a project feature.
Yup. It sure does. However, it doesn't work as we need
it to. When I looked at EditPlus last time, it had a flat
project structure. Meaning that you could add files to a
project, but when you opened that project, all you would
see is a list of all the files.
> Hi wanna know How can i take the day of week of aany date...
> Example:
> How to know that 14 of march of 2001 is a Wednesday??
date( "l", $timeStamp ); // lowercase "L", or you could use "D"
Look up the date() function. The documentation is your friend.
Chris
> If the keywords inputted from user are: "word2, word1", it
> will reture News1 twice:
That's because you are selecting all the records that match
each single key word individually.
> I want to search this table based on the Keywords. the code is:
> $split = explode(" ",$keywords);
> $Num = 0;
After hours of searching :/ I was able to find Rasmus'
PostToHost() function. It's working fine, for the most
part. It's posting to the page and printing what it gets
back as part of the page/code that calls the function.
This is most likely expected behavior, just not what I
expected.
However,
> I am not sure exactly what you are asking but by this do you mean ..
>
> process_statements
> ...
> ...
> Header("Location:http://www.some.net?id=$row->ID");
>
>
>
> then use the string in $QUERY_STRING to retreive/parse your data.
>
Yes, more or less. However, I'm trying to find som
> http://www.php.net/manual/en/ref.funchand.php
> This page must be your friends.
I took a look at this page (and all the functions referenced
therein). While there must be a use for these functions
otherwise they wouldn't have been included in PHP, I'm at
a total loss as to why anyone would eve
> YES!
> The only "problem" will be that these .php pages will be
> maybe 5% slower since PHP is "parsing" them.
That and all the links pointing to the old .html files will be
broken...
So if you mix PHP and HTML in a file, PHP will be slower
to parse those files? I thought it was smart enough
> Is there a workaround under php3 for include_once ?
if( !$this_include_file_only_variable_declared ) {
$this_include_file_only_variable_declared = 1;
// your include script here
}
And if you attempt to include the file more than once
in a script, the IF() will resolve true and skip past
> > So if you mix PHP and HTML in a file, PHP will be slower
> > to parse those files? I thought it was smart enough to
> > parse only what was within the recognized start and end
> > tags (, , ,
> > etc)?
> PHP *is* smart enough, but it has to "look" in the HTML to
> see any
> Could someone plese explain this line if code??? What does the "?" do?
> $r = ($r < 1) ? $config['maxResults'] : $r;
It's short circuit IF (I believe that's the right word for it). This is the
same
thing as doing this:
if( $r < 1 ) {
$r = $config['maxResults'];
} else {
$r = $r;
}
Chri
> Yo!
> I'm thinking of writing a bulletin board and I wonder about
> threads. I want the board to be built on threads but I don't
> know how to do it. I want it to look something like this:
> subject 1
>|
>|__ reply1 to 'subject 1'
>| |
>| |__ reply1 to 'reply1 to su
> > Just keep track of a parent message number. You should be able
> > to use that one field to trace any message back to a root message.
> > And with that information, you should be able to build a "thread".
> I concur on that.
Good to see it's not just me. :p
> However, I am more fond of the
Unless I'm missing something, I've looked all over the
PHP site for a link to PEAR but have been unable to find
one (including in the PEAR section of the manual, where
you would think it would be...).
Could someone please provide a link?
Chris
> > Unless I'm missing something, I've looked all over the
> > PHP site for a link to PEAR but have been unable to find
> > one (including in the PEAR section of the manual, where
> > you would think it would be...).
> > Could someone please provide a link?
> http://www.php.net/manual/en/pear.php
> > Could someone please provide a link?
> http://pear.php.net/
> Don't be too disappointed about the website, some work on it is in
> progress
I can tell. :p There is an error when you access that page.
Chris
Is there any sample code for the above PEAR
class around anywhere?
Chris
> I'm trying to remember what is the function to replace blank
> spaces with %20.
> Can anyone remind me of that?
urlencode();
Chris
Can you use the above function to set the error
handler to a custom class? If so, how? I've been
having no luck no matter what I do...
Chris
> If I'm not mistaken set_error_handler() takes a string that
> is the name of a function, I am sure in that function you can
> instantiate whatever class you want.
I thought about that. But ideally, what I'm trying to do is
trap the errors with a class method (after instantiating)
then print
> If I'm not mistaken set_error_handler() takes a string that
> is the name of a function, I am sure in that function you
> can instantiate whatever class you want.
After thinking about it some more, I'm doing this. Not sure
if this is the best way to go about it, but it allows me to do
what I
> ""Boget, Chris"" <[EMAIL PROTECTED]> wrote:
> > Can you use the above function to set the error
> > handler to a custom class? If so, how? I've been
> > having no luck no matter what I do...
> I tried doing something like:
> set_erro
We compiled PHP to be used as a CGI and it's
working great. However, whenever we run a
php script, the following message gets outputted
at the start of the output:
"X-Powered-By: PHP/4.0.3pl1
Content-type: text/html"
Is there any way we can suppress that message?
I looked all over the docs and
A bit OT, yes, but I don't want to ask an
inappropriate question here (not that this
isn't an inappropriate question :p).
Can someone recommend a good Javascript
mailing list?
Chris
Given the following code:
-
class myClass {
function myClass() {
$classVar = get_class( $this );
}
}
$thisInstance = new myClass();
-
What value should $classVar contain?
"myClass"
or
"thisInstance"
?
The documentation leads me to believe that it is the
latter value, but
I've got the following code:
---
while( list( $timeStamp, $elementArray ) = each(
$this->ErrorMessages )) {
$tmpArray = $elementArray;
if( $tmpArray[errorNumber] & $typesToDisplay ) { // line to
comment out
while( list( $elementKey, $elementValu
Ok, I found out what the problem was. I'm still curious
why the problem is occuring.
> if( $tmpArray[errorNumber] & $typesToDisplay ) { // line to comment out
I almost always access associative arrays like the above -
almost never without the quotes. IE
$there = 5;
echo "$this[that]\n";
ech
> >Ok, I found out what the problem was. I'm still curious
> >why the problem is occuring.
> >> if( $tmpArray[errorNumber] & $typesToDisplay ) {
> you're using the bitwise & when you want the logical &&
No, I actually wanted to use the bitwise &. I wanted to see
if the "errorNumber" was in $t
1 - 100 of 246 matches
Mail list logo