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 Mark Forums Read
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 04-18-2009, 03:51 PM   #1
Killswitch - BANNED FOR LIFE
Guest
 
Posts: n/a
I'm board, ask me PHP related questions.

I'm bored, it's Saturday night and I'm home trying to force myself to work, but I don't want too.. So help me get in the mood and ask me any PHP related question, and I'll answer as best as I can.
  Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 04-18-2009, 03:55 PM   #2
Killswitch - BANNED FOR LIFE
Guest
 
Posts: n/a
Fuck, and I just noticed I spelled bored, board...
  Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 04-18-2009, 03:56 PM   #3
candyflip
Carpe Visio
 
candyflip's Avatar
 
Industry Role:
Join Date: Jul 2002
Location: New York
Posts: 43,061
What are your rates?
__________________

Spend you some brain.
Email Me
candyflip is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 04-18-2009, 04:03 PM   #4
Serge Litehead
Confirmed User
 
Serge Litehead's Avatar
 
Industry Role:
Join Date: Dec 2002
Location: Behind the scenes
Posts: 5,190
have you found a use for its new goto function?)
__________________
Serge Litehead is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 04-18-2009, 04:06 PM   #5
borked
Totally Borked
 
borked's Avatar
 
Industry Role:
Join Date: Feb 2005
Posts: 6,284
Why is needle/haystack not consistent in logical order?
__________________

For coding work - hit me up on andy // borkedcoder // com
(consider figuring out the email as test #1)



All models are wrong, but some are useful. George E.P. Box. p202
borked is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 04-18-2009, 04:06 PM   #6
bo$$
Confirmed User
 
bo$$'s Avatar
 
Join Date: Feb 2009
Location: The bank
Posts: 235
When I display an echo only executed with an if statements on the same page, it seems like that echo is on the page BEFORE I execute the code (for example, age verification validation)

Like this:

PHP Code:
<?php
$age 
$_GET['age']
if (
$age 18)
{
echo 
"your too young";
}
?>
<form action="penis.php" method="get">
<input type="text" name="age" />
<input type="submit" />
If I were to go to /penis.php, the echo would be displayed.

How the fuck do I do this?

Im new to php..

Last edited by bo$$; 04-18-2009 at 04:07 PM..
bo$$ is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 04-18-2009, 04:09 PM   #7
StuartD
Sofa King Band
 
StuartD's Avatar
 
Join Date: Jul 2002
Location: Outside the box
Posts: 29,903
Quote:
Originally Posted by borked View Post
Why is needle/haystack not consistent in logical order?
that always gets me
StuartD is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 04-18-2009, 04:12 PM   #8
Killswitch - BANNED FOR LIFE
Guest
 
Posts: n/a
Quote:
Originally Posted by candyflip View Post
What are your rates?
Not really looking to take on anything as I got products of my own to put out, along with my own projects, but if you want hit me up depending on what you need done, we can work something out.

Quote:
Originally Posted by holograph View Post
have you found a use for its new goto function?)
Never really used the function to be honest.

Quote:
Originally Posted by borked View Post
Why is needle/haystack not consistent in logical order?
Good question, but I don't know that answer.

Quote:
Originally Posted by bo$$ View Post
When I display an echo only executed with an if statements on the same page, it seems like that echo is on the page BEFORE I execute the code (for example, age verification validation)

Like this:

PHP Code:
<?php
$age 
$_GET['age']
if (
$age 18)
{
echo 
"your too young";
}
?>
<form action="penis.php" method="get">
<input type="text" name="age" />
<input type="submit" />
If I were to go to /penis.php, the echo would be displayed.

How the fuck do I do this?

Im new to php..
Because if $_GET['age'] isn't defined via penis.php?age=12 then technically $age returns as 0, which is lower then 18, therefor your echo is executed. Best way would be to do this:

PHP Code:
<?php
$age 
$_GET['age']
if (!empty(
$age) && ($age 18))
{
echo 
"your too young";
}
?>
<form action="penis.php" method="get">
<input type="text" name="age" />
<input type="submit" />
  Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 04-18-2009, 04:13 PM   #9
majortom
Confirmed User
 
Industry Role:
Join Date: Mar 2004
Location: SEA
Posts: 445
Thanks for the proposed help.
Hey, I got a CMS (updatem.com url defunct now) from 2005 running my member's area updates.
It works great, I couldn't live without it.

