Welcome to the GoFuckYourself.com - Adult Webmaster Forum forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Post New Thread Reply

Register GFY Rules Calendar
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed.

 
Thread Tools
Old 03-20-2010, 11:41 PM   #1
Fucksakes
Shit... Fuck! What the Hell?
 
Fucksakes's Avatar
 
Industry Role:
Join Date: Dec 2003
Posts: 7,567
anything wrong with my code.. php

PHP Code:

    
if( file_exists$url.'/video.mp4') )
    {
        
$filename $url.'/video.mp4';
    } else {
        
$filename $url.'/video.flv';
    } 
Fucksakes is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 03-20-2010, 11:51 PM   #2
fatfoo
ICQ:649699063
 
Industry Role:
Join Date: Mar 2003
Posts: 27,763
Run...

__________________
Send me an email: [email protected]
fatfoo is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 03-20-2010, 11:53 PM   #3
Fucksakes
Shit... Fuck! What the Hell?
 
Fucksakes's Avatar
 
Industry Role:
Join Date: Dec 2003
Posts: 7,567
are you ok?
Fucksakes is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 03-20-2010, 11:56 PM   #4
fatfoo
ICQ:649699063
 
Industry Role:
Join Date: Mar 2003
Posts: 27,763
Are you a bot?
__________________
Send me an email: [email protected]
fatfoo is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 03-20-2010, 11:58 PM   #5
k0nr4d
Confirmed User
 
k0nr4d's Avatar
 
Industry Role:
Join Date: Aug 2006
Location: Poland
Posts: 9,228
looks ok.
k0nr4d is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 03-21-2010, 12:13 AM   #6
k0nr4d
Confirmed User
 
k0nr4d's Avatar
 
Industry Role:
Join Date: Aug 2006
Location: Poland
Posts: 9,228
no wait. You cant do file_exists on a url, only a linux path. I knew it was a trick question!
k0nr4d is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 03-21-2010, 12:18 AM   #7
munki
Do Fun Shit.
 
munki's Avatar
 
Industry Role:
Join Date: Dec 2004
Location: OC
Posts: 13,393
Quote:
Originally Posted by k0nr4d View Post
no wait. You cant do file_exists on a url, only a linux path. I knew it was a trick question!
I've run into a few issues on file_exists not working on big movie files also... I believe approaching 2-3 gb limits.
__________________

I have the simplest tastes. I am always satisfied with the best.” -Oscar Wilde
munki is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 03-21-2010, 12:44 AM   #8
AlCapone
Confirmed User
 
AlCapone's Avatar
 
Join Date: Sep 2003
Posts: 708
Looks like the beginnings of a tube script.
__________________
"You can get more with a kind word and a gun than you can with a kind word alone.”
AlCapone is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 03-21-2010, 12:53 AM   #9
AlCapone
Confirmed User
 
AlCapone's Avatar
 
Join Date: Sep 2003
Posts: 708
Code:
$url="http://www.site.com/video.flv";

$fp = fopen('$url', 'r');
if($fp) {
	$filename="$url";
	fclose($fp);
}
__________________
"You can get more with a kind word and a gun than you can with a kind word alone.”
AlCapone is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 03-21-2010, 08:05 AM   #10
fris
Too lazy to set a custom title
 
fris's Avatar
 
Industry Role:
Join Date: Aug 2002
Posts: 55,219
Quote:
Originally Posted by AlCapone View Post
Code:
$url="http://www.site.com/video.flv";

$fp = fopen('$url', 'r');
if($fp) {
	$filename="$url";
	fclose($fp);
}
thats really bad code
__________________
Since 1999: 69 Adult Industry awards for Best Hosting Company and professional excellence.


WP Stuff
fris is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 03-21-2010, 08:20 AM   #11
cyco_cc
Confirmed User
 
cyco_cc's Avatar
 
Join Date: Oct 2008
Posts: 344
Quote:
Originally Posted by fris View Post
thats really bad code
Yeah, there's no sense in using the resources to open the file just to check for its existence and also (I haven't done anything in PHP for years so I may be wrong) I think fopen() by default doesn't allow you to open up URLs for security reasons.

