mushroom
-
Posts
41 -
Joined
-
Last visited
Never
Posts posted by mushroom
-
-
There is no need to hide your page if you do it like this
<?php $allowed[]="xxx.xx.xx.xx"; # authorized ip's 1 per line # $allowed[]="xxx.xx.xx.xx"; # uncomment and/or add as many as you like $raddr=$_SERVER["REMOTE_ADDR"]; if (in_array($raddr,$allowed)) { # your code here # insert e-mail code if you need conformation } else { $myself="http://your_main_index.page"; # redirect page for all others header("Location: $myself"); } ?>
-
Mushroom, could you explain that code to me, and how it would help, thanks.
Thanks again
If you look at the line I quoted, there is a built in php function to do what you are asking.
http://ca.php.net/manual/en/function.in-array.php
-
I've stored some values in an array, and they are in a mysql database. I get the array back and find a value from it, and I want to test if that value is equal to something.
you may wish to incorporate this
if (in_array($your_value,$array))
-
I do a lot of php/mysql and find openSUSE the easiest to set up and manage.
-
i used gmdate("Y-m-d",time());
why it says 2008-06-05 ????? instead of 06-04??
gmdate() returns Greenwich Mean Time.
if you want local time use date()
-
yes, the table filled 600K of records already after 2 weeks. It may look like a lot, but each record is only a few integers, with no text so it's pretty fast. It will eventually overflow after about 4 billions records which is approx 20 years. I intended to keep a 3 years history.
Fairly slow then....
on the group I am tracking one particular IP generated 173M records in a month. ( a mail server)
A thing to remember is that the larger a table gets the slower it works.
I may be wise to only keep a month worth of data in a single table and create new table(s) for each month. this will minimize the slow down.
-
Hope this question entertain you guys.
I got a table called packet_log. As the name say it, it logs packets data in and out the gateway.
If you have any amount of traffic I would suggest a total rethink of your table structure, it will get way to big way to fast, I know. I wrote a suite for my local ISP to track usage on 9 subnets.
-
I do not see any "{}" with your if ,else statements
if (....) { code ; } else { code ; }
-
I tried sleep(x), but that hangs the http request til the sleep is finished as well.
I don't think you can avoid that, but you can finish the page.
after "</html>" and before sleep(x); add
ob_flush(); flush();
-
OK, there is no default php page in most Linux installs
I haven't used Fedora is quite some time but have download the latest and plan on looking at it in the near future.
For a development machine I recommend that you:
1. edit apache, to follow symlinks
2. edit php.ini to display all errors
3. give each project a directory in /home/your_user_name/public_html/
4. create a symlink to each project directory
-
I didn't know browsers had the ability to build arrays the same way php can ???
if they do, try designating each array value when[0], when[1], when[2], etc.
-
I have found that some functions do not work with compound variables.......
solution give the function a simple variable
$files=$files."/"; $total = total_size('$files');
-
If you have 4 elements in your array they are numbered by default 0,1,2,3 not 1,2,3,4
-
2) the script will read the file and set each line to a numbered variable.. eg:
the variable 1 would be set to the first line of text
the variable 2 would be set to the second line of text
and so on...
thanx in advanced
Note: variables can not start with a number. but it can be done with code some thing like this
$i=0; # open file # loop through file. {$var="varname".$i; $$var=$line; # read each line $i++; }
I have use this in the past, but now prefer to use arrays they are much easier to work with later.
# open file # loop through file. { $array_name[]=$line; # read each line }
-
If a table gets corrupted it may go into a locked state.
Some back up programs will lock tables while they do their work.
and ??
-
if ($submit_button=="other_option") { include("other_php_page"); # code for that button } elseif ($submit_button=="normal_option") { # code for that button } else { # code for no button }
-
I sounds like the job will have to be killed manually, apache restarted, or the server rebooted.
-
I most cases you can't "decrypt".
What is normally done is to encrypt the "word" with the same algorithm and compare it to the stored encrypted "word".
-
I would use
while($file = readdir($dir_handle)) {if($file[0] !=".") { $fileCount++; echo "$fileCount - $file<br />"; } }
-
"mysqldump" is for making an sql
mysql -u user_name -p password -h host_name_or_address data_base_name < /complete_path_and_name_file
if you transfer the file to the server
mysql -u user_name -p password data_base_name < /complete_path_and_name_file
-
irish21 is trying to use php variables outside of php
-
Did you restart apache? The php.ini file is only read when apache starts.
I do not use phpmyadmin for very large db's, I prefer to use the command line utilities in mysql "mysql" and "mysqldump". Some the stuff I work with runs into gigs.
-
Is Power a reserved word?
Have a look http://www.htmlite.com/mysql002a.php
-
"NULL" is a reserved word and can not be used as a field name!
Duplicate entry '0' for key 1
in MySQL Help
Posted
If "cat_id" is "AUTO_INCREMENT" there is no need to include in your second query at all, the field and value will fill in automatically.