![]() |
![]() |
![]() |
||||
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. |
![]() ![]() |
|
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed. |
|
Thread Tools |
![]() |
#1 |
Confirmed User
Join Date: Nov 2009
Posts: 252
|
PHP Help Needed :)
Building a paid module for a custom tube script, but i'm getting this error
Notice: Undefined variable: paid in /home/nakedmov/public_html/xxx/video.php on line 179 Notice: Undefined variable: paid in /home/nakedmov/public_html/xxx/video.php on line 213 Line 179 to 187 PHP Code:
PHP Code:
Thanks ![]() |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#2 |
Confirmed User
Industry Role:
Join Date: May 2003
Posts: 3,765
|
dont think you use == for a boolean
try: if($paid = false)
__________________
flexx [dot] aeon [at] gmail |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#3 |
Confirmed User
Join Date: Nov 2009
Posts: 252
|
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#4 |
Confirmed User
Industry Role:
Join Date: Sep 2002
Posts: 1,209
|
I'm no expert, but that is wrong? You just assigned a value to $paid, which of course got rid of his PHP notices.
The PHP notices are displayed because $paid has no value set before the conditional.
__________________
Awesome cloud hosting by DigitalOcean |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#5 |
Available for Coding Work
Industry Role:
Join Date: Jun 2008
Posts: 1,435
|
PHP Code:
__________________
<developer> MechBunny ![]() ![]() Email: vlad [at] dangerouscoding.com Telegram: @dangerouscoding |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#6 |
So Fucking Banned
Industry Role:
Join Date: Jul 2010
Location: ☣
Posts: 9,327
|
PHP Code:
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#7 |
Confirmed User
Industry Role:
Join Date: May 2003
Posts: 3,765
|
if it's under an if condition it's not setting a value
__________________
flexx [dot] aeon [at] gmail |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#8 |
Confirmed User
Join Date: Nov 2009
Posts: 252
|
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#9 |
Making PHP work
Industry Role:
Join Date: Nov 2002
Location: 🌎🌅🌈🌇
Posts: 20,515
|
No it didn't.
Run these two scripts : <?php $paid = false; if($paid = false) { echo "This really works!"; } else { echo "No No No No!"; } ?> ------------- <?php $paid = false; if($paid == false) { echo "This really works!"; } else { echo "No No No No!"; } ?>
__________________
Make Money with Porn |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#10 |
Making PHP work
Industry Role:
Join Date: Nov 2002
Location: 🌎🌅🌈🌇
Posts: 20,515
|
stfu!
....
__________________
Make Money with Porn |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#11 | |
Confirmed User
Join Date: Oct 2002
Posts: 3,745
|
Quote:
The warning goes away because it's perfectly legal code, but it's also perfectly useless - it will always be true. To confirm, try this: $paid = 1; if ($paid = false) { echo "oops, wrong answer"; }
__________________
For historical display only. This information is not current: support@bettercgi.com ICQ 7208627 Strongbox - The next generation in site security Throttlebox - The next generation in bandwidth control Clonebox - Backup and disaster recovery on steroids |
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#12 | |
Making PHP work
Industry Role:
Join Date: Nov 2002
Location: 🌎🌅🌈🌇
Posts: 20,515
|
Quote:
<?php //$paid is not defined yet if($paid = false) { echo "paid is false"; } //$paid was set to false above if($paid == false) { echo "That's really FUCKED UP!!!!!!!!!!!!!!!!!!!!!!!!!!!"; } ?>
__________________
Make Money with Porn |
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#13 |
Available for Coding Work
Industry Role:
Join Date: Jun 2008
Posts: 1,435
|
You can also do this.
PHP Code:
__________________
<developer> MechBunny ![]() ![]() Email: vlad [at] dangerouscoding.com Telegram: @dangerouscoding |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#14 |
Confirmed User
Industry Role:
Join Date: May 2003
Posts: 3,765
|
haha holy shit. i apologize, i was wrong. rookie mistake. doing 3 other things. but...
from the dude that still uses tables??? gtfoh
__________________
flexx [dot] aeon [at] gmail |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#15 | |
Making PHP work
Industry Role:
Join Date: Nov 2002
Location: 🌎🌅🌈🌇
Posts: 20,515
|
Quote:
![]() I use tables because I know what the fuck I'm doing. ![]()
__________________
Make Money with Porn |
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#16 |
Confirmed User
Industry Role:
Join Date: Feb 2011
Location: Ontario, Canada
Posts: 1,026
|
Your original code should work fine. The problem seems to be getting the boolean value assigned to the variable in the first place. Your error message states "Undefined variable", meaning it probably has no value. Have you echo'd out the value of $paid before the if statement to see if it has any value or is NULL?
__________________
[email protected] ICQ: 269486444 ZoxEmbedTube - Build unlimited "fake" tubes with this easy 100% unencoded CMS! |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#17 |
Confirmed User
Industry Role:
Join Date: May 2003
Posts: 3,765
|
__________________
flexx [dot] aeon [at] gmail |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#18 |
Confirmed User
Industry Role:
Join Date: Oct 2007
Posts: 1,448
|
Yes, it does. Test it and see. PHP executes what's inside the brackets first, and since it successfully assigned $paid as false, the conditional passes.
__________________
xMarkPro -- Ultimate Blog Network Management Streamline your marketing operations. Centralize management of domains, pages, Wordpress blogs, sponsors, link codes, media items, sales and traffic statistics, plus more! |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#19 |
Confirmed User
Industry Role:
Join Date: Sep 2010
Location: Europe
Posts: 207
|
That is plain wrong. You're checking if the variable exists, not if the value is true or false.
-- The real solution: PHP Code:
PHP Code:
__________________
It's all just a strange dream.. |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#20 |
Too lazy to set a custom title
Industry Role:
Join Date: May 2004
Location: West Coast, Canada.
Posts: 10,217
|
Oh good lord.... lol.. The "proper" way.
Code:
if( !isset($page) || $page !== true ){ Code:
if( !isset($page) || $page != 1 ){ |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#21 |
Beer Money Baron
Industry Role:
Join Date: Jan 2001
Location: brujah / gmail
Posts: 22,157
|
Oh shit this is hilarious. Don't take code advice from GFY anymore!
__________________
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#22 |
Registered User
Industry Role:
Join Date: Aug 2008
Location: around...
Posts: 81
|
that was intense...
__________________
___ |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#23 |
Confirmed User
Industry Role:
Join Date: Jan 2010
Location: Europe
Posts: 1,327
|
Code:
if(empty($paid)){ if(isset($users_credits)){ if($credits > $users_credits){ $errors[] = 'Not enough credits for this action. Visit credits page from your profile to charge up your account!'; } } else { $errors[] = 'You need to login before you can watch this video'; } } Code:
$smarty->assign('paid', !empty($paid)?$paid:false);
__________________
icq: 395 294 346 http://www.adultsubmitter.eu - submit any adult site to 20 directories from 1 form! now 20 domains! http://www.porndeals.eu http://www.ebonybangbros.com |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#24 |
Too lazy to set a custom title
Join Date: Jan 2002
Location: Holland
Posts: 9,870
|
thats a lot of wrong adivce, next time ask you quetsion at www.stackoverflow.com
__________________
Don't let greediness blur your vision | You gotta let some shit slide icq - 441-456-888 |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#25 |
Confirmed User
Join Date: Feb 2007
Location: Sweden
Posts: 5,650
|
__________________
Free 🅑🅘🅣🅒🅞🅘🅝🅢 Every Hour (Yes, really. Free ₿itCoins.) (Signup with ONLY your Email and Password. You can also refer people and get even more.) |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#26 |
Confirmed User
Industry Role:
Join Date: Jul 2005
Location: icq#: 639544261
Posts: 1,965
|
The only guy on the thread who knows what he is talking about.
__________________
I'm out. |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#27 | |
Confirmed User
Join Date: Oct 2002
Posts: 3,745
|
Quote:
Hey it's about like us circa 1997.
__________________
For historical display only. This information is not current: support@bettercgi.com ICQ 7208627 Strongbox - The next generation in site security Throttlebox - The next generation in bandwidth control Clonebox - Backup and disaster recovery on steroids |
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#28 |
Confirmed User
Join Date: Nov 2009
Posts: 252
|
Damn guys i wont buy any shit you made...
Where's konrad ![]() |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#29 |
So Fucking Banned
Industry Role:
Join Date: Nov 2011
Posts: 995
|
First time I have seen code tags used here
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#30 |
Confirmed User
Join Date: Mar 2003
Location: Very small penis
Posts: 5,809
|
I'm just here for the cocks
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#31 |
Confirmed User
Industry Role:
Join Date: May 2003
Posts: 3,765
|
noooooo my bane is back from the dead!
![]() haha......wow. don't drink and code ![]()
__________________
flexx [dot] aeon [at] gmail |
![]() |
![]() ![]() ![]() ![]() ![]() |