GoFuckYourself.com - Adult Webmaster Forum

GoFuckYourself.com - Adult Webmaster Forum (https://gfy.com/index.php)
-   Fucking Around & Business Discussion (https://gfy.com/forumdisplay.php?f=26)
-   -   PHP people... Quick question on why this no longer works... (https://gfy.com/showthread.php?t=895243)

V_RocKs 03-22-2009 12:42 PM

PHP people... Quick question on why this no longer works...
 
This code used to work... Then my host upgraded my PHP and now it lo longer works... Pooh pooh!

Code:

if ($cmd == 'go' && ($url && $title && $blogs && $types))

The variables $url, $title, $blogs and $types all are arrays.

Again, this used to work yesterday.... Now it doesn't.

PHP was 5.2.5 and is now 5.2.9.

HorseShit 03-22-2009 12:44 PM

how is your blog network doing?

Deej 03-22-2009 12:46 PM

After their upgrade, did they get apache up and running properly?

A simple upgrade 'shouldnt' effect an already working script

V_RocKs 03-22-2009 12:54 PM

After upgrade everything else worked... except for this particular script. For some reason it doesn't return TRUE anymore. I believe it has something to do with the variables being arrays...

Blog network is going good.

Babaganoosh 03-22-2009 01:06 PM

Did they enable safe mode when they upgraded?

woj 03-22-2009 01:15 PM

they probably disabled register_globals :2 cents:

V_RocKs 03-22-2009 01:16 PM

Ah... was a globals problem.

gornyhuy 03-22-2009 02:01 PM

In case anyone is keyword searching, there actually is a backward-INcompatible change from PHP4.X to php5.X involving arrays.

In php5 If you don't explicitly declare a variable as an array and then later you try to use certain array functions on it (slice, splice, etc), it will not work.

I learned this the hard way when I upgraded a dedicated box with a bunch of legacy php code on it.

V_RocKs 03-23-2009 06:04 PM

Quote:

Originally Posted by gornyhuy (Post 15660024)
In case anyone is keyword searching, there actually is a backward-INcompatible change from PHP4.X to php5.X involving arrays.

In php5 If you don't explicitly declare a variable as an array and then later you try to use certain array functions on it (slice, splice, etc), it will not work.

I learned this the hard way when I upgraded a dedicated box with a bunch of legacy php code on it.

Thanks for the heads up!

Tempest 03-23-2009 06:17 PM

Quote:

Originally Posted by V_RocKs (Post 15659790)
This code used to work... Then my host upgraded my PHP and now it lo longer works... Pooh pooh!

Code:

if ($cmd == 'go' && ($url && $title && $blogs && $types))

The variables $url, $title, $blogs and $types all are arrays.

Again, this used to work yesterday.... Now it doesn't.

PHP was 5.2.5 and is now 5.2.9.

You should also write the code cleaner by using things like isset($url) instead of the way you're doing it.. Doing it the way you're doing it is going to be throwing a lot of errors you just don't see (unless you set the error reporting higher) but that could very well be being logged to the server error log. I learned that the hard way when I had a log filling up my disk space on a small virtual acount.

By the way.. If you ever want to source out your programming, I'd be interested in doing some of your stuff..

2012 03-23-2009 06:22 PM

coding the phps
 
($url && $title && $blogs && $types)

that must be returning true

why not maybe change to

if($cmd == 'go' ){
if($url==true && $title==true && $blogs==true && $types==true){}
}
?

calmlikeabomb 03-23-2009 06:32 PM

This thread makes my balls hurts.

If they are arrays you should first check to make sure that's indeed what they are.

http://php.net/is_array

Also, try using a switch instead of a null else or long ass if-elseif-else chain.

http://php.net/switch

I'm happy the code you posted here fails :error

2012 03-23-2009 06:35 PM

echo 'help me' . '<BR>' ;
echo 'help meeeeeeeeeeeeeeeeeeeeeeeeeeeeeee' ;

2012 03-23-2009 06:37 PM

Quote:

Originally Posted by calmlikeabomb (Post 15664700)

I'm happy the code you posted here fails :error

how nice of you :thumbsup

Tempest 03-23-2009 06:48 PM

Quote:

Originally Posted by calmlikeabomb (Post 15664700)
This thread makes my balls hurts.

If they are arrays you should first check to make sure that's indeed what they are.

http://php.net/is_array

Also, try using a switch instead of a null else or long ass if-elseif-else chain.

http://php.net/switch

I'm happy the code you posted here fails :error

switch is for pussies... you're not a real programmer unless your code is unreadable.

2012 03-23-2009 06:49 PM

Quote:

Originally Posted by Tempest (Post 15664739)
switch is for pussies... you're not a real programmer unless your code is unreadable.

no shit homie, don't you know they just re-instated the "goto" statement. Get with the times loser :helpme Your point in mute

Killswitch - BANNED FOR LIFE 03-23-2009 06:57 PM

if ($_GET['cmd'] == 'go' && (($_GET['url'] && $_GET['title']) && ($_GET['blogs'] && $_GET['types'])))

Win.

calmlikeabomb 03-23-2009 07:00 PM

^ That's a fail, because it'd require the array to be passed via the url.

Unless you're assigning an array to $_GET, which in case would also be a fail.

Plus you're still not checking to see if the variables are arrays. Wouldn't you want to do that before any processing occurs?

calmlikeabomb 03-23-2009 07:04 PM

I want to know what url, title, blogs, and types variable are part of so i can see the big picture. Wtf, does your script do.

2012 03-23-2009 07:09 PM

Quote:

Originally Posted by Killswitch (Post 15664774)
if ($_GET['cmd'] == 'go' && (($_GET['url'] && $_GET['title']) && ($_GET['blogs'] && $_GET['types'])))

Win.

Quote:

Originally Posted by calmlikeabomb (Post 15664782)
^ That's a fail, because it'd require the array to be passed via the url.

Unless you're assigning an array to $_GET, which in case would also be a fail.

Plus you're still not checking to see if the variables are arrays. Wouldn't you want to do that before any processing occurs?

Quote:

Originally Posted by calmlikeabomb (Post 15664792)
I want to know what url, title, blogs, and types variable are part of so i can see the big picture. Wtf, does your script do.

http://www.gofuckyourself.com/showpo...00&postcount=9

Tempest 03-23-2009 07:42 PM

Quote:

Originally Posted by fartfly (Post 15664745)
no shit homie, don't you know they just re-instated the "goto" statement. Get with the times loser :helpme Your point in mute

When I heard that I was exstatic... almost ended up with a cum stain...

Voodoo 03-23-2009 08:28 PM

This works. I'm not sure if it's proper for what you're doing or not, but maybe it helps.
Code:

$cmd=$_GET['cmd'];
$url=$_GET['url'];
$title=$_GET['title'];
$blogs=$_GET['blogs'];
$types=$_GET['types'];
$check=is_string($url)&&($title)&&($blogs)&&($types);

if(($cmd=='go')&&($check != FALSE)){
        echo "YAY!";
}else{
        echo "BOOO!";
}


Why 03-23-2009 08:45 PM

VooDoo, wtf you been up to lately man? good to see your still kickin.

NaughtyRob 03-23-2009 08:49 PM

Fucking geeks....

http://www.izzatz.com/images/geeks-tshirt-for-girls.jpg

J/K I wish I knew php

http://tornpaige.files.wordpress.com/2008/02/geek2.jpg

uno 03-23-2009 11:37 PM

Quote:

Originally Posted by fartfly (Post 15664745)
no shit homie, don't you know they just re-instated the "goto" statement. Get with the times loser :helpme Your point in mute

I'm on a grammar kick. Moot, not mute.


All times are GMT -7. The time now is 02:39 AM.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123