[PHP] Copy?

2005-02-23 Thread Wiberg
Hi there!

How do I copy a file from an URL to my server?
I url fopen wrappers is NOT enabled, and I'm not allowed to do that.

/G
@varupiraten.se
-- 
Internal Virus Database is out-of-date.
Checked by AVG Anti-Virus.
Version: 7.0.300 / Virus Database: 265.8.7 - Release Date: 2005-02-10

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



SV: SV: SV: SV: [PHP] Copy? - What am I doing wrong???

2005-02-25 Thread Wiberg
Hi there!

You're right. It wasn't a problem. It was my local Win-computer that failed
totally...

/G
@varupiraten.se



-Ursprungligt meddelande-
Från: Richard Lynch [mailto:[EMAIL PROTECTED]
Skickat: den 25 februari 2005 21:46
Till: Jochem Maas
Kopia: [EMAIL PROTECTED]; [php] PHP General List
Ämne: Re: SV: SV: SV: [PHP] Copy? - What am I doing wrong???


Jochem Maas wrote:
> Wiberg wrote:
>> Hi there!
>>
>> fgtcvs works fine, but there's another problem now... I run updates to
>> the
>> db for each row (every row is unique) and must be updated. If I run the
>> script with 2 rows then my site couldn't open the database from
>> another
>> location. Is this MySQL-specific or PHP-specific? Is there any way to
>> release memoryresources in PHP?
>
> I am not going to answer this question for 2 reasons:
>
> 1. I'm not your personal helpdesk. (mail the list not me personally - use
> 'Reply All')
> 2. I don't get what your asking.
>
> with regard to memory: unset()
> with regard to the rest, please post your question again, this time to the
> list,
> also try to formulate your question differently (if I don't understand it
> probably other
> people won't either - and that increases the chance that your mail will be
> ignored)

I'm guessing he's running into a table-locking problem while trying to
update 2 records with unique IDs.

If so, solutions include:
Doing the updates a few rows at a time, so the table is only locked for a
few seconds every minute over the course of a day.

Altering the underlying table type in MySQL from MyISAM to, err, some
table format that supports row-locking???  [I could be way off base and
ISAM already does that...]

It's also entirely possible he's only anticipating a problem that isn't a
problem.  Hard to tell.

--
Like Music?
http://l-i-e.com/artists.htm

--
No virus found in this incoming message.
Checked by AVG Anti-Virus.
Version: 7.0.300 / Virus Database: 266.4.0 - Release Date: 2005-02-22

--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.300 / Virus Database: 266.4.0 - Release Date: 2005-02-22

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



SV: [PHP] Difficulty with SQL LIKE clause

2005-02-25 Thread Wiberg
Hi there!

A little off-topic but what the heck (it's a more MySQL - related question)

Is 197* a numbertype field?
Try maybe $query= "SELECT * FROM my_table WHERE Year LIKE '197*'";

/G
@varupiraten.se

-Ursprungligt meddelande-
Från: David Freedman [mailto:[EMAIL PROTECTED]
Skickat: den 25 februari 2005 21:28
Till: php-general@lists.php.net
Ämne: [PHP] Difficulty with SQL LIKE clause


When I use this query in PHP it works, and I get all things with the YEAR of
1977, as I expected.

$query= "SELECT * FROM my_table WHERE Year LIKE 1977 ";

But, when I use this query it does not work.

$query= "SELECT * FROM my_table WHERE Year LIKE 197* ";

I thought I should get the result of ALL things with the years in the 1970's
(1970-1979).  But the asterisk in the LIKE clause does not seem to work.
I have tried various syntax's to try to get the 197* recognized but without
any luck.

Can the '*' be used? What am I doing wrong.

David F.



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

--
No virus found in this incoming message.
Checked by AVG Anti-Virus.
Version: 7.0.300 / Virus Database: 266.4.0 - Release Date: 2005-02-22

--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.300 / Virus Database: 266.4.0 - Release Date: 2005-02-22

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



[PHP] NH05 to 5, NH07 to 7

2004-11-25 Thread Wiberg
hi there!

i guess you know a simple solution to convert the string

NH01 into 1
NH02 into 2
..
...
NH13 into 13

and so on

/Gustav Wiberg
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.799 / Virus Database: 543 - Release Date: 2004-11-19

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



[PHP] ScreenHeight?

2004-12-01 Thread Wiberg
Hi

Is there any way of getting the clients screenheight in PHP? (or do I have
to do it in Javascript)

/Gustav Wiberg
@varupiraten.se
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.802 / Virus Database: 545 - Release Date: 2004-11-26

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



[PHP] Strip of code - what could be wrong?

2004-12-18 Thread Wiberg
Hi there!

I'm trying to figure out some code I haven't done myself, but I don't get
what could
be wrong. Check this code out:

the coder says he when he import files, he gets a result that the line ends
at wrong positions... Is it 4096 that is wrong?

/G
@varupiraten.se


$file = $rad[url_productlist];
$OpenFile = @fopen($file, "r");

while (!feof ($OpenFile))
{
$buffer = fgets($OpenFile, 4096);
$rader[] = $buffer;
}

fclose ($OpenFile);

for($i=0; $i
$del = explode("<>", $rader[$i]);

insert into DBcode...

}

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.808 / Virus Database: 550 - Release Date: 2004-12-08

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



[PHP] Prado

2004-12-18 Thread Wiberg
Hi there!

Anyone used PRADO? What's YOUR opinion? *curious*
http://www.xisc.com/

/G
@varupiraten.se


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.818 / Virus Database: 556 - Release Date: 2004-12-17

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



[PHP] OpenSource -webshop?

2004-12-27 Thread Wiberg
Hi there!

I have a thougt of making my site OpenSource. It's a webshop, so I'm
unsecure about the
security... Maybe someone will use the sourcecode for malicious attacks
instead of making
the code better? What are your thoughts about this? *curious*

/G
@varupiraten.se
--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.296 / Virus Database: 265.6.5 - Release Date: 2004-12-26

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



[PHP] Why extra slashes???

2004-12-30 Thread Wiberg
Hi there!

Right now I'm creating a form that saves the text from a textarea to an
array. That doesn't seem to be any problem.
But when I save the contents, I get extra / ?

The code looks like this:
-

//Which main product category is to treat?
//
if (isset($_REQUEST["reqIDKategori"])) {

$streqIDKategori = $_REQUEST["reqIDKategori"];

}


//Save current main category to file
//
if (isset($_REQUEST["saveCategory"])) {

//Open file for writing
//
$handle = fopen("../maincategorypages/" . $streqIDKategori . 
".html","wb");

//Get contents of textarea
//
$textArea = $_REQUEST["frmSaveArea"];


//Save all info in textarea into file
//
fwrite($handle, $textArea);

//Close file
//
fclose($handle);

}


//Read maincategory html-file
//
function readFileCategory($ID) {

//Load file into array
//
$returnfile = file("../maincategorypages/" . $ID . ".html");

//Send back array with fileinfo
//
return $returnfile;

}


//Show specific array to screen
//
function showArray($array) {

for ($i=0;$i


main




  

  





  
  

  




 
  

  


 
 





/G
@varupiraten.se
--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.296 / Virus Database: 265.6.6 - Release Date: 2004-12-28

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



[PHP] Forgive me

2005-01-03 Thread Wiberg
AFAICS

What does that mean? *feeling stupid*

/G
@varupiraten.se

-- 
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.296 / Virus Database: 265.6.7 - Release Date: 2004-12-30

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



[PHP] URL-funtion - returnvalue into variable...?

2005-01-12 Thread Wiberg
Hi there!

I'm a total newbie at connecting to diffrent servers, and b2b and such stuff
, so I guess this is a simple question for you guys...

Another company wants me to access their productinfo thorugh URL, something
like this:
https://www.anothercompany.com/returnValueOfProductID=1043

If I access this site, the value of product that has ID 1043 will be
returned.
How do I get this returnvalue into a variable?

/G
@varupiraten.se



--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.300 / Virus Database: 265.6.10 - Release Date: 2005-01-10

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



[PHP] Optimize code?

2005-01-25 Thread Wiberg
Hi!

I wonder if I can optimize following code (or do something better) below?
It works fine when about 3.000 rows exists in the textfile, but when it gets
to 10.000 rows then it will get a session timeout. (or internal server
error)


ARTICLENR: $articleNumberManufacturer";
//echo "SALDO: $saldo";



//Articlenr exists in line
//
if (intval($articleNumberManufacturer)>0) {


//Get ID of product (if there is any in varupiratens db)
//skip the product if the saldo is the same as in
//the textfile
//
$sql = "SELECT IDVara FROM tbvara WHERE Varunamn =
'$prefix$articleNumberManufacturer' LIMIT 1;";
$querys = mysql_query($sql);
$dbArray = mysql_fetch_array($querys);
$IDVara = $dbArray["IDVara"];
if ($IDVara == Null) {$IDVara = 0;}


//If product is found, then update saldo
//
if (intval($IDVara)>0) {

$sql = "UPDATE tbvara SET Saldo=$saldo WHERE IDVara=$IDVara 
LIMIT 1;";
$querys = mysql_query($sql);
echo "QUERY DB -> $sql";

}

//END Articlenr exists in line
}

}
mysql_close();
}

?>

/G
@varupiraten.se

--
Internal Virus Database is out-of-date.
Checked by AVG Anti-Virus.
Version: 7.0.300 / Virus Database: 265.7.1 - Release Date: 2005-01-19

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



[PHP] set-time-limit

2005-01-26 Thread Wiberg
Hi!

when safe mode is one, i can't use set_time_limit. Is there any workarounds?

why is it so that when I echo something to the screen then I can run the
script for a longer time, than if I don't have echo? Don't get the logic...

/G
@varupiraten.se

--
Internal Virus Database is out-of-date.
Checked by AVG Anti-Virus.
Version: 7.0.300 / Virus Database: 265.7.1 - Release Date: 2005-01-19

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



Re: [PHP] source code protection

2005-02-26 Thread Gustav Wiberg
Hi there!
What's the point of doing that? The PHP-codes are well protected if they are 
on a well
configured server.

/G
@varupiraten.se
- Original Message - 
From: "shabanip" <[EMAIL PROTECTED]>
To: 
Sent: Saturday, February 26, 2005 4:43 PM
Subject: [PHP] source code protection


is there any way to protect PHP files source code?
thanks,
Payam Shabanian
shabanip -at- avapajoohesh.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

--
No virus found in this incoming message.
Checked by AVG Anti-Virus.
Version: 7.0.300 / Virus Database: 266.5.0 - Release Date: 2005-02-25


--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.300 / Virus Database: 266.5.0 - Release Date: 2005-02-25
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Apache and PHP

2005-02-28 Thread Gustav Wiberg
Hi there!
I've just installed Apache on a new computer. (just for testing)
It's Windows XP. I've then installed PHP and it says that Apache could be 
not configured automatically.

Newbies question as hell probably but here it goes:
I can access my Apache-server, I have the document-root to c:\webb and the 
apace-files is in c:\program\Apache
I've changed a little in httpd.conf file and restarted the Apace-service. I 
have changed the documentRoot and another parameter that was very alike 
documentRoot...

But my problem...
The sourcecode for PHP shows when I access the http-server with php-files.
I don't cant getting any full support answers on this, just give me hints... 
:-)

/G
@varupiraten.se 

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


Re: [PHP] Apache and PHP

2005-02-28 Thread Gustav Wiberg
Hi there!
Thanx! :-)
I hope I can solve this myself now... :-)
/G
@varupiraten.se
- Original Message - 
From: "dan" <[EMAIL PROTECTED]>
To: 
Sent: Monday, February 28, 2005 11:23 PM
Subject: Re: [PHP] Apache and PHP


Gustav Wiberg wrote:
Hi there!
I've just installed Apache on a new computer. (just for testing)
It's Windows XP. I've then installed PHP and it says that Apache could be 
not configured automatically.

Newbies question as hell probably but here it goes:
I can access my Apache-server, I have the document-root to c:\webb and 
the apace-files is in c:\program\Apache
I've changed a little in httpd.conf file and restarted the Apace-service. 
I have changed the documentRoot and another parameter that was very alike 
documentRoot...

But my problem...
The sourcecode for PHP shows when I access the http-server with 
php-files.

I don't cant getting any full support answers on this, just give me 
hints... :-)

/G
@varupiraten.se
Check out:
http://www.php.net/manual/en/install.windows.apache2.php
Pay particular attention to the AddType directives.  This will make Apache 
"process" PHP files.

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


[PHP] Sessions and frames

2005-04-14 Thread Gustav Wiberg
Hi there!
I have built my site into frames.
I want to transfer a session-variable from my left frame to my right 
frame... How do I do this best? Thoughts?

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


Re: [PHP] Sessions and frames

2005-04-16 Thread Gustav Wiberg
Hi there!
Thanx a lot, i thought it was like that, but I wasn't sure
/G
@varupiraten.se
- Original Message - 
From: "Chris W. Parker" <[EMAIL PROTECTED]>
To: "Gustav Wiberg" <[EMAIL PROTECTED]>; "PHP General" 

Sent: Friday, April 15, 2005 1:26 AM
Subject: RE: [PHP] Sessions and frames

Gustav Wiberg <mailto:[EMAIL PROTECTED]>
   on Thursday, April 14, 2005 4:00 PM said:
I have built my site into frames.
I want to transfer a session-variable from my left frame to my right
frame... How do I do this best? Thoughts?
You do this best by setting some session data on one page (any page),
and then accessing that same data on another page (any page). If both
frame sources are within the same domain they both have access to the
same session data.

Chris.
--
No virus found in this incoming message.
Checked by AVG Anti-Virus.
Version: 7.0.308 / Virus Database: 266.9.11 - Release Date: 2005-04-14
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Single SQL-statement in PHP to order...

2005-04-18 Thread Gustav Wiberg
Hi there!
I guess this is off-topic? but I want to know if this is possible. (If 
there's anyone out there that have a solution, I would appreciate it 
though)

I want to know if there is anyway of showing tables in PHP in an order 
like this in a single SQL-statement...

Table is like this:
IDCategory
7
15
4
3
I want to order the table like this: First everything that is IDCategory 
4, then the rest of the posts (doesn't matter which order)

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


[PHP] Re: [PHP-WIN] Confused

2007-08-24 Thread Gustav Wiberg

AHA.. Thanx :-)

/Gustav

- Original Message - 
From: "John Mertic" <[EMAIL PROTECTED]>