My questions are: is the script still secured to use, even though we are now at PHP5.something? Should it be reviewed/rewritten?

Thanks in advance for your time
MajorTom
__________________
Divers Do It Deeper !!!
majortom is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 04-18-2009, 04:15 PM   #10
Killswitch - BANNED FOR LIFE
Guest
 
Posts: n/a
Quote:
Originally Posted by majortom View Post
Thanks for the proposed help.
Hey, I got a CMS (updatem.com url defunct now) from 2005 running my member's area updates.
It works great, I couldn't live without it.

My questions are: is the script still secured to use, even though we are now at PHP5.something? Should it be reviewed/rewritten?

Thanks in advance for your time
MajorTom
All depends on how the code is written, if it works fine in PHP5 and doesn't have errors, and is written properly then you're good.
  Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 04-18-2009, 04:19 PM   #11
rowan
Too lazy to set a custom title
 
Join Date: Mar 2002
Location: Australia
Posts: 17,393
Quote:
Originally Posted by borked View Post
Why is needle/haystack not consistent in logical order?
Hate that, I'm constantly loading up the php reference site to check... even worse, some functions will quietly fail without complaint if you supply a string then array when it should have been array then string.
rowan is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 04-18-2009, 04:38 PM   #12
u-Bob
there's no $$$ in porn
 
u-Bob's Avatar
 
Industry Role:
Join Date: Jul 2005
Location: icq: 195./568.-230 (btw: not getting offline msgs)
Posts: 33,063
Your opinion on the difference in speed between switch and if when comparing a string against several regex's?
u-Bob is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 04-18-2009, 04:45 PM   #13
Killswitch - BANNED FOR LIFE
Guest
 
Posts: n/a
Quote:
Originally Posted by u-Bob View Post
Your opinion on the difference in speed between switch and if when comparing a string against several regex's?
I don't see much of a difference, I personally use if/elseif but I've also been told by many that Switch is better...
  Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 04-18-2009, 04:52 PM   #14
KRosh
So Fucking Outlawed
 
KRosh's Avatar
 
Industry Role:
Join Date: Nov 2001
Posts: 5,114
Why does this work? Why does this show the email address?

#1

Code:
<?php
class person {
    private $email = ?foo?;
    function showEmail() {
        echo $this->email;
    }
}
class user extends person {}
$u = new user();
$u->showEmail();


but this doesn?t?

#2

Code:
<?php
class person {
    private $email = ?foo?;
}
class user extends person {
    function showEmail() {
        echo $this->email;
    }
}
$u = new user();
$u->showEmail();
Also, why does this work

#3

Code:
<?php
class person {
    private $email = ?foo?;
    function showEmail() {
        echo $this->email;
    }}
class user extends person {
    function showEmail() {
        parent::showEmail();
    }
}
$u = new user();
$u->showEmail();

__________________
ICQ 115433750
KRosh is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 04-18-2009, 04:58 PM   #15
Killswitch - BANNED FOR LIFE
Guest
 
Posts: n/a
Quote:
Originally Posted by KRosh View Post
Why does this work? Why does this show the email address?

#1

Code:
<?php
class person {
    private $email = ?foo?;
    function showEmail() {
        echo $this->email;
    }
}
class user extends person {}
$u = new user();
$u->showEmail();


but this doesn?t?

#2

Code:
<?php
class person {
    private $email = ?foo?;
}
class user extends person {
    function showEmail() {
        echo $this->email;
    }
}
$u = new user();
$u->showEmail();
Also, why does this work

#3

Code:
<?php
class person {
    private $email = ?foo?;
    function showEmail() {
        echo $this->email;
    }}
class user extends person {
    function showEmail() {
        parent::showEmail();
    }
}
$u = new user();
$u->showEmail();

PHP Code:
<?php
class person {
    var 
$email 'foo';
}
class 
user extends person {
    function 
showEmail() {
        echo 
$this->email;
    }
}
$u = new user();
$u->showEmail();
?>
  Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 04-18-2009, 05:00 PM   #16
quantum-x
Confirmed User
 
quantum-x's Avatar
 
Join Date: Feb 2002
Location: ICQ: 251425 Fr/Au/Ca
Posts: 6,863
Quote:
Originally Posted by KRosh View Post
Why does this work? Why does this show the email address?

#1

