[PHP] preg_split() - pattern problem

2002-11-11 Thread Tobias Talltorp
How would I write the pattern for this preg_split()?
"/T.*O.*B/", seems to only return the first and last portion of the string
(1: Once upon a time, 2: going for a walk).

$string = "Once upon a time T:O.B there was a T.O,B duck who was T-O'B going
for a walk";

$array = preg_split('/T.*O.*B/', $string, -1, PREG_SPLIT_OFFSET_CAPTURE);

for ($i=0; $i";
}

Any thoughts?
// Tobias



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




[PHP] FDF on windows

2002-07-11 Thread Tobias Talltorp

I am interrested in experimenting a bit with FDF, but I use windows, and it
seems that it is only available on Linux... According to Adobe, it should
work on windows aswell, but perhaps not with PHP...
Anyone got it working with windows?

This is what I am talking about:
http://www.php.net/manual/en/ref.fdf.php

// Tobias



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




[PHP] using pdf template

2002-07-11 Thread Tobias Talltorp

Is it possible to produce a PDF, use it as a template and populate
predefined sections of it from a database?
The PDFs I want to create are a little too complex for me to produce from
scratch.

// Tobias



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




Re: [PHP] using pdf template

2002-07-12 Thread Tobias Talltorp

>From what I can understand, I can only use PDI to put PDFs in the
background, not use the actual elements from the PDF?

Example:
I have created a PDF with a table with two cells in one row. The cells have
the text "cell1" and "cell2".
I run this PDF through the PDI.
Now, can I replace the texts "cell1" and "cell2" with "tobias" and
"talltorp", or do I have to place this text "on top of" the original PDF?

Hope this explanation makes any sence :)

// Tobias

> Only using the commercial PDI library from pdflib.com

> > Is it possible to produce a PDF, use it as a template and populate
> > predefined sections of it from a database?
> > The PDFs I want to create are a little too complex for me to produce
from
> > scratch.




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




[PHP] PREG-pattern, help needed

2003-09-09 Thread Tobias Talltorp
I need help with a preg-pattern for preg_replace_callback().

I need to match  and replace them with .

This is as far as I have come in my code:






tabell2 cell1
tabell2 cell2



första cell i rad två
Detta är den sista

';

$counter = 0;
function bla($matches) {
global $counter;
$counter++;
return "";
}


// this pattern is all wrong, since it matches and replaces all tags
echo preg_replace_callback("|(<[td][^>]+>)|i", "bla", $html);

?>


Any thoughts?
// Tobias

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



[PHP] POST headers

2001-01-23 Thread Tobias Talltorp

What are the HTTP Headers performing a POST?

I need to simulate a POST to a webpage.
NOTE: I do not want to use curl or the post-to-host function, since these
get the information.

What I want to do is this:

I enter the page "localhost/post.php" where there are a set of HTTP Headers
for sending a post to "domain.com/result.php". From this point on,
domain.com handles the displaying of the result. Just exactly the same
process as a HTML-form, just without the form.

Thanks,
// Tobias



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] session_destroy() fails...

2001-03-01 Thread Tobias Talltorp

I am looking into sessions at the moment and havn´t got it all working
properly to continue my journey.

I´m having problem with the session_destroy(), and after some searching in
the archive, I found out that other people have had this problem aswell, but
I didn´t find a fix...

Here is the error message I get:
Warning: Session object destruction failed in
E:\Inetpub\wwwroot\testscript\sessions\test.php on line 5

Here is my code:


Is this error caused by php.ini, my webserver or other?

My configuration:
IIS 5 for Win2k
PHP 4.0.3 PL 1

Thanks
// Tobbe



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] session_destroy() fails...

2001-03-01 Thread Tobias Talltorp

> Why would you want to create and destroy the session data during a single
> request? That simply doesn't make sense - session persistence is designed
> to keep registered session data available across _a_series_ requests.

This I know, but it was just to show what I wanted to do.

> I believe PHP chokes at session_destroy() since the session save file has
> not yet been created, and thus deleting the session data returns an error
code.

I first got the problem when I tried this tutorial at Zend:
http://www.zend.com/zend/tut/session.php

I found it funny that a tutorial about sessions had such a "bug", since it
was supposed to cover this feature.

Complete source can be downloaded here:
http://www.phpwizard.net/resources/tutorials/session_intro.html

I had to change some in your code (lines marked with >>)...

> if (isset($value)) {
echo "thanks";
session_destroy();
}
else {
// These were below the echo before...
>> session_start();
>> session_register($value);
$value = 12;
echo "";
echo "input type=submit>";
}
?>

Error message: Warning: Trying to destroy uninitialized session in
E:\Inetpub\wwwroot\testscript\sessions\test.php on line 4

Just a thought...
Could it have anything with the session.save_path?
session.save_path =e:\Temp\sessions

Regards,
// Tobias



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] session won´t use cookies

2001-03-02 Thread Tobias Talltorp

I have a problem with the session not using cookies.

The code below doesn´t seem to set a cookie even though my php.ini has it
set.
If I use the header after initializing the session, nothing appears in
getsess.php.
If I click the link on the other hand, the PHPSESSID-variable is added to
the URL.

What do I do to enable the cookies?
(I know how ordinary cookies work and how to set and delete them=


if ($submit) {

 $pref_username = "tobias";
 $pref_password = "password";

 if ($pref_username == $username && $pref_password == $password) {
 session_start();

 session_register("SESSION");
 $SESSION["username"] = $username;
 $SESSION["password"] = $password;
 // header("Location: getsess.php");
 // echo "go";
 } else {
 header("Location: $PHP_SELF?username=$username");
 }
}
?>


Username: 

Password: 




// -- getsess.php -->


What am I missing?

Thanks
// Tobias



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Verify session in function

2001-03-05 Thread Tobias Talltorp

I am building my first basic function to verify a session.
If the verification is not in the function it works...
What am I missing?
(I couldn´t find anything about this in the mailing list archive)

-- This works -->
session_start();

   if (isset($PHPSESSID)){
echo "ok";
} else

echo "not ok";
}


-- This does not work ->
session_start();
verifySess();

function verifySess() {
if (isset($PHPSESSID)){
echo "ok";
} else

echo "not ok";
}
  }