To: "Gustav Wiberg" <[EMAIL PROTECTED]>
Cc: "Aaron Kenney" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Friday, August 24, 2007 9:47 PM
Subject: Re: [PHP-WIN] Confused



Just grab the windows installer and choose LDAP under the Extensions tree.

John

On 8/24/07, Gustav Wiberg <[EMAIL PROTECTED]> wrote:

Hi again!

Sorry I'm so dumb, but what exactly should I download? I've tried to
download OpenLDAP (Is this wrong?)
ftp://ftp.openldap.org/pub/OpenLDAP/openldap-stable/openldap-stable-20070110.tgz
but I found no php_ldap.dll

Best regards
/Gustav Wiberg


- Original Message -
From: "Aaron Kenney" <[EMAIL PROTECTED]>
To: "Gustav Wiberg" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Friday, August 24, 2007 4:44 PM
Subject: Re: [PHP-WIN] Confused


> To get LDAP working in PHP for Windows, you first need to download the
> ZIP package of PHP. Extract the ZIP package to some folder (do NOT
> overwrite your PHP installation!). From the files you have extracted,
> open the /ext folder and copy the php_ldap.dll file. Paste   the file
> into the /ext folder of your PHP installation. Make sure that the file
> has appropriate security so that your web server can access it.
> Then edit the php.ini file and remove the ; so that the line
>
> ;extension=php_ldap.dll
>
> reads
>
> extension=php_ldap.dll
>
> if you do not have the original line, simply add the new line before
> the Module Settings section. Restart IIS or Apache (whichever one you
> are using).
>
> Here is an example of connecting and binding:
>
> $ldaprdn = '[EMAIL PROTECTED]';
> $ldappass = 'PWD';
> $ds = 'servername.domainname.net';
> $dn = 'dc=domainname,dc=net';
> $ldapport = 389;
> $ldapconn = ldap_connect($ds, $ldapport)
> or die("Could not connect to LDAP server.");
>
> if ($ldapconn)
> {
> ldap_set_option($ldapconn, LDAP_OPT_PROTOCOL_VERSION,3);
> ldap_set_option($ldapconn, LDAP_OPT_REFERRALS,0);
> $ldapbind = ldap_bind($ldapconn, $ldaprdn, $ldappass);
> }
>
> I hope this helps.
> -Aaron Kenney
>
> On 8/24/07, Gustav Wiberg <[EMAIL PROTECTED]> wrote:
>> Hi there!
>>
>> Yes, thank you - please send me examples. LDAP seems to be a part of
>> Active Directory. I guess in true Microsoft-spirit, it isn't possible 
>> to

>> turn it on or off.
>>
>> It seems you have to compile LDAP together with PHP on Windows. How do 
>> I
>> do that? I tried to follow the instructions on php.net but I got 
>> lost...

>>
>> Best regards
>> /Gustav Wiberg
>>
>>
>>
>> -Original Message-
>> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
>> Sent: Friday, August 24, 2007 4:04 PM
>> To: Gustav Wiberg
>> Subject: Re: [PHP-WIN] Confused
>>
>> I don't know exactly how to do it but LDAP connection is available as 
>> a
>> setting on active directory. I'm not sure how one turns it on or off, 
>> but
>> it is possible. It was discussed on this list some time ago. I can 
>> send

>> you an example of the script I used to connect if needed.
>> Sent via BlackBerry from T-Mobile
>>
>> -Original Message-
>> From: Gustav Wiberg <[EMAIL PROTECTED]>
>>
>> Date: Fri, 24 Aug 2007 15:56:00
>> To:"'[EMAIL PROTECTED]'" <[EMAIL PROTECTED]>
>> Subject: FW: [PHP-WIN] Confused
>>
>> Hello!
>>
>> IS Active Directory an LDAP server? (dumb question I know but I need 
>> to

>> know :-))
>>
>> Best regards
>> /Gustav Wiberg
>>
>>
>> -Original Message-
>> From: Gustav Wiberg [mailto:[EMAIL PROTECTED]
>> Sent: Friday, August 24, 2007 3:53 PM
>> To: '[EMAIL PROTECTED]'
>> Subject: [PHP-WIN] Confused
>>
>> Hi!
>>
>> LDAP Server, LDAP Client
>>
>> LDAP is a protocol
>>
>>
>> LDAP Client is needed to be installed and compiled together with PHP 
>> so

>> it would work.
>>
>> Do I Have to install an LDAP Server also? Where do I find that? *can't
>> figure it out really*
>>
>>
>>
>> /Gustav
>>
>>
>> No virus found in this outgoing message.
>> Checked by AVG Free Edition.
>> Version: 7.5.484 / Virus Database: 269.12.4/969 - Release Date:
>> 2007-08-23 16:04
>>
>>
>> --
>> PHP Windows Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>
>> No virus found in this outgoing message.
>> Checked by AVG Free Edition.
>> Version: 7.5.484 / Virus Database: 269.12.4/969 - Release Date:
>> 2007-08-23 16:04
>>
>>
>> --
>> PHP Windows Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>
>

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





--
--
John Mertic"Explaining a joke
is like dissecting a frog: you
[EMAIL PROTECTED]  understand it better,
but the frog dies in the
 process."

 -Mark Twain



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



[PHP] Why not user...?

2007-08-27 Thread Gustav Wiberg

Hi!

Why is it so that I get this error. I'm using Windows Integrated 
authorization-method for actual webb I'm testing on.


Notice: Undefined index: PHP_AUTH_USER in C:\www\utveckling\username.php on 
line 2



?

Best regards
/Gustav Wiberg 


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



Re: [PHP] Why not user...?

2007-08-27 Thread Gustav Wiberg

Hi!

Thanx!
I figured it out. The username wasn't in server-variable PHP_AUTH_USER but 
in AUTH_USER 


Best regards
/Gustav Wiberg


- Original Message - 
From: "Stut" <[EMAIL PROTECTED]>

To: "Gustav Wiberg" <[EMAIL PROTECTED]>
Cc: "PHP General" 
Sent: Monday, August 27, 2007 3:51 PM
Subject: Re: [PHP] Why not user...?



Gustav Wiberg wrote:
Why is it so that I get this error. I'm using Windows Integrated 
authorization-method for actual webb I'm testing on.


Notice: Undefined index: PHP_AUTH_USER in C:\www\utveckling\username.php 
on line 2


For some reason it's not getting set. This could be because you've not 
configured IIS correctly, are you sure you've disabled anonymous 
authentication?


If you're sure it's configured correctly try var_dump'ing $_SERVER - it's 
possible (though unlikely) the username is in another place.


-Stut

--
http://stut.net/



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



[PHP] why?

2007-08-27 Thread Gustav Wiberg

Hi!

I can't figure the thing with Windows Integrated authentication... I have 
checked a website for doing this. I still have to enter username and 
password even if I'm on the local computer (through a VPN though) This would 
be the same as using computer locally on the network, but I have to enter 
username and password. I'm sure I have checked the "Windows Integreated 
authenication" - checkbox for the website it's about.


When I have entered username and password I can go on and do whatever I want 
on that site...


I've tested with both IE6, and IE7. What could be the problem?

Best regards
/Gustav Wiberg

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



[PHP] windows auth with php

2007-08-27 Thread Gustav Wiberg

Hi again!

I read
"The HTTP Authentication hooks in PHP are only available when it is running 
as an Apache module and is hence not available in the CGI version. In an 
Apache module PHP script, it is possible to use the header() function to 
send an "Authentication Required" message to the client browser causing it 
to pop up a Username/Password input window. Once the user has filled in a 
username and a password, the URL containing the PHP script will be called 
again with the predefined variables PHP_AUTH_USER, PHP_AUTH_PW, and 
AUTH_TYPE set to the user name, password and authentication type 
respectively. These predefined variables are found in the $_SERVER and 
$HTTP_SERVER_VARS arrays. Both "Basic" and "Digest" (since PHP 5.1.0) 
authentication methods are supported. See the header() function for more 
information."



I'm checking Windows Integrated Authentication in IIS 6.0 and I'm using PHP 
5.0.1.


PHP is working as an ISAPI-module. Is this the problem? Is that why the 
authentication is not working automatically? (without logging in with 
username and password at first)


Or is the version of PHP the problem? Should it be larger than 5.1.0 ? Is 
that why the authentication is not working automatically? (without logging 
in with username and password at first)


I'm trying with IE6 and IE7...


Best regards
/Gustav Wiberg






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



Re: [PHP] why?

2007-08-27 Thread Gustav Wiberg

Hi!

No it doesn't seem to work locally either (I haven't tested myself, but a 
working-friend did)


Best regards
/Gustav Wiberg

- Original Message - 
From: "Stut" <[EMAIL PROTECTED]>

To: "Gustav Wiberg" <[EMAIL PROTECTED]>
Cc: "PHP General" 
Sent: Monday, August 27, 2007 8:51 PM
Subject: Re: [PHP] why?



Gustav Wiberg wrote:
I can't figure the thing with Windows Integrated authentication... I have 
checked a website for doing this. I still have to enter username and 
password even if I'm on the local computer (through a VPN though) This 
would be the same as using computer locally on the network, but I have to 
enter username and password. I'm sure I have checked the "Windows 
Integreated authenication" - checkbox for the website it's about.


When I have entered username and password I can go on and do whatever I 
want on that site...


I've tested with both IE6, and IE7. What could be the problem?


Transparent authentication between IE and IIS may not work over a VPN 
depending on a huge number of factors, but mainly how the VPN server has 
been configured.


Does it work when on the same network as the web server and AD server?

-Stut

--
http://stut.net/



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



Re: [PHP] why?

2007-08-27 Thread Gustav Wiberg

Hi!

Ok. Of course Why didn't I think of that? Thanx! :-)

Best regards
/Gustav Wiberg


- Original Message - 
From: "Stut" <[EMAIL PROTECTED]>

To: "Gustav Wiberg" <[EMAIL PROTECTED]>
Cc: "PHP General" 
Sent: Monday, August 27, 2007 8:59 PM
Subject: Re: [PHP] why?



Gustav Wiberg wrote:
No it doesn't seem to work locally either (I haven't tested myself, but 
a working-friend did)


I suggest you find a Windows Server mailing list and ask there. This is 
almost certainly not an issue with PHP.


You might also want to find/write an ASP script that will show the 
username of the logged in user so you can take PHP out of the equation. 
Once it's working with ASP it should work with PHP.


-Stut


- Original Message - From: "Stut" <[EMAIL PROTECTED]>
To: "Gustav Wiberg" <[EMAIL PROTECTED]>
Cc: "PHP General" 
Sent: Monday, August 27, 2007 8:51 PM
Subject: Re: [PHP] why?



Gustav Wiberg wrote:
I can't figure the thing with Windows Integrated authentication... I 
have checked a website for doing this. I still have to enter username 
and password even if I'm on the local computer (through a VPN though) 
This would be the same as using computer locally on the network, but 
I have to enter username and password. I'm sure I have checked the 
"Windows Integreated authenication" - checkbox for the website it's 
about.


When I have entered username and password I can go on and do whatever 
I want on that site...


I've tested with both IE6, and IE7. What could be the problem?


Transparent authentication between IE and IIS may not work over a VPN 
depending on a huge number of factors, but mainly how the VPN server 
has been configured.


Does it work when on the same network as the web server and AD server?


-Stut

--
http://stut.net/



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



Re: [PHP] why?

2007-08-27 Thread Gustav Wiberg

Hi!

Yes, a single sign-on it is... It doesn't work together with Windows (and 
PHP) you mean?


Best regards
/Gustav Wiberg

- Original Message - 
From: "Jay Blanchard" <[EMAIL PROTECTED]>
To: "Jay Blanchard" <[EMAIL PROTECTED]>; "Gustav Wiberg" 
<[EMAIL PROTECTED]>; "PHP General" 

Sent: Monday, August 27, 2007 9:26 PM
Subject: RE: [PHP] why?


[snip]
... be the same as using computer locally on the network, but I have
to
enter username and password. I'm sure I have checked the "Windows
Integreated authenication" - checkbox for the website it's about.

When I have entered username and password I can go on and do whatever I
want on that site...

I've tested with both IE6, and IE7. What could be the problem?

http://us.php.net/features.http-auth
[/snip]

I hit send before I finished my thoughts

Are you trying to do single sign-on? This would be one of the holy
grails of the PHP on Linux, Windows clients operations. This is
available with .Net and with legacy ASP/Jscript apps but not with
PHPeven on windows

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



Re: [PHP] Why not user...?

2007-08-27 Thread Gustav Wiberg

Hi!

Thnank you for your input, but I used AUTH_USER-server variable instead of 
PHP_AUTH_USER and that did the trick! :-)


Best regards
/Gustav W iberg

- Original Message - 
From: "Richard Lynch" <[EMAIL PROTECTED]>

To: "Stut" <[EMAIL PROTECTED]>
Cc: "Gustav Wiberg" <[EMAIL PROTECTED]>; "PHP General" 


Sent: Tuesday, August 28, 2007 3:20 AM
Subject: Re: [PHP] Why not user...?



On Mon, August 27, 2007 8:51 am, Stut wrote:

Gustav Wiberg wrote:

Why is it so that I get this error. I'm using Windows Integrated
authorization-method for actual webb I'm testing on.

Notice: Undefined index: PHP_AUTH_USER in
C:\www\utveckling\username.php
on line 2


For some reason it's not getting set. This could be because you've not
configured IIS correctly, are you sure you've disabled anonymous
authentication?

If you're sure it's configured correctly try var_dump'ing $_SERVER -
it's possible (though unlikely) the username is in another place.


Going for the more obvious...

Did you perhaps take code written with the default setting of E_ALL ~
E_NOTICE and are now running it with E_ALL, and this is the first
page-view before you've even typed in your usernane/password?

Cuz that for sure would do it.

Change the code to be more like this:

if (isset($_SERVER['PHP_AUTH_USER'])){
 //try to login
}

You'll probably have a fair number of these E_NOTICE thingies to fix
before you are through.

They're all trivial to fix, and there's no real excuse to have code
that has E_NOTICE messages firing off anyway.

Under extreme pressure, you can switch to E_ALL ~ E_NOTICE for this
app for now and put it on the ToDo list to fix it right someday...

--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?




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



[PHP] Open Source mailinglist?

2006-07-19 Thread Gustav Wiberg

Hi there!

I hope you don't kill me out there, but I'm totally out of luck here. I've 
been doing some research on Open Source questions because I want a product 
of mine to become better in any ways (yes, it's written in PHP and yes, it's 
Open Source). Because of not doing advertising here, I'll skip the name :-)


