php-general Digest 15 Jan 2006 07:27:56 -0000 Issue 3906

Topics (messages 228619 through 228623):

PHP5 + Mysql5 + Apache 2.0.55
        228619 by: Erik Gyepes
        228623 by: Libit

Cookie problem
        228620 by: Al
        228622 by: Aaron Koning

Re: Help taking a string from a file
        228621 by: M. Sokolewicz

Administrivia:

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

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

To post to the list, e-mail:
        [email protected]


----------------------------------------------------------------------
--- Begin Message ---
Hi all.

I'm trying to set up mysql 5 with php 5 on my windows machine, but I can't get work it. Also I can't see any loaded extensions with phpinfo(). I have set extensions directory in php.ini, PATH dir in windows, what else I may to do? I used linux a lot of time and now I cant remember how to set up these things on windows :)

thanks,
depi

--- End Message ---
--- Begin Message ---
Erik Gyepes wrote:
Hi all.

I'm trying to set up mysql 5 with php 5 on my windows machine, but I can't get work it. Also I can't see any loaded extensions with phpinfo(). I have set extensions directory in php.ini, PATH dir in windows, what else I may to do? I used linux a lot of time and now I cant remember how to set up these things on windows :)

thanks,
depi

SKIP this part if your apache already have php installed

-------------------
1.add this in you conf/httpd apache configuration file
add it at the end of the file:

LoadModule php5_module "c:/php/php5apache2.dll"
AddType application/x-httpd-php .php
PHPIniDir "C:/windows"

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

2.in the php.ini
extension_dir = "C:/php/ext/"

3.remove the ; from this line
extension=php_mysql.dll

4.copy this file libmysql.dll into windows/system32 (this file is originally in you php folder)

good luck :)

--- End Message ---
--- Begin Message ---
Can't get a cookie to set. Below is the code near the file top BEFORE any html 
output.

$_POST['prefs'] comes from a hidden field in the middle of the html output.

$_POST['filter'] comes from a select option.

A Submit button closes the page and refreshes it.

print_r($_POST) shows $_POST['prefs'] $_POST['prefs'] are just as I expect when 
the page refreshes.

## code
print_r($_POST)
session_start();
print_r($_COOKIE);

if(isset($_POST['prefs']))
        $cookie= setcookie("listpref", $_POST['filter'], time()+7776000);

var_dump($cookie) shows bool TRUE

I added the session_start() as a test.

print_r($_COOKIE) shows the session ID cookie works just fine.

IE6 and Firefox don't record the regular cookie.

--- End Message ---
--- Begin Message ---
Try simplifying the problem to determine the error point. For example don't
involve $_POST just try setting a cookie with hard coded variables. If that
works then add in the $_POST and test for BOTH $_POST['prefs'] and
$_POST['filter'].

Example of simplification:

<?php
// Send cookie
setcookie("listpref","selected",time()+7776000);
?>

Aaron


On 1/14/06, Al <[EMAIL PROTECTED]> wrote:
>
> Can't get a cookie to set. Below is the code near the file top BEFORE any
> html output.
>
> $_POST['prefs'] comes from a hidden field in the middle of the html
> output.
>
> $_POST['filter'] comes from a select option.
>
> A Submit button closes the page and refreshes it.
>
> print_r($_POST) shows $_POST['prefs'] $_POST['prefs'] are just as I expect
> when the page refreshes.
>
> ## code
> print_r($_POST)
> session_start();
> print_r($_COOKIE);
>
> if(isset($_POST['prefs']))
>         $cookie= setcookie("listpref", $_POST['filter'], time()+7776000);
>
> var_dump($cookie) shows bool TRUE
>
> I added the session_start() as a test.
>
> print_r($_COOKIE) shows the session ID cookie works just fine.
>
> IE6 and Firefox don't record the regular cookie.
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

--- End Message ---
--- Begin Message ---
Lists wrote:
Hello List,

I made something work, but probably in the most crappy way possible.

My goal is to take just the HTML for the image and link from the Flickr badge js script.

This is what I did, please help me do in a better way. I'd appreciate good sources to read to learn to strip stuff away and just get specific parts as well. I never know which of the str functions to use.

<?
// allow retrieval of external web source
ini_set('allow_url_fopen',1);

// get flickr js file
$photo = file_get_contents("http://www.flickr.com/badge_code_v2.gne? count=1&display=latest&size=m&layout=h&source=user&user=91667218% 40N00");

//get rid of all the crap except for the image tags
$photo = strstr($photo, '<a');
list($image, $trash) = explode("'", $photo);
$image = ereg_replace("</td>","", $image);
?>

why not just do:

$file = file_get_contents('http://www.flickr.com/badge_code_v2.gne?count=1&display=latest&size=m&layout=h&source=user&user=91667218%40N00');

preg_match('#<img (.*)src="(.+)"#U', $file, $r);
$photo = $r[2];

?
- tul

--- End Message ---

Reply via email to