
pkSML
Members-
Posts
191 -
Joined
-
Last visited
Everything posted by pkSML
-
If obsidian's code works, great! You work quite quickly, obsidian! If not, please post admin.php (or the file-saving portion of it). Then it can be tailored to do what I was explaining in my previous post.
-
Yes, make sure your path is right. Use an absolute path if necessary to the mp3 file. Example: "d:/uploads/whatever/whatever.mp3" You may need to use a special audio class to avoid clipping the file in the middle of an MP3 frame. This may cause the audio player problems with the beginning of the file. The best thing you can do is test your script in different players. You may also need to set the PHP execution timeout value in your script: set_time_limit(0); // Infinite value @dingus, you must live in Australia then, right?
-
If you want a unique number with guaranteed uniqueness for three complete years, just grab the last 8 digits from time(). After the three years' time, the likelihood of a duplicate is about 3 in 90 million. Is that good enough?!?
-
How are news clippings posted? To a script, or just with Notepad? If they're posted via a script, have an index file (like news_index.txt). This will be your mini-database. You could save each entry as Title|date|Author... Then the entries would all be listed chronologically. Then just grab the index file with file(), and parse each line. It's much quicker than making so many filesystem calls. If postings are just saved with Notepad, then this will be a little more complex.
-
This may not be the prettiest way to do it, but just have several complex if statements inside your while loop. Use global variables to keep track of the running totals.
-
Even with only 8 digits, there are approximately 4,294,967,296 possible combinations. Yes, that's over 4 billion. So, the chances of uniqueness are pretty high.
-
[SOLVED] $var = file('http... gives parse error
pkSML replied to johnnyboy's topic in PHP Coding Help
No problem. I didn't think PHP 4 was that much different from PHP 5! -
Yes, it's possible to rotate an image with GD. Here's plenty of links. --> http://pksml.net/search/php+gd+rotate+image Digging around in the PHP manual and searching Google, you'll find how to place an image on a canvas.
-
[SOLVED] $var = file('http... gives parse error
pkSML replied to johnnyboy's topic in PHP Coding Help
PHP Manual: "You can use a URL as a filename with this function if the fopen wrappers have been enabled." Possibly you can't open a remote location. Try file_get_contents for the URL. Maybe the problem is related to the fact that 'http://www.example.com/myfile.txt' is a non-existent URL. Try a real URL. -
Why don't you put the source from the site in a file. Then perform md5(file_get_contents("./source.txt")) and compare it to md5(file_get_contents("http://www.lifevstyle.com/rivalnyc/")) See what happens then.
-
You're welcome. You might take a look at the Abyss Web Server. It's much easier to figure out. It's what I use for all my sites -> http://24.145.130.71 (and, no, I'm not getting paid to say that Anyways, here's the exception: RewriteEngine on RewriteCond %{REQUEST_URI} !-f RewriteRule ^(.*)$ /index.php?$1 The condition tests to see if a file is requested (the Request_uri exists). If it doesn't the redirection will occur. See http://httpd.apache.org/docs/1.3/mod/mod_rewrite.html for much more info.
-
Yes, md5 is a function. See http://php.net/md5 You might use crc32() as well -> http://php.net/crc32 Just md5 or crc32 the string from your code and do the same for the file_get_contents string.
-
What you're wanting is a URL rewrite. They ask for some page, but get index.php to respond to the request. Here's a search for ya' -> http://pksml.net/search/apache+mod_rewrite+tutorial I recommend the first link. It's much more explanatory. Take some time to read it though. URL rewriting is rather complex --- not for the simple-minded. RewriteEngine on RewriteRule ^(.*)$ /index.php?$1 You might try this. This will redirect http://yoursite.com/cool/page.php -> http://yoursite.com/index.php?/cool/page.php Thus the page they're looking for will be held in the query string ($_SERVER['QUERY_STRING']). The page they're looking for should also be available as $_SERVER['REQUEST_URI'] already.
-
filesize() from PHP manual: So turn on error_reporting on to 2047. If you get a warning, the file probably doesn't exist. FYI: file_exists from PHP manual: You should have access to your directories, which are specified in safe_mode_include_dir. So, file_exists should work for you. Check for errors in your file path.
-
What you would do is this: Have two files: 1.php -- it will include 2.php, which is located in a different folder 2.php -- will print environmental array, server array... So, you load 1.php in your browser and see if you get a variable with the info you're looking for.
-
Newline characters and not sending emails out
pkSML replied to greenhawk117's topic in PHP Coding Help
#1: line 1 of $message should start with $message =, not $message .= #2: line 1 of $message - both variables in the string should be enclosed in braces, not single quotes --> {}, not ' ' Try fixing those and let us know if things work out. -
Right. Heredoc syntax , which can be read about at http://www.php.net/manual/en/language.types.string.php#language.types.string.syntax.heredoc , cannot contain anything else on the beginning line or the ending line. (The identifier is to be terminated with a newline.)
-
I don't know if that would be possible. PHP is invoked by the webserver after it has received a request for a file associated with the PHP parser. ***But***, for the server to answer the call, there must a valid host for which that server is set up to answer to (unless it is a default host). So by asking for forums.website.com, the server must have a host set up for this subdomain, otherwise all requests will be ignored. Try giving some more information about your setup, possible even the real URL. The more info given, the better chance you can be helped if there is a solution. BTW, the best servers out there perform this feature, so you're not excluding anybody by using server-level URL rewriting.
-
<img height='14' width='14' border='0' alt='' src='images/ad_delete.gif'> This image won't show? Jesirose is right: the problem is your path. The source (src) should be an absolute path (that starts with http://) or a relative path (which will start with a period or a slash). Your image begins with neither of those.
-
The answer is almost too easy... That is, if you have access to the $_SERVER['SERVER_NAME'] variable. At the beginning of your script, have this if statement. <?php if (stristr($_SERVER['SERVER_NAME'], "nextgenwt")) { // If we're on production server $path = "/homestead/"; } else { // If we're on localhost $path = "/"; // I don't know your localhost path, so you'll have to fill in this one } ?> Your links will look like this: <a href="<?php echo $path ?>remodel/">Remodel</a> This solution will work on both servers, and work on all the pages.
-
You can just use a relative path. For example, if they're at the kitchens/index.php page, your link to remodeling would be <a href="../remodeling/index.php">.
-
<?php $rpage = $_SERVER['SCRIPT_NAME']; $page = substr(($rpage),0,5); ?> <div id="ltnav"> <ul id="navleft"> <li<?php if(stristr($rpage, 'remodel')){echo " class=\"current\"";}?>> <a href="http://www.nextgenwt.com/homestead/remodel/">Remodel</a> </li> Great way to merge PHP with CSS! BTW, you may not want to use dashed lines separating your columns. It gets muddy with IE6 when scrolling.
-
What function to use to get the first day of the month ?
pkSML replied to jd2007's topic in PHP Coding Help
Here's how to get the first day of the current calendar month: <?php $day_of_week = date("l", mktime(0, 0, 0, date('n'), 1, date('Y'))); echo $day_of_week; ?> For August 2007, output is "Wednesday". See http://stephen.calvarybucyrus.org/misc/first_day_of_month.php