To the OP, as konrad said, replace the $url with the local FS path and it should be fine.
cyco_cc is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 03-21-2010, 08:23 AM   #12
k0nr4d
Confirmed User
 
k0nr4d's Avatar
 
Industry Role:
Join Date: Aug 2006
Location: Poland
Posts: 9,228
Quote:
Originally Posted by AlCapone View Post
Code:
$url="http://www.site.com/video.flv";

$fp = fopen('$url', 'r');
if($fp) {
	$filename="$url";
	fclose($fp);
}
Don't do this. Not only will this use a whole lot of ram, it will download the file over http first.
k0nr4d is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 03-21-2010, 08:41 AM   #13
MichaelP
Registered User
 
Industry Role:
Join Date: Aug 2003
Location: QWEBEC Corporate Office
Posts: 7,124
TRY :

$file = "full/server/path/to/file/video.mp4" ;
$url = "http://somedomain.com/" ;

IF (file_exists( $file)) {
$filename = $url/video.mp4';
} ELSE {
$filename = $url/video.flv';
}
MichaelP is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 03-21-2010, 09:15 AM   #14
Brujah
Beer Money Baron
 
Brujah's Avatar
 
Industry Role:
Join Date: Jan 2001
Location: brujah / gmail
Posts: 22,157
Code:
$filename = $url.'video.mp4';
$ch = curl_init($filename);

curl_setopt($ch, CURLOPT_NOBODY, TRUE);
curl_exec($ch);

$ret = curl_getinfo($ch, CURLINFO_HTTP_CODE);
if ($ret >= '400')
{
	$filename = $url.'video.flv';
}

curl_close($ch);
__________________
Brujah is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 03-21-2010, 09:27 AM   #15
CaptainHowdy
Too lazy to set a custom title
 
CaptainHowdy's Avatar
 
Industry Role:
Join Date: Dec 2004
Location: Happy in the dark.
Posts: 92,989
Quote:
Originally Posted by AlCapone View Post
Looks like the beginnings of a tube script.
__________________
FLASH SALE INSANITY! deal with a 100% Trusted Seller
Buy Traffic Spots on a High-Quality Network

1 Year or Lifetime — That’s Right, Until the Internet Explodes!
CaptainHowdy is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 03-21-2010, 06:25 PM   #16
fris
Too lazy to set a custom title
 
fris's Avatar
 
Industry Role:
Join Date: Aug 2002
Posts: 55,219
use file_exists works for local and url
__________________
Since 1999: 69 Adult Industry awards for Best Hosting Company and professional excellence.


WP Stuff
fris is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 03-21-2010, 06:52 PM   #17
rowan
Too lazy to set a custom title
 
Join Date: Mar 2002
Location: Australia
Posts: 17,393
Quote:
Originally Posted by k0nr4d View Post
Don't do this. Not only will this use a whole lot of ram, it will download the file over http first.
It's a strange way to do things, but I don't think it would download the entire file. At most it would read the response and a few K of data until the buffer becomes full.
rowan is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 03-21-2010, 07:36 PM   #18
Overload
Confirmed User
 
Overload's Avatar
 
Industry Role:
Join Date: Jul 2005
Location: Beck's City, North Teutonia
Posts: 3,185
Quote:
Originally Posted by CaptainHowdy View Post
edgar wallace?
__________________
There aren't enough faces and palms on this planet for an appropriate reaction to religion.
Overload is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 03-21-2010, 09:52 PM   #19
SomeCreep
:glugglug
 
SomeCreep's Avatar
 
Join Date: Mar 2003
Location: Where the Wild Things Are
Posts: 26,118
Quote:
Originally Posted by Fucksakes View Post
PHP Code:

    
if( file_exists$url.'/video.mp4') )
    {
        
$filename $url.'/video.mp4';
    } else {
        
$filename $url.'/video.flv';
    } 
Too much chinese, ching chang kling kong.
__________________

Webair Hosting

I use and recommend Webair for hosting.
SomeCreep is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Post New Thread Reply
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >

Bookmarks



Advertising inquiries - marketing at gfy dot com

Contact Admin - Advertise - GFY Rules - Top

©2000-, AI Media Network Inc



Powered by vBulletin
Copyright © 2000- Jelsoft Enterprises Limited.