Thanks,
// Tobias





-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Function, array - problem (probably easy to solve)

2001-03-14 Thread Tobias Talltorp

I am constructing a function for retrieving records from a mysql database
and putting them into an array called $print_field[name][number].

My problem is that I only seem to get the first two records and I think I
know where the problem is, but I can´t seem to be able to solve it.

Any ideas anyone?

";
 echo $print_field["field2"][$i]."";
}
?>

Thanks,
// Tobias





-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] creating array on variable variable (bug?)

2001-03-15 Thread Tobias Talltorp

Hello all.

Howcome I can create an array on a variable variable using array(), but not
in a for-loop (See code below)?



In the for-loop I get this error message:
Fatal error: Cannot use [] for reading in
E:\Inetpub\wwwroot\testscript\sessions\test4.php on line 6

Is this a bug or do I have the bugs in my head finally gotten to my thinking
area?

Thanks,
// Tobias Talltorp



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] FAQ

2001-03-15 Thread Tobias Talltorp

Just something I notices...
At the bottom of the page there is a link to the mailing list (well, not
directly to the list, but anywho):
PHP General Mailing List (http://www.php.net/)

Why not add this aswell:
Before posting, check the PHP Generall Mailing List Archive
(http://marc.theaimsgroup.com/?l=php-general)

I like this one better than the manual to search for problems similar to the
ones I have...

// Tobias Talltorp

"Rick St Jean" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> It is there a list of most frequently asked questions?
> It seems that people ask the same questions, again and again,
> they do not READ THE MANUAL.  Yes I have asked 2 stupid
> questions, but I really did search and I am reading my manuals,
> the PHP and the book that I bought.
>
>
> Also I would like to know if there would be a demand for an
> experienced mailing list?  I am just frustrated by the same 3
> questions that pop up about once a day. The rest of the posts
> are great.
>
> Rick
> ##
> #  Rick St Jean,
> #  [EMAIL PROTECTED]
> #  President of Design Shark,
> #  http://www.designshark.com/
> #  Quick Contact:  http://www.designshark.com/messaging.ihtml
> #  Tel: 905-684-2952
> ##
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] creating array on variable variable (bug?)

2001-03-15 Thread Tobias Talltorp

Thanks a million man!

This did the trick...

Best Regards,
// Tobias Talltorp

""Mahmoud Abu-Wardeh"" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> try this: (you need to escape the variable part of the variable variable
> with {})
>
>  $name = "talltorp";
>
> $$name = array(1,2,3,4);  // <-- this works
>
> for ($i=0; $i<10; $i++) { //
> ${$name}[] = $i;// <-- this will work now
> } //
>
> for ($i=0; $i
> echo $talltorp[$i];
> }
> ?>
>
> -Original Message-
> From: Tobias Talltorp [mailto:[EMAIL PROTECTED]]
> Sent: 16 March 2001 00:15
> To: [EMAIL PROTECTED]
> Subject: [PHP] creating array on variable variable (bug?)
>
>
> Hello all.
>
> Howcome I can create an array on a variable variable using array(), but
not
> in a for-loop (See code below)?
>
>  $name = "talltorp";
>
> $$name = array(1,2,3,4);  // <-- this works
>
> for ($i=0; $i<10; $i++) { //
> $$name[] = $i;// <-- this does not work
> } //
>
> for ($i=0; $i
> echo $talltorp[$i];
> }
> ?>
>
> In the for-loop I get this error message:
> Fatal error: Cannot use [] for reading in
> E:\Inetpub\wwwroot\testscript\sessions\test4.php on line 6
>
> Is this a bug or do I have the bugs in my head finally gotten to my
thinking
> area?
>
> Thanks,
> // Tobias Talltorp
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] PostToHost

2001-03-15 Thread Tobias Talltorp

I scratched my head for weeks with this problem untill I found a discussion
on this in the archives.

It seems that a post-form MUST be executed from the client side.
Here is the start of the discussion:
http://marc.theaimsgroup.com/?l=php-general&m=97614760211168&w=2

So... It has to be done with JavaScript...

Just a tip:
Check out the cURL-functions in the manual.
They do the stuff that the Post-to-Host does, but much much more...

Regards,
// Tobias Talltorp


""Boget, Chris"" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> 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'm curious if there is a way to POST data to
> a page WHILE redirecting the browser to that particular
> page.  You can do this, _sort of_, client side with JavaScript
> (OnClick = document.form.submit();)  I'm wondering
> if there is a way you can do this server side with PHP?
>
> Thanks.
>
> Chris
>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] function mail()

2001-03-21 Thread Tobias Talltorp

See the SMTP value in your PHP.ini and set it to a valid outgoing mail
server

Another thing I have noticed, perhaps this is only me, is that if the
TO-address isn´t valid it will fail.
Try to send an email to your own email address...

// Tobias


""Eric Tonicello"" <[EMAIL PROTECTED]> wrote in message
99a1hq$tns$[EMAIL PROTECTED]">news:99a1hq$tns$[EMAIL PROTECTED]...
> Hi !
>
> I'm trying to use the function mail().
>
> 
>
> I get :
>
> Warning: Failed to Connect in D:\IBOIS\web\test.php on line 1
>
> I'm using the lastest version of PHP on IIS 4.0
>
> What's wrong ?
>
> Should I  change the php.ini ?
>
> If I try to use the snmp library i get lot of errors...
>
> PLease help.me
>
> mcfly
>
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] PHP post

2001-03-21 Thread Tobias Talltorp

No can do...

You can send a post to another page, but not go to that page.

In order to go to the page the form was was posted, the information must
come from the client. You can use javascript for this, but it is not a very
stable solution.

// Tobias

""Paul Juliano"" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]...
> Hello,
>
> How would I simulate an http post in PHP.  Something like the equivalent
> of this:
>
> 
> 
> 
> 
> 
> 
>
> And how would I be able to read the resulting page.
>
> __
> www.edsamail.com
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] unregister part of array in session

2001-04-15 Thread Tobias Talltorp

I know how to unset a specific value in an ordinary array:
unset ($array["one"]);
How do I do this if my array is in a session?