Code:
<?php
class person {
    private $email = ?foo?;
    function showEmail() {
        echo $this->email;
    }
}
class user extends person {}
$u = new user();
$u->showEmail();


but this doesn?t?

#2

Code:
<?php
class person {
    private $email = ?foo?;
}
class user extends person {
    function showEmail() {
        echo $this->email;
    }
}
$u = new user();
$u->showEmail();
Also, why does this work

#3

Code:
<?php
class person {
    private $email = ?foo?;
    function showEmail() {
        echo $this->email;
    }}
class user extends person {
    function showEmail() {
        parent::showEmail();
    }
}
$u = new user();
$u->showEmail();

These are all inheritance / overriding questions.
#1 works, because you're extending a class, but not overriding any functions - so the object $user has inherited all the properties and methods of person - basically, you've cloned it.

#2 doesn't work, because you've declared $email in the parent class as private. If you wanted to access that, you'd have to use something like the third method, using an accessor - ie parent::getEmail() - or declare the variable as public (not so good)
quantum-x is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 04-18-2009, 05:01 PM   #17
quantum-x
Confirmed User
 
quantum-x's Avatar
 
Join Date: Feb 2002
Location: ICQ: 251425 Fr/Au/Ca
Posts: 6,863
Quote:
Originally Posted by Killswitch View Post
PHP Code:
<?php
class person {
    var 
$email 'foo';
}
class 
user extends person {
    function 
showEmail() {
        echo 
$this->email;
    }
}
$u = new user();
$u->showEmail();
?>
Sure, but that's gone back to PHP4 style OOP...
quantum-x is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 04-18-2009, 05:02 PM   #18
Killswitch - BANNED FOR LIFE
Guest
 
Posts: n/a
Quote:
Originally Posted by quantum-x View Post
Sure, but that's gone back to PHP4 style OOP...
What do you suggest, using public instead of var?

I really don't see much difference with var or public.

protected $email = 'foo'; works also
  Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 04-18-2009, 05:09 PM   #19
Killswitch - BANNED FOR LIFE
Guest
 
Posts: n/a
Quote:
Originally Posted by Killswitch View Post
What do you suggest, using public instead of var?

I really don't see much difference with var or public.

protected $email = 'foo'; works also
I guess the only thing I can find that makes public better then var is in PHP6 var will be removed.
  Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 04-18-2009, 07:50 PM   #20
bo$$
Confirmed User
 
bo$$'s Avatar
 
Join Date: Feb 2009
Location: The bank
Posts: 235
Quote:
Originally Posted by Killswitch View Post
Not really looking to take on anything as I got products of my own to put out, along with my own projects, but if you want hit me up depending on what you need done, we can work something out.



Never really used the function to be honest.



Good question, but I don't know that answer.



Because if $_GET['age'] isn't defined via penis.php?age=12 then technically $age returns as 0, which is lower then 18, therefor your echo is executed. Best way would be to do this:

PHP Code:
<?php
$age 
$_GET['age']
if (!empty(
$age) && ($age 18))
{
echo 
"your too young";
}
?>
<form action="penis.php" method="get">
<input type="text" name="age" />
<input type="submit" />
Swayt !

Thanks bro
bo$$ is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 04-19-2009, 01:12 AM   #21
borked
Totally Borked
 
borked's Avatar
 
Industry Role:
Join Date: Feb 2005
Posts: 6,284
Quote:
Originally Posted by KRosh View Post
Why does this work? Why does this show the email address?

#1

but this doesn?t?

#2

Also, why does this work

#3




For understanding private/public/protected visibility, take a look at this OOP tutorial

http://www.brainbell.com/tutorials/php/TOC_oop.html
__________________