I can't seem to find any place on the net where you can discuss Open 
Source-related questions in general???


Best regards
/Gustav Wiberg 


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



Re: [PHP] Open Source mailinglist?

2006-07-19 Thread Gustav Wiberg


[snip]
I hope you don't kill me out there, but I'm totally out of luck here.
I've
been doing some research on Open Source questions because I want a
product
of mine to become better in any ways (yes, it's written in PHP and yes,
it's
Open Source). Because of not doing advertising here, I'll skip the name
:-)

I can't seem to find any place on the net where you can discuss Open
Source-related questions in general???
[/snip]

Don't Sourceforge and Freshmeat have lists?

I've checked there, but I just find newsletters. At freshmeat I found some 
chat-function located at IRC, and I don't want to install IRC.

, but no mailinglists...
(or else I'm blind)

Best regards
/Gustav Wiberg 


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



[PHP] Quotes?

2006-09-05 Thread Gustav Wiberg

I want to save this to a string...


</pre><tt>var uri = '<a  rel="nofollow" href="http://impse.tradedoubler.com/imp/img/16352388/1122503">http://impse.tradedoubler.com/imp/img/16352388/1122503</a>?' + new 
</tt><tt>String (Math.random()).substring (2, 11);
</tt><tt>document.write('<a 
</tt><tt>href="<a  rel="nofollow" href="http://clk.tradedoubler.com/click?p=48859&a=1122503&g=16352388"">http://clk.tradedoubler.com/click?p=48859&a=1122503&g=16352388"</a>; 
</tt><tt>target="_blank"><img src="'+uri+'" border=0></a>');
</tt><pre style="margin: 0em;">



How could i type?

I've tried with ' and ".. but can't get it to work.

tested diffrent types..
$str = '';
</pre><tt>$str = 'var uri = '<a  rel="nofollow" href="http://impse.tradedoubler.com/imp/js/16350344/1122503">http://impse.tradedoubler.com/imp/js/16350344/1122503</a>?' + 
</tt><tt>new String (Math.random()).substring (2, 11);';
</tt><tt>$str = ""document.write('<sc'+'ript language="JavaScript" src="'+uri+'" 
</tt><tt>charset="ISO-8859-1"></sc'+'ript>');"";
</tt><pre style="margin: 0em;">
$str = """";

Best regards
/Gustav Wiberg
Stammis Internet

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



[PHP] Random pictures - not twice

2006-12-03 Thread Gustav Wiberg

Hi there!

I have created a script the generates random pictures...


  



With this above script the same picture can be shown twice. Is there any 
smart way of avoiding this without having to rely on cookies/sessionids?


Best regards
/Gustav Wiberg
Stammis Internet - http://www.stammis.com/ - pedigrees on the net

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



Re: [PHP] Random pictures - not twice

2006-12-03 Thread Gustav Wiberg
- Original Message - 
From: <[EMAIL PROTECTED]>

To: 
Cc: <[EMAIL PROTECTED]>
Sent: Sunday, December 03, 2006 11:52 PM
Subject: Re: [PHP] Random pictures - not twice


Without using cookies or session information, you're going to go through 
your picture list faster depending on how many users are accessing the 
random pic page.  If you don't make it user-specific, then it doesn't 
really matter if you go through the images sequentially.. it may appear 
random on the user end because other users are going to be grabbing 
sequential pics as well.


If you want to stir the waters a bit, you could run them sequentially but 
randomize the sequence.  This is what some music playlist programs do when 
you randomize a playlist.  Instead of pulling a random song from the list 
and risking playing the same song back to back, it just shuffles the 
playlist and plays it sequentially.  When you get to the end of your 
randomized list, you can re-shuffle it and start over.  This gives some 
semblance of randomness.


If you want to make sure each image gets its fair amount of time in the 
spotlight,  you could keep track of how many times each image has been 
displayed.  Having a database table with a list of all the image names and 
their 'served' count would let you weight your list a bit to give 
preference to the images that havn't been displayed that often.



And if you want to give each user the total package, you can keep track of 
how many times each image was served to a specific user and weight your 
shuffling that way.



I'm sure there are other ways, but there are just a few that may be viable 
for you, depending on the level of randomness per user you need.


Let us know what solution you come up with.  I'm sure others have had 
similar questions and just havn't asked.


-TG

= = = Original message = = =

Hi there!

I have created a script the generates random pictures...


  



With this above script the same picture can be shown twice. Is there any
smart way of avoiding this without having to rely on cookies/sessionids?

Best regards
/Gustav Wiberg
Stammis Internet - http://www.stammis.com/ - pedigrees on the net



___
Sent by ePrompter, the premier email notification software.
Free download at http://www.ePrompter.com.

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



Hi again!

I've solved it with array_rand. It wasn't that hard at all, just had to know 
which function to use! :-)


code:



Best regards
/Gustav Wiberg
Stammis Internet - http://www.stammis.com/ - pedigrees on the net

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



Re: [PHP] Random pictures - not twice

2006-12-04 Thread Gustav Wiberg


- Original Message - 
From: "tedd" <[EMAIL PROTECTED]>
To: "Gustav Wiberg" <[EMAIL PROTECTED]>; "PHP General" 


Sent: Monday, December 04, 2006 4:15 PM
Subject: Re: [PHP] Random pictures - not twice



At 11:20 PM +0100 12/3/06, Gustav Wiberg wrote:

Hi there!

I have created a script the generates random pictures...


-snip-

With this above script the same picture can be shown twice. Is there any 
smart way of avoiding this without having to rely on cookies/sessionids?


Random does mean it can happen more than once. I think what you want is 
more along a shuffle. Look into the array function "shuffle".


Cheers,

tedd
--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

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


Hi there!

Ok, thanx! I will check the function out :-)

Best regards
Gsutav Wiberg
http://www.stammis.com/ - Stammis Internet - pedigrees on the net

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



[PHP] RSS / XML

2006-02-25 Thread Gustav Wiberg

Hi there guys!

Where is a good startpoint for learning XML Reader on a very, very basic 
level? (I appreciate links)

Is RSS a technique for retrieving XML? I can't clue the pieces together...

/G

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



Re: [PHP] RSS / XML

2006-02-25 Thread Gustav Wiberg
- Original Message - 
From: "Weber Sites LTD" <[EMAIL PROTECTED]>
To: "'Gustav Wiberg'" <[EMAIL PROTECTED]>; "'PHP General'" 


Sent: Saturday, February 25, 2006 7:37 PM
Subject: RE: [PHP] RSS / XML



Here are a few (from easy to hard)

Parsing XML With DOMXML And PHP
http://www.weberdev.com/ViewArticle-158.html

Converting XML Into a PHP Data Structure
http://www.weberdev.com/ViewArticle-389.html

Building XML Trees with PEAR's XML_Tree Class
http://www.weberdev.com/ViewArticle-345.html

Building XML Web Services with PHP NuSOAP
http://www.weberdev.com/ViewArticle-336.html

Serializing XML With PHP
http://www.weberdev.com/ViewArticle/450

Injecting XML Content Into Page Templates With patXMLRenderer
http://www.weberdev.com/ViewArticle/441

berber
-Original Message-
From: Gustav Wiberg [mailto:[EMAIL PROTECTED]
Sent: Saturday, February 25, 2006 2:55 PM
To: PHP General
Subject: [PHP] RSS / XML

Hi there guys!

Where is a good startpoint for learning XML Reader on a very, very basic
level? (I appreciate links) Is RSS a technique for retrieving XML? I can't
clue the pieces together...

/G

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

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


Thanx!

/G 


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



[PHP] Expat + PHP Examples...

2006-02-25 Thread Gustav Wiberg

Hi there!

I've found out that I can use expat XML, but I can't figure out HOW to 
use... it seems simple, but I tried and can't figure it out...


I'd like to get retrieve info from
http://www.frisim.com/frisim/servlet/rss?searchString=google

and convert it to html...

I've read a lot a of text for Expat, but found no really good example (I 
found one at phpbuilder.com but with links that went to xml-files that 
didn't exists ):


Someone who have used expat.. ..and can give me a hint...

/G 


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



[PHP] HOW update time and date-fields to mysql....

2006-02-28 Thread Gustav Wiberg

Hi there guys!

I have used a date-field and a time-field in a mysql-database.

How should I update these fields through php?
This is my code now (it works fine locally with data on a win-machine, but 
not on Linux at my webhotel - Time doesn't work at all)



function safeQuote($value)
{
  // Stripslashes
  if (get_magic_quotes_gpc()) {
  $value = stripslashes($value);
  }
  // Quote if not integer
  if (!is_numeric($value)) {
  $value = "'" . mysql_real_escape_string($value) . "'";
  }

  return $value;
}


$sql = "UPDATE tbforum SET";
$sql .= " question=" . safeQuote($frmQuestion);
$sql .= ", insertDate='" . $dat . "'";
$sql .= ", insertTime='" . time() . "'";
$sql .= " WHERE IDForum=" . safeQuote($idForum);
$querys = mysql_query($sql);

/G 


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



[PHP] About date & time...

2006-02-28 Thread Gustav Wiberg

Hi

Thanx for your input about date & time...

Here's some functions that worked for me after some searching...


function currenttime() {

$today = getdate();

$ithours = $today["hours"];
if (intval($ithours)<10) {
 $ithours = "0" . $ithours;
}

$itminutes = $today["minutes"];
if (intval($ithours)<10) {
 $ithours = "0" . $ithours;
}

$itseconds = $today["seconds"];
if (intval($itseconds)<10) {
 $itseconds = "0" . $itseconds;
}


$it = $ithours . ":" . $itminutes . ":" . $itseconds;
return $it;
}

function currentdate() {

$today = getdate();

$idyear = $today["year"];
if (intval($idyear)<10) {
 $idyear = "0" . $idyear;
}

$idmonthnr = $today["mon"];
if (intval($idmonthnr )<10) {
 $idmonthnr  = "0" . $idmonthnr ;
}

$idmonthday = $today["mday"];
if (intval($idmonthday)<10) {
 $idmonthday = "0" . $idmonthday;
}


$id = $idyear . "-" . $idmonthnr . "-" . $idmonthday;
return $id;

}

$insertTime = currenttime();
$insertDate = currentdate();



/G

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



Re: [PHP] About date & time...

2006-02-28 Thread Gustav Wiberg


- Original Message - 
From: "tedd" <[EMAIL PROTECTED]>

To: ; "Gustav Wiberg" <[EMAIL PROTECTED]>
Sent: Tuesday, February 28, 2006 4:17 PM
Subject: Re: [PHP] About date & time...



>Thanx for your input about date & time...


Here's some functions that worked for me after some searching...

function currenttime() {

-snip- lot's of code.


Hi Gustav:

Not meaning to embarrass, but your code could be shortened considerably by 
using date(), like so:


Your lengthy  -- function currenttime()

can be replaced simply with:

   echo("Date: " . date('Y\-\ m\-\ d') . "" );

and your -- function currentdate()

can be replaced with:

echo("Time: " . date('h\:\ i\:\ s') . "" );

If you don't like the spaces in the output, then strip them out, like so:

$date = date('Y\-\ m\-\ d');
$date = str_replace(" ", "", $date);
echo("Date: " . $date. "" );

and

$date = date('h\:\ i\:\ s') ;
$date = str_replace(" ", "", $date);
echo("Time: " . $date. "" );

You can find more code examples at:

http://www.weberdev.com/AdvancedSearch.php?searchtype=title&search=date&Submit1.x=0&Submit1.y=0


tedd

--

http://sperling.com


Hi there!

Not meaning to embarrass, but your code could be shortened considerably by 
using date(), like so:
*hehe* It's all okey, it was something like this you're typing that I was 
searching for, but couldn't find it exactly as I wanted. Thanx a lot!!! :-) 
I really appreciate it!


/G 


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



Re: [PHP] About date & time...

2006-02-28 Thread Gustav Wiberg


- Original Message - 
From: "tedd" <[EMAIL PROTECTED]>

To: ; "Gustav Wiberg" <[EMAIL PROTECTED]>
Sent: Tuesday, February 28, 2006 4:17 PM
Subject: Re: [PHP] About date & time...



>Thanx for your input about date & time...


Here's some functions that worked for me after some searching...

function currenttime() {

-snip- lot's of code.


Hi Gustav:

Not meaning to embarrass, but your code could be shortened considerably by 
using date(), like so:


Your lengthy  -- function currenttime()

can be replaced simply with:

   echo("Date: " . date('Y\-\ m\-\ d') . "" );

and your -- function currentdate()

can be replaced with:

echo("Time: " . date('h\:\ i\:\ s') . "" );

If you don't like the spaces in the output, then strip them out, like so:

$date = date('Y\-\ m\-\ d');
$date = str_replace(" ", "", $date);
echo("Date: " . $date. "" );

and

$date = date('h\:\ i\:\ s') ;
$date = str_replace(" ", "", $date);
echo("Time: " . $date. "" );

You can find more code examples at:

http://www.weberdev.com/AdvancedSearch.php?searchtype=title&search=date&Submit1.x=0&Submit1.y=0


tedd

--

http://sperling.com


Hi there!

I've now done coding like this...


function currenttime() {

 $t = date('h\:\ i\:\ s');
 $returnTime = str_replace(" ", "", $t);
 return $returnTime;

}

function currentdate() {

 $d = date('Y\-\ m\-\ d');
 $returnDate = str_replace(" ", "", $d);
 return $returnDate;

}

$insertTime = currenttime();
$insertDate = currentdate();

I'm a swede, and I we use hours 0 - 24.

8 pm = 20 for us.
9 pm = 21 for us
10 pm = 22...

and so on...

But with date()-function there is 10 pm that shows (and I want 22 to show 
instead)


I'm using PHP 4.0.3...

Do I have to use getdate() then? (getdate()-function showed 22...)

/G

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



Re: [PHP] About date & time...

2006-02-28 Thread Gustav Wiberg


- Original Message - 
From: "Grant Young" <[EMAIL PROTECTED]>

To: 
Cc: <[EMAIL PROTECTED]>
Sent: Tuesday, February 28, 2006 11:25 PM
Subject: Re: [PHP] About date & time...



Hi Gustav.



I'm a swede, and I we use hours 0 - 24.

8 pm = 20 for us.
9 pm = 21 for us
10 pm = 22...

and so on...

But with date()-function there is 10 pm that shows (and I want 22 to 
show instead)


I'm using PHP 4.0.3...

Do I have to use getdate() then? (getdate()-function showed 22...)


The docs for date() (http://www.php.net/date) show that there are a 
number of different options for the first parameter.  If you check out 
the table on that page, you'll find:


>> H | 24-hour format of an hour with leading zeros | 00 through 23

With this in mind, the following will work (if I understand your 
question correctly):


$t = date('H\:\ i\:\ s');

HTH, Grant


AHA!!!

Sometimes I'm so stupid... hm...

Thanx! :-)

/G

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



Re: [PHP] About date & time...

2006-02-28 Thread Gustav Wiberg


- Original Message - 
From: "tedd" <[EMAIL PROTECTED]>

To: ; "Gustav Wiberg" <[EMAIL PROTECTED]>
Sent: Tuesday, February 28, 2006 11:34 PM
Subject: Re: [PHP] About date & time...



Gustav:


I'm a swede, and I we use hours 0 - 24.


Well... I don't know what I am, but non sum qualis eram.

In any event, you want military time -- simple enough -- just change the h 
to H, like so:


  echo("Time: " . date('H\:\ i\:\ s') . "" );

You can find more code examples at:

http://www.weberdev.com/AdvancedSearch.php?searchtype=title&search=date&Submit1.x=0&Submit1.y=0

Also, you need to review the php manual regarding date() -- it's a super 
function that has lot's of formatting symbols.


tedd

--

http://sperling.com

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


Yes, thanx! I've totally missed the part about 12/24-h setting... :-)

/G

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



[PHP] Mailto members..?

2006-03-01 Thread Gustav Wiberg

Hi guys!

Anyone knows of something like this, but for free?
http://www.webscriptsdirectory.com/PHP/E-Mail-Systems/Php-Newsletter-Script-L1237/

All I want to do is to send "a html mail" to all my members at 
http://www.stammis.com/ (swedish site for pedigrees). It would be a 
informative letter that tells them about latest news at Stammis Internet.


I could something like this...

while ($dbArray = mysql_fetch_array($querys)) {
...sendmail (from, to, htmltext...)...
}

but this will bring a timeout. Any suggestions? (I don't want to change the 
timeout - value, it doesn't seem correct)



/G
ps. OT: Planning of making this site Open Source, do you think it matters if 
the site is in swedish for the sake of Open Source? (the code is in 
english). 


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



Re: [PHP] Mailto members..?

2006-03-01 Thread Gustav Wiberg


- Original Message - 
From: "Kevin Davies - Bonhurst Consulting" <[EMAIL PROTECTED]>
To: "'Jim Moseby'" <[EMAIL PROTECTED]>; "'Gustav Wiberg'" 
<[EMAIL PROTECTED]>; "'PHP General'" 

Sent: Wednesday, March 01, 2006 4:32 PM
Subject: RE: [PHP] Mailto members..?




Others here have mentioned the use
of a mailer class I can't remember the name of (phpmailer maybe?).



PHPMailer is really good for sending HTML/Text/Both emails - I'm using it 
on

a few different sites.

Link: http://phpmailer.sourceforge.net/

Also, if you're going to use PHPMailer an excellent tutorial can be found
here: http://www.phpfreaks.com/tutorials/130/0.php

HTH

Cheers,

Kev

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


Hi there!

THANX! This was really what I was looking for! :-)

/G

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



Re: [PHP] About date & time...

2006-03-01 Thread Gustav Wiberg


- Original Message - 
From: "Marcus Gnaß" <[EMAIL PROTECTED]>

To: "Gustav Wiberg" <[EMAIL PROTECTED]>
Sent: Wednesday, March 01, 2006 5:24 PM
Subject: Re: [PHP] About date & time...



Gustav Wiberg schrieb:

function currenttime() {

 $t = date('h\:\ i\:\ s');
 $returnTime = str_replace(" ", "", $t);
 return $returnTime;

}

function currentdate() {

 $d = date('Y\-\ m\-\ d');
 $returnDate = str_replace(" ", "", $d);
 return $returnDate;

}

Although beeing a totally noob to PHP I suggest this instead:
function currenttime() {return date('H\:i\:s');}
function currentdate() {return date('Y\-m\-d');}

Marcus


Why?

return date('H\:i\:s') doesn't work as expected... :-)

/G

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



Re: [PHP] Mailto members..?

2006-03-01 Thread Gustav Wiberg
- Original Message - 
From: "Marcus Gnaß" <[EMAIL PROTECTED]>

To: "Gustav Wiberg" <[EMAIL PROTECTED]>
Sent: Wednesday, March 01, 2006 5:29 PM
Subject: Re: [PHP] Mailto members..?



Gustav Wiberg schrieb:

while ($dbArray = mysql_fetch_array($querys)) {
...sendmail (from, to, htmltext...)...
}
Why let PHP do all the work? If the body is all the same for all 
recipients you could send only one mail with all recipients in the 
BCC-field and only one dummy-adress in the To-field. This would lead to a 
very short execution-time.


Marcus


Yes, that's true! Is there any sideffects maybe...?

/G

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



Re: [PHP] Mailto members..?

2006-03-01 Thread Gustav Wiberg


- Original Message - 
From: "Jim Moseby" <[EMAIL PROTECTED]>
To: "'Gustav Wiberg'" <[EMAIL PROTECTED]>; "Marcus Gnaß" 
<[EMAIL PROTECTED]>

Cc: "PHP General" 
Sent: Wednesday, March 01, 2006 7:29 PM
Subject: RE: [PHP] Mailto members..?





> Gustav Wiberg schrieb:
>> while ($dbArray = mysql_fetch_array($querys)) {
>> ...sendmail (from, to, htmltext...)...
>> }
> Why let PHP do all the work? If the body is all the same for all
> recipients you could send only one mail with all recipients in the
> BCC-field and only one dummy-adress in the To-field. This
would lead to a
> very short execution-time.
>
> Marcus

Yes, that's true! Is there any sideffects maybe...?


This type of email may be more susceptible to being caught in spam traps.
Check with your webhost to learn of any limits to the number of recipients
per message, and number of messages per day/hour/etc.

JM


Aha.. that's a reason good enough for me for not using this method.

Thanx.

/G

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



[PHP] internal error when mailing...

2006-03-01 Thread Gustav Wiberg

Here's my code


if (strtoupper(substr(PHP_OS,0,3)=='WIN')): $eol="\r\n"; elseif 
(strtoupper(substr(PHP_OS,0,3)=='MAC')): $eol="\r"; else: $eol="\n"; endif;


//Message Subject
$emailsubject="Stammis Internet nyhetsbrev " . date("Y/m/d H:i:s");

//Message Body
ob_start();
 require("emailbody.php");// page for showing in the email (no html and 
body-tags here)

$body=ob_get_contents(); ob_end_clean();

// Common Headers
//

$headers .= 'From: Stammis Internet <[EMAIL PROTECTED]>'.$eol;
$headers .= 'Reply-To: Stammis Internet <[EMAIL PROTECTED]>'.$eol;
$headers .= 'Return-Path: Stammis Internet <[EMAIL PROTECTED]>'.$eol;// 
these two to set reply address
$headers .= "Message-ID: <".$now." 
TheSystem@".$_SERVER['SERVER_NAME'].">".$eol;
$headers .= "X-Mailer: PHP v".phpversion().$eol;  // These two to 
help avoid spam-filters

$headers .= 'MIME-Version: 1.0'.$eol;
$headers .= "Content-type: text/html; charset=iso-8859-1\n";

// HTML Version
//
$msg = $body.$eol.$eol;

// SEND THE EMAIL(s)
// FROM MYSQL-db
//

require("../phpfunctions/opendb.php");

$sql = "SELECT mail FROM tbusers ORDER BY mail";
$querys = mysql_query($sql);

while ($dbArray = mysql_fetch_array($querys)) {
$dbMail = $dbArray["mail"];

$emailaddress=$dbMail;

ini_set(sendmail_from,'[EMAIL PROTECTED]');  // the INI lines are to force 
the From Address to be used !

 mail($emailaddress, $emailsubject, $msg, $headers);
ini_restore(sendmail_from);

echo "SENT EMAIL TO $dbMail right now";
}

mysql_close();
?>

When I tested this script all mails I think was sent, BUT this error showed 
when the loop hade gone through all posts...



HTTP/1.1 200 OK Date: Wed, 01 Mar 2006 20:41:15 GMT Server: Apache 
X-Powered-By: PHP/4.4.1 Connection: close Transfer-Encoding: chunked 
Content-Type: text/html; charset=iso-8859-1

OK
The server encountered an internal error or misconfiguration and was unable 
to complete your request.
Please contact the server administrator, [EMAIL PROTECTED] and inform them 
of the time the error occurred, and anything you might have done that may 
have caused the error.


More information about this error may be available in the server error log.



What could have caused this?



/G

ps. YES http://phpmailer.sourceforge.net/ seems very great, but this code 
above is mostly for testing and experimenting...


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



Re: [PHP] Mailto members..?

2006-03-01 Thread Gustav Wiberg


- Original Message - 
From: "Jim Moseby" <[EMAIL PROTECTED]>
To: "'Gustav Wiberg'" <[EMAIL PROTECTED]>; "Jim Moseby" 
<[EMAIL PROTECTED]>

Cc: "PHP General" 
Sent: Wednesday, March 01, 2006 9:17 PM
Subject: RE: [PHP] Mailto members..?



> This type of email may be more susceptible to being caught
in spam traps.
> Check with your webhost to learn of any limits to the
number of recipients
> per message, and number of messages per day/hour/etc.
>
> JM

Aha.. that's a reason good enough for me for not using this method.


It would still be to your advantage to check with your hosting about 
limits.
I ran up against that on the last newsletter I coded where I could have 
only

25 recipients per message and 99 total messages per day.

JM


That's true!

Thanx again!

/G

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



Re: [PHP] internal error when mailing...

2006-03-01 Thread Gustav Wiberg
- Original Message - 
From: "John Nichel" <[EMAIL PROTECTED]>

To: "Gustav Wiberg" <[EMAIL PROTECTED]>
Sent: Wednesday, March 01, 2006 9:57 PM
Subject: Re: [PHP] internal error when mailing...



Gustav Wiberg wrote:

Here's my code


if (strtoupper(substr(PHP_OS,0,3)=='WIN')): $eol="\r\n"; elseif 
(strtoupper(substr(PHP_OS,0,3)=='MAC')): $eol="\r"; else: $eol="\n"; 
endif;


//Message Subject
$emailsubject="Stammis Internet nyhetsbrev " . date("Y/m/d H:i:s");

//Message Body
ob_start();
 require("emailbody.php");// page for showing in the email (no html 
and body-tags here)

$body=ob_get_contents(); ob_end_clean();

// Common Headers
//

$headers .= 'From: Stammis Internet <[EMAIL PROTECTED]>'.$eol;
$headers .= 'Reply-To: Stammis Internet <[EMAIL PROTECTED]>'.$eol;
$headers .= 'Return-Path: Stammis Internet <[EMAIL PROTECTED]>'.$eol; 
// these two to set reply address
$headers .= "Message-ID: <".$now." 
TheSystem@".$_SERVER['SERVER_NAME'].">".$eol;
$headers .= "X-Mailer: PHP v".phpversion().$eol;  // These two to 
help avoid spam-filters

$headers .= 'MIME-Version: 1.0'.$eol;
$headers .= "Content-type: text/html; charset=iso-8859-1\n";

// HTML Version
//
$msg = $body.$eol.$eol;

// SEND THE EMAIL(s)
// FROM MYSQL-db
//

require("../phpfunctions/opendb.php");

$sql = "SELECT mail FROM tbusers ORDER BY mail";
$querys = mysql_query($sql);

while ($dbArray = mysql_fetch_array($querys)) {
$dbMail = $dbArray["mail"];

$emailaddress=$dbMail;

ini_set(sendmail_from,'[EMAIL PROTECTED]');  // the INI lines are to force 
the From Address to be used !

 mail($emailaddress, $emailsubject, $msg, $headers);
ini_restore(sendmail_from);

echo "SENT EMAIL TO $dbMail right now";
}

mysql_close();
?>

When I tested this script all mails I think was sent, BUT this error 
showed when the loop hade gone through all posts...



HTTP/1.1 200 OK Date: Wed, 01 Mar 2006 20:41:15 GMT Server: Apache 
X-Powered-By: PHP/4.4.1 Connection: close Transfer-Encoding: chunked 
Content-Type: text/html; charset=iso-8859-1

OK
The server encountered an internal error or misconfiguration and was 
unable to complete your request.
Please contact the server administrator, [EMAIL PROTECTED] and inform 
them of the time the error occurred, and anything you might have done 
that may have caused the error.


More information about this error may be available in the server error 
log.




What could have caused this?


Gremlins?  ;)

Misconfigured mail server.

--
John C. Nichel IV
Programmer/System Admin (ÜberGeek)
Dot Com Holdings of Buffalo
716.856.9675
[EMAIL PROTECTED]


Ok, but the code is okay right?

/G

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



[PHP] Only 4 of 5...

2006-03-02 Thread Gustav Wiberg

Hi there!

What's wrong here??

0) {

?>
Visa telefonbilder för :
0) {

   $dbNameManufacturer = $dbArray["nameManufacturer"];

 ?>
 Visa telefonbilder för :
 
Alla telefonbilder i arkivet:

 height="130">

 

I have 5 posts in the table, but the images shown are only four! Why?

/G

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



Re: [PHP] Only 4 of 5...

2006-03-02 Thread Gustav Wiberg


- Original Message - 
From: <[EMAIL PROTECTED]>

To: <[EMAIL PROTECTED]>; 
Sent: Thursday, March 02, 2006 11:05 PM
Subject: RE: [PHP] Only 4 of 5...


[snip]
I have 5 posts in the table, but the images shown are only four! Why?
[/snip]

Are you counting starting with 1 or 0?

Don't understand your question... I have 5 posts in the table, but I'll only 
retrieve 4 posts when going through the array... like this...


while ($dbArray = mysql_fetch_array($querys)) {
 $dbIDPic = $dbArray["IDPic"];
 $dbPicNameSmall = $dbArray["picNameSmall"];
 ?>
 
 . 


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



Re: [PHP] Only 4 of 5...

2006-03-02 Thread Gustav Wiberg


- Original Message - 
From: <[EMAIL PROTECTED]>

To: <[EMAIL PROTECTED]>; 
Sent: Thursday, March 02, 2006 11:15 PM
Subject: RE: [PHP] Only 4 of 5...


[snip]
while ($dbArray = mysql_fetch_array($querys)) {
 $dbIDPic = $dbArray["IDPic"];
 $dbPicNameSmall = $dbArray["picNameSmall"];
 ?>
 
 http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

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



Re: [PHP] Only 4 of 5...

2006-03-02 Thread Gustav Wiberg


- Original Message - 
From: "Thorsten Suckow-Homberg" <[EMAIL PROTECTED]>
To: "Gustav Wiberg" <[EMAIL PROTECTED]>; "PHP General" 


Sent: Thursday, March 02, 2006 11:13 PM
Subject: Re: [PHP] Only 4 of 5...



Because of this:


$dbArray = mysql_fetch_array($querys);


This will fill $dbArray with the first row fetched from the table. 4 are 
left which you are calling in your loop at the end of your code example. 
What's your reason anyway to call mysql_fetch_array() here?

Delete this line and I'd bet you're getting your 5 results ;)

HTH

Thorsten


Aha, this seems reasonable! Thanx, this solved it!

/G

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



Re: [PHP] Only 4 of 5...

2006-03-03 Thread Gustav Wiberg
- Original Message - 
From: "John Nichel" <[EMAIL PROTECTED]>

To: "PHP General" 
Sent: Friday, March 03, 2006 2:30 AM
Subject: Re: [PHP] Only 4 of 5...



Gustav Wiberg wrote:

Hi there!

What's wrong here??



You're pulling the first row here


if (intval($frmIDModel)>0) {

?>
Visa telefonbilder för :
0) {

   $dbNameManufacturer = $dbArray["nameManufacturer"];

 ?>
 Visa telefonbilder för :
 
Alla telefonbilder i arkivet:


So now there are only 4 rows left when you loop thru them here.


   while ($dbArray = mysql_fetch_array($querys)) {
 $dbIDPic = $dbArray["IDPic"];
 $dbPicNameSmall = $dbArray["picNameSmall"];
 ?>
 height="130">

 

I have 5 posts in the table, but the images shown are only four! Why?

/G




--
By-Tor.com
...it's all about the Rush
http://www.by-tor.com

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


Thanx, I got feedback on this one yesterday! :) Thanx anyway!

/G

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



Re: [PHP] Re: DOMElement::setAttribute() manual example question

2006-03-03 Thread Gustav Wiberg
- Original Message - 
From: "Rob" <[EMAIL PROTECTED]>

To: "Andreas Korthaus" <[EMAIL PROTECTED]>
Cc: 
Sent: Friday, March 03, 2006 4:43 PM
Subject: [PHP] Re: DOMElement::setAttribute() manual example question



Andreas Korthaus wrote:

Hi!

I've a question regarding the example in DOMElement::setAttribute() 
chapter of the PHP manual: http://de3.php.net/dom-domelement-setattribute


There, an attribute is added to an element this way:

createElement("root");
$newnode = $doc->appendChild($node);
$newnode->setAttribute("align", "left");
echo $doc->saveXML();
?>

$doc->createElement() returns the created DOMElement, $doc->appendChild() 
returns the appended DOMNode. Isn't this the same object? Is it a 
reference?


Check out:
http://de3.php.net/manual/en/function.dom-domdocument-createelement.php
( This function creates a new instance of class DOMElement. This node will 
not show up in the document unless it is inserted with e.g. 
DOMNode->appendChild().)


I really don't understand WHY your next example is working...

/G








I'm asking, because the following works too:

createElement("root");
$node->setAttribute("align", "left");
$doc->appendChild($node);
echo $doc->saveXML();
?>


I like the 2nd example more, because first you create an object 
(DOMElement), add some attributes to the object and after that append it 
somewhere to the DOM tree. The 1st example creates a new DOMElement 
object, appends it to the DOM tree, and adds the attributes not to the 
created object, but to another object (the DOMNode appended to the tree), 
which seems to be a reference to the original object.


Why does the manual prefer the (IMO less intuitive) 1st way? Is there a 
problem with the 2nd way?


Both ways are perfectly valid. $node and $newnode refer to the same 
object. It was written the 1st way to demonstrate the return value of 
appendChild(), because in many cases people create the element 
differently.


i.e.

$newnode = $doc->appendChild($doc->createElement("root"));
or
$newnode = $doc->appendChild(new DOMElement("root"));

Also, in the event $node is created using the new DOMElement syntax:

$node = new DOMElement("root");

the node is read only and must be appended into the tree before it can be 
modified, so the example just tries to be neutral here regarding the 
syntax used.


Rob

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



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



Re: [PHP] Coding Practice: Use global $var or pass in by refernce

2006-03-03 Thread Gustav Wiberg
- Original Message - 
From: "Mark Steudel" <[EMAIL PROTECTED]>

To: 
Sent: Friday, March 03, 2006 7:46 PM
Subject: [PHP] Coding Practice: Use global $var or pass in by refernce



I was wondering what the general rule on using the global driective versus
passing in a variable by reference, why you should or shouldn't, etc.

e.g.

function ()
{
   global $db;

   $res =& $db->query( "SQL");
}

or

function ( &$db )
{

   $res =& $db->query( "SQL");
}

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


Hi!

My oponion is that is insane to use global variables. The main drawback with 
global variables is that is very easy to mix up variables, and keep track of 
what variable belongs to what. So an advice: Don't use it!


/G

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



Re: [PHP] Re: DOMElement::setAttribute() manual example question

2006-03-03 Thread Gustav Wiberg


- Original Message - 
From: "Rob" <[EMAIL PROTECTED]>

To: "Gustav Wiberg" <[EMAIL PROTECTED]>
Cc: "Andreas Korthaus" <[EMAIL PROTECTED]>; 
Sent: Friday, March 03, 2006 8:04 PM
Subject: Re: [PHP] Re: DOMElement::setAttribute() manual example question



Gustav Wiberg wrote:


Check out:
http://de3.php.net/manual/en/function.dom-domdocument-createelement.php
( This function creates a new instance of class DOMElement. This node 
will not show up in the document unless it is inserted with e.g. 
DOMNode->appendChild().)


I really don't understand WHY your next example is working...


Every example so far has called appendChild(). The only difference has 
been when at which point it is called to append the element and how the 
element to append has been created.


Rob

Maybe it is so that the objects propertys is created in a certain order 
undependet of the script order?


/G

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



Re: [PHP] Coding Practice: Use global $var or pass in by refernce

2006-03-03 Thread Gustav Wiberg


- Original Message - 
From: "Andreas Korthaus" <[EMAIL PROTECTED]>

To: ; "Gustav Wiberg" <[EMAIL PROTECTED]>
Sent: Friday, March 03, 2006 8:53 PM
Subject: Re: [PHP] Coding Practice: Use global $var or pass in by refernce



Hi Gustav!

Gustav Wiberg wrote:

My oponion is that is insane to use global variables. The main drawback 
with global variables is that is very easy to mix up variables, and keep 
track of what variable belongs to what. So an advice: Don't use it!


Ok, so what's your recommendation to solve the problem with using a DB 
class in many other objects/methodes? Think of a DB class:


class DB {...}

And a lot of classes which want to use the DB class:

class Foo {
  function saveChangesInDb() {...}
}

class Bar {
  function saveChangesInDb() {...}
}

- You can use a global "$db = new DB..." and pass it to every 
class/methode,


- you can make $db "global" in each methode,

- you can create a new instance ("new DB") in every methode (but you 
usually only want a single DB-connection per script, and where do you pass 
config-data to access the DB?) or


- use a factory/singleton, which is not so much better than a global 
variable (and again, what about config-data?).



So what's the way you'd recommend and why?


best regards
Andreas

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


Hi Andreas!

I don't have that much experience with classes, but wouldn't it work to:

1. make a connection to the db like $db = , and then pass around 
this variable?


2. Extend the DB - class, so the saveChangesInDb()  - function in the 
Foo-class would be an extension from the DB-class

? (I think this works to extend a class in PHP right?)

3 . Use already existing classes for db...http://www.phpclasses.org/ PHP 
Scripts / Databases


I hope this'll help!

/G

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



[PHP] Swedish sourgeforge for php-prg

2006-03-03 Thread Gustav Wiberg

Hi there!

I wonder as a swedish PHP-programmer if there are any sites like 
sourgeforge.net but in swedish?


/G

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



Re: [PHP] Mysql Rows

2006-03-04 Thread Gustav Wiberg


- Original Message - 
From: "tedd" <[EMAIL PROTECTED]>

To: 
Cc: "benifactor" <[EMAIL PROTECTED]>; "Murray @ PlanetThoughtful" 
<[EMAIL PROTECTED]>; "Anthony Ettinger" <[EMAIL PROTECTED]>

Sent: Saturday, March 04, 2006 3:14 PM
Subject: Re: [PHP] Mysql Rows



planetthoughtful  wrote:

But, too often I've seen people new to database design not liking 'gaps' 
because 'user1' will have a unique id of '1', while 'user2' will have a 
unique id of '6' because the records associated with unique ids '2' 
through '5' were deleted during testing, and so on. So, they feel that 
'user2' should have a unique id of '2', ignoring the fact that that's not 
a unique id at all, if you had id '2' associated with another record at 
some point.


And, Anthony wrote:


I remember the days where i'd
clear a database after testing to keep the auto_increment inline, but
eventually, you will get out of sync on that, so it's not a reliable way 
of

keeping a numerical sequence.


Well... I'm one of those people who don't like gaps. I understand that if 
the dB is relational, then you shouldn't be concerned about gaps. Gaps are 
only perceived from a perspective of an artificial ordering system -- who 
knows where the data actually is in memory or on disk.


However, when I'm working with a flat dB and want to step through the 
records to do editing, I like the records to be in order based upon an 
"id" (i.e., Record 1, Record 2, Record 3, and so on). I use an 
auto_increment unique "id"  for this.


It's not a big problem for me to keep the records in order either. 
Whenever I delete a record, I simply follow with:


$dbQuery = "ALTER TABLE $dbtable ";
$dbQuery .= "DROP id, ";
$dbQuery .= "ADD id INT UNSIGNED NOT NULL AUTO_INCREMENT,";
$dbQuery .= "AUTO_INCREMENT = 1";
$result = mysql_query($dbQuery) or die("2. Could not renumber dB $dbQuery" 
. mysql_error());


and my dB is in order and all things are right with the world again. I'm 
simple-minded that way.


Now, I'm not allowing more one than one person (namely me) the ability to 
delete and reorder things, so I don't think there are any problems. Of 
course I could lock down the tables, delete, and then do the reorder if 
the dB is online -- but I haven't encountered any problems thus far.


I've read numerous dB books about why it isn't necessary to reorder and 
everyone deplores the action, which is only done by newbies. But I don't 
really understand, with a flat dB, as to why it's a bad idea to do this?


Now, is there a problem with the way I'm doing this? If so, *please* 
enlighten me. Please tell me why this isn't a reliable way of keeping a 
numerical sequence AND what technique would be?


Many thanks.

tedd
--

http://sperling.com

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



Hi Tedd!

Generally speaking about db's it's not a good pratice to do in that you 
describe, but as I understand you've already figured that out...


But one thing not doing "your" way is lack of performance:

I'll quote you:

"not a big problem for me to keep the records in order either.

Whenever I delete a record, I simply follow with:

$dbQuery = "ALTER TABLE $dbtable ";
$dbQuery .= "DROP id, ";
$dbQuery .= "ADD id INT UNSIGNED NOT NULL AUTO_INCREMENT,";
$dbQuery .= "AUTO_INCREMENT = 1";
$result = mysql_query($dbQuery) or die("2. Could not renumber dB $dbQuery" 
. mysql_error());"


No, maybe not when it's a small db, but when you try to delete 50.000 posts 
I have a strong feeling this would be very much slower then if you don't 
alter table after each deletion.


/G

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



Re: [PHP] Mysql Rows

2006-03-05 Thread Gustav Wiberg
- Original Message - 
From: "tedd" <[EMAIL PROTECTED]>

To: 
Cc: "Gustav Wiberg" <[EMAIL PROTECTED]>; "Robert Cummings" 
<[EMAIL PROTECTED]>

Sent: Sunday, March 05, 2006 12:58 AM
Subject: Re: [PHP] Mysql Rows



Hi:

Gustav said:

No, maybe not when it's a small db, but when you try to delete 50.000 
posts I have a strong feeling this would be very much slower then if you 
don't alter table after each deletion.


First, I'm not deleting 50,000 records -- I dropping a table and 
renumbering it.


In any event, I just tested your claim on my host and I was able to 
renumber 50,000 records in less than 1/2 second. Even though I tried it 
several times, the results were never above 0.47 seconds. If I was dealing 
with a database that was accessible to others, then I would either lock 
tables or use transaction and then renumber -- but in either case the 
difference in time is less than additional 1/10 of a second.
Ok, it wasn't really a claim, it was more a "feeling", but I couldn't say it 
for sure, so I applogize for misleading you there! :-)


Half a second or 0.47 seconds may not be a big issue, but as I see it this 
could be "unessescary time", if you could achieve the same
functionality (without doing some alter-statements) faster and without have 
to lock the db. Have you tested without the alter-table statement? *just 
curious*


Aha... I missed the part ...
"I was dealing with a database that was accessible to others"
Only YOU are using the db? Ok, then it would not be a problem.







I don't know if 1/2 second is a big deal in your world, or not, but it 
seems a bit slow to me. I wrote splay binary tree search routine that 
would perform 100,000 searches in a two million record dB in less than one 
second on my Mac. And if you know what a splay algorithm is, then you also 
know that it not only preforms a search but then reorders the tree each 
time a search is successful and thus is very laborious. Yet the time it 
took to preform 100,000 searches and reorders was still less than one 
second.


Perhaps my host is running something slower -- after all, I'm only paying 
$7.00 per year for the service. But with all things considered, a half 
second is not that significant with a small 50,000 record dB. That's 
probably less than the majority of web sites that use MySQL, don't you 
think?


Ok, I got your point! :-) But there is another side to it , and that is 
scalability. Ok, you don't have so many posts in your database.

Ok, it does take less then a second...

What if you had do make the db visible to other users? Then this link that 
might intrest you: (it's about pitfalls with transactions as may see in the 
link)

http://www.onlamp.com/pub/a/php/2003/12/18/transaction_pitfalls.htmlhttp://www.onlamp.com/pub/a/php/2003/12/18/transaction_pitfalls.html

But what If you suddenly hade to change host for some reason... The new host 
server maybe wouldn't be as fast as yours is today.
And as someone mentioned, what about if your db was growing to include a 
couple of million posts.


Of course, if you don't think your db will grow so much, and it works fine, 
then of course you could contiuning doing the ALTER-statement thing, but 
there's always two sides of the story... ;-)


"That's probably less than the majority of web sites that  use MySQL, don't 
you think?"

I really have no clue, I could only guess... :-)



Rod said:


*LOL* I knew those MySQL people shouldn't have made the ALTER TABLE
syntax available to just anyone. Gun --> foot --> *BLAM*. I hope to God
you never get your hands on a real database with millions of entries.


I'm glad that you were amused. Considering that I was talking about a flat 
dB, then you have already shot yourself in the foot if your "real 
database" is in the millions of entries and is flat. I hope to God that 
normalization may be something you consider in your next database design.


In any event, it's interesting that I posted a question here and I 
expected some ribbing, but I also expected something of value.


If the ALTER TABLE statement is prone to error, then I would like to know 
that and why. However, I suspect that claim isn't true, it's just that 
it's misuse has generated an urban myth of "Don't do that! That's 
dangerous!" without any real substance other than for programer error.
*LOL* I have to say, that I agree with you on this one. I've searched on 
issues/regarding ALTER TABLE, and could only find errors regarding this when

Microsoft was involved ;-)

Of course, I've run into windozes programmers who
accept the occasional crash and burn as "it comes with the territory", but 
that's unfortunate to apply this "apprehension" to MySQL.

:-)



In my previous post I plea

[PHP] What am I missing?

2006-03-07 Thread Gustav Wiberg

Hi there!

Why...

I have this code:

Add manufacturer:
action="admin/phpfunctions/addnewmanufacturer.php?frmManufacturer=$frmIDManufacturer;?>&frmModel=" method="post">





When i press the submit - button, I get this error:

Not Found
The requested URL 
/mobilkamera/admin/admin/phpfunctions/addnewmanufacturer.php was not found 
on this server.


Apache/2.0.53 (Win32) Server at 192.168.0.3 Port 80

Why is there TWO admins? Why isn't the path like this...?
The requested URL /mobilkamera/admin/phpfunctions/addnewmanufacturer.php was 
not found on this server.


???

If this is not a question that suits the list, please guide me tips where to 
look...


Best regards
/Gustav Wiberg

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



Re: [PHP] What am I missing?

2006-03-07 Thread Gustav Wiberg


- Original Message - 
From: "Shaunak Kashyap" <[EMAIL PROTECTED]>
To: "Gustav Wiberg" <[EMAIL PROTECTED]>; "PHP General" 


Sent: Tuesday, March 07, 2006 8:05 PM
Subject: RE: [PHP] What am I missing?


It is more of an HTML/HTTP question than PHP but here's my shot at a
possible explanation:

The file containing the form code seems to live in the
/mobilkamera/admin/ directory. Therefore action="admin/phpfunctions..."
implies that the form is to be submitted to that path starting from the
current directory (i.e. /mobilkamera/admin/), which resolves to
/mobilkamera/admin/admin/phpfunctions...

One solution would be remove the "admin/" from the action. Another (and
probably better solution) would be to use absolute paths, as Joe Henry
suggests.

Shaunak Kashyap

Senior Web Developer
WPT Enterprises, Inc.
5700 Wilshire Blvd., Suite 350
Los Angeles, CA 90036

Direct: 323.330.9870
Main: 323.330.9900

www.worldpokertour.com

Confidentiality Notice:  This e-mail transmission (and/or the
attachments accompanying) it may contain confidential information
belonging to the sender which is protected.  The information is intended
only for the use of the intended recipient.  If you are not the intended
recipient, you are hereby notified that any disclosure, copying,
distribution or taking of any action in reliance on the contents of this
information is prohibited. If you have received this transmission in
error, please notify the sender by reply e-mail and destroy all copies
of this transmission.



-Original Message-
From: Gustav Wiberg [mailto:[EMAIL PROTECTED]
Sent: Tuesday, March 07, 2006 10:45 AM
To: PHP General
Subject: [PHP] What am I missing?

Hi there!

Why...

I have this code:

Add manufacturer:

action="admin/phpfunctions/addnewmanufacturer.php?frmManufacturer=
echo
$frmIDManufacturer;?>&frmModel="

method="post">





When i press the submit - button, I get this error:

Not Found
The requested URL
/mobilkamera/admin/admin/phpfunctions/addnewmanufacturer.php was not

found

on this server.

Apache/2.0.53 (Win32) Server at 192.168.0.3 Port 80

Why is there TWO admins? Why isn't the path like this...?
The requested URL

/mobilkamera/admin/phpfunctions/addnewmanufacturer.php

was
not found on this server.

???

If this is not a question that suits the list, please guide me tips

where

to
look...

Best regards
/Gustav Wiberg

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


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

Thanx!!!

/Gustav Wiberg

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



Re: [PHP] making a tutorial

2006-03-16 Thread Gustav Wiberg


- Original Message - 
From: "John Taylor-Johnston" <[EMAIL PROTECTED]>

To: "PHP-General" 
Sent: Friday, March 17, 2006 7:51 AM
Subject: [PHP] making a tutorial



I'm making a tutorial and don't really understand how to do this myself :)

Which of the following pets do have at home:
dog
cat
snake
snake
none of these


How do I parse favourite[]? I might have 2 or 5, so I need to parse ^0]
- nMax. It is a checkbox.

I might use favourite[] with mail() or store it in a mysql field.

If mysql, would I store it in a varchar(20) or an enum() and how?

John



Hi there!

Do you have to name it as favourite[]? Can't you name it as "just" favourite 
(without brackets)
If you name it as just favourite, at least in Javascript you could loop 
through favourite as an array. I don't know if this works in PHP as well.


Best regards
/Gustav Wiberg

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



[PHP] Div-element at same vert. position?

2006-03-28 Thread Gustav Wiberg

Hi guys!

I have a code-snippet here:

while ($dbArray = mysql_fetch_array($querys)) {
$dbIDLevel1 = $dbArray["IDLevel1"];
$dbLevel1Name = $dbArray["level1Name"];
$dbFactsLevel1Name = $dbArray["factsLevel1Name"];
$dbFactsPictureLevel1Name = $dbArray["factsPictureLevel1Name"];
?>



align="top" width="200" height="150">







   $sql2 = "SELECT tblevel2catlevel1cat.ForIDLevel1Cat, 
tblevel2catlevel1cat.ForIDLevel2Cat, tblevel2cat.IDLevel2, 
tblevel2cat.level2Name FROM tblevel2catlevel1cat";
   $sql2 .= " LEFT JOIN tblevel2cat ON (tblevel2cat.IDLevel2 = 
tblevel2catlevel1cat.ForIDLevel2Cat)";
   $sql2 .= " WHERE tblevel2catlevel1cat.ForIDLevel1Cat = " . 
safeQuote($dbIDLevel1);

   $querys2 = mysql_query($sql2);

   $nrRows++;
   while ($dbArray2 = mysql_fetch_array($querys2)) {
   $dbIDLevel2 = $dbArray2["IDLevel2"];
   $dbLevel2Name = $dbArray2["level2Name"];
   ?>
   title="">$dbLevel2Name;?>

   
   
   
You'll see that two div-elements are created. I want "rightmenu_$dbIDLevel1;?>" to be at the same vertical level as div-element: 
"factsmenu_"


Any ideas? (I tried with $yMenu +=(8*intval($nrRows)) with the rule that any 
row is 8 pixels, but this doesn't seem to be true)


/G

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



Re: [PHP] Div-element at same vert. position?

2006-03-28 Thread Gustav Wiberg


- Original Message - 
From: "Jay Blanchard" <[EMAIL PROTECTED]>
To: "Gustav Wiberg" <[EMAIL PROTECTED]>; "PHP General" 


Sent: Tuesday, March 28, 2006 10:00 PM
Subject: RE: [PHP] Div-element at same vert. position?


[snip]
I have a code-snippet here:

while ($dbArray = mysql_fetch_array($querys)) {
$dbIDLevel1 = $dbArray["IDLevel1"];
$dbLevel1Name = $dbArray["level1Name"];
$dbFactsLevel1Name = $dbArray["factsLevel1Name"];
$dbFactsPictureLevel1Name = $dbArray["factsPictureLevel1Name"];
?>









   
   
   
   
" to be at the same vertical level as div-element:
"factsmenu_"

Any ideas? (I tried with $yMenu +=(8*intval($nrRows)) with the rule that
any
row is 8 pixels, but this doesn't seem to be true)
[/snip]

A. The is a CSS question
2. You didn't provide a way to see it.
III. Using absolute positioning is a bad thing and the left div should
be floated to the left.

Ok, I got your message you all! But I really wanted to do the postitioning 
in PHP with absolute positioning (just for the sakes cause ;-))


/G

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



Re: [PHP] Div-element at same vert. position?

2006-03-28 Thread Gustav Wiberg


- Original Message - 
From: "Jay Blanchard" <[EMAIL PROTECTED]>
To: "Gustav Wiberg" <[EMAIL PROTECTED]>; "PHP General" 


Sent: Tuesday, March 28, 2006 11:52 PM
Subject: RE: [PHP] Div-element at same vert. position?


[snip]
A. The is a CSS question
2. You didn't provide a way to see it.
III. Using absolute positioning is a bad thing and the left div should
be floated to the left.

Ok, I got your message you all! But I really wanted to do the
postitioning
in PHP with absolute positioning (just for the sakes cause ;-))
[/snip]

While you may be using PHP to output attributes for CSS you are not
doing positioning with CSS.

And your point is?

/Gustav Wiberg

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



[PHP] ID-tags from picture?

2006-04-03 Thread Gustav Wiberg

Hi guys!

If I've got this right, there will be some kind of tag that is saved in a 
picture (hidden). Is it possible to retrieve this information from PHP and 
what it is called? Any ideas / suggestions would be approciated!


/Gustav Wiberg 


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



Re: [PHP] ID-tags from picture?

2006-04-04 Thread Gustav Wiberg
- Original Message - 
From: "Chris" <[EMAIL PROTECTED]>

To: "Gustav Wiberg" <[EMAIL PROTECTED]>
Cc: "PHP General" 
Sent: Tuesday, April 04, 2006 4:14 AM
Subject: Re: [PHP] ID-tags from picture?



Gustav Wiberg wrote:

Hi guys!

If I've got this right, there will be some kind of tag that is saved in a 
picture (hidden). Is it possible to retrieve this information from PHP 
and what it is called? Any ideas / suggestions would be approciated!


Depends on what information you are after.

Some images may have exif info, but not all.

http://www.php.net/exif

Possibly IPTC information too (but only applies to jpegs apparently):

http://www.php.net/iptcparse

--
Postgresql & php tutorials
http://www.designmagick.com/


Hi!

And thanx a lot! Exactly what I was looking for!

Best regards
/Gustav Wiberg 


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



[PHP] Convert from jpg to gif ... change dpi...

2006-05-07 Thread Gustav Wiberg

Hi there!

Is there any way of converting a jpg to gif and change dpi on the fly?

Best regards
Gustav Wiberg

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



[PHP] Copy of image -> smaller

2006-05-15 Thread Gustav Wiberg

Hi there!

When I upload a picture from a form, then I want to create a copy with a 
smaller image.
For example: I upload a picture with dimensions 200x150 name 4.jpg. I also 
want a copy of this image but with the dimensions 100x75 pixels. I've tried 
this below, but I'm missing something I think... :-)


I'm using PHP 4.x  (don't know exactly the vers.nr, but I can search for it 
if it is of importance)


The code down below is a function for uploading a picture. The part I want 
help with is after the comment: //What should/could I do here?


Best regards
Gustav Wiberg



0)
  {
  //ECHO "yes! ID=$idUpload PIC=$picUpload ADD=$addUpload";
  $uploaddir = dirname($_FILES[$picUpload]['tmp_name']) . "/";

  //Replace .jpeg to .jpg
  //
  $_FILES[$picUpload]['name'] = 
str_replace(".jpeg",".jpg",$_FILES[$picUpload]['name']);


  //Get first 4 last characters of uploaded filename
  //
  $ble = strtolower(substr($_FILES[$picUpload]['name'], -4, 4));

  //Move to path $toPath (followed by what to add after file (that is sent 
to this function)) and ext.)

  //
  $mfileAdd = $idUpload . $addUpload . $ble;

  move_uploaded_file($_FILES[$picUpload]['tmp_name'], $toPath . $mfileAdd);


  //echo "mfileAdd=$mfileAdd";
  //Set appropiate rights for file
  //
  //echo "FILE TO TEST=$mfileAdd";
  chmod($toPath . $mfileAdd, intval('0755', 8));


  //Copy this file to another file?
  //
  if (strlen($copyFile)>0) {
  $mfile = $idUpload . $copyFile . $ble;
  //echo "MFILE=$mfile";
  copy($toPath . $mfileAdd, $toPath . $mfile);
  chmod($toPath . $mfile, intval('0755', 8));
  }


//What should/could I do here?
//

   //Set new width and height
   //
  $new_width = 100;
  $new_height = 200;
  $tmp_image=imagecreatefromjpeg($toPath . $mfileAdd);
  $width = imagesx($tmp_image);
  $height = imagesy($tmp_image);
  $new_image = imagecreatetruecolor($new_width,$new_height);
   ImageCopyResized($new_image, $tmp_image,0,0,0,0, $new_width, 
$new_height, $width, $height);


   //Grab new image
   ob_start();
   ImageJPEG($new_image);
   $image_buffer = ob_get_contents();
   ob_end_clean();
   ImageDestroy($new_image);

   //Create temporary file and write to it
   $fp = tmpfile();
   fwrite($fp, $image_buffer);
   rewind($fp);

   //Upload new image
   $copyTo = 'http://www.ledins.se/test.jpg';
   $conn_id = ftp_connect('');
   ftp_login($conn_id,'','');
   ftp_fput($conn_id, $copyTo, $fp, FTP_BINARY);
   fclose($fp);



  //Return the filename created based on productID
  //
  return $mfileAdd;
  }



}


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



Re: [PHP] Copy of image -> smaller

2006-05-15 Thread Gustav Wiberg

Hi there!

If I understand this right, I must have adminstration rights for installing 
Magic Wand...
The problem is that my host doesn't have any support for this application. 
(It's not MY server)


Is there any workaround?

Best regards
/Gustav Wiberg

- Original Message - 
From: "Sascha Braun" <[EMAIL PROTECTED]>

To: "Gustav Wiberg" <[EMAIL PROTECTED]>
Sent: Monday, May 15, 2006 9:18 AM
Subject: Re: [PHP] Copy of image -> smaller


I dont have the code you  need handy at the moment, but please take a look 
at

imagemagick.org and the

convert -size 120x80 in.jpg -resize 120x80 out.jpg

command.

First you have to use gd getimagesize command to find out
the width and height of the uploaded image, to find out if
the image has a higher width or height value.

The scale it down by the factor needed.

200 / 120 * factor i guess.

Don't forget the path in the convert command otherwise
you are going to delete the original image.

Normaly i do a copy(/tmp/file, /to/destination/path);

unlink(/tmp(file);

convert original source path to thumbnail destination path

and so forth.

When you get handy with ffmpeg you can do the same stuff
with movies. Lame helps you to do the same with audio files.

Have fun!

Sascha Braun
___
SMS schreiben mit WEB.DE FreeMail - einfach, schnell und
kostenguenstig. Jetzt gleich testen! http://f.web.de/?mc=021192



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



[PHP] Check before uploading

2006-05-15 Thread Gustav Wiberg

Hi there!

Just a thought. Someone posted a question if you could check filesize before 
uploading some days ago. Maybe this is possible with Javascript?
Javascript wouldn't be the best solution, cause of it's incompability 
between browsers, that users can inactivate it. But it's might be better 
than nothing.. The important thing is not to RELY on the Javascript-code.


Best regards
/Gustav Wiberg 


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



Re: [PHP] Copy of image -> smaller

2006-05-15 Thread Gustav Wiberg


- Original Message - 
From: "Chris" <[EMAIL PROTECTED]>

To: "Gustav Wiberg" <[EMAIL PROTECTED]>
Cc: "PHP General" 
Sent: Monday, May 15, 2006 9:42 AM
Subject: Re: [PHP] Copy of image -> smaller



Gustav Wiberg wrote:

Hi there!

When I upload a picture from a form, then I want to create a copy with a 
smaller image.
For example: I upload a picture with dimensions 200x150 name 4.jpg. I 
also want a copy of this image but with the dimensions 100x75 pixels. 
I've tried this below, but I'm missing something I think... :-)


I'm using PHP 4.x  (don't know exactly the vers.nr, but I can search for 
it if it is of importance)


First of all *run* to this thread and add some security checks to your 
image uploading:


http://marc.theaimsgroup.com/?l=php-general&m=114755779206436&w=2

Secondly, what does or doesn't happen with your code?

It looks fine at first glance but do you get an error? What do you expect 
it to do and what does it actually do?


--
Postgresql & php tutorials
http://www.designmagick.com/

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


Hi there!

Thanx for tip about security!

There is no errors displayed, but the file test.jpg isn't created. It isn't 
accessible when accessing http://www.ledins.se/test.jpg


Best regards
/Gustav Wiberg

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



Re: [PHP] Check before uploading

2006-05-15 Thread Gustav Wiberg


- Original Message - 
From: "Stut" <[EMAIL PROTECTED]>

To: "Gustav Wiberg" <[EMAIL PROTECTED]>
Cc: "PHP General" 
Sent: Monday, May 15, 2006 12:50 PM
Subject: Re: [PHP] Check before uploading



Gustav Wiberg wrote:

Just a thought. Someone posted a question if you could check filesize 
before uploading some days ago. Maybe this is possible with Javascript?
Javascript wouldn't be the best solution, cause of it's incompability 
between browsers, that users can inactivate it. But it's might be 
better than nothing.. The important thing is not to RELY on the 
Javascript-code.



This was suggested at the time, but for what should be obvious reasons 
it's not possible due to security restrictions.


-Stut


Hi there!

Ok, do you have a solution the problem now?

Best regards
/Gustav Wiberg

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



Re: [PHP] Copy of image -> smaller

2006-05-15 Thread Gustav Wiberg


- Original Message - 
From: "Rabin Vincent" <[EMAIL PROTECTED]>

To: "Gustav Wiberg" <[EMAIL PROTECTED]>
Cc: "PHP General" 
Sent: Monday, May 15, 2006 1:35 PM
Subject: Re: [PHP] Copy of image -> smaller


On 5/15/06, Gustav Wiberg <[EMAIL PROTECTED]> wrote:
[snip]

//What should/could I do here?
//

//Set new width and height
//
   $new_width = 100;
   $new_height = 200;
   $tmp_image=imagecreatefromjpeg($toPath . $mfileAdd);
   $width = imagesx($tmp_image);
   $height = imagesy($tmp_image);
   $new_image = imagecreatetruecolor($new_width,$new_height);
ImageCopyResized($new_image, $tmp_image,0,0,0,0, $new_width,
$new_height, $width, $height);


I can't see anything wrong with this resizing.


//Grab new image
ob_start();
ImageJPEG($new_image);
$image_buffer = ob_get_contents();
ob_end_clean();
ImageDestroy($new_image);
//Create temporary file and write to it
$fp = tmpfile();
fwrite($fp, $image_buffer);
rewind($fp);


Instead of doing this, you may want to use the filename
argument of ImageJPEG to save the image directly to a file.


//Upload new image
$copyTo = 'http://www.ledins.se/test.jpg';
$conn_id = ftp_connect('');
ftp_login($conn_id,'','');
ftp_fput($conn_id, $copyTo, $fp, FTP_BINARY);


Destination file ($copyTo) is supposed to be a path (eg.
public_html/test.jpg) and not a URL.

Ok! Thanx, that might be the problem! :-)

Best regards
/Gustav Wiberg

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



Re: [PHP] Check before uploading

2006-05-15 Thread Gustav Wiberg


- Original Message - 
From: "Stut" <[EMAIL PROTECTED]>

To: "Gustav Wiberg" <[EMAIL PROTECTED]>
Cc: "PHP General" 
Sent: Monday, May 15, 2006 10:32 PM
Subject: Re: [PHP] Check before uploading



Gustav Wiberg wrote:

From: "Stut" <[EMAIL PROTECTED]>

Gustav Wiberg wrote:

Just a thought. Someone posted a question if you could check filesize 
before uploading some days ago. Maybe this is possible with Javascript?
Javascript wouldn't be the best solution, cause of it's incompability 
between browsers, that users can inactivate it. But it's might be 
better than nothing.. The important thing is not to RELY on the 
Javascript-code.


This was suggested at the time, but for what should be obvious reasons 
it's not possible due to security restrictions.


Ok, do you have a solution the problem now?


It wasn't my problem, and not I don't really have the solution. There 
really isn't a solution short of using a Java applet. PHP doesn't get a 
look in until the file has been uploaded, and Javascript doesn't have the 
security scruples.


-Stut

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


Ok!

Best regards
/Gustav Wiberg 


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



[PHP] Pictures and caches

2006-05-18 Thread Gustav Wiberg

Hi!

The thing I want to do is to copy a picturefile to another picturefile.
The thing is that I want to copy this file, show it , and then delete it 
(when it has been shown) .Is this possible?


I want to do this, because of avoiding problems with cache when uploading 
file through an admin-online-system... (the customer uses IE)


When I delete the file in code down below, the picture is not shown (I guess 
because the browser hasn't rendered out all info?)


If you want more code, tell me :-)

Best regards
/Gustav Wiberg



$fileName = "pictures/products/$dbIDProduct1" . "_small";

$ran = strval(mktime()); //Current time

if (file_exists($fileName . ".gif")) {

   copy($fileName . ".gif", "pictures/products/1_$ran.gif");
   showpicture("pictures/products/1_$ran.gif", $dbProductName1, 300, 150, 
"top");

   //deletefile("pictures/products/1_$ran.gif");

}

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



[PHP] Range mktime?

2006-05-18 Thread Gustav Wiberg

Hi

I wondew which range the mktime has? (in digits)
In my case it always start with 1.
something like
1147951344

Is this ALWAYS TRUE (that it would start with 1)

Best regards
/Gustav Wiberg

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



Re: [PHP] Re: Range mktime?

2006-05-18 Thread Gustav Wiberg


- Original Message - 
From: "Barry" <[EMAIL PROTECTED]>

To: ; "Gustav Wiberg" <[EMAIL PROTECTED]>
Cc: "PHP General" 
Sent: Thursday, May 18, 2006 1:45 PM
Subject: [PHP] Re: Range mktime?



Gustav Wiberg schrieb:

Hi

I wondew which range the mktime has? (in digits)
In my case it always start with 1.
something like
1147951344

Is this ALWAYS TRUE (that it would start with 1)

Best regards
/Gustav Wiberg

mktime is giving you the time in seconds since 1st april 1970

So no. It's not true.

--
Smileys rule (cX.x)C --o(^_^o)
Dance for me! ^(^_^)o (o^_^)o o(^_^)^ o(^_^o)

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


Ok, thanx!

Best regards
/Gustav Wiberg

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



[PHP] Does anyone have a valid magic.mime file?

2004-11-10 Thread Björn Wiberg
Hi everyone!
I've been trying to get mime_magic to work with PHP 5.0.2, but it seems to 
complain about the magic file being valid. I've tried both with the Apache 
2.0.52 version of "magic" and with the PHP5 Win32 version of "magic.mime", 
but it still says that they're invalid.

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

Many thanks in advance!
Best regards,
Björn
-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

[PHP] Freing memory resources?

2005-06-16 Thread Gustav Wiberg

Hi there!

I have a script that runs about 10 minutes... Localy on my computer (Windows 
XP 2.6Ghz, Apache) the computer hangs a little now and then when the script 
is running. Is there any good way of releasing more memory while the script 
is running? The script could take 20 minutes, it's not a big matter how long 
the script takes. (As long as the server can do other things at the same 
time)


(In production environment, the php-script is on Apache and Linux (if it 
matters))


Best regards
Gustav Wiberg
@varupiraten.se

Here is my script:
";

//Close file for writing to logfile
//
fclose($logHandle);

}
//Set limitstart for first time
//
if (!isset($limitStart)) {$limitStart = 0;}

if (isset($_REQUEST["updateActions"])) {$updateActions = 
$_REQUEST["updateActions"];}
if (isset($_REQUEST["deleteActions"])) {$deleteActions = 
$_REQUEST["deleteActions"];}

if (isset($_REQUEST["startTime"])) {$startTime = $_REQUEST["startTime"];}

if ($_REQUEST["limitstart"]) {
 $limitStart = $_REQUEST["limitstart"];
}


require ("phpfunctions/opendb.php");


   $sql = "SELECT COUNT(IDVara) cn FROM tbvara WHERE Varunamn LIKE 
'$checkLev%'";

   $querys = mysql_query($sql);

   //Count products in db
   //
   if ($limitStart == 0) {

 $dbArray = mysql_fetch_array($querys);
 $nrOfProducts = $dbArray["cn"];
 echo "Antal produkter: $nrOfProducts";

   //Create logfile or delete all content from current logfile
   //
   $logHandle = fopen($logFileName,"wb");
   fclose($logHandle);


 //Get starttime of script
 //
 $startTime = time();
   }

   else {

 $nrOfProducts = $_REQUEST["nrofproducts"];

  }

  if ($limitStart > $nrOfProducts) {
$nrSeconds = time() - $startTime;
$nrMinutes = $nrSeconds / 60;
?>
Klar med uppdatering av saldo och ev. borttagningar för 
GNT.
Tid för uppdatering:  sekunder eller 
 minuter

Antal uppdateringar: 
Antal produkter som ej visas efter uppdatering:  $deleteActions;?>
href="captech_checksaldo_step2.php?deleteActions=0&updateActions=0">Kolla 
captech produkter

Avslutar scriptet nu!";
   exit;

   }




   //Go through database with products from GNT
   //
   $sql = "SELECT tbvara.IDVara, tbvara.Saldo, tbvara.startPris, 
tbvara.Varunamn, tbvara.synligVara, tbvara.lastPris, 
tbunderkategori.marginalProcent, tbunderkategori.Underkategori FROM tbvara";
   $sql .= " LEFT JOIN tbunderkategorivara ON (tbvara.IDVara = 
tbunderkategorivara.ForIDVara)";
   $sql .= " LEFT JOIN tbunderkategori ON (tbunderkategori.IDUnderKategori 
= tbunderkategorivara.ForIDUnderKategori)";
   $sql .= " WHERE Varunamn LIKE '$checkLev%' AND 
tbunderkategori.marginalProcent>-1 AND tbunderkategori.Underkategori<>'Ej 
tilldelade' ORDER BY IDVara LIMIT $limitStart,$limitSteps";

   //echo $sql;
   //exit;
   $querys = mysql_query($sql);

   while ($toarray = mysql_fetch_array($querys)) {

   //Get current row from db
   //
   $idproduct = $toarray["IDVara"];
   $dbSaldo = $toarray["Saldo"];
   $dbArtNr = $toarray["Varunamn"];
   $dbPris = $toarray["startPris"];
   $dbSynligVara = $toarray["synligVara"];
   $dbLastPris = $toarray["lastPris"];
   $dbMarginalProcent = $toarray["marginalProcent"];
   $dbUnderKategori = $toarray["Underkategori"];

   //Taken from table tbunderkategori
   //
   $marginalProcent = intval($dbMarginalProcent);

   //Delete $checkLev from string $dbArtNr for the sake of 
comparing

   //(take away the three first characters)
   //
   $dbArtNr = substr($dbArtNr, 3);


   //Go through whole textfile and compare with current row in db
   //
   $handle = fopen($fileName, "r");



   $foundProduct= false;
   ob_start();

   while (($data = fgetcsv($handle, 1000, ";")) !== FALSE) {

  $textSaldo = $data[$saldoColumn];
  $textArtNr = $data[$artNrColumn];
  $textPris = $data[$priceColumn];


   //Default marginal is 15 when marginal isn't set for 
undercategory

   //
   if (intval($marginalProcent) == 0) {

 $marginalProcent = 15;

   }

   //echo "Marginal för underkategori $dbUnderKategori är 
$marginalProcent%";


   //Set price based on price from textfile + marginal set
   //for undercategory
   //
   $newPrice = $textPris + (($textPris * 
($marginalProcent/100)));

   $newPrice = round($newPrice,0);


  if (isset($textArtNr) AND isset($textSaldo)

[PHP] Fast count of recordset in php...

2005-08-06 Thread Gustav Wiberg

Hello there!

How do i get a fast count of a recordset in php?

Look at this code:

   $sql = "SELECT COUNT(IDVara) cn FROM tbvara WHERE Varunamn LIKE 
'$checkLev%'";

   $querys = mysql_query($sql);

   //Count products in db
   //
   $dbArray = mysql_fetch_array($querys);
   $nrOfProducts = $dbArray["cn"];


It's slow... Why? Any suggestions?

/mr G
@varupiraten.se

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



Re: [PHP] Fast count of recordset in php...

2005-08-06 Thread Gustav Wiberg

Hi again!

Thanx!!! I think this will help a lot!!!

/mr G
@varupiraten.se


- Original Message - 
From: "TalkativeDoggy" <[EMAIL PROTECTED]>

To: "Sebastian" <[EMAIL PROTECTED]>
Cc: "Gustav Wiberg" <[EMAIL PROTECTED]>; 
Sent: Sunday, August 07, 2005 6:04 AM
Subject: Re: [PHP] Fast count of recordset in php...



if you just wana get count of recordset,
don't do this:
$sql = mysql_query("SELECT col FROM tbvara WHERE Varunamn LIKE 
'$checkLev%'");

// record count
echo mysql_num_rows($sql);

be coz this way is slow and costs more overload.

   $sql = "SELECT COUNT(IDVara) cn FROM tbvara WHERE Varunamn LIKE 
'$checkLev%'";

   $querys = mysql_query($sql);

   //Count products in db
   //
   $dbArray = mysql_fetch_row($querys);
   $nrOfProducts = $dbArray[0];

Sebastian wrote:
you'd be suprized how fast an index can be.. you should read the manual 
on indexes,

http://dev.mysql.com/doc/mysql/en/mysql-indexes.html

"If a table has 1,000 rows, this is at least 100 times faster than 
reading sequentially"


while you may not get 100x faster, it will be faster than having no 
index.. also try using mysql_num_rows()


$sql = mysql_query("SELECT col FROM tbvara WHERE Varunamn LIKE 
'$checkLev%'");

// record count
echo mysql_num_rows($sql);


PS, 'reply all' to list.

Gustav Wiberg wrote:


Hi there!

There are about 300 records.
You're right, I can add an index, but Is that the only way to get a 
faster solution?


/mr G
@varupiraten.se

- Original Message - From: "Sebastian" 
<[EMAIL PROTECTED]>

To: "Gustav Wiberg" <[EMAIL PROTECTED]>
Sent: Saturday, August 06, 2005 11:08 PM
Subject: Re: [PHP] Fast count of recordset in php...


how many records in the table? its going to be slow no matter what, 
especially if you have a lot of records.. your searching each record 
then counting them.. do you have any indexes? judging by your query 
you can add index on Varunamn and it should be more speedy..


Gustav Wiberg wrote:


Hello there!

How do i get a fast count of a recordset in php?

Look at this code:

   $sql = "SELECT COUNT(IDVara) cn FROM tbvara WHERE Varunamn LIKE 
'$checkLev%'";

   $querys = mysql_query($sql);

   //Count products in db
   //
   $dbArray = mysql_fetch_array($querys);
   $nrOfProducts = $dbArray["cn"];


It's slow... Why? Any suggestions?

/mr G
@varupiraten.se


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



--
No virus found in this incoming message.
Checked by AVG Anti-Virus.
Version: 7.0.338 / Virus Database: 267.10.0/63 - Release Date: 2005-08-03




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



[PHP] Unique user?

2005-08-19 Thread Gustav Wiberg

Hi there!

Is there any way of doing this:

1. User may vote 1-10 on a joke on a site X.
2. Same User may NOT vote again dependent of the computer...

I know this works if I check IP-adress, but because some users doesn't have 
a fixed ip-adress... it won't work correct.


Thought of getting a mac-adress, but I think is impossible to... :-)

Any ideas?

/G
@varupiraten.se

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



[PHP] possible to get a function from another domain

2005-08-23 Thread Gustav Wiberg

hi there!

Is it possible in PHP to retrieve value from one domain to another than my 
own?


Something like this:

Other domain: function getValueForMp3Player()

My domain: $price = getValueForMp3Player('Inno AX VB4393') //retrieves value 
from other domain


/G
@varupiraten.se 


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



Re: [PHP] possible to get a function from another domain

2005-08-23 Thread Gustav Wiberg

Hi!

Njae

I have a webshop and want to see a price from another webshop online 
(directly).


Let's call my webshop - varupiraten.se
and the other webshop - inwarehouse.se

I want to be able to see what price inwarehouse.se has for a certain product 
directly. (without no copying). Of course I have to know the implemenation 
of the code that inwarehouse.se has given to varupiraten.se


Do you understand what I'm trying to do? :-)

/G
@varupiraten.se

- Original Message - 
From: "Rory Browne" <[EMAIL PROTECTED]>

To: "Gustav Wiberg" <[EMAIL PROTECTED]>
Cc: "PHP General" 
Sent: Tuesday, August 23, 2005 9:45 PM
Subject: Re: [PHP] possible to get a function from another domain


I'm not sure I understand but:

You define a function on one machine;

You want to use that function on another machine;

If I understand you correctly, then you should be able to just

cp function_server.php function_server.txt
,

and include it over http

and done



On 8/23/05, Gustav Wiberg <[EMAIL PROTECTED]> wrote:

hi there!

Is it possible in PHP to retrieve value from one domain to another than my
own?

Something like this:

Other domain: function getValueForMp3Player()

My domain: $price = getValueForMp3Player('Inno AX VB4393') //retrieves 
value

from other domain

/G
@varupiraten.se

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




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



--
No virus found in this incoming message.
Checked by AVG Anti-Virus.
Version: 7.0.338 / Virus Database: 267.10.14/79 - Release Date: 2005-08-22

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



Re: [PHP] possible to get a function from another domain

2005-08-23 Thread Gustav Wiberg

Hi!

Can I use require with http?

My domain: www.varupiraten.se

Other domain: www.webshop2.se

Does this kind of code work?

Code for my domain:
http://www.webshop2.se/externfunctions.php);
$x = getValueFromProduct('Inno AX5000'); //This function retrieves price 
from webshop2.se

?


/G
@varupiraten.se

- Original Message - 
From: "Jasper Bryant-Greene" <[EMAIL PROTECTED]>

To: 
Sent: Tuesday, August 23, 2005 9:47 PM
Subject: Re: [PHP] possible to get a function from another domain



Gustav Wiberg wrote:
Is it possible in PHP to retrieve value from one domain to another than 
my own?


Something like this:

Other domain: function getValueForMp3Player()

My domain: $price = getValueForMp3Player('Inno AX VB4393') //retrieves 
value from other domain


What exactly do you mean by domain in this example? You can include() or 
require() the file with the function declaration in it...


Jasper

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



--
No virus found in this incoming message.
Checked by AVG Anti-Virus.
Version: 7.0.338 / Virus Database: 267.10.14/79 - Release Date: 2005-08-22




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



Re: [PHP] possible to get a function from another domain

2005-08-24 Thread Gustav Wiberg

Hi there!

Thanx for the help!

And everybody else that helped me with the solution of course! :-)

/G
@varupiraten.se

- Original Message - 
From: "Rory Browne" <[EMAIL PROTECTED]>

To: "Jim Moseby" <[EMAIL PROTECTED]>
Cc: 
Sent: Tuesday, August 23, 2005 10:21 PM
Subject: Re: [PHP] possible to get a function from another domain


I withdraw my information in my earlier post.

I was in a cybercafe in a hurry - and didn't have time to consider
what was said, nor what I was saying myself.

What I said before has little or not merit. 


You can make an experimental interface, and parse the html without the
other domain owners co-operation(although it may be considered rude to
do it without his consent). Your interface breaks when he changes his
system.

You can get him to create an XML page, that you can parse, if you have
his co-operation, or you could possibly get him to create an XML-RPC
or SOAP interface to his site.

On 8/23/05, Jim Moseby <[EMAIL PROTECTED]> wrote:

> [snip]
> Can I use require with http?
>
> My domain: www.varupiraten.se
>
> Other domain: www.webshop2.se
>
> Does this kind of code work?
>
> Code for my domain:
>  require(http://www.webshop2.se/externfunctions.php);
> $x = getValueFromProduct('Inno AX5000'); //This function
> retrieves price
>
> from webshop2.se
> ?
> [/snip]
>
> Have you tried it?
>
> Really, unless you own the the other domain and have a way to
> access the
> data, you really cannot do this without some sort of screen
> scraping or
> URL munging. Let us say that you know the product listing for
> the other
> domain is something like
>
> http://www.webshop2.com/productInfo.php?product=Inno_AX5000
>
> You could retrieve that data and manipulate it.
>

But even if you did, you're giving the other guy the power to break your
site.  All he has to do is change the URL or the format of the page, and
BOOM, your site croaks.

So a relevant question is: "Do you have control of the other site, or at
least the cooperation of the other site's owner?"

JM

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




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



--
No virus found in this incoming message.
Checked by AVG Anti-Virus.
Version: 7.0.338 / Virus Database: 267.10.14/79 - Release Date: 2005-08-22

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



[PHP] Computer name?

2005-08-25 Thread Gustav Wiberg

Is it possible to retrieve (view) the computers name from the client in PHP?

/G
@varupiraten.se

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



[PHP] Computers name?

2005-08-29 Thread Gustav Wiberg

Hi there!

Is it possible to get (retrieve) the computername of the client? I just want 
the name for comparing...


/G
@varupiraten.se

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



[PHP] divide-column?

2005-08-29 Thread Gustav Wiberg

Hi there!

How do I do a sort in PHP where a column in a db must be two other columns 
divided...`?


I tried to use DIV-function in MySQL but it doesn't seem to work ): Of 
course, I can hard-code it, but i want this value because of sorting ten 
largest of the resultvalue. ($gradeJoke). Ten best jokes I want to get and 
ten worst jokes.. .


Some of my code looks like this:

   while ($toarray = mysql_fetch_array($querys)) {

   $IDJoke = $toarray["IDJoke"];
   $titleJoke = $toarray["titleJoke"];
   $fromJoke = $toarray["fromJoke"];
   $nrOfVotes = $toarray["nrOfVotes"];
   $totalValueJoke = $toarray["totalValueJoke"];
   $gradeJoke = $toarray["gradeJoke"];

 if ($totalValueJoke >0 AND $nrOfVotes > 0) {

   $gradeJoke = ($totalValueJoke / $nrOfVotes);

   }
  else {

   $gradeJoke = 0;

   }

I want this: $gradeJoke = ($totalValueJoke / $nrOfVotes);

to be integrated in MySQL, is it possible? (I guess it is, but what function 
do i USE?)


/G
@varupiraten.se

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



[PHP] ID based on position?

2005-08-31 Thread Gustav Wiberg

Hi there!

Is there any function in PHP that gives an ID from a MySQL-db based on which 
position the record has in the table?



Let's say, there's a table like this:

1. Record1 ID 33
2. Record2 ID 76
3. Record3 ID 100


If I know position 2, I want to get ID 76. Is the only way to loop through 
the recordset?


/G
@varupiraten.se

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



[PHP] CookieMonster

2005-09-01 Thread Gustav Wiberg

Hi

Simple question I guess..

How do I set a cookie so it will never expire? (I don't want it to expire)

/G
@varupiraten.se

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



Re: [PHP] session cookies

2005-09-01 Thread Gustav Wiberg

Hi there!

Try using ob_start() and then set sessions, and then user HEADER...

http://se.php.net/manual/sv/function.ob-start.php

/G
@varupiraten.se

- Original Message - 
From: "Philip Hallstrom" <[EMAIL PROTECTED]>

To: "Jasper Bryant-Greene" <[EMAIL PROTECTED]>
Cc: "php list" 
Sent: Thursday, September 01, 2005 10:43 PM
Subject: Re: [PHP] session cookies



Philip Hallstrom wrote:
Then use an HTML meta refresh (or javascript, just not 
Header("Location...) to redirect them to another page.


Why not header("Location...")? Just out of interest -- it's always worked 
for me, and it's a much better way to redirect users for many reasons[1] 
(like not breaking the back button).


[1] http://www.w3.org/QA/Tips/reback


For some reason (and maybe it's no longer true) I've had problems setting 
a cookie and then doing a header("Location...").  Seems some browsers 
wouldn't pick up the cookie.


Now... when this happened (could have been as early as 98) I don't recall, 
but it's always stuck with me and I usually end up spitting back a little 
javascript to send the user wherever it is I want them to go...


-philip

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



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



[PHP] Impossible???

2005-09-01 Thread Gustav Wiberg

Hi again!


Is this impossible to do in PHP?


Dim objNet
On Error Resume Next

'In case we fail to create object then display our custom error

Set objNet = CreateObject("WScript.NetWork")
If  Err.Number <> 0 Then'If error occured then display 
notice

MsgBox "Don't be Shy." & vbCRLF &_
  "Do not press ""No"" If your browser warns you."
Document.Location = "UserInfo.html"
   'Place the Name of the document.
'It will display again
End if

Dim strInfo
strInfo = "User Name is " & objNet.UserName & vbCRLF & _
 "Computer Name is " & objNet.ComputerName & vbCRLF & _
 "Domain Name is   " & objNet.UserDomain
MsgBox strInfo

Set objNet = Nothing'Destroy the Object to free the 
Memory



/G
@varupiraten.se

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



Re: [PHP] deleting files on Windows...permissions issue

2005-09-02 Thread Gustav Wiberg

Hi there!

Are you using rmdir?

http://se2.php.net/manual/en/function.rmdir.php

/G
@varupiraten.se

- Original Message - 
From: "James" <[EMAIL PROTECTED]>

To: 
Sent: Friday, September 02, 2005 6:45 PM
Subject: [PHP] deleting files on Windows...permissions issue


I have a php script that can delete files in a folder but it can not 
delete the folder itself.


I've tried to play around with permissions on the Windows box and 
couldn't set it to something that would allow the PHP script to 
delete the folder.  I think I even tried to set the permissions for 
the folder's parent folder.


This PHP script is called from a browser.

What user does the PHP script run as when served up by Apache on 
Windows?   (once I have this answer, I can set the owner of the 
folder to this user and give that a shot)

--
-James

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



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



[PHP] Content - strip...

2005-09-02 Thread Gustav Wiberg

Hi there!

Anyone that has an easy solution to this?

I have a string filled with content. A lot of content is before Jumping Jack 
flash


I want the $content - string to start at Jumping Jack flash

Is there any smart way of doing this?

/G
@varupiraten.se

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



  1   2   3   >