Here is my code:
 "number one", two=> "Number two", three=> "Number
three");
session_register("array");
?>

I tried this... Didn't work:


Thanks,
// Tobias Talltorp




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] accepting credit cards

2001-04-15 Thread Tobias Talltorp

I don´t have any experience in this area either, but I found this article on
Php-bilder.com. It might be useful for you:
http://www.phpbuilder.com/columns/matt2305.php3
(Curl is a part of PHP now... http://www.php.net/manual/en/ref.curl.php)

You might find these sections in the manual rewarding aswell:
http://www.php.net/manual/en/ref.pfpro.php
http://www.php.net/manual/en/ref.cybercash.php

I don´t know how much they cost or anything... Anyone who knows?

// Tobias Talltorp


""Tyler Longren"" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Hello everyone,
>
> I know this has been discussed many times before.  I even read the past
> threads in the list archives.  I've written a shopping cart/catalog that
> uses mysql on the backend.  I need to be able to accept cc orders.  Is
> Paypal a good choice?  I've never really use any service like this before.
> When the user orders an item, will they have to leave my website?
>
> Thanks,
> Tyler
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] search string

2001-04-15 Thread Tobias Talltorp

I think you want regular expressions...

Try this on for size:
$str = "http://www.yahoo.com/somedir/somepage.html";

if (preg_match("/www.yahoo.com/i", $str)) {
 print "Your submission cannot be accepted";
} else {
 print "You are good";
}

If you want to read up on regular expressions:
http://www.php.net/manual/en/ref.pcre.php (Faster than ereg)
http://www.php.net/manual/en/ref.regex.php

// Tobias Talltorp


""Joseph Bannon"" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> What is the function to search a string? Basically, I want search a string
> (a url) to see if it has "www.yahoo.com" in it and if yes, tell the user
> their submission cannot be accepted.
>
> J
>
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] unregister part of array in session

2001-04-16 Thread Tobias Talltorp

I did it!
Too much work for something as simple as this though IMO. I think I will
write a function for this...



Thanks,
// Tobias


""Yasuo Ohgaki"" <[EMAIL PROTECTED]> wrote in message
9bdeag$88r$[EMAIL PROTECTED]">news:9bdeag$88r$[EMAIL PROTECTED]...
> You are registered $array as session,
> You need to unset() element. I think it should work.
>
> Regards,
> --
> Yasuo Ohgaki
>
>
> ""Tobias Talltorp"" <[EMAIL PROTECTED]> wrote in message
> 9bd8un$kqt$[EMAIL PROTECTED]">news:9bd8un$kqt$[EMAIL PROTECTED]...
> > I know how to unset a specific value in an ordinary array:
> > unset ($array["one"]);
> > How do I do this if my array is in a session?
> >
> > Here is my code:
> >  > session_start();
> > $array = array(one=> "number one", two=> "Number two", three=> "Number
> > three");
> > session_register("array");
> > ?>
> >
> > I tried this... Didn't work:
> >  > session_start();
> > session_unregister("array[one]");
> > ?>
> >
> > Thanks,
> > // Tobias Talltorp
> >
> >
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > To contact the list administrators, e-mail: [EMAIL PROTECTED]
> >
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] resource id #2

2001-04-16 Thread Tobias Talltorp

> $query=mysql_query("Select pass from members where uname='$username'");
> $result = mysql_query($query)
> or die("You are not authorized to be here.");



What you are doing is checking if the query is valid. Your die() would print
only if you had a faulty query (try changing pass to pass2), but if the
username is wrong, it returns an empty set.
The mysql_query() returns the "resource id #2" that you can use with the
mysql_fetch_array, mysql_num_rows etc to get printable information.

// Tobias



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] resource id #2

2001-04-16 Thread Tobias Talltorp

Sorry...
Read morgans topic aswell...
Didn´t see the duplicate mysql_query(). :)

// Tobias

""Tobias Talltorp"" <[EMAIL PROTECTED]> wrote in message
9betpl$nb0$[EMAIL PROTECTED]">news:9betpl$nb0$[EMAIL PROTECTED]...
> > $query=mysql_query("Select pass from members where uname='$username'");
> > $result = mysql_query($query)
> > or die("You are not authorized to be here.");
>
>  $query=mysql_query("Select pass from members where uname='$username'");
> $result = mysql_query($query);
>
> // If the number of rows is less than one (meaning zero) then die()
> if ($mysql_num_rows($result) < 1)) {
> die("You are not authorized to be here.");
> }
> ?>
>
> What you are doing is checking if the query is valid. Your die() would
print
> only if you had a faulty query (try changing pass to pass2), but if the
> username is wrong, it returns an empty set.
> The mysql_query() returns the "resource id #2" that you can use with the
> mysql_fetch_array, mysql_num_rows etc to get printable information.
>
> // Tobias
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] session variable problem

2001-04-16 Thread Tobias Talltorp

The reason for the fatal error is that you can only store the sessions in
three (or four) ways, files, in a database or in the memory.

What variable has no value?
Have you started the session before you try to access the values?
session_start();
echo $your_value;
(Or preferably)
echo $HTTP_SESSION_VARS["your_value"];

Here is a little code for you to test if you can read the session variables:

session_start();
while(list($key, $val) = each($HTTP_SESSION_VARS))

echo "Variables name: $key - The value: $val";
}


"SERKAN BALKANLI (EBÝ Bþk.-Analist Prog.)" <[EMAIL PROTECTED]> wrote in
message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> i am starting and registering session variable succesfully  that i can see
> the file on the server ,  but when it comes to use or display i can not ,
> the variable has no value ... the "session.save_handler  = files"  is
in
> php.ini , i tried to change it to user but that occured a fatal error
etc..
> So shortly what is the thing that i am missing
> thanks alot
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Getting referrer from another frame

2001-05-11 Thread Tobias Talltorp


I would like to tweek the getenv("REMOTE_ADDRESS") a little.




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Getting referrer from other frame.

2001-05-11 Thread Tobias Talltorp

Sorry about the post before (if there was one)... It was sent by accident.
Here is the complete question:

I would like to tweek the getenv("REMOTE_ADDRESS"); a little.
I want my top frame to print the referrer for the frame below.

