|
Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com |
php-general Digest 25 Mar 2005 13:57:24 -0000 Issue 3358
php-general-digest-help
lists.php.net
Date: Fri Mar 25 2005 - 07:57:24 CST
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
php-general Digest 25 Mar 2005 13:57:24 -0000 Issue 3358
Topics (messages 211536 through 211561):
OR statement
211536 by: Marquez Design
211538 by: Tom Rogers
211541 by: Josh Whiting
211546 by: Philip Olson
211548 by: Joe Wollard
Re: Storing data structires in DB
211537 by: Joshua Beall
Game development approach
211539 by: Alexandre
211544 by: Robert Cummings
211545 by: Robert Restad
211558 by: maillists.morningstarcom.net
Re: Getting the process ID
211540 by: trlists.clayst.com
211542 by: Josh Whiting
211549 by: Rasmus Lerdorf
PHP4 and PHP5 in virtual Host
211543 by: Juan Pablo Herrera
rounding test fails when I try to "make test"
211547 by: Larry
Re: [semi OT]: Planning projects
211550 by: kamen 123
Download Link !
211551 by: AN.S
211553 by: Ken
211560 by: maillists.morningstarcom.net
Re: How can I destroy parameters by page
211552 by: listas.uakari.com
211554 by: Colin Ross
Re: Pagination
211555 by: Colin Ross
Where is php installed on linux
211556 by: Merlin
211557 by: Jason Wong
Re: Problem with header in an if
211559 by: Jay Blanchard
header("Location: page.php target=_parent")?????
211561 by: Jacques
Administrivia:
To subscribe to the digest, e-mail:
php-general-digest-subscribe
lists.php.net
To unsubscribe from the digest, e-mail:
php-general-digest-unsubscribe
lists.php.net
To post to the list, e-mail:
php-general
lists.php.net
----------------------------------------------------------------------
attached mail follows:
Hello,
I would like to first thank everyone for their help with the last few
questions I have had. I really appreciate it.
Here is my question:
if ($audio == "Cool"){
Do this
}else{
Do that
}
This work fine, however, I would like to add to the criteria above. I would
like to say:
if ($audio == "Cool" or "junk" or "funky"){
...
I have tried to look for something in the manual, and am still looking, but
a little help on this would be appreciated.
Thank you again,
--
Steve Marquez
attached mail follows:
Hi,
Friday, March 25, 2005, 11:27:30 AM, you wrote:
MD> Hello,
MD> I would like to first thank everyone for their help with the last few
MD> questions I have had. I really appreciate it.
MD> Here is my question:
MD> if ($audio == "Cool"){
MD> Do this
MD> }else{
MD> Do that
MD> }
MD> This work fine, however, I would like to add to the criteria above. I would
MD> like to say:
MD> if ($audio == "Cool" or "junk" or "funky"){
MD> ...
MD> I have tried to look for something in the manual, and am still looking, but
MD> a little help on this would be appreciated.
MD> Thank you again,
MD> --
MD> Steve Marquez
The most easily expandable way is with a switch statement
switch($audio){
case 'Cool':
case 'junk':
case 'funky':
Do this....
break;
default:
Do that....
break;
}
--
regards,
Tom
attached mail follows:
> This work fine, however, I would like to add to the criteria above. I would
> like to say:
>
> if ($audio == "Cool" or "junk" or "funky"){
>
> ...
>
if (in_array($audio,array("Cool","junk","funky"))) {
...
}
not the most elegant looking but it gets the job done.
/josh w
attached mail follows:
> > This work fine, however, I would like to add to the criteria above. I would
> > like to say:
> >
> > if ($audio == "Cool" or "junk" or "funky"){
> >
> > ...
> >
>
> if (in_array($audio,array("Cool","junk","funky"))) {
> ...
> }
>
Yes that's one way but to answer the question:
if ($a == 'foo' OR $a == 'bar') {
Regards,
Philip
attached mail follows:
This can also be done with double pipes, which is what is used in many
other languages.
---------------------------------
if($audio=="Cool" || $audio=="junk" || $audio=="Funky"){
Do this
} else{
Do this
}
----------------------------------
As far as I can tell there are no plans to remove or reason to favor one
method or the other, so it's just a matter of preference.
Philip Olson wrote:
>>>This work fine, however, I would like to add to the criteria above. I would
>>>like to say:
>>>
>>> if ($audio == "Cool" or "junk" or "funky"){
>>>
>>>...
>>>
>>>
>>>
>>if (in_array($audio,array("Cool","junk","funky"))) {
>>...
>>}
>>
>>
>>
>
>Yes that's one way but to answer the question:
>
> if ($a == 'foo' OR $a == 'bar') {
>
>
>Regards,
>Philip
>
>
>
attached mail follows:
"Joshua Beall" <jbeall
heraldic.us> wrote in message
news:d1vjj0$422$1
sea.gmane.org...
> You should look into the WDDX functions - http://php.net/wddx/ - they give
> you an XML document that you can edit by hand much more easily than the
> bytestream you get from serialize. However it is not as compact as
> serialize, and not only that it suffers from what I consider a showstopped
> bug.
er, make that "showstopper..."
attached mail follows:
Hi there,
I'm developing an online game (using PHP+MySQL, and being totally interfaced via
web) which needs to have a "game cycle" running. For example, the player is
flying a plane, so he sets the plane speed to 10%, then the game cycle needs to
keep "moving the plane" forward (i.e. updating position), while the player
doesn't order it a full stop. The point is how to implement this "game cycle"?
I've done some research on the web and haven't found a feasible approach to this
idea.
Thanks in advance for any help.
[]s
Alex
attached mail follows:
On Tue, 2005-03-22 at 21:13, Alexandre wrote:
> Hi there,
>
> I'm developing an online game (using PHP+MySQL, and being totally interfaced via
> web) which needs to have a "game cycle" running. For example, the player is
> flying a plane, so he sets the plane speed to 10%, then the game cycle needs to
> keep "moving the plane" forward (i.e. updating position), while the player
> doesn't order it a full stop. The point is how to implement this "game cycle"?
>
> I've done some research on the web and haven't found a feasible approach to this
> idea.
Javascript. And perhaps use XmlHttpRequest to synchronize the game cycle
with your web server from time to time. Or if the pages are being
submitted, you can just synchronize at that time.
Cheers,
Rob.
--
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com |
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting |
| a powerful, scalable system for accessing system services |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for |
| creating re-usable components quickly and easily. |
`------------------------------------------------------------'
attached mail follows:
I suggest you write a 'tick' engine, which i.e. games like Planetarion
use.
This should be written in C or C++, compiled... You can run this using
PHP of course, and run it from command line/shell, but PHP isnt ideal
for this. If you have a decent server and not too much players (i.e.
more than a hundred simultaneous players), then PHP will do. Any more
than this, and I doubt PHP can handle without choking the server.
You should also consider to study some math. I.e. if the plane is going
to move at various speeds at various angles, basic math is needed.
Good web games requires a lot of development time.
Best regards
Robert.
-----Mensagem original-----
De: Alexandre [mailto:mech39
terra.com.br]
Enviada em: terça-feira, 22 de março de 2005 23:13
Para: php-general
lists.php.net
Assunto: [PHP] Game development approach
Hi there,
I'm developing an online game (using PHP+MySQL, and being totally
interfaced via
web) which needs to have a "game cycle" running. For example, the player
is
flying a plane, so he sets the plane speed to 10%, then the game cycle
needs to
keep "moving the plane" forward (i.e. updating position), while the
player
doesn't order it a full stop. The point is how to implement this "game
cycle"?
I've done some research on the web and haven't found a feasible approach
to this
idea.
Thanks in advance for any help.
[]s
Alex
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
attached mail follows:
On Tuesday 22 March 2005 21:13, Alexandre wrote:
> Hi there,
>
> I'm developing an online game (using PHP+MySQL, and being totally
> interfaced via web) which needs to have a "game cycle" running. For
> example, the player is flying a plane, so he sets the plane speed to 10%,
> then the game cycle needs to keep "moving the plane" forward (i.e. updating
> position), while the player doesn't order it a full stop. The point is how
> to implement this "game cycle"?
>
> I've done some research on the web and haven't found a feasible approach to
> this idea.
>
> Thanks in advance for any help.
>
> []s
> Alex
I am no expert and someone may have already answered you.
I would try C, JavaScript, PostgreSQL (instead of MySQL), and XML along with
your PHP
--
Win a Vespa Scooter or a Dell Gift Card worth $3,000.00
http://www.morningstarcom.net/raffle-contest.php
--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
MailScanner thanks transtec Computers for their support.
attached mail follows:
On 24 Mar 2005 Joshua Beall wrote:
> I realized that this sort of problem would always exist unless I had some
> sort of semaphore mechanism. Once a user has *started* a transaction, they
> need to be prevented from initiating a second transaction until the first
> transaction has been completed.
Why not simply store some kind of user ID and a timestamp for the
transaction start time in a database. Every time a new transaction is
started check the database, if there is another one in process, give an
appropriate error. When the transaction completes delete the record.
The hole in this of course is transactions that start and never finish.
That's why I suggest a timestamp -- you can use it to check how long
it's been since the previous transaction started, and ignore it if
that's over some threshold (for example, if the previous transaction
was stated a minute ago and a normal transaction takes 5 seconds, you
can be pretty sure). And you can run a cron job to periodically sweep
the database and remove old transactions that never completed.
--
Tom
attached mail follows:
> The problem I am having is that people are double-submitting certain
> transactions. My first attempt to prevent this was to store a flag in the
> session record indicating whether or not certain transactions had been
> completed, but this turned out to be insufficient at times because users
> could try and initiate a second transaction before the first transaction had
> finished (and thus the system had not yet flagged the transaction completed
> in the session record). They then both completed in parallel, and voila,
> duplicate transactions again.
>
> I realized that this sort of problem would always exist unless I had some
> sort of semaphore mechanism. Once a user has *started* a transaction, they
> need to be prevented from initiating a second transaction until the first
> transaction has been completed.
>
> I am open to suggestions on how to do this. What is the best way?
do you have access to a database? why not just manage the transaction
on the database level? transactions, locking, etc. are a core part of
what databases do for a living. it's not a problem best solved with PHP.
/josh w
attached mail follows:
Joshua Beall wrote:
> "Rasmus Lerdorf" <rasmus
lerdorf.com> wrote in message
> news:42435332.70807
lerdorf.com...
>
>>Joshua Beall wrote:
>>
>>>I am doing some work where I want to do locking, and prevent scripts from
>>>running in parallel. I see that I could use the semaphore mechanism, but
>>>I'd like for my code to be portable, and that extension is not enabled in
>>>many places.
>>
>>Sort of defeats the whole concept of a web server, but to answer just your
>>process id question, use getmypid()
>
>
> http://php.net/manual/en/function.getmypid.php
>
> It says "Process IDs are not unique"
>
> I really only need it to be unique at any given instant. I can do
> sha1(microtime().getmypid()) to generate a unique ID. But of course it is
> only guaranteed to be unique if indeed the process ID is not shared.
pids are not unique over time. They get re-used, but in any instant on
a single server, the pid is unique.
> The problem I am having is that people are double-submitting certain
> transactions. My first attempt to prevent this was to store a flag in the
> session record indicating whether or not certain transactions had been
> completed, but this turned out to be insufficient at times because users
> could try and initiate a second transaction before the first transaction had
> finished (and thus the system had not yet flagged the transaction completed
> in the session record). They then both completed in parallel, and voila,
> duplicate transactions again.
But a double-submit is likely to come from separate Apache processes, so
I don't see where the pid comes into the picture. If I reload a page
and resend the post data, that POST request is going to be processed a
second time most likely by a different httpd process. What you need to
do is put a unique (you can use the uniqid function) in the actual
transaction data and not allow the transaction if that token is already
present in your datastore.
-Rasmus
attached mail follows:
Hi!
I have apache, php4 and php5 on my server.
I use virtual host in this server. The virtual host have or not PHP4 using:
php_admin_flag engine off/on in apache2.conf
How can i use PHP5 or PHP4 or both?
PHP4 is running as module and PHP5 is running as cgi.
Regards,
JP
attached mail follows:
Hi,
I am trying to build the latest stable release of php (4.3.10)
I've successfully compiled but when I run "make test"
the following are the two bugs that fail.
FAILED TEST SUMMARY
---------------------------------------------------------------------
Bug #24142 (round() problems) [ext/standard/tests/math/bug24142.phpt]
Bug #25694 (round() and number_format() inconsistency)
[ext/standard/tests/math/bug25694.phpt]
I've been searching for the past few days and haven't been able find any
resolution.
From looking at the Changelog for 4.3.10 http://www.php.net/ChangeLog-4.php
it shows that both of these bugs were fixed in the 4.3.10 release.
But still the tests fail?
Are the bugs fixed and the test case hasn't been updated?
My PHP app relies heavily on round().
Any insight into this issue is much appreciated.
Thanks,
Larry
attached mail follows:
Hello
For planning project I like simplistic design and scalability.
I describe business objects involved in the project and the processes
between them with plain text and schemas. Discuss them with the client. When he confirms these documents I write code according to this functional design/plan.
-----------------------------------------------------------------
http://gbg.bg/search - Èçïðîáâàéòå îùå ñåãà íàé-äîáðàòà áúëãàðñêà òúðñà÷êà!
attached mail follows:
Hello,
When I purchased a website template from templatemonster.com, they sent
the download link to my email, this link was active for only 2 or 3 days
then it became inactive.
Now I'm writing a script for selling website templates, the templates
are uploaded to a certain folder, when someone buys a template a
download link must be sent to his/her email address, and must be active
for only 2 or 3 days..
Anyone have an idea how to start or where to start?
Any link, any tutorial?
attached mail follows:
>On Fri, 25 Mar 2005 11:25:09 -0800, AN
S <php
anas.cc> wrote:
> Hello,
>
> When I purchased a website template from templatemonster.com, they sent
> the download link to my email, this link was active for only 2 or 3 days
> then it became inactive.
>
> Now I'm writing a script for selling website templates, the templates
> are uploaded to a certain folder, when someone buys a template a
> download link must be sent to his/her email address, and must be active
> for only 2 or 3 days..
>
> Anyone have an idea how to start or where to start?
> Any link, any tutorial?
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
A quick outline:
when a user purchases something, enter an unique string (try
md5(microtime()) although it's not completely unique) into the
database.
make a script that verifies the string...
verify.php?unique=12345............&user=johndoe
in verify.php you'd have something that compares $_GET['unique'] to
the database value, same with $_GET['user']
Then if that's good, send the download link. However, I would use
headers for downloads. By doing this you can place your template files
outside your web directory, which will make it more secure, obviously.
if you know how to use pear then i suggest using http_download. if you
don't, have a look at the fpassthru bit in the manual.
http://www.php.net/fpassthru
hth... it was a bit too simple but you have the general idea now :D
attached mail follows:
On Friday 25 March 2005 14:25, AN
S wrote:
> Hello,
>
> When I purchased a website template from templatemonster.com, they sent
> the download link to my email, this link was active for only 2 or 3 days
> then it became inactive.
>
> Now I'm writing a script for selling website templates, the templates
> are uploaded to a certain folder, when someone buys a template a
> download link must be sent to his/her email address, and must be active
> for only 2 or 3 days..
>
> Anyone have an idea how to start or where to start?
> Any link, any tutorial?
http://www.oscommerce.com has what you need.
--
Win a Vespa Scooter or a Dell Gift Card worth $3,000.00
http://www.morningstarcom.net/raffle-contest.php
--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
MailScanner thanks transtec Computers for their support.
attached mail follows:
Use unset()
unset($_GET['item']);
unset($_GET['ac2']);
if you want to destroy the value and its name in the same $_GET array.
or unset($item); if you want to destroy another variable, not related to
$_GET
You can use the same with $_POST...
Devta.
>IHow Can I destroy some variable that I pass by url, exmple:
>http://webadmin/paginas/personalidades.php?ac2=delete&item=18#
>then when i get the varibale ac2 and item, I want to delete the value of
>this variable.
>how can I do?
>
___________________________________________________
Yahoo! Messenger - Nueva versión GRATIS
Super Webcam, voz, caritas animadas, y más...
http://messenger.yahoo.es
attached mail follows:
on a side note, for devs, i don't really like how you can override the
values of the $_GET (or $_POST) array, seems like it could be a
security threat. Also, with that ability, you can never tell
(especially if you are making a mod, etc for a larger system) if what
your dealling with is the ACTUAL $_GET vars or something injected
later in the code.
On Fri, 25 Mar 2005 10:35:30 +0100, listas
uakari.com <listas
uakari.com> wrote:
> Use unset()
>
> unset($_GET['item']);
> unset($_GET['ac2']);
>
> if you want to destroy the value and its name in the same $_GET array.
>
> or unset($item); if you want to destroy another variable, not related to
> $_GET
>
> You can use the same with $_POST...
>
> Devta.
>
> >IHow Can I destroy some variable that I pass by url, exmple:
> >http://webadmin/paginas/personalidades.php?ac2=delete&item=18#
> >then when i get the varibale ac2 and item, I want to delete the value of
> >this variable.
> >how can I do?
> >
>
> ___________________________________________________
>
> Yahoo! Messenger - Nueva versión GRATIS
>
> Super Webcam, voz, caritas animadas, y más...
>
> http://messenger.yahoo.es
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
attached mail follows:
watch out for SQL injection attacks on that one though:
what if the 'user' went to "page.php?start=1;SELECT * from `mysql`;
On Thu, 24 Mar 2005 22:55:01 +0100, pavel <pavel
ogi.cz> wrote:
> > I am wanting to paginate records from a MySQL Database.
> > I want there to be 5 records on a page, on multiple pages.
>
> example for selecting page of records from mysql table:
> $sql=sprintf("
> SELECT SQL_CALC_FOUND_ROWS * FROM table LIMIT %d, %d",
> $position*$records,
> $records
> );
>
> after get count of all records:
> $sql='SELECT FOUND_ROWS()';
>
> > (I would like there to be a "next" and "previous.")
>
> you can use http://pear.php.net/package/Pager
>
> --
> Pavel Vrany
> http://ogi.cz/
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
attached mail follows:
Hi there,
I want to install Turck MMCasche. The install instructions say that the path to
the php install has to be declared. Now I was searching the linux system for the
php install but could not find it! It is compiled as a module and there is a
file /usr/local/bin/php but no directory.
The instructions read:
Step 1. Compiling Turck MMCache
export PHP_PREFIX="/usr"
$PHP_PREFIX/bin/phpize
./configure --enable-mmcache=shared --with-php-config=$PHP_PREFIX/bin/php-config
make
You must specify the real prefix where PHP is installed in the "export" command.
It may be "/usr" "/usr/local", or something else.
Can anybody point me into the right [dir]ections?
Thank you in advance,
Merlin
attached mail follows:
On Friday 25 March 2005 19:03, Merlin wrote:
> I want to install Turck MMCasche. The install instructions say that the
> path to the php install has to be declared. Now I was searching the
> linux system for the php install but could not find it! It is compiled
> as a module and there is a file /usr/local/bin/php but no directory.
>
> The instructions read:
>
> Step 1. Compiling Turck MMCache
>
> export PHP_PREFIX="/usr"
> $PHP_PREFIX/bin/phpize
> ./configure --enable-mmcache=shared
> --with-php-config=$PHP_PREFIX/bin/php-config make
>
> You must specify the real prefix where PHP is installed in the "export"
> command. It may be "/usr" "/usr/local", or something else.
In your case you have to set PHP_PREFIX to '/usr/local', and before you
can proceed you must make sure you have the file '/usr/local/bin/phpize'.
--
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
------------------------------------------
New Year Resolution: Ignore top posted posts
attached mail follows:
[snip]
> /* send the errors to the interface and exit*/
> if('' !== $errorsReported){
> for($i = 0; $i < count($errorsReported); $i++){
> echo $errorsReported[$i];
> }
unset($errorsReported);
print_r($errorsReported);
> } else {
> /* reload the empty interface */
a quick echo statement here to check that this block is running when
you expect it to might tell you something... but you have probably
already plastered your code with echo/print statements to determine the
flow :-)
[/snip]
Well, the array still appears, it is empty and unset (see modified code
above) does not get rid of it. Here is how it comes back ....
Array ( [0] => [1] => [2] => [3] => )
attached mail follows:
How should I formulate the header function to replace the current frameset
page with a new one? I have tried a combination of header("Location:
page.php target=_parent"); but I get an error message saying the page does
not exist.
Also, can I save a frameset page with a .php extension? I have tried it out
and it seems to work. Maybe perhaps I should not do this as there may be
some implications later on???
Regards
Jacques
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]