php-general Digest 17 Jan 2006 08:04:03 -0000 Issue 3910
Topics (messages 228681 through 228702):
ÐÂÄê¿ìÀÖ!
228681 by: uzfbyuqew2
Best way to do this: www.domain.com?page=var
228682 by: Michael Hulse
228683 by: tg-php.gryffyndevelopment.com
228684 by: Michael Hulse
228685 by: Ray Hauge
228686 by: Ezra Nugroho
228687 by: M. Sokolewicz
228688 by: Michael Hulse
228689 by: Michael Hulse
228697 by: Steve Clay
PHP not seeing MySQL functions
228690 by: Jonathan Duncan
need help arranging files!
228691 by: Nicholas Couloute
228692 by: Michael Hulse
228693 by: Michael Hulse
228694 by: Nicholas Couloute
228696 by: Nicholas Couloute
Validating Radio Buttons in two directions
228695 by: HiFi Tubes
Re: help plz
228698 by: Ligaya Turmelle
Re: help plz [Books]
228699 by: Travis Doherty
Site down?
228700 by: Dotan Cohen
how 2 open File Browser window in PHP
228701 by: suresh kumar
228702 by: Aaron Koning
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 ---
让利银饰批发网::银饰批发::http://www.rangli.com
925纯银饰品,纯银手链,纯银吊坠,纯银手镯,戒指等上千种产品
每月更新在500款以上!出厂价格,同类产品价格最低,品质保证!
200元起批,300元免快递运费!
欢迎各大零售商、店主、淘宝易趣卖家前来批发,团购!
本站支持“支付宝支付”,购物零风险,验货后再付款(全国范围)
4:54:38
--- End Message ---
--- Begin Message ---
Hello,
What would be the best way to get a page variable like this:
www.domain.com?page=home
to show up when a user types in:
www.domain.com
My current fix is to have this:
header("Refresh: 0; URL=http://www.domain.com/start.php?page=home");
... on a index.php page on the root.
Is there a way I can do this and avoid having a page that just does
redirection?
Thanks for help.
Cheers,
Micky
--- End Message ---
--- Begin Message ---
On your web server you can configure 'default pages'. Apache and *nix type
servers seem to favor the "index.html" type default pages while Microsoft's IIS
goes for the "Default.htm" just to be different. But you can add default pages
to a list in the order you want them accepted.
For instance, if you use PHP a lot (which I think we all do :) but you have a
lot of directories that just have static HTML in them, you might have:
index.html
index.php
(or vice versa) as your default pages list. If it doesn't find any of those in
the directory being accessed, then you should get your good old 404 error.
Should just be a matter of adding "start.php" to your defaults list in whatever
priority order you want.
I think that'll do it for ya. If you're going through an ISP, they still may
have a way that you can set your defaults, possibly through .htaccess or some
other Apache type prefs setting mechanism.
Good luck!
-TG
= = = Original message = = =
Hello,
What would be the best way to get a page variable like this:
www.domain.com?page=home
to show up when a user types in:
www.domain.com
My current fix is to have this:
header("Refresh: 0; URL=http://www.domain.com/start.php?page=home");
... on a index.php page on the root.
Is there a way I can do this and avoid having a page that just does
redirection?
Thanks for help.
Cheers,
Micky
___________________________________________________________
Sent by ePrompter, the premier email notification software.
Free download at http://www.ePrompter.com.
--- End Message ---
--- Begin Message ---
On Jan 16, 2006, at 2:14 PM, <[EMAIL PROTECTED]> wrote:]
I think that'll do it for ya. If you're going through an ISP, they
still may have a way that you can set your defaults, possibly through
.htaccess or some other Apache type prefs setting mechanism.
Good luck!
Great! Thanks for the quick response, I really appreciate it. I had a
feeling it was a fix at the server level. :)
Cheers,
Micky
--- End Message ---
--- Begin Message ---
You could also check to see if $_GET['page'] contains a value, and if it does
not, then redirect it. Something like this:
if($_GET['page'] == ''){
header("Refresh: 0; URL=http://www.domain.com/start.php?page=home");
}
Granted that isn't validating the $_GET['page'] variable input for security,
but that should at least get you going. Also, that assumes that all your
pages use the GET query to specify which page they are on. If that's just
for the initial page, then you'd have to do some more qualification.
HTH
--
Ray Hauge
Programmer/Systems Administrator
American Student Loan Services
http://www.americanstudentloan.com
1.800.575.1099
On Monday 16 January 2006 03:14 pm, [EMAIL PROTECTED] wrote:
> On your web server you can configure 'default pages'. Apache and *nix type
> servers seem to favor the "index.html" type default pages while Microsoft's
> IIS goes for the "Default.htm" just to be different. But you can add
> default pages to a list in the order you want them accepted.
>
> For instance, if you use PHP a lot (which I think we all do :) but you have
> a lot of directories that just have static HTML in them, you might have:
>
> index.html
> index.php
>
> (or vice versa) as your default pages list. If it doesn't find any of
> those in the directory being accessed, then you should get your good old
> 404 error.
>
>
> Should just be a matter of adding "start.php" to your defaults list in
> whatever priority order you want.
>
>
> I think that'll do it for ya. If you're going through an ISP, they still
> may have a way that you can set your defaults, possibly through .htaccess
> or some other Apache type prefs setting mechanism.
>
> Good luck!
>
> -TG
>
>
> = = = Original message = = =
>
> Hello,
>
> What would be the best way to get a page variable like this:
>
> www.domain.com?page=home
>
> to show up when a user types in:
>
> www.domain.com
>
> My current fix is to have this:
>
> header("Refresh: 0; URL=http://www.domain.com/start.php?page=home");
>
> .. on a index.php page on the root..
>
> Is there a way I can do this and avoid having a page that just does
> redirection?
>
> Thanks for help.
> Cheers,
> Micky
>
>
> ___________________________________________________________
> Sent by ePrompter, the premier email notification software.
> Free download at http://www.ePrompter.com.
--- End Message ---
--- Begin Message ---
On Mon, 2006-01-16 at 14:20 -0800, Michael Hulse wrote:
> On Jan 16, 2006, at 2:14 PM, <[EMAIL PROTECTED]> wrote:]
> > I think that'll do it for ya. If you're going through an ISP, they
> > still may have a way that you can set your defaults, possibly through
> > .htaccess or some other Apache type prefs setting mechanism.
> >
> > Good luck!
>
> Great! Thanks for the quick response, I really appreciate it. I had a
> feeling it was a fix at the server level. :)
You probably want to check mod_rewrite.
http://httpd.apache.org/docs/1.3/mod/mod_rewrite.html
--- End Message ---
--- Begin Message ---
I'm confused...
why does everyone use a refresh??? According to me, that's not what a
refresh is supposed to be used for (!). Why don't use a
header('Location: http://www.domain.com/start.php?page=home'); for it?
It's more in-line with RFC's
- tul
Ray Hauge wrote:
You could also check to see if $_GET['page'] contains a value, and if it does
not, then redirect it. Something like this:
if($_GET['page'] == ''){
header("Refresh: 0; URL=http://www.domain.com/start.php?page=home");
}
Granted that isn't validating the $_GET['page'] variable input for security,
but that should at least get you going. Also, that assumes that all your
pages use the GET query to specify which page they are on. If that's just
for the initial page, then you'd have to do some more qualification.
HTH
--- End Message ---
--- Begin Message ---
On Jan 16, 2006, at 2:24 PM, Ezra Nugroho wrote:
You probably want to check mod_rewrite.
http://httpd.apache.org/docs/1.3/mod/mod_rewrite.html
Ah, looks useful! Thanks for link, reading about it now. :)
--- End Message ---
--- Begin Message ---
On Jan 16, 2006, at 3:27 PM, M. Sokolewicz wrote:
I'm confused...
why does everyone use a refresh??? According to me, that's not what a
refresh is supposed to be used for (!). Why don't use a
header('Location: http://www.domain.com/start.php?page=home'); for it?
It's more in-line with RFC's
Good point... I actually should start using Location instead... seems
to make more sense. Thanks for pointing that out. ;)
CHeers,
Micky
--- End Message ---
--- Begin Message ---
Monday, January 16, 2006, 5:14:49 PM, tg-php wrote:
> Should just be a matter of adding "start.php" to your defaults list in
> whatever priority order you want.
Apache's .htaccess:
DirectoryIndex start.php index.php index.html
In start.php:
// instead of redirecting, just set page
if (!isset($_GET['page'])) {
$_GET['page'] = 'home';
}
If, for some reason you /can't/ change the directory index page, make an
index.php with this:
// again, no redirect necessary
$_GET['page'] = 'home';
require('start.php');
Steve
--
http://mrclay.org/
--- End Message ---
--- Begin Message ---
I just got a new web server with RedHat Enterprise Linux 4 on it. It came
with MySQL 4.1.x and PHP 4.3.9 on it. I uninstalled the MySQL 4 and put
MySQL 5 on it. When I run a PHP script that has a DB connection in it I
get:
Fatal error: Call to undefined function: mysql_connect() in
/var/www/html/mysqltest.php on line 5
I check the PHPINFO and see:
Configure Command has '--with-mysql=shared,/usr'
And "dbx" supported databases has 'MySQL'
However, there is no MySQL section.
I checked in the '/etc/php.ini' file and see:
[MySQL]
mysql.allow_persistent = On
mysql.max_persistent = -1
mysql.max_links = -1
mysql.default_port =
mysql.default_socket =
mysql.default_host =
mysql.default_user =
mysql.default_password =
mysql.connect_timeout = 60
mysql.trace_mode = Off
What is missing that would keep me getting the missing functions error? I
restarted apache of course.
Thanks,
Jonathan
--- End Message ---
--- Begin Message ---
I need to know how to arrange files alphabetically in my directory when
I display it on the browser! I have it display the filename foreach that
exist is there a way to arrange by alphabet?
~Nick Couloute
co-owner/web Designer
SiDEkiCk2MuSiC.CoM
--- End Message ---
--- Begin Message ---
On Jan 16, 2006, at 5:21 PM, Nicholas Couloute wrote:
I need to know how to arrange files alphabetically in my directory
when I display it on the browser! I have it display the filename
foreach that exist is there a way to arrange by alphabet?
I would read the contents of the directory into an array, then use the
sort()[1] function.
Example code (wrote the below code so I could generate a dynamic html
drop-down menu):
...
...
...
$the_dir = opendir($file_path);
# Loop through directory and add files to array $html:
while ($file = readdir($the_dir)) {
# Check if it's a file, and it has a valid extension:
if(eregi("(\.html|\.htm|\.php|\.txt)$", $file)) {
# Add file to array $html:
$html[] = $file;
}
}
# Close the stream:
closedir($the_dir);
# Generate the drop-down menu:
if($html == null) { die("There are no files in this directory!"); } //
If no content is found, alert user.
...
...
...
From here, in your case, I would just apply one of the PHP sort
functions on the $html var and then print/echo your results from
there...
[1] http://us3.php.net/manual/en/function.sort.php
Hth,
Cheers,
Micky
--- End Message ---
--- Begin Message ---
On Jan 16, 2006, at 6:10 PM, Nicholas Couloute wrote:
I tried the script but it keeps saying it is not an array!
Hmm, I just set-it-up on my server:
http://www.ambiguism.com/php/readDirSort.php
Seems to work for me. Code:
$file_path = $_SERVER['DOCUMENT_ROOT'].'/php/test/';
$the_dir = opendir($file_path);
# Loop through directory and add files to array $html:
while ($file = readdir($the_dir)) {
# Check if it's a file, and it has a valid extension:
if(eregi("(\.pdf|\.html|\.htm|\.php|\.txt)$", $file)) {
# Add file to array $html:
$html[] = $file;
}
}
# Close the stream:
closedir($the_dir);
# Generate the drop-down menu:
if($html == null) { die("There are no files in this directory!"); } //
If no content is found, alert user.
sort($html);
foreach($html as $html => $value) {
echo '<br />'.$value;
}
Keep in mind, the above code is very minimal... you could probably
spend a bit of time making more secure/robust... I pulled it out of a
function I use.
You might want to read-up on sorting via PHP.net (in comments section)
for more robust user-defined functions...
Hth!
Cheers,
Micky
--- End Message ---
--- Begin Message ---
can any one help me out? plz
~Nick Couloute
co-owner/web Designer
SiDEkiCk2MuSiC.CoM
--- End Message ---
--- Begin Message ---
I figured it out! it runs on my pc but not on the web!
$fileroot = "amrs/$cat/";
foreach ($author = scandir($fileroot); as $author){
echo "$author";
}
???
~Nick Couloute
co-owner/web Designer
SiDEkiCk2MuSiC.CoM
--- End Message ---
--- Begin Message ---
I'm kind of a newbie so speak sllllooooowly.
I've got a problem with validating radio buttons that seems to be harder
than I think to solve. I've got ten items set up like this:
Green: <input type="Radio" name="color1" value="1" /> <input type="Radio"
name="color1" value="2" /> <input type="Radio" name="color1" value="3" />
and son on out to 10.
Then I've got Red: <input type="Radio" name="color2" value="1" /> and so on
out to ten again.
So I've got ten colors each with 10 radio buttons so that they can be ranked
from 1 to 10. The problem? Well, obviously, the user can only pick one
value in the row for each color. That part is simple. BUT I also need to
make sure that they only rank one color with the value "1" and, of course,
only one color can have "2" and so on. How do I validate this so that they
get a warning before they submit that user has picked more one color with
the same ranking?
An additional complication: They don't have to answer or rank all the
colors. All they really need to do is rank one color to copmplete the
question.
I created an array with the answers and then used array_count_values to find
out the frequency but that chokes on color rankings that are left blank.
How do I assure that only one color is ranked at any one value?
I hope my question makes sense. Any help will be appreciated.
Thanks in advance.
HiFi Tubes
a retro kinda' guy who values quality over convenience
--- End Message ---
--- Begin Message ---
I am also assuming you actually do know the basics of MySQL and PHP and
are looking for that next step - past the beginner stuff.
Ligaya Turmelle wrote:
I personally liked George Schlossnagle's book "Advanced PHP
Programming", published by Sams.
http://www.amazon.com/gp/product/0672325616/qid=1137394700/sr=2-1/ref=pd_bbs_b_2_1/104-0195316-0794320?s=books&v=glance&n=283155
suresh kumar wrote:
hi,
i am working as a web designer in PHP & Mysql.i
know the basics of PHP & Mysql,i want 2 become PHP
Expert,i am planning to buy one Book,but i dont know
which book 2 buy.plz give me info .
A.suresh
Send instant messages to your online friends
http://in.messenger.yahoo.com
--
life is a game... so have fun.
--- End Message ---
--- Begin Message ---
Ligaya Turmelle wrote:
> I personally liked George Schlossnagle's book "Advanced PHP
> Programming", published by Sams.
> I am also assuming you actually do know the basics of MySQL and PHP
> and are looking for that next step - past the beginner stuff.
I agree. I have seen this book alone take "coder" to developer.
It is not a beginner's book - but will help you get closer to expert
faster than a two foot stack of beginner level material (again, assuming
you "are looking for that next step....") Leave section five
(Extensions) until you are more experienced.
"High Performance MySQL" by Zawodny & Balling, O'Reilly -- not PHP
specific but essential if your MySQL databases will have heavy load on them.
Travis Doherty
Ligaya Turmelle wrote:
> I personally liked George Schlossnagle's book "Advanced PHP
> Programming", published by Sams.
>
> http://www.amazon.com/gp/product/0672325616/qid=1137394700/sr=2-1/ref=pd_bbs_b_2_1/104-0195316-0794320?s=books&v=glance&n=283155
>
>
> suresh kumar wrote:
>
>> hi,
>> i am working as a web designer in PHP & Mysql.i
>> know the basics of PHP & Mysql,i want 2 become PHP
>> Expert,i am planning to buy one Book,but i dont know
>> which book 2 buy.plz give me info .
>> A.suresh
>>
>> Send instant messages to your online friends
>> http://in.messenger.yahoo.com
>
>
--- End Message ---
--- Begin Message ---
I just noticed that http://www.io.org/~rasmus is down. Anybody else
remember this site?
Dotan Cohen
--- End Message ---
--- Begin Message ---
hi,
i dont know exact PHP code for how 2 open file browser window to uplad
file or an image plz help me.its very urgent.
A.suresh
Send instant messages to your online friends http://in.messenger.yahoo.com
--- End Message ---
--- Begin Message ---
Please attempt to search www.php.net first for this information.
A search for 'file uploads' reveals what you want:
http://ca.php.net/features.file-upload
Aaron
On 1/16/06, suresh kumar <[EMAIL PROTECTED]> wrote:
>
> hi,
> i dont know exact PHP code for how 2 open file browser window to
> uplad file or an image plz help me.its very urgent.
> A.suresh
>
> Send instant messages to your online friends http://in.messenger.yahoo.com
>
--- End Message ---