I'm not sure if this should be done with PHP or javascript. Sounds like
javascript though...

Any thoughts?
// Tobias



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] assign values to variables, all taken from txt file

2001-05-15 Thread Tobias Talltorp

>From what I could see you want variable variables
$value = $line[0];
$variable = $line[1];
$$variable = $value;

// Tobias

""Alain"" <[EMAIL PROTECTED]> wrote in message
9dqrh1$23a$[EMAIL PROTECTED]">news:9dqrh1$23a$[EMAIL PROTECTED]...
> Hello,
> I am trying to get values assigned to variables, by taking these data from
a
> textfile.
> my txt file looks like that:
> variable1 // value1
> variable2 // value2
> etc...
> The point here is that I want to be able to get BOTH the variable name and
> its corresponding value..
> I tried things like:
> --//---
> $configuration_data = file("conf/configuration.txt");
> for($index=0; $index < count($configuration_data); $index++)
> {
> $line = explode("//",$configuration_data[$index]);
> $value = "$line[0]";
> $variable = "$line[1]";
> $"\$variable" = "$value";
> }
> --//
> So it's that "$"\$variable" = "$value";" which is wrong and now I don't
have
> any inspiration anymore...
>
> Could somebody help me plase?!
> thanks,
> -Alain-
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Curl: Reuse cookie vars

2002-02-26 Thread Tobias Talltorp

( Code at the bottom of the message)
I logged in to a page, using the Curl-extension.
I want to use the vars set in the cookie to continue being logged in and
download another page.

In regular Curl, I need to save the headers, containing the cookie
information, to a file.
In the next step I need to use that file to fake the cookies...

In regular Curl I use this to dump the headers to a file:
--dump-header "c:\curl\headers.txt"

How would I do this using the Curl-extension?

Any thoughts?
// Tobias


// Login
$url = "http://mydomain.com/login.php";;
$postvars = "user=joeuser&pass=password";
$user_agent = "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)";

   $ch = curl_init();
   curl_setopt ($ch, CURLOPT_URL, $url);
   curl_setopt ($ch, CURLOPT_POST, 1);
   curl_setopt ($ch, CURLOPT_POSTFIELDS, $postvars);
   curl_setopt ($ch, CURLOPT_USERAGENT, $user_agent);
   // Here I get the headers, but waht to do with them?
   curl_setopt ($ch, CURLOPT_HEADER, 1);
   curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 0);

  // Somewhere here would be nice to save the cookies to a file

   curl_exec ($ch);
   curl_close ($ch);


// Download next page
$url = "http://mydomain.com/otherpage.php";;
$user_agent = "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)";


  $ch = curl_init();
   curl_setopt ($ch, CURLOPT_URL, $url);
   curl_setopt ($ch, CURLOPT_USERAGENT, $user_agent);
   curl_setopt ($ch, CURLOPT_HEADER, 1);
   curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);

  // Read the headers in the saved file and use them to fake cookies

   $result = curl_exec ($ch);
   curl_close ($ch);
   echo $result;




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




[PHP] Re: Reuse cookie vars

2002-02-26 Thread Tobias Talltorp

No worries, I fixed it...

For anyone who is interrested, here is the script:

function get_header($url, $user_agent, $postvars="") {
   $ch = curl_init();
   curl_setopt ($ch, CURLOPT_URL, $url);

   if (isset($postvars)) {
curl_setopt ($ch, CURLOPT_POST, 1);
curl_setopt ($ch, CURLOPT_POSTFIELDS, $postvars);
   }
   curl_setopt ($ch, CURLOPT_USERAGENT, $user_agent);
   curl_setopt ($ch, CURLOPT_HEADER, 1);
   curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 0);

   $fp = fopen ("d:/inetpub/wwwroot/curl/test/cookieFileName.txt", "w");
   curl_setopt ($ch, CURLOPT_WRITEHEADER, $fp);

   curl_exec ($ch);
   curl_close ($ch);
   fclose ($fp);
}

function get_page($url, $user_agent, $postvars="") {
   $ch = curl_init();
   curl_setopt ($ch, CURLOPT_URL, $url);

   if (isset($postvars)) {
curl_setopt ($ch, CURLOPT_POST, 1);
curl_setopt ($ch, CURLOPT_POSTFIELDS, $postvars);
   }
   curl_setopt ($ch, CURLOPT_USERAGENT, $user_agent);
   curl_setopt ($ch, CURLOPT_HEADER, 0);
   curl_setopt ($ch, CURLOPT_COOKIEFILE,
"d:/inetpub/wwwroot/curl/test/cookieFileName.txt");
   curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
   $result = curl_exec ($ch);
   curl_close ($ch);
   return $result;
}

// VARS
$url1 = "http://mydomain.com/login.php;
$url2 = "http://mydomain.com/otherpage.php;
$postvars = "user=user&pass=password";
$user_agent = "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)";

// Log in
get_page($url, $user_agent, $postvars);

// Get the page
echo get_page($url2, $user_agent, "");

// Tobias

"Tobias Talltorp" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> ( Code at the bottom of the message)
> I logged in to a page, using the Curl-extension.
> I want to use the vars set in the cookie to continue being logged in and
> download another page.
>
> In regular Curl, I need to save the headers, containing the cookie
> information, to a file.
> In the next step I need to use that file to fake the cookies...
>
> In regular Curl I use this to dump the headers to a file:
> --dump-header "c:\curl\headers.txt"
>
> How would I do this using the Curl-extension?
>
> Any thoughts?
> // Tobias
>
> 
> // Login
> $url = "http://mydomain.com/login.php";;
> $postvars = "user=joeuser&pass=password";
> $user_agent = "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)";
>
>$ch = curl_init();
>curl_setopt ($ch, CURLOPT_URL, $url);
>curl_setopt ($ch, CURLOPT_POST, 1);
>curl_setopt ($ch, CURLOPT_POSTFIELDS, $postvars);
>curl_setopt ($ch, CURLOPT_USERAGENT, $user_agent);
>// Here I get the headers, but waht to do with them?
>curl_setopt ($ch, CURLOPT_HEADER, 1);
>curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 0);
>
>   // Somewhere here would be nice to save the cookies to a file
>
>curl_exec ($ch);
>curl_close ($ch);
>
> 
> // Download next page
> $url = "http://mydomain.com/otherpage.php";;
> $user_agent = "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)";
>
>
>   $ch = curl_init();
>curl_setopt ($ch, CURLOPT_URL, $url);
>curl_setopt ($ch, CURLOPT_USERAGENT, $user_agent);
>curl_setopt ($ch, CURLOPT_HEADER, 1);
>curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
>
>   // Read the headers in the saved file and use them to fake cookies
>
>$result = curl_exec ($ch);
>curl_close ($ch);
>echo $result;
>
>
>



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