For coding work - hit me up on andy // borkedcoder // com
(consider figuring out the email as test #1)



All models are wrong, but some are useful. George E.P. Box. p202
borked is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 04-19-2009, 01:29 AM   #22
who
So Fucking Banned
 
Join Date: Aug 2003
Location: ICQ #23642053
Posts: 19,593
What does PHP stand for?
who is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 04-19-2009, 02:11 AM   #23
KRosh
So Fucking Outlawed
 
KRosh's Avatar
 
Industry Role:
Join Date: Nov 2001
Posts: 5,114
Quote:
Originally Posted by who View Post
What does PHP stand for?
used to mean personal home page until the release of php3

now it stands for Hypertext Preprocessor.

__________________
ICQ 115433750
KRosh is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 04-19-2009, 02:13 AM   #24
Socks
Confirmed User
 
Industry Role:
Join Date: May 2002
Location: Toronto
Posts: 8,475
Quote:
Originally Posted by who View Post
What does PHP stand for?
It means you haven't been paying much attention over your last 18,000 posts...
Socks is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 04-19-2009, 02:14 AM   #25
KRosh
So Fucking Outlawed
 
KRosh's Avatar
 
Industry Role:
Join Date: Nov 2001
Posts: 5,114
Quote:
Originally Posted by borked View Post
For understanding private/public/protected visibility, take a look at this OOP tutorial

http://www.brainbell.com/tutorials/php/TOC_oop.html
thanks for the link but,

He said he was bored so I thought I would give him a little something.

It was not a question I had, or anything I was working on, but merely something to take away boredom.


__________________
ICQ 115433750
KRosh is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 04-19-2009, 05:52 AM   #26
calmlikeabomb
Confirmed User
 
calmlikeabomb's Avatar
 
Join Date: May 2004
Location: SW Palm Bay, Florida
Posts: 1,323
Quote:
Originally Posted by KRosh View Post
Why does this work? Why does this show the email address?
#1

Code:
<?php
class person {
    private $email = “foo”;
    function showEmail() {
        echo $this->email;
    }
}
class user extends person {}
$u = new user();
$u->showEmail();
This works because the email property is within scope of the method accessing it.

Quote:
Originally Posted by KRosh View Post
but this doesn’t?
#2

Code:
<?php
class person {
    private $email = “foo”;
}
class user extends person {
    function showEmail() {
        echo $this->email;
    }
}
$u = new user();
$u->showEmail();
This doesn't work, because email is out of scope. If you set it to "protected" then extending classes will be able it inherit the email property.

Quote:
Originally Posted by KRosh View Post
Also, why does this work
#3

Code:
<?php
class person {
    private $email = “foo”;
    function showEmail() {
        echo $this->email;
    }}
class user extends person {
    function showEmail() {
        parent::showEmail();
    }
}
$u = new user();
$u->showEmail();
This works because, again the property is within scope of the method calling it.

Also, you shouldn't be defining properties like that. That should be done in the constructor. The only time you'd do that are with class constants.

http://www.php.net/construct
__________________
subarus.

Last edited by calmlikeabomb; 04-19-2009 at 05:55 AM..
calmlikeabomb is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 04-19-2009, 06:07 AM   #27
blazin
Confirmed User
 
Join Date: Aug 2002
Posts: 2,781
What's the best PHP framework?
__________________
I don't endorse a god damn thing......
blazin is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 04-19-2009, 08:34 AM   #28
nation-x
Confirmed User
 
nation-x's Avatar
 
Industry Role:
Join Date: Mar 2004
Location: Rock Hill, SC
Posts: 5,370
Quote:
Originally Posted by blazin View Post
What's the best PHP framework?
It depends on what you are trying to accomplish... if you want fast code... NONE. 99% of frameworks are slower than shit and personally, I think they complicate the development process more than they benefit. Frameworks are the tools of lazy programmers.

To clarify, any developer worth more than a penny should already have developed his own toolset of objects. I have my own and can develop complex/scalable applications very quickly because of it.

I could give a fuck less if another programmer thinks that developing apps in the latest OOP style using abstracted classes (like Zend Framework) is a good idea... I know from experience that apps built in that fashion run like shit. There is much more to consider, when building an app, than how fancy your code is.

Here is a super simple example of a framework I wrote and use alot. The one I actually use is alot more robust and secure... but, if you consider what it does, you will get the idea behind how I code applications.

http://www.phpclasses.org/browse/package/4963.html

Using this simple framework, you can build apps with SE friendly URLs where each URL is a seperate module, class and views. It is a little different than the MVC type of framework because I don't really like the Model/Controller model like you find in Zend Framework, Cake or Symphony. I also don't like template classes like Smarty, so I just use php in my templates. The simple beauty of this method is that, if I want to add new functionality, I don't even have to mess with any of the existing code except the bootstrap (index.php), where I add the includes. All I need to do is create a module class (memberModule.php), a class to handle functionality and my view templates. Any classes that I define in the bootstrap (like a database object), are available to the module... So I have a very scalable solution right from jump.
nation-x 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
Thread Tools



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.