php-general Digest 30 Dec 2007 21:10:58 -0000 Issue 5208
Topics (messages 266369 through 266387):
Comparison Problems with 5.2.5
266369 by: Magnus Anderson
266370 by: Silvio Porcellana
266373 by: Casey
Using PHP to remove certain number of bytes from file
266371 by: Scott Wilcox
266375 by: Benjamin Darwin
266376 by: Robert Cummings
266378 by: Robert Cummings
266380 by: Casey
Re: Question regarding linking PHP Parser library into my private Http server
266372 by: Nathan Nobbe
Re: script stoped working over christmas ?
266374 by: Jochem Maas
Question about sqli class
266377 by: alvaro
266379 by: Nathan Nobbe
read email
266381 by: Yui Hiroaki
266382 by: Børge Holen
Mail system
266383 by: mattias
266384 by: Stut
266385 by: mattias
266386 by: Stut
266387 by: mattias
Administrivia:
To subscribe to the digest, e-mail:
[EMAIL PROTECTED]
To unsubscribe from the digest, e-mail:
[EMAIL PROTECTED]
To post to the list, e-mail:
[EMAIL PROTECTED]
----------------------------------------------------------------------
--- Begin Message ---
Hi,
I have runned into a slight annoying problem with my code, that I have never
had before.
Either I have something wrong in my code or PHP 5.2.5 that I user is acting
weird in windows. I have recently installed PHP on my windows machine for
local developement instead of a remote server.
What I try to do is to make an if statement betwean two string numbers.
$_USER['level'] = The level the user has
The $_USER['level'] string is taken from the Database and is "5".
This will not work (I expect this to work since _USER['level'] is 5)
if($_USER['level'] => 5)
This will work (And I expect it to work to)
if($_USER['level'] => 6)
This will work (Not supposed to work since _USER['level'] is 5)
if($_USER['level'] > 5)
--
View this message in context:
http://www.nabble.com/Comparison-Problems-with-5.2.5-tp14547671p14547671.html
Sent from the PHP - General mailing list archive at Nabble.com.
--- End Message ---
--- Begin Message ---
Magnus Anderson wrote:
...snip...
This will not work (I expect this to work since _USER['level'] is 5)
if($_USER['level'] => 5)
Try
if($_USER['level'] >= 5)
maybe it helps ('=>' is used when assigning values in an hash, maybe you
are triggering something strange...)
--
Antinori and Partners - http://www.antinoriandpartners.com
Soluzioni web - da professionisti
--- End Message ---
--- Begin Message ---
On Dec 30, 2007 8:04 AM, Silvio Porcellana <[EMAIL PROTECTED]> wrote:
> Magnus Anderson wrote:
> >
> > ...snip...
> >
> > This will not work (I expect this to work since _USER['level'] is 5)
> > if($_USER['level'] => 5)
> >
>
> Try
> if($_USER['level'] >= 5)
>
> maybe it helps ('=>' is used when assigning values in an hash, maybe you
> are triggering something strange...)
>
> --
> Antinori and Partners - http://www.antinoriandpartners.com
> Soluzioni web - da professionisti
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
I think it needs to be >= (greater than or equal to) or <= (less than
or equal to).
-Casey
--- End Message ---
--- Begin Message ---
Is it possible with PHP to remove a certain number of bytes from a file,
purely within PHP?
If so, does someone have an example of doing this, removing the first
230 bytes from a file.
Thanks,
Scott.
--- End Message ---
--- Begin Message ---
Maybe one of these days I'll remember to actually reply to the list the
first time.
---------- Forwarded message ----------
From: Benjamin Darwin <[EMAIL PROTECTED]>
Date: Dec 30, 2007 2:12 PM
Subject: Re: [PHP] Using PHP to remove certain number of bytes from file
To: Scott Wilcox <[EMAIL PROTECTED]>
Try this:
$file_data = file_get_contents('filename', false, null, 230);
file_put_contents('filename', $file_data);
This should do exactly what you need, although you may want to see if either
one returns false (indicating an error) and stop the script.
On Dec 30, 2007 12:20 PM, Scott Wilcox <[EMAIL PROTECTED]> wrote:
> Is it possible with PHP to remove a certain number of bytes from a file,
> purely within PHP?
>
> If so, does someone have an example of doing this, removing the first
> 230 bytes from a file.
>
> Thanks,
>
> Scott.
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--
Benjamin Darwin
[EMAIL PROTECTED]
"Dream as if you'll live forever, live as if you'll die today." ~James Dean
--- End Message ---
--- Begin Message ---
On Sun, 2007-12-30 at 17:20 +0000, Scott Wilcox wrote:
> Is it possible with PHP to remove a certain number of bytes from a file,
> purely within PHP?
Yes. Why wouldn't it?
> If so, does someone have an example of doing this, removing the first
> 230 bytes from a file.
No, that's an awfully specific problem. But here's the tools you'll
need:
fopen(), fread(), fwrite(), fclose().
Further info... you could do this without creating a separate temporary
file (meaning shift bytes within a single file), but I suggest using a
temporary target file for writing the new content, and then replacing
the original once everything has completed successfully.
Cheers,
Rob.
--
...........................................................
SwarmBuy.com - http://www.swarmbuy.com
Leveraging the buying power of the masses!
...........................................................
--- End Message ---
--- Begin Message ---
On Sun, 2007-12-30 at 14:14 -0500, Benjamin Darwin wrote:
> Maybe one of these days I'll remember to actually reply to the list the
> first time.
>
>
> ---------- Forwarded message ----------
> From: Benjamin Darwin <[EMAIL PROTECTED]>
> Date: Dec 30, 2007 2:12 PM
> Subject: Re: [PHP] Using PHP to remove certain number of bytes from file
> To: Scott Wilcox <[EMAIL PROTECTED]>
>
>
> Try this:
>
> $file_data = file_get_contents('filename', false, null, 230);
> file_put_contents('filename', $file_data);
I don't suggest this route with files that are in the hundreds of
megs :) But admittedly, it's the simplest solution for small files.
Also, can't use it if you're stuck with PHP 4 since it doesn't support
file_put_contents(). PHP4 is dead now anyways, supposedly, so I read
someplace ;)
Cheers,
Rob.
--
...........................................................
SwarmBuy.com - http://www.swarmbuy.com
Leveraging the buying power of the masses!
...........................................................
--- End Message ---
--- Begin Message ---
On Dec 30, 2007 11:26 AM, Robert Cummings <[EMAIL PROTECTED]> wrote:
> On Sun, 2007-12-30 at 14:14 -0500, Benjamin Darwin wrote:
> > Maybe one of these days I'll remember to actually reply to the list the
> > first time.
> >
> >
> > ---------- Forwarded message ----------
> > From: Benjamin Darwin <[EMAIL PROTECTED]>
> > Date: Dec 30, 2007 2:12 PM
> > Subject: Re: [PHP] Using PHP to remove certain number of bytes from file
> > To: Scott Wilcox <[EMAIL PROTECTED]>
> >
> >
> > Try this:
> >
> > $file_data = file_get_contents('filename', false, null, 230);
> > file_put_contents('filename', $file_data);
>
> I don't suggest this route with files that are in the hundreds of
> megs :) But admittedly, it's the simplest solution for small files.
> Also, can't use it if you're stuck with PHP 4 since it doesn't support
> file_put_contents(). PHP4 is dead now anyways, supposedly, so I read
> someplace ;)
>
> Cheers,
> Rob.
> --
> ...........................................................
> SwarmBuy.com - http://www.swarmbuy.com
>
> Leveraging the buying power of the masses!
> ...........................................................
>
> --
>
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
30 seconds alternative:
<?php
$fh = fopen($file, 'rb');
$f2 = fopen('temp', 'wb');
fseek($fh, 230);
do {
fwrite($f2, fread($fh, 4069));
} while (!feof($fh);
fclose($fh);
fclose($f2);
rename('temp', $file);
?>
-Casey
--- End Message ---
--- Begin Message ---
On Dec 30, 2007 4:02 AM, Talya Nevo <[EMAIL PROTECTED]> wrote:
>
> Hi,
>
> I am porting my software from Linux to µC/OS-II OS.
> On Linux I ran the Boa Web server with PHP.
> The µC/OS-II has a basic open source Http Server that does not support PHP
> or CGI.
>
> What I was able to do - is from the Http server, each time an http request
> is received, call using 'System' function the PHP interpreter program (like
> from cli) with input the requested page.
> This seams to basically work but it is not efficient at all.
>
> What I would like to do is to link the Http Server to the basic PHP parser
> library and call the 'parse' function each time the server gets an http
> request.
>
> Is this possible?
> Does anyone know how to do this - which library to link to, which function
> to call, maybe an example.
though i have not interacted with them, i suspect this question may be
better received on the internals list.
-nathan
--- End Message ---
--- Begin Message ---
Joker7 schreef:
...
>>>>
>>>> config.php
>>>> <?php
>>>> $max_summary = 6;
>>>> $max_latest = 7;
>>>> $summary_template = "t_summary.tp";
>>>> $article_template = "t_article.tp";
>>>> $password = "password";
>>>> latest.php
>>>> <?php
>>>>
>>>> require('config.php');
>>>>
>>>> $filename = "article_summary.php";
>>>>
>>>> #- open article summaries
>>>> if(file_exists($filename)){
full path to this file is not being used.
>>>> $fh = fopen($filename, "r");
>>>> $old_news = fread($fh, filesize($filename));
>>>> fclose($fh);
>>>> }
does the file exist? is it readable by php? is there anything in the file?
have you looked at the output source to see what if anything was actually
outputted?
>>>>
>>>> #- get article
>>>> $articles = explode("<!--ARTICLE-->", $old_news);
>>>> $i=0;
>>>> foreach ( $articles as $article ){
>>>> if(count($articles)>$i){
>>>> if($max_latest >= $i++){
>>>> print $article;
>>>> }
>>>> }
>>>> }
>
> No error message it's as if it working ,but not ,if I change the path or any
> thing else I get the apporiate error message.
>
> Chris
>
--- End Message ---
--- Begin Message ---
I don´t know if this is the correct place to ask this questions but I haver
some doubts about using mysqli class in php. I am designing a web place using
wamp2 (php5, mysql 5.0.x ....). My databases have been done using phpmyadmin so
they are "normal" mysql, I mean that I have done nothing with SQLITE. On the
other hand, I am accessing to my databases and tables using mysqli class and
methods for example:
$conn = new mysqli ( ..........) (this is what I am using)
I am using that because I read in the internet that mysqli methods where more
efficient but I don´t know if it´s correct to use that methods with my mysql
database (it runs perfect).
so... is it correct? supposing that it´s correct to use it......is it faster
and better to use mysqli methods than using the functions that were used before
these new classes appeared?
thanks...
my email is:
[EMAIL PROTECTED]
--- End Message ---
--- Begin Message ---
On Dec 30, 2007 2:11 PM, alvaro <[EMAIL PROTECTED]> wrote:
> I don´t know if this is the correct place to ask this questions but I
> haver some doubts about using mysqli class in php. I am designing a web
> place using wamp2 (php5, mysql 5.0.x ....). My databases have been done
> using phpmyadmin so they are "normal" mysql, I mean that I have done nothing
> with SQLITE. On the other hand, I am accessing to my databases and tables
> using mysqli class and methods for example:
> $conn = new mysqli ( ..........) (this is what I am using)
> I am using that because I read in the internet that mysqli methods where
> more efficient but I don´t know if it´s correct to use that methods with my
> mysql database (it runs perfect).
>
> so... is it correct? supposing that it´s correct to use it......is it
> faster and better to use mysqli methods than using the functions that were
> used before these new classes appeared? <[EMAIL PROTECTED]>
i believe the main reason for mysqli being 'better' than mysql is the object
oriented approach to the api design.
there may be other optimizations under the hood, but i am not aware of any
off the top of my head (list: feel free to correct me).
as per your overall system design, deciding to go w/ mysqli comes down to a
few things
- do you want to write all the sql by hand
- do you plan on using a different database w/ the same system
there are more questions of course but anyway; what im getting at is you
might want to take a look at something like propel
http://propel.phpdb.org/trac/
there are similar systems out there, but to summarize their features they
essentially use a code generation paradigm to write
all the database i/o in your system on your behalf; then you can just start
using it. it is customizable as well.
you will find pros / cons to such a system and a learning curve. but mainly
i just want to acquaint you with such systems.
anyway if youre not going to use something like that id say shoot for mysqli
over mysql.
-nathan
--- End Message ---
--- Begin Message ---
HI!
I am trying to access qmail with php.
Why!
Because I would like to read mail who someone send an email me to qmail.
If anyone knows the code, please send me the code.
Regards,
Yui
--- End Message ---
--- Begin Message ---
On Sunday 30 December 2007 21:19:16 Yui Hiroaki wrote:
> HI!
>
> I am trying to access qmail with php.
>
> Why!
> Because I would like to read mail who someone send an email me to qmail.
>
> If anyone knows the code, please send me the code.
NOW that was straight forward
I always thought the easiest way to figure out how this works, is to take
appart... something like squirrelmail or openwebmail... even something like
the one we use on our students at work, a short name, like zork dork work...
can't remember. :).
Even so, never got to it and forgot about it. Never thought about the shortcut
of askin' here...
However, why doesn't this seem likely ;D
>
> Regards,
> Yui
--
---
Børge Holen
http://www.arivene.net
--- End Message ---
--- Begin Message ---
If i run coureir and postfix
I want to have a signup script
How should the code be written?
--- End Message ---
--- Begin Message ---
mattias wrote:
If i run coureir and postfix
I want to have a signup script
How should the code be written?
Since you're asking on a PHP list I'm going to assume you want to use
PHP. The answer you seek is... by you, using some form of text editor!
We're not here to write code for you. Have a go, then come back if you
have problems. The manual will help, as will Google. There's a good
chance someone has already done this, so I'd start with Google.
-Stut
--
http://stut.net/
--- End Message ---
--- Begin Message ---
First of all
If you have a bad day don't send to the list
-----Ursprungligt meddelande-----
Från: Stut [mailto:[EMAIL PROTECTED]
Skickat: den 30 december 2007 21:46
Till: mattias
Kopia: [EMAIL PROTECTED]
Ämne: Re: [PHP] Mail system
mattias wrote:
> If i run coureir and postfix
> I want to have a signup script
> How should the code be written?
Since you're asking on a PHP list I'm going to assume you want to use
PHP. The answer you seek is... by you, using some form of text editor!
We're not here to write code for you. Have a go, then come back if you
have problems. The manual will help, as will Google. There's a good
chance someone has already done this, so I'd start with Google.
-Stut
--
http://stut.net/
--- End Message ---
--- Begin Message ---
mattias wrote:
First of all
If you have a bad day don't send to the list
I'm actually having a pretty good day thanks. Seriously though, Google
for an existing solution, and if there isn't one have a go yourself and
then ask for help if you have problems.
I apologise if you feel that's harsh, but that's the way it is.
-Stut
--
http://stut.net/
-----Ursprungligt meddelande-----
Från: Stut [mailto:[EMAIL PROTECTED]
Skickat: den 30 december 2007 21:46
Till: mattias
Kopia: [EMAIL PROTECTED]
Ämne: Re: [PHP] Mail system
mattias wrote:
If i run coureir and postfix
I want to have a signup script
How should the code be written?
Since you're asking on a PHP list I'm going to assume you want to use
PHP. The answer you seek is... by you, using some form of text editor!
We're not here to write code for you. Have a go, then come back if you
have problems. The manual will help, as will Google. There's a good
chance someone has already done this, so I'd start with Google.
-Stut
--- End Message ---
--- Begin Message ---
Yes but i are newbie in php
I think i should use php exec but i dont know no more
-----Ursprungligt meddelande-----
Från: Stut [mailto:[EMAIL PROTECTED]
Skickat: den 30 december 2007 22:01
Till: mattias
Kopia: [EMAIL PROTECTED]
Ämne: Re: SV: [PHP] Mail system
mattias wrote:
> First of all
> If you have a bad day don't send to the list
I'm actually having a pretty good day thanks. Seriously though, Google
for an existing solution, and if there isn't one have a go yourself and
then ask for help if you have problems.
I apologise if you feel that's harsh, but that's the way it is.
-Stut
--
http://stut.net/
> -----Ursprungligt meddelande-----
> Från: Stut [mailto:[EMAIL PROTECTED]
> Skickat: den 30 december 2007 21:46
> Till: mattias
> Kopia: [EMAIL PROTECTED]
> Ämne: Re: [PHP] Mail system
>
>
> mattias wrote:
>> If i run coureir and postfix
>> I want to have a signup script
>> How should the code be written?
>
> Since you're asking on a PHP list I'm going to assume you want to use
> PHP. The answer you seek is... by you, using some form of text editor!
>
> We're not here to write code for you. Have a go, then come back if you
> have problems. The manual will help, as will Google. There's a good
> chance someone has already done this, so I'd start with Google.
>
> -Stut
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---