Re: [PHP] addslashes Question

2001-03-21 Thread Tobias Talltorp

This seems to be more of a HTML problem.
Form fields simply can´t print out ". You need to change the " to " in
order for it to appear.
This can be done using the function htmlspecialchars():
http://www.php.net/manual/en/function.htmlspecialchars.php

In your case:
">

You can test these two things to see the difference:
1. 
2. 

// Tobias

""Jeff Oien"" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> I have a form to modify a record in a MySQL database.
> The record contains this:
> 3" Brush
> The code in question is like this:
> while ($row = mysql_fetch_array($result)) {
> $desc1 = $row['desc1'];
> --
> ">
>
> I've tried using addslashes to the variable in various ways and it
> always returns:
> 3\
> What am I doing wrong? Sorry this is probably the 1000th time
> this has been asked.
> Jeff Oien
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] linking classes together

2001-03-21 Thread Tobias Talltorp

I have two classes, one with mysql-connections and one with session-stuff.
The session-class relies on the mysql to check if the user is registered and
such.

What is the proper way to connect/link these classes together?

I got it working if I created a $db = new mysql_connect; in the function,
but there are other functions that need to be able to connect to a database
aswell.
Putting the $db = new mysql_connect; in the constructor did not work.
(See code below)


// This works --->
class sessions

function testprint() {
$db = new mysql_connect;
$db-> connect()
}
}
$sess = new sessions;
$sess-> testprint();

// This does not work -->
class sessions {
function sessions {
$db = new mysql_connect;
}

function testprint() {
$db-> connect()
}
}
$sess = new sessions;
$sess-> testprint();

Any thoughts?
// Tobias





-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] big problem

2001-03-22 Thread Tobias Talltorp

You need to set the permissions in that folder so that you can write.
PHP acts like IUSR(computernmae), so set IUSR(computername) permission to
write.
This is Windows, by the way...

// Tobias

""Salim Meethoo"" <[EMAIL PROTECTED]> wrote in message
99c90k$83u$[EMAIL PROTECTED]">news:99c90k$83u$[EMAIL PROTECTED]...
> hello there,
> can somebody help me out with my scripts while running this:
>  ..
> $myfile = fopen("data.txt","w");
> .etc;
> ?>
> i get the following error message:
> Warning: fopen("compteur","w") - Permission denied in
cmguestcount.inc.php3
> on line 11
> i'm using php3 and this scripts are for a counter of my page .
> thanks
> Salim
>
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Register session in function without global?

2001-03-22 Thread Tobias Talltorp

I am trying to register a session variable in a function without using the
global in the beginning.
The reason for this is that I don´t always know how many variables I am
going to register (I separate the different fields with | like this,
"username|email|cellphone" and explode them).

Is there some way I can make all the variables in the function global, so I
can get the session variables registered?

function test() {
global $username // <-- With this, it works. Without it, it doesn´t
session_start();
$username="tobias";
session_register("username");
}

The best I could come up with was (didn´t work):
global $HTTP_SESSION_VARS;

Any thoughts?
// Tobias





-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Register session in function without global?

2001-03-22 Thread Tobias Talltorp

Well... Whadda ya know. Right after I sent the post I figured it out.
(Solution? Variable variables!)

function register_vars($reg_var) {

// Make the $reg_var global
$global_vars=explode("|", $reg_var);
for ($i=0; $i wrote in message
99dn35$duo$[EMAIL PROTECTED]">news:99dn35$duo$[EMAIL PROTECTED]...
> I am trying to register a session variable in a function without using the
> global in the beginning.
> The reason for this is that I don´t always know how many variables I am
> going to register (I separate the different fields with | like this,
> "username|email|cellphone" and explode them).
>
> Is there some way I can make all the variables in the function global, so
I
> can get the session variables registered?
>
> function test() {
> global $username // <-- With this, it works. Without it, it doesn´t
> session_start();
> $username="tobias";
> session_register("username");
> }
>
> The best I could come up with was (didn´t work):
> global $HTTP_SESSION_VARS;
>
> Any thoughts?
> // Tobias
>
>
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] HELP? HTTP HEADER GURUS etc?

2001-03-23 Thread Tobias Talltorp

Try out cURL. I think it will work for java and C aswell:
http://curl.haxx.se

It does posts and handles cookies and more.

// Tobias

"brunatex" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
>
> Hello,
>
> Not sure if this is exactly focused on PHP, but i thought some of you
> guys might know.
>
> The general problem:
> I want to be able to send SMS messages from my computer using one of
> the free SMS services.
> I want to be able to do this without logging on each time - i.e.
> from a program (eiither C or java or the like).
>
> In essence, the problem is to get a program to 'Log In' to a site, and
> keep the user 'Logged In' (by sending cookies with
> each request i presume..)
>
> So the 2 questions are:
>
> 1. how do i send a POST query (containing login details) to a page?
> (if it were GET, i could just append to the URL, how do i do it with
> POST?)
>
> 2. once i have sent this (correct) login, i will receive back a
> cookie. I can store this, but need to know how to send it back with each
> request? (in the header somehow i presume..?)
>
> Thanks in advance,
>
> Jonathan
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Help with Posting Data

2001-03-28 Thread Tobias Talltorp

Sorry, a post MUST come from the client. The only way I know, is to use
JavaScript for this...

// Tobias


""Peter Phillips"" <[EMAIL PROTECTED]> wrote in message
99p6a2$vou$[EMAIL PROTECTED]">news:99p6a2$vou$[EMAIL PROTECTED]...
> Hi,
> I need a way to POST data to another script on another server, without
using
> a form and without using GET (i.e. foobar.php?name=value), I then need the
> user to be sent to that page (which now has the data).
>
> Is that possible? I found some functions (PostToHost), but they only POST
> the data and do now direct the user to the site.
>
> Any help would be appreciated.
>
> Thanks
>
> BTW: I can't use sessions or anything like that.
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Help w/ exec() on Win2k, IIS5.

2001-03-29 Thread Tobias Talltorp

I have had this problem with exec, passthru with that configuration
aswell...

To read the files into an array, do this:
(http://www.php.net/manual/en/function.opendir.php)

";
}
?>

// Tobias

"SHAWN" <[EMAIL PROTECTED]> wrote in message
D1FF6C0809A9D411815D0050DA841BCC3EE5@ONSITESERVER">news:D1FF6C0809A9D411815D0050DA841BCC3EE5@ONSITESERVER...
> Using IIS5 on W2K Server, I can't get get the exec() or other similar
> commands to work.
>
> This is what I'm doing -
>
> exec( "dir/a-d/b $dir_name", $arFiles )
>
> The array doesn't contain anything! I've tried it with cmd.exe before the
> command, but it just seems to get stuck in a loop! Can anyone tell me how
to
> successfully use this command? Or if not, any other ideas on how to get
the
> file names inside a directory into an array?
>
> Thanks in Advance,
>
> Shawn Sellars
>
>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] show mysql_query_result with php

