HDFilmMaker2112
-
Posts
547 -
Joined
-
Last visited
Never
Posts posted by HDFilmMaker2112
-
-
Then let's try using that output to your advantage. This should work, assuming you've described the directory structure properly. See what happens with this code.
And why did you add square brackets to the $files1, $files2 and $files3 assignments?
works perfectly like that... just removed the echos and now it's absolutely perfect. Thanks.
-
It displays this:
/home/zyquo/public_html/ghosthuntersportal.com
-
From your description, I think this is what you're after. Using a single dot signifies a path relative to the current directory, whereas a double dot indicates one directory above the current directory.
$files1[] = glob("../*.php"); $files2[] = glob("../includes/*.php"); $files3[] = glob("../images/*");
Still no luck. Any other ways to accomplish this without glob()?
-
It's "elseif" not "else if"
correct... I just copied what was there and altered it slightly. Didn't look to see if everything was correct.
-
$home = ""; $how = ""; $signup = ""; $offers = ""; $friends = ""; $login = ""; $register = ""; if ($_GET['page'] == "home") { include "page_name.ext"; } else if ($_GET['page'] == "how") { include "page_name.ext"; } ect.
-
my full path to the folder is public_html/ghosthuntersportal.com/sub-folders
the code is contained in func.php which is in the includes sub-folder.
If I do:
glob("*.php");
Wouldn't it assume I'm looking for php files in the sub-folder the script is contained in? and not the main folder.
-
$files1[] = glob("./ghosthuntersportal.com/*.php"); $files2[] = glob("./ghosthuntersportal.com/includes/*.php"); $files3[] = glob("./ghosthuntersportal.com/images/*"); $files[]=array_merge($files1, $files2, $files3); if(is_array($files) && count($files) > 0) { foreach($files as $file) { $filetime[]=filemtime($file); } } $filetime=max($filetime); $lastupdated="Last Updated: ".date ("F j, Y", $filetime);
This returns the below:
Warning: filemtime() [function.filemtime]: stat failed for Array in /home/zyquo/public_html/ghosthuntersportal.com/includes/func.php on line 27
-
You're sending a string to the max() function. When only one parameter is sent to max(), it must be an array. This is because of the way you're assigning the value: $filetime = should be filetime[] =.
Added the [] results in this:
Warning: max() [function.max]: Array must contain at least one element in /home/zyquo/public_html/ghosthuntersportal.com/includes/func.php on line 33
The $files Array seems to be blank.
-
On a *nix host, you can exec this:
find . -type f -printf '%TY-%Tm-%Td %TT %p\n' | sort -r | head -n 1
Replace the "." with whatever the parent directory is of the tree you need to check. I'd probably do something like this:
$lastchanged = `/usr/bin/find /path_to_search -type f -printf '%TY-%Tm-%Td %TT %p\n' | /usr/bin/sort -r | /usr/bin/head -n 1`;
Keep in mind that this is going to scan the filesystem everytime it's called, so if this is a large tree, that could be some substantial IO. The filesystem is not an indexed database. The results you get are going to look like this:
2011-06-11 12:42:55.0000000000 /home/david/foo.txt
So you would have to break the string into pieces but that is something done easily with explode.
I tried this just to check, error:
Warning: shell_exec() has been disabled for security reasons in /home/zyquo/public_html/ghosthuntersportal.com/includes/func.php on line 34
-
I came up with this:
$files1 = glob("./ghosthuntersportal.com/*.php"); $files2 = glob("./ghosthuntersportal.com/includes/*.php"); $files3 = glob("./ghosthuntersportal.com/images/*"); $files=array_merge($files1, $files2, $files3); if(is_array($files) && count($files) > 0) { foreach($files as $file) { $filetime=filemtime($file); } } $filetime=max($filetime); $lastupdated="Last Updated: ".date ("F j, Y", filemtime($filetime));
But I get this error:
Warning: Wrong parameter count for max() in /home/zyquo/public_html/ghosthuntersportal.com/includes/func.php on line 32
It returns a date of Last Updated: December 31, 1969.
-
Find the glob() function, but don't know if it's what I'm looking for...
-
Is there anyway to write a script that will find the file with the most recent file modified/uploaded date and return it?
I know I can use filemtime() to return the time from the specific file, but I need a way to find the last modified file.
-
I basically need something like this:
mysql_fetch_array(mysql_query("SELECT COUNT(product_id) AS num FROM products WHERE product_cat=(SELECT product_cat FROM products WITH LEAST SUM(product_id))"));
-
I'm looking to know how to tweak this query so it finds the one category with the fewest products in it.
mysql_fetch_array(mysql_query("SELECT COUNT(product_id) AS num FROM products"));
-
function_exists is looking for a string so it needs to be this:
function_exists('get_magic_quotes_gpc')
-
Narrowed down the issue to this:
function_exists(get_magic_quotes_gpc())
it returns false... any ideas why?
When I use
get_magic_quotes_gpc()
by itself it returns true.
-
I just checked to see when the slashes are added and they're placed in there prior to mysql_real_escape_string, which makes no sense.... the function is not called prior to that at all.
This is the form:
<form action="./product_process.php?do=add" method="post"> <p><label>Product Name:</label> <input type="text" name="product_name" size="30" /> <label>Product Price:</label> <input type="text" name="product_price" size="5" /> </p> <p><label>Product Code:</label> <input type="text" name="product_code" size="30" /></p> <p><label>Product Category:</label> <input type="text" name="product_category" size="30" /></p> <p><label>Product Link:</label><br /> <textarea name="product_link" rows="5" cols="30"></textarea> </p> <p><label>Product Image:</label> <input type="text" name="product_image" size="30" /></p> <p><label>Product Tag:</label> <input type="text" name="product_tag" size="30" /></p> <p><label>Product Keywords:</label> <input type="text" name="keyword" size="30" /></p> <p><label>Product Hightlights:</label><br /> <textarea name="product_highlights" rows="10" cols="60"></textarea> </p> <p><label>Product Features:</label><br /> <textarea name="product_features" rows="10" cols="60"></textarea> </p> <p><label>Product Pros:</label><br /> <textarea name="product_pros" rows="5" cols="30"></textarea> </p> <p><label>Product Cons:</label><br /> <textarea name="product_cons" rows="5" cols="30"></textarea> </p> <p><label>Product Description:</label><br /> <textarea name="product_description" rows="10" cols="60"></textarea> </p> <p><label>Product Notes:</label><br /> <textarea name="product_notes" rows="5" cols="30"></textarea> </p> <p><label>Product Specifications:</label><br /> <textarea name="product_specifications" rows="10" cols="60"></textarea> </p> <p><input type="submit" value="Submit" name="Submit" /></p> </form>
-
When I submit a product using my admin panel, the PayPal button has slashes added to escape the double quotes in the paypal button. It's also adding slashes to my apostrophes. I didn't think it was suppose to add slashes, or they should atleast be pulled out on insert into the database?
function sanitize($formValue){ if(function_exists(get_magic_quotes_gpc()) && get_magic_quotes_gpc()) { $formValue = stripslashes($formValue); } $formValue = mysql_real_escape_string($formValue); return $formValue; }
$product_link=sanitize($_POST['product_link']);
-
hmm... I made some changes to the code when I posted the thread, didn't think I changed anything to make it work; but most of. Solved.
-
I'm having an issue with this function:
function copyyear($setyear){ $year = date('Y'); $copyrightdate="© ".$setyear; if($year!=$setyear){ $copyrightdate.=" - ".$year.""; } return $copyrightdate; }
I'm echoing out the function here:
<?php echo copyyear("2011"); ?> Ghost Hunter's Portal, L.L.C.
This is resulting in:
"Ghost Hunter's Portal, L.L.C." with no date in front of it.
-
I'm looking for some good MySQL/MySQLi and PHP5.3 and PHP6 books to really delve into MySQL and the newer versions of PHP. Any suggestions?
-
Alright, come to this result:
SELECT $tbl_name.product_id , AVG($tbl_name3.review_product_rating) AS avg_rating FROM $tbl_name LEFT OUTER JOIN $tbl_name3 ON $tbl_name3.product_id = $tbl_name.product_id WHERE $tbl_name.product_category = '$cat' GROUP BY $tbl_name.product_id ORDER BY avg_rating
The above works perfectly for the basic product_category view. But when it comes to my search page it shows no results.
Here's the search mysql query:
$likeValues = "$tbl_name2.keyword LIKE '%" . implode("%' OR $tbl_name2.keyword LIKE '%", $keywords) . "%'"; $sql10000= "SELECT * FROM $tbl_name JOIN $tbl_name2 USING(product_id) WHERE $likeValues GROUP BY product_id ORDER BY $sort_by_selected2 LIMIT $start, $limit";
-
Would there be a way to simplify the following, so it's not got the while loop in it?
$sql_average_rating="SELECT product_id, (SUM(review_product_rating)/(COUNT(review_product_rating)-1)) AS review_product_rating FROM $tbl_name3 GROUP BY product_id"; $results_average_rating=mysql_query($sql_average_rating); while($row_average_rating=mysql_fetch_array($results_average_rating)){ extract($row_average_rating); $sql_insert_rating="UPDATE $tbl_name product_rating_average='$review_product_rating' WHERE product_id='$product_id'"; mysql_query($sql_insert_rating); }
-
I may need a sub-query. Basically I have a reviews table ($tbl_name3) which has product_id and review_product_rating. So there maybe 5 reviews for product_id "1", and 3 reviews for product_id "2"... I need to Average together the 5 reviews for product_id "1" and average together the 3 reviews for product_id "2" but not average together product_id "1" and product_id "2". So I need to average together the product's reviews independently of each other, and then ORDER the main query be those average values.
Need Some Help On Index Redirecting
in PHP Coding Help
Posted
Is the code you posted contained in the page "http://mucove.com/?os=changepass"?
Just as an example (you do NOT have to change the code to what I have, just checking I'm understanding you correctly), here's the way I have a site set-up.
In my contactus.php page I have:
Now I can get an URL of www.domainname.ext/index.php?page=contactus&do=showform