2001-03-29 Thread Tobias Talltorp

What is the layout of your table, the names of fields etc.

By the way, is it just one table?

If you provide me with this information, I think I will be able to solve
your problem...

// Tobias

""Denis Mettler"" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Hi,
>
> i have a mysql table with the fields name and categorie.
> on my page search.php is a search mask where the visitor
> can insert a miscellaneous keyword.
>
> this keyword should be the categorie.
>
> basicly, how can i handle the problem,
> that the visitors keyword shows an output with all
> the entrys in the database where the keyword=categorie or
> how can i make links to defined categories?
>
> i know how i can make simple queries in php but i couldn't find anything
in
> the web
> for making this.
>
> thanks in advance.
> denis
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] how much data can a session store?

2001-04-09 Thread Tobias Talltorp

Just a quick question...

How much data can a session store?
The reason I´m asking is that I have developed a news system and want a
"preview"-thingy and for this I want to store the data in a session. The
main-content can be very large.

Thanks,
// Tobias



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Updating a value in a session

2001-04-12 Thread Tobias Talltorp

On my first page I have a form that posts a value to page2 where it gets
registered in a session. Works like a charm...
When I try to do this again, but send another value, the session doesn´t
update the new value.
Why?

PAGE 1 --->








PAGE 2 --->


Thanks,
// Tobias





-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] sending mail.. PLEASE HELP!

2001-04-12 Thread Tobias Talltorp

Or just adding this to the top of the page that is taking forever to
process:

set_time_limit(60); // 60 seconds before timeout, change to more if you want
to

This way you don´t have to change the time limit for all of the pages.

// Tobias Talltorp

> Are you doing a bulk mail out or something like that?
> Your script is timing out. The max_execution_time can be changed in
> php.ini
>
> Mick
>
> On Thu, 12 Apr 2001, Jude Sanglitan wrote:
>
> > Oops! How can I prevent this?
> >
> > Fatal error: Maximum execution time of 30 seconds exceeded in
> > C:\Inetpub\wwwroot\TFC Survey Form\mailform.php on line 17




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Problem Reading session files

2001-04-12 Thread Tobias Talltorp

Just a comment...
I tried your code and it worked just fine for me, I could see the session
contents.
The only thing that is different in my setup is that I use PHP 4.03pl1...
Try downgrading and see if it works...

// Tobias

""Schulz, Evan"" <[EMAIL PROTECTED]> wrote in message
919AAA764477D31189A00060942F0B8F142C7F@EXCHANGE">news:919AAA764477D31189A00060942F0B8F142C7F@EXCHANGE...
> I am about to pull my hair out trying to figure out why this isn't
working.
> I figured I would wait and hope that someone else's eyes would pick
> something up, though.  I am running it on 4.04pl1 CGI / Win 2k / IIS 5.  I
> am trying to read from the session files that are in C:\php\sessiondata in
> order to create an administration script to open up each session file,
grab
> each username variable that I have registered in it, and print the names
to
> the screen.
>
> This is the code I have with comments describing what is happening when I
> run it:
>
> function show_loggedin_users() {
>   $loopcounter=0;
>   if ($dir = opendir('c:/php/sessiondata')) {
> while($files = readdir($dir)) {
>   if (substr($files,0,1) != '.') {  file://don't want the '.' or '..'
files
> $sess_id[$loopcounter]=substr($files, 5);  file://get the sid from
the
> filename (removes the sess_ from the filename)
>
> $fullfilepath='c:/php/sessiondata/'.$files;
>
> $fp = fopen($fullfilepath, "r");  file://open up the session's
file
>
> $fcontents = fread($fp, filesize($fullfilepath));  file://get the
> contents of the file - it won't, though!
> echo $fcontents; file://just to check to see if it worked - it
doesn't
> print anything
> fclose($fp);
> ...
>
> There is a session file in the directory, there are registered variables
in
> the file, and I can print $fullfilepath and get a correct path and
filename
> to the file.  I also tried fgets instead of fread.  Nothing seems to work,
> though...
>
> Any corrections/thoughts/comments are appreciated.
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] getting all variables from session into array

2001-04-13 Thread Tobias Talltorp

I know this question has been up here before, but all the searches I did
turned up with to many or no hits, so I couldn´t find anything.

I want to get all the variables from a session and get them into an array
like this:

$sessionvar[userid]
$sessionvar[user]
$sessionvar[email]
...

I think I remember something call vardump or something, but I could´t find
it in the manual.

Any thoughts?
// Tobias



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] getting all variables from session into array

2001-04-13 Thread Tobias Talltorp

Does it act as a "normal" array like:
$array = array(one => "Number One", two => "Number Two");

How would I go about to make this loop work (if I use the above array it
works):

while(list($key, $val) = each($HTTP_SESSION_VARS))

 echo "$key - $val";
}

Regards,
// Tobias Talltorp

"Rasmus Lerdorf" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> There is already such an array.  It is $HTTP_SESSION_VARS
>
> -Rasmus
>
> On Fri, 13 Apr 2001, Tobias Talltorp wrote:
>
> > I know this question has been up here before, but all the searches I did
> > turned up with to many or no hits, so I couldn´t find anything.
> >
> > I want to get all the variables from a session and get them into an
array
> > like this:
> >
> > $sessionvar[userid]
> > $sessionvar[user]
> > $sessionvar[email]
> > ...
> >
> > I think I remember something call vardump or something, but I could´t
find
> > it in the manual.
> >
> > Any thoughts?
> > // Tobias
> >
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > To contact the list administrators, e-mail: [EMAIL PROTECTED]
> >
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Parsing HTML tags

2001-04-13 Thread Tobias Talltorp

// Get the webpage into a string
$html = join ("", file ("http://www.altavista.com"));

// Using eregi
eregi("(.*)", $html, $tag_contents);

// Using preg_match (faster than eregi)
// The i in the end means that it is a case insensitive match
preg_match("/(.*)<\/title>/i", $html, $tag_contents);

$title = $tag_contents[1];

// Tobias

"Chris Empson" <[EMAIL PROTECTED]> wrote in message
9b6vkl$jpf$[EMAIL PROTECTED]">news:9b6vkl$jpf$[EMAIL PROTECTED]...
> Could anyone tell me how to extract a string from between a pair of HTML
> tags?
>
> Specifically, I would like to extract the page title from between the
>  and  tags. I have read the regular expression docs and I'm
> still a bit stuck.
>
> Can anyone help?
>
> Thanks in advance,
>
> Chris Empson
>
> [EMAIL PROTECTED]
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Payflo Pro and credit cards

2001-06-19 Thread Tobias Talltorp

I have a few questions regarding credit cards and the Payflo Pro function in
PHP.
Currently I only need to check that the creditcard is valid, no actual
payment is needed right now.

1)
How do I perform this check against Payflo Pro?

2)
How and where should I save the credit card numbers? In a file outside the
webroot that I can crypt, in a database that I can crypt (can MySQL do
this)?

Thanks in advance,
// Tobias Talltorp





[PHP] multiple domains using one cookie

2001-07-05 Thread Tobias Talltorp

Hello all.

I want multiple domains to be able to read from one cookie, or set one
cookie each for the different domains.

Here is the case:
When the user logs in to my server, I want to set a cookie that has the
value $name="tobias". He specifies which domains that can read this cookie,
something like $domains="domain1.com;domain2.com;domain6.com".
Then these sites can read the $name and print it.

The other way might be to set one cookie with the value $name="tobias" for
domain1.com, one for domain2.com and one for domain6.com.
But the cookie _has_ to come from domain1.com, otherwise it will only work
for mydomain.com, right?
In other words, I can´t set, edit or read a cookie for an other site?

How would I go about doing this?

Regards,
// Tobias



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] RTF image encoding

2001-09-27 Thread Tobias Talltorp

Does anyone know what kind of encoding/decoding RTF uses for images?
I tried using base64 in PHP, but it didn't do the trick.

Any thoughts?,
// Tobias




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Error on mail attachment

2001-02-05 Thread Tobias Talltorp

I get a strange error when I am trying to send a mail with an attachment.
I used the class below, but I get two error messages.
1. Unknown has generated errors and will be closed by windows...
2.
CGI ERROR
The specified CGI application misbehaved by not returning a complete set of
HTTP headers. The headers it did return are:
ERROR: could not get the task list

How do I fix this?

I use php 4.0.3pl 1 (CGI), Win2k.


*  Modified by Tobias Ratschiller <[EMAIL PROTECTED]>:
*  - General code clean-up
*  - separate body- and from-property
*  - killed some mostly un-necessary stuff
*/

   class mime_mail
{
var $parts;
var $to;
var $from;
var $headers;
var $subject;
var $body;
 /*
 * void mime_mail()
 * class constructor
 */
function mime_mail()
 {
 $this->parts = array();
 $this->to =  "";
 $this->from =  "";
 $this->subject =  "";
 $this->body =  "";
 $this->headers =  "";
 }
 /*
 * void add_attachment(string message, [string name], [string cty
   pe])
 * Add an attachment to the mail object
 */
function add_attachment($message, $name =  "", $ctype =
   "application/octet-stream")
 {
 $this->parts[] = array (
  "ctype" => $ctype,
  "message" => $message,
  "encode" => $encode,
  "name" => $name
 );
 }
   /*
*  void build_message(array part=
*  Build message parts of an multipart mail
*/
   function build_message($part)
{
$message = $part[ "message"];
$message = chunk_split(base64_encode($message));
$encoding =  "base64";
return  "Content-Type: ".$part[ "ctype"].
   ($part[ "name"]? "; name = \"".$part[ "name"].
   "\"" :  "").

   "\nContent-Transfer-Encoding: $encoding\n\n$message\n";
}
   /*
*  void build_multipart()
*  Build a multipart mail
*/
   function build_multipart()
{
$boundary =  "b".md5(uniqid(time()));
$multipart =
   "Content-Type: multipart/mixed; boundary = $boundary\n\nThis is a MIME
encoded message.\n\n--$boundary";
for($i = sizeof($this->parts)-1; $i >= 0; $i--)
   {
   $multipart .=  "\n".$this->build_message($this->parts[$i]).
   "--$boundary";
   }
return $multipart.=  "--\n";
}
   /*
*  void send()
*  Send the mail (last class-function to be called)
*/
   function send()
{
$mime =  "";
if (!empty($this->from))
   $mime .=  "From: ".$this->from. "\n";
if (!empty($this->headers))
   $mime .= $this->headers. "\n";

if (!empty($this->body))
   $this->add_attachment($this->body,  "",  "text/plain");
$mime .=  "MIME-Version: 1.0\n".$this->build_multipart();
mail($this->to, $this->subject,  "", $mime);
}
   };  // end of class
   /*
* Example usage
*
*/
$attachment = fread(fopen("images/jean.jpg", "r"),
filesize("images/jean.jpg"));
$mail = new mime_mail();
$mail->from = "[EMAIL PROTECTED]";
$mail->headers = "Errors-To: [EMAIL PROTECTED]";
$mail->to = "[EMAIL PROTECTED]";
$mail->subject = "Testing...";
$mail->body = "This is just a test.";
$mail->add_attachment("$attachment", "images/jean.jpg", "image/jpeg");
$mail->send();


   ?>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] How to get information out of an external page?

2001-02-07 Thread Tobias Talltorp

Try this:

http://www.zend.com/codex.php?id=39&single=1
Just replace the fopen() and eregi() to suit your needs.

// Tobias

""David Tandberg-Johansen"" <[EMAIL PROTECTED]> wrote in message
95onrm$dj6$[EMAIL PROTECTED]">news:95onrm$dj6$[EMAIL PROTECTED]...
> Hello!
>
> I try to get some information from an public DB to controll that the users
> input is right.
>
> I can access the DB via http, so I dont have to logg in to it
>
> The public DB write out and plain HTML page.
>
> I want to check if only one of the records is the same as the user input.
I
> am only using the information in public DB to verify, and nothing else.
>
> Example of output from DB:
> *
> Name :Joe
> Lastname:Doe
> Userid:45545654 /*this is the information I wants
> City:New York
> *
>
> I figured out that I have to use fopen () and fread().
>
> Could anyone give mes some hints!
>
> Thank's
>
> David
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] List of all file extensions

2001-02-07 Thread Tobias Talltorp

Hello.

Do you know where I can find a list of all file extensions used today?
Like:
.gif
.htm
.php
.doc
...

Is there an organisation, like ICANN, that decide who can use these file
extensions and what you need to do to register one of your own?

Thanks,
// Tobias



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] List of all file extensions

2001-02-07 Thread Tobias Talltorp

> No. People use whatever file extensions they like.

So, If I create a 3D-program, I could say that file extensions for this
program will be .pdf (not a prefered extension, but still)?
Is it more a question of getting your file extension as widely used as
possible, so other companies dont bother using them, since most computers
have them associated with an other program?

> MIME-types do what you need. But they don't belong to the filename.

What do you mean by this?

Regards,
// Tobias




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] List of all file extensions

2001-02-07 Thread Tobias Talltorp

Thanks for straightening everything out for me!

// Tobias


"Philip Olson" <[EMAIL PROTECTED]> wrote in message
Pine.BSF.4.10.10102072314500.92822-10@localhost">news:Pine.BSF.4.10.10102072314500.92822-10@localhost...
> This is a good start :
>
> http://directory.google.com/Top/Computers/Data_Formats/
>
> Regards,
>
> Philip
>
> On Wed, 7 Feb 2001, Tobias Talltorp wrote:
>
> > > No. People use whatever file extensions they like.
> >
> > So, If I create a 3D-program, I could say that file extensions for this
> > program will be .pdf (not a prefered extension, but still)?
> > Is it more a question of getting your file extension as widely used as
> > possible, so other companies dont bother using them, since most
computers
> > have them associated with an other program?
> >
> > > MIME-types do what you need. But they don't belong to the filename.
> >
> > What do you mean by this?
> >
> > Regards,
> > // Tobias
> >
> >
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > To contact the list administrators, e-mail: [EMAIL PROTECTED]
> >
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Getting MIME-type of file

2001-02-08 Thread Tobias Talltorp

After a lot of searching on the mailing list and different resources I have
come up with... nothing.

My question:
Can I get the MIME-type of a file using PHP?
(image/gif, text/plain, application/octet-stream, ect.)

Thanks,
// Tobias




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Getting MIME-type of file

2001-02-08 Thread Tobias Talltorp

Oops, I forgot to mention the most important part...
I need to get the MIME-type (or something that can identify the
file-extension) from a file ALREADY on the server, not posted through a
form.
I.e. How do I get the MIME-type of "tobias.zip" in my folder?

I already know how to get the MIME-type from a form...
Thanks for the nice snippets though. They might come in handy in the future.

// Tobias


""James, Yz"" <[EMAIL PROTECTED]> wrote in message
95uqe5$473$[EMAIL PROTECTED]">news:95uqe5$473$[EMAIL PROTECTED]...
> Yes:
>
> Assuming that then input variable for the file is "file":
>
> like: 
>
> The returned results would be:
> $file = the name of the temporary file on the server.
>
> $file_name = The actual name of the file uploaded (ie pic.jpg)
>
> $file_size = the size of the file, in bytes.
>
> $file_type = the MIME type (yay) of the file.
>
> So, if you uploaded a Jpeg to your server, you could echo each of those
> variables to get info on them.
>
> You can also specify what files you want / don't want... Something like
this
> might do it:
>
> $allowed_types = array("image/gif","image/pjpeg","image/jpeg");
>
> if (!in_array($file_type/* Our type of file */,$allowed_types) {
> echo "You uploaded $file_name.  Unfortunately, we don't allow files
with
> the MIME type, $file_type.";
> } else {
> echo "You uploaded $file_name, which has a MIME type of $file_type.
> Your file was $file_size.  Thanks :)";
> }
>
> Of course, you will have to do more extensive checking, and write some
code
> to unlink invalid file types, together with auto-rename if you expect, for
> example, a lot of people to be uploading membership details:  If they
> include a pic, out of two people uploading a picture, say "tobias.jpg",
one
> of them is going to be disappointed;  One file will overwrite the other if
> put into the same directory :)
>
> Also, you'll probably want to set a maximum files size.
>
> $max_file_size = "102400"; /* in bytes (100Kb in this example) */
>
> if ($file_size > $max_file_size) {
> echo "Your file's too big!";
> }
>
> Hope this helps.
>
> James.
>
>
> > After a lot of searching on the mailing list and different resources I
> have
> > come up with... nothing.
> >
> > My question:
> > Can I get the MIME-type of a file using PHP?
> > (image/gif, text/plain, application/octet-stream, ect.)
> >
> > Thanks,
> > // Tobias
> >
> >
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > To contact the list administrators, e-mail: [EMAIL PROTECTED]
> >
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]