1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Is this already PHP 7 Friendly?

Discussion in 'PHP' started by suwandichen13, Jun 6, 2018.

  1. #1
    is this PHP code is alright and PHP 7 friendly?

    <?php
    $qry		= preg_replace('/\/customlist.php\?/', '', $_SERVER['REQUEST_URI']);
    parse_str($qry, $output);
    $db_host	= 'localhost';
    $db_usr		= 'fbaba';
    $db_pwd		= 'test';
    $db_db		= 'test';
    $mysqli		= @new mysqli($db_host, $db_usr, $db_pwd, $db_db);
    function mysqli_result($res, $row, $field=0) { 
    	$res->data_seek($row); 
    	$datarow	= $res->fetch_array();
    	return $datarow[$field]; 
    }
    function parseUrl($url) {
    	$pieces	= parse_url($url);
    	$domain	= isset($pieces['host']) ? $pieces['host'] : '';
    	if (preg_match('/(?P<domain>[a-z0-9][a-z0-9\-]{1,63}\.[a-z\.]{2,6})$/i', $domain, $regs)) {
    		return $regs['domain'];
    	}
    	return false;
    }
    function makeRequest($url) {
    	$ch		= @curl_init($url);
    	@curl_setopt($ch, CURLOPT_TIMEOUT, 4);
    	@curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    	$result	= @curl_exec($ch);
    	@curl_close($ch);
    	return $result;
    }
    class alexa {
    	var $xml;
    	var $values;
    	var $alexa_address;
    	function alexa($alexa_address,$domain) {
    		$this->alexa_address	= $alexa_address;
    		$this->xml		= $this->get_data($domain);
    		$this->set();
    	}
    	function get_data($domain) {
    		$url	= $this->alexa_address.$domain;
    		$xml	= simplexml_load_file($url) or die('Cannot retrieve feed');
    		return $xml;
    	}
    	function set() {
    		$this->values['rank']		= isset($this->xml->SD[1]->POPULARITY)?$this->xml->SD[1]->POPULARITY->attributes()->TEXT:0;
    		$this->values['reach']		= ($this->xml->SD->REACH['RANK'] ? number_format($this->xml->SD->REACH['RANK']) : 0);
    		$this->values['linksin']	= ($this->xml->SD->LINKSIN['NUM'] ? number_format($this->xml->SD->LINKSIN['NUM']) : 0);
    	}
    	function get($value) {
    		return (isset($this->values[$value]) ? $this->values[$value] : '"'.$value.'" does not exist.');
    	}
    }
    function getAR($id, $val) {
    	global $mysqli;
    	$alexa_connector	= new alexa('http://data.alexa.com/data?cli=10&dat=snbamz&url=', $val);
    	$ar					= $alexa_connector->get('rank');
    	if ($ar != '') {
    		$sql	= "UPDATE `list` SET `AR` = '$ar' WHERE `ID` = '$id'";
    		$mysqli->query($sql);
    		return $ar;
    	}
    	else {
    		$sql	= "UPDATE `list` SET `AR` = '0' WHERE `ID` = '$id'";
    		$mysqli->query($sql);
    		return $ar;
    	}
    }
    $sql		= "SELECT * FROM `list` WHERE `STATUS` = '1' AND `CATEGORY` = '" . CATEGORY . "'";
    if ($result = $mysqli->query($sql)) {
    	$cnt	= $result->num_rows;
    }
    $npp	= 15;
    $p		= $output['p'];
    $sb		= $output['sb'];
    if (! $sb) { $sb = 'name'; }
    $so		= $output['so'];
    if (! $so) { $so = 'asc'; }
    if ($so == 'asc') { $nso = 'desc'; }
    else { $nso = 'asc'; }
    if ($p) { $start = ($p - 1) * $npp; }
    else { $start = 0; }
    if ($p == 0) { $p = 1; }
    $prev		= ($p - 1);
    $next		= ($p + 1);
    $last		= ceil($cnt / $npp);
    $last2		= ($last - 1);
    $pagination	= "<br/>\n";
    if ($last > 1) {
    	$pagination	.= "<div class=\"pagination\">";
    	if ($p > 1) { $pagination .= "<a href=\"" . SITE_URL . "?p=$prev&sb=$sb&so=$so\">&laquo; prev</a>"; }
    	else { $pagination .= "<span class=\"disabled\">&laquo; prev</span>"; }
    	if ($last < 13) {
    		for ($counter = 1; $counter <= $last; $counter++) {
    			if ($counter == $p) { $pagination .= "<span class=\"current\">$counter</span>"; }
    			else { $pagination .= "<a href=\"" . SITE_URL . "?p=$counter&sb=$sb&so=$so\">$counter</a>"; }
    		}
    	}
    	elseif($last >= 13) {
    		if ($p < 7) {
    			for ($counter = 1; $counter < 10; $counter++) {
    				if ($counter == $p) { $pagination .= "<span class=\"current\">$counter</span>"; }
    				else { $pagination .= "<a href=\"" . SITE_URL . "?p=$counter&sb=$sb&so=$so\">$counter</a>"; }
    			}
    			$pagination	.= "...";
    			$pagination	.= "<a href=\"" . SITE_URL . "?p=$last2&sb=$sb&so=$so\">$last2</a>";
    			$pagination	.= "<a href=\"" . SITE_URL . "?p=$last&sb=$sb&so=$so\">$last</a>";
    		}
    		elseif(($last - 6) > $p && $p > 6) {
    			$pagination	.= "<a href=\"" . SITE_URL . "?p=1&sb=$sb&so=$so\">1</a>";
    			$pagination	.= "<a href=\"" . SITE_URL . "?p=2&sb=$sb&so=$so\">2</a>";
    			$pagination	.= "...";
    			for ($counter = $p - 3; $counter <= $p + 3; $counter++) {
    				if ($counter == $p) { $pagination .= "<span class=\"current\">$counter</span>"; }
    				else { $pagination .= "<a href=\"" . SITE_URL . "?p=$counter&sb=$sb&so=$so\">$counter</a>"; }
    			}
    			$pagination	.= "...";
    			$pagination	.= "<a href=\"" . SITE_URL . "?p=$last2&sb=$sb&so=$so\">$last2</a>";
    			$pagination	.= "<a href=\"" . SITE_URL . "?p=$last&sb=$sb&so=$so\">$last</a>";
    		}
    		else {
    			$pagination	.= "<a href=\"" . SITE_URL . "?p=1&sb=$sb&so=$so\">1</a>";
    			$pagination	.= "<a href=\"" . SITE_URL . "?p=2&sb=$sb&so=$so\">2</a>";
    			$pagination	.= "...";
    			for ($counter = ($last - 8); $counter <= $last; $counter++) {
    				if ($counter == $p) { $pagination .= "<span class=\"current\">$counter</span>"; }
    				else { $pagination .= "<a href=\"" . SITE_URL . "?p=$counter&sb=$sb&so=$so\">$counter</a>"; }
    			}
    		}
    	}
    	if ($p < $counter - 1) { $pagination .= "<a href=\"" . SITE_URL . "?p=$next&sb=$sb&so=$so\">next &raquo;</a>"; }
    	else { $pagination .= "<span class=\"disabled\">next &raquo;</span>"; }
    	$pagination	.= "</div>\n";
    	$limit	= "LIMIT $start, $npp";
    }
    $sql	= "SELECT * FROM `list` WHERE `STATUS` = '1' AND `PREMIUM` = '1' ORDER BY `$sb` $so;";
    if ($result = $mysqli->query($sql)) {
    	if ($result->num_rows) {
    		while ($row = $result->fetch_assoc()) {
    			$sites[]	= $row;
    		}
    	}
    }
    $sql	= "SELECT * FROM `list` WHERE `STATUS` = '1' AND `PREMIUM` = '0' ORDER BY `$sb` $so;";
    if ($result = $mysqli->query($sql)) {
    	if ($result->num_rows) {
    		while ($row = $result->fetch_assoc()) {
    			$sites[]	= $row;
    		}
    	}
    }
    $sites	= array_slice($sites, $start, $npp);
    ?
    Code (markup):

     
    suwandichen13, Jun 6, 2018 IP
  2. Nei

    Nei Well-Known Member

    Messages:
    106
    Likes Received:
    3
    Best Answers:
    1
    Trophy Points:
    170
    #2
    Yes, it looks completely PHP 7 friendly for me. And I even checked this code on host with PHP 7, there are no errors (except the database tables are absent).

    P.S. Except you missed ">" at the end of your code :)
     
    Nei, Jun 7, 2018 IP
    suwandichen13 and Arick unirow like this.
  3. suwandichen13

    suwandichen13 Well-Known Member

    Messages:
    615
    Likes Received:
    18
    Best Answers:
    0
    Trophy Points:
    140
    #3
    thank you for your help.
     
    suwandichen13, Jun 8, 2018 IP
  4. deathshadow

    deathshadow Acclaimed Member

    Messages:
    9,732
    Likes Received:
    1,998
    Best Answers:
    253
    Trophy Points:
    515
    #4
    Some advice though, DON'T ERROR SUPPRESS WITH @!!! That's just BEGGING for the whole thing to go bits-up face-down.

    Whoever told you to do this:
    $mysqli		= @new mysqli($db_host, $db_usr, $db_pwd, $db_db);
    Code (markup):
    or this:

    
    	$ch		= @curl_init($url);
    	@curl_setopt($ch, CURLOPT_TIMEOUT, 4);
    	@curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    	$result	= @curl_exec($ch);
    	@curl_close($ch);
    
    Code (markup):
    Needs a good swift kick in the groin.

    Likewise that code has COMPLETELY MISSED THE POINT of not using the mysql_ functions anymore, since it's still slopping values into the query strings instead of using prepare/execute with binding. Admittedly this would be WAY simpler with PDO, but in general this:

    $sql	= "UPDATE `list` SET `AR` = '$ar' WHERE `ID` = '$id'";
    Code (markup):
    ... and this:

    $sql	= "SELECT * FROM `list` WHERE `STATUS` = '1' AND `PREMIUM` = '1' ORDER BY `$sb` $so;";
    Code (markup):
    ... and this...

    $sql	= "SELECT * FROM `list` WHERE `STATUS` = '1' AND `PREMIUM` = '0' ORDER BY `$sb` $so;";
    Code (markup):
    are 100% grade A farm fresh ermagerd teh herpafreakingderp. Insecure outmoded RUBBISH. YOU DO NOT PUT VARIABLES INTO YOUR QUERY STRINGS! -- in mysqli's case you put placeholder ?'s in and then ->bindParam to the statement. (in PDO there are multiple ways of handling it)

    Likewise can't say I'm wild about all that memory thrashing memory wasting string addition for what should probably just be output with echo.

    You probably also shouldn't be using 'var' -- this isn't PHP 4 and whilst it is legacy supported, that support is allegedly on the chopping block. Choose public, private, or protected instead. I actually even forgot PHP had a 'var' command, it's been that long (14 years) since it was relevant.

    Basically this looks like a half-hearted attempt to take some really sloppy PHP 4 and try to make it run under 7, and whilst it does, it misses EVERY single reason for the changes made since PHP 5 was introduced roughly an indiction ago!

    I'd suggest starting over with PDO and bother actually using WHY the changes to the language have taken place.
     
    deathshadow, Jun 8, 2018 IP
    SpacePhoenix and Arick unirow like this.
  5. unbrako1

    unbrako1 Greenhorn

    Messages:
    4
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    11
    #5
    Why is PDO advantages over mysqli then?
     
    unbrako1, Jul 6, 2018 IP
  6. deathshadow

    deathshadow Acclaimed Member

    Messages:
    9,732
    Likes Received:
    1,998
    Best Answers:
    253
    Trophy Points:
    515
    #6
    1) PDO can target MORE than just mysql / mariaDB. (most people are now using MariaDB and don't even know it). Postgresql, sqlite, firebird, oracle, there's a pretty good list of database engines PDO can access as it is "SQL engine neutral". That's good for scalability. More so if you start implementing things like "named queries" that allow you to swap out your queries on the fly for engine specific ones.

    If there's a driver for it, PDO can use it.
    http://php.net/manual/en/pdo.drivers.php

    2) Regardless of if you PDO->query, PDO->exec, or PDO->prepare, you are returned a PDOStatement. This means there is only one thing to learn instead of the TWO that mysqli requires, and codebases can be more iniform in implementation. Simply put having mysqli->query and mysqli->exec return mysqliResult whilst mysqli->prepare returns mysqliStmt is pretty jack-tarded... and to be frank mysqliStmt sucks out loud and is a pain in the ass to work with compared to PDOStatement!

    3) PDO supports labels as placeholders in addition to question marks. When you start getting into large queries having ":name" and ":id" in your queries gets a lot easier to work with than having 30+ question marks you can barely decipher. This also makes binding for POEM easier. Some would argue that mysqli's bind-param and question mark only approach results in less code, but that code tends to be an undecipherable mess. For all my talk of minimalism, I'll take code clarity over "have to save that one extra byte" obsession any day.

    4) You can pass an array of values to PDOStatement->execute, something that mysqli cannot do. This can be REALLY handy in a lot of instances where you already have the data in an array and are just going for a one-off. For example think on this:

    Say you had the names on your login form setup as this:
    
    <label for="login_username">Username:</label><br>
    <input type="text" name="login[:name]" id="login_username"><br>
    <label for="login_password">Password:</label><br>
    <input type="password" name="login[:password]" id="login_password"><br>
    <button>submit</button>
    
    Code (markup):
    Handling it thanks to named references and array passing becomes as simple as:

    
    if (array_key_exists('login', $_POST) {
    	$stmt = $db->prepare('
    		SELECT id
    		FROM users 
    		WHERE name = :name
    		AND password = :password
    	');
    	$_POST['login'][':password'] = hash('sha512', $_POST['login'][':password']);
    	$stmt->execute($_POST['login']);
    	if ($id= $stmt->fetchColumn()) { // login successful
    
    Code (markup):
    Doing that in mysqli...

    
    if (array_key_exists('login', $_POST) {
    	$stmt = $db->prepare('
    		SELECT id
    		FROM users 
    		WHERE name = ?
    		AND password = ?
    	');
    	$_POST['login'][':password'] = hash('sha512', $_POST['login'][':password']);
    	$stmt->bind_param('ss', $_POST['login'][':name'], $_POST['login'][':password']);
    	$stmt->execute();
    	$stmt->bind_result($id);
    	if ($stmt->fetch() { // login successful
    
    Code (markup):
    I really prefer the former in situations like that. Mind you in production code I'd have much more robust checks of the values and indexes of $_POST['login']

    5) It has no pointless dumbass "functional" wrapper crap polluting the global namespace, hobbling people's learning and introducing excess overhead for NOTHING of value. That's garbage in mysqli should NEVER have been created in the first damned place. Seriously if the difference between doing $db->prepare('') and mysqli_prepare($db, ''); is so difficult you "have" to use the latter, just do the world a favor, back the f*** away from the keyboard, and go take up something a bit less detail oriented like macramé!

    6) PDOStatement->fetchColumn. In a LOT of queries (see my examples above) you know you're not only getting just one result row, you're getting

    7) You aren't forced to bind_result. PDO has an equivalent, bindColumn, but you don't have to use it and can instead process results of prepared queries just like you would with a ->query or ->exec

    In fact, much of the above -- particularly points 2, 3, and 7 -- I suspect are a significant contributor to why people who use mysqli are often still going full Pakled derping their variables into query strings, completely missing the POINT of why mysqli_ functions went the way of the dodo. mysqli's prepare is so convoluted and different from how normal ->query and ->exec works it creates an unnecessary difference and even less desirable learning curve over something that is relatively simple!

    I really don't get why anyone would choose mysqli in the first place other than outright ignorance. Though to be fair I say the same thing about 99% of the stuff that has the word 'framework' attached to it. See such mind-numbing asshat ignorant BULLSHIT as jQuery, react, angular, vue, and bootcrap!
     
    deathshadow, Jul 8, 2018 IP
    SpacePhoenix and Nei like this.
  7. NetStar

    NetStar Notable Member

    Messages:
    2,471
    Likes Received:
    541
    Best Answers:
    21
    Trophy Points:
    245
    #7
    Because they are new to PHP and don't know or understand why they shouldn't. There are tons of tutorials, books and classes that still teach PHP using mysqli. From a beginners perspective it is what they are taught therefor must be the only reasonable way. I'm sure right now newbies are scratching their head wondering what the F you are talking about. All you have to do is simply explain why it's a bad idea to use mysqli and what to use instead. Same goes for SQL injection... odds are if they are inserting user defined variables in to an SQL statement they have no idea why that would be bad practice.
    I see you are still spewing out garbage about Frameworks in every post you make. I find that funny.... I hope you realize that there's not a single smart programmer or company out there willing to invest big money on using their time and resources for thick headed programmers to reinvent the wheel just so they can say "no one helped me do it!". You aren't employable. I hope you own your own business.....and if you do I'm sure you are taking FOREVER to launch your product. Doughnut. Missed me? =)
     
    NetStar, Jul 8, 2018 IP
  8. deathshadow

    deathshadow Acclaimed Member

    Messages:
    9,732
    Likes Received:
    1,998
    Best Answers:
    253
    Trophy Points:
    515
    #8
    Those really aren't the people I was going after with that statement -- though I probably should have been more specific.

    What I don't get is how people who've been doing this for a decade or more would choose mysqli over PDO. People who SHOULD know better and know these things.

    It shouldn't surprise me though, given how many people spent the past decade making up half-assed excuses not to migrate away from mysql_ even though we were told it was coming, saying "Oh we'll do it when we have to" or "I don't need to learn that yet" -- and now that 5.5 started throwing warnings, 5.6 started throwing errors, and 7 flat out doesn't have them, those same asshatts are running around like chicken with their heads cut off "what do we do, what do we do" -- and THEN are so mind-numbingly stupid as to simply stick with PHP 5.4 and to hell with security...

    I guess failing to grasp WHY we're supposed to have made the change pretty much the day PHP 5.1 dropped nearly THIRTEEN YEARS AGO shouldn't be a surprise.

    I think you mean mysql_... though if you do mean mysqli that proves my point since generally speaking mysqli and PDO are only about a year apart in age -- and we were NOT actively encouraged to switch away from mysql_ until PHP 5.2 back in '08.

    Though on the whole, web rot is a contributing factor. Same reason most people spent a decade and a half vomiting up HTML 3.2 and slapping 4 tranny on it, and today slap 5 lip-service around the same outdated, outmoded, and half-assed practices so they can slap each-other on the back over how 'modern' they are.

    Which is why we need to fight web-rot and that bad outdated advice. This is an industry where three years is obsolete, five years is the scrap heap -- and we've had over a decade of being told this was coming to make that change!

    It is difficult to explain to those who know neither, or only know one, what's better about one or the other. Think you can do better? Do it.

    Oh it's that simple is it?

    ... and here I was hoping that underscore was a link to something explaining it. Speaking of things we aren't even supposed to use or support on websites.

    They ARE willing to pay however when they are in COURT for accessibility failings because some know-nothing DUPED them into thinking one of these dumbass bloated frameworks was worth using. More so when they are being fined thousands a day and facing civil lawsuits over said shortcomings.

    Much less it's not reinventing the wheel if it's the same or even less work without them -- which is so often the case. People only CLAIM they are 'easier' because they don't know enough about the underlying language to realize they're being packed full of so much sand their name should be Sahara. Repeatedly when it comes to 'frameworks' you hear things like "easier" or "simpler" or "makes you more productive" without any actual proof -- or worse intentionally card stacked bullshit -- to justify those claims... leaving those who know better stuck asking the question "HOW?!? How the blazes is this easier? How is writing as much if not more code simpler? How is doing more work making me more productive?!?"

    Again just look at bootcrap and how it makes you start out with three times the CSS most entire websites should even have, to write as much if not more CSS than you should have to do anything it doesn't do out of the box, so you can write three to ten times the HTML needed to do the job -- ALL whilst pissing away accessibility, semantics, and separation of presentation from content. How is that EASIER?!?

    Same with these MVC frame-works shoe-horning a programming model meant for desktop applications in event driven environments into a top-down execution request/response model language... using five to ten times the code needed and making any task it wasn't designed for (which is pretty much all of them) require as much if not more code than you'd have without it -- OFTEN using techniques and methodologies that are bad practice at best, security and maintenance nightmares at worst!

    Though it is so easy to cherry pick examples to make it LOOK simpler, but again that's just card stacking to back up the glittering generalities and testimonial that makes them hot and trendy. Just look at vue.js' tutorials for that where they start out with simple card-stacked examples to make it look good, but by the time you're doing anything practical at the end of each section they've made the task five times more complex and twice as much code as needed.

    Or at least, more work and as much if not more code if you give a flying purple fish about accessibility, usability, user experience, graceful degradation, and a host of other norms that these 'frameworks' universally flip the bird at!

    Hence why I do most of my freelancing these days for banks, medical facilities, government agencies, and other places where things like the US ADA and UK EQA are a concern.

    Even if that orange cheeto fingered commander in half-tweet and his fascist wannabe's in Congress are trying to put me out of business by undermining the ADA and consumer protections.

    With every shot so far! :p
     
    Last edited: Jul 8, 2018
    deathshadow, Jul 8, 2018 IP
    NetStar likes this.
  9. qwikad.com

    qwikad.com Illustrious Member Affiliate Manager

    Messages:
    7,151
    Likes Received:
    1,656
    Best Answers:
    29
    Trophy Points:
    475
    #9
    @NetStar Jason M. Knight is a retired software engineer. He's over 60 y.o. (more like close to 70). Is that correct @deathshadow ? Being employable is not applicable to him.

    @deathshadow how exactly the current Congress is undermining the ADA? Do you have any facts?
     
    qwikad.com, Jul 8, 2018 IP
  10. deathshadow

    deathshadow Acclaimed Member

    Messages:
    9,732
    Likes Received:
    1,998
    Best Answers:
    253
    Trophy Points:
    515
    #10
    Actually I'm 49... and was forced into retirement by my failing health, and forced back into working against doctors orders by my enjoyment of having a full belly and roof over my head. With my non-24 and Parkinsons I really should not be dealing with the stress of working, but here we are.

    I started young, but there's a reason I say 40 years experience with computers, thirty of that professionally. How many of you at age 9 soldered together a Cosmac ELF?

    Read the disgustingly named "ADA Education and Reform Act of 2017" (H.R. 620)

    They wrapped it in a cozy shell of pretending to focus on educating businesses about accessibility norms and how to meet them, but it puts in place massive sweeping protections against anyone suing or prosecutors going after companies that fail to meet such norms. It basically removes the legal recourse option from the ADA which for all intents and purposes neuters what little power it had.

    You'd almost think the house's corporate taskmasters had the ever living piss scared out of them by what happened to Portugese Telecom... or the current hubbub with the TSB over in the UK. I expect my phone to ring over that new one any day now.

    Since that's almost entirely my focus in development now, going in and ripping out accessibility failures and the things that cause them. LIKE FRAMEWORKS. That and fighting the employees at these places who refuse to believe that their beloved almighty framework is the root of their problems, or fight accessibility tooth and nail because some marketing turd complains it isn't flashy enough to stand out against the competition...

    Which when it's a banking portal, you already won that fight jackass!

    I've actually gotten more people fired for their ignorance or willfull negligence (and stupidity) the past two years than I've had total consulting jobs.
     
    Last edited: Jul 8, 2018
    deathshadow, Jul 8, 2018 IP
  11. qwikad.com

    qwikad.com Illustrious Member Affiliate Manager

    Messages:
    7,151
    Likes Received:
    1,656
    Best Answers:
    29
    Trophy Points:
    475
    #11
    Good to know. Someone PMed me a while back and somehow we ended up talking about you and the person thought you were 70+. LOL. So, you're about my age. Sucks that you've been forced back into working considering all the health issues you're dealing with.
     
    qwikad.com, Jul 8, 2018 IP
  12. mmerlinn

    mmerlinn Prominent Member

    Messages:
    3,197
    Likes Received:
    818
    Best Answers:
    7
    Trophy Points:
    320
    #12
    Dang. I was also under the ASSumption that you were a wee bit older. As it stands, from my viewpoint, you are still a spring chicken barely dry behind the ears.

    That said, like 'they' say, age is only a number. What really matters is how one lives his life, not necessarily how long it is.

    My first computer was an Apple II+ with 16k of RAM and with NO programs available for it. Forced me to learn how to be a MINIMALIST programmer because of the paucity of space available - EVERY byte counted. Also forced me to be a MODULAR programmer where code was in modules that were debugged ONCE and never touched again for decades. I am still using some code that I wrote over 30 years ago. And using lots of old debugged code that was rewritten in more modern languages. Still tend to do things MINIMALISTICALLY and MODULARLY where it is write ONCE, debug ONCE, and use FOREVER.
     
    mmerlinn, Jul 8, 2018 IP
  13. deathshadow

    deathshadow Acclaimed Member

    Messages:
    9,732
    Likes Received:
    1,998
    Best Answers:
    253
    Trophy Points:
    515
    #13
    Which to me was an overpriced pile of junk by the time the ][+ came out. Well, to be honest everything crApple has ever done is overpriced rinky poorly engineered junk.

    But then I was a TRS-80 guy, who briefly dabbled in Commodore stuff.

    Laugh is I've got a ][e platinum with a duodisk in my collection. Never use it... which is sad when a PCJr gets more use than a Apple ][.
     
    deathshadow, Jul 9, 2018 IP
  14. nico_swd

    nico_swd Prominent Member

    Messages:
    4,153
    Likes Received:
    344
    Best Answers:
    18
    Trophy Points:
    375
    #14
    Ugh, what happened? What year is it?
     
    nico_swd, Jul 9, 2018 IP
  15. deathshadow

    deathshadow Acclaimed Member

    Messages:
    9,732
    Likes Received:
    1,998
    Best Answers:
    253
    Trophy Points:
    515
    #15
    1955.

    Haven't you noticed the McCarthyist paranoia, attacks on free press, and every two bit bigoted dirtbag oozing out from under the rocks they've been hiding under since the early '70's?

    Though 1938 for its fascism and late 19th century for its robber barons might be possibilities. It sure as the hell doesn't feel like the 21st century.

    .. or were you just referring to the thread drift into late '70's / early '80's microcomputing?

    NOT that thread drift matters anymore since without fifty types of adblock, a custom stylesheet override, ghostery telling 90%+ of the scripting to go plow itself that this place sees much in the way of active users. Hence why there's not really any REAL on-topic discussion 'round here about web development anymore.

    I swear so many forums now are so desperate for ad revenue they lose sight of the fact all this bullshit is scaring away users. THEN they blame it on people moving to social media. Can't have ad revenue if idiocy like skimlinks is scaring away the normals who don't know how to tell that go sod off.
     
    Last edited: Jul 9, 2018
    deathshadow, Jul 9, 2018 IP
    nico_swd likes this.
  16. SpacePhoenix

    SpacePhoenix Well-Known Member

    Messages:
    196
    Likes Received:
    28
    Best Answers:
    2
    Trophy Points:
    155
    #16
    The website for the local newspaper here has a habit of sometimes redirecting you to a random site, don't know if it's meant to be an ad. A fair few of the pages have about a dozen ads, and then they wonder why people use Adblock
     
    SpacePhoenix, Jul 9, 2018 IP
  17. nico_swd

    nico_swd Prominent Member

    Messages:
    4,153
    Likes Received:
    344
    Best Answers:
    18
    Trophy Points:
    375
    #17
    Quite frankly, no.

    I've been hiding under a rock myself for some time! I haven't been around here since late twenty-sixteen. But I sure as heck remember your name!

    Hi!

    Well in a way, yes. But my initial observation that caused my confusion was the code posted by the person that goes by the name suwandichen13.

    Code that at first glance appears to be from another era, and that I personally wouldn't run on any version of PHP even if it was behind 12 firewalls.

    But a closer look brought up an interesting detail I didn't catch at first.

    
    $qry = preg_replace('/\/customlist.php\?/', '', $_SERVER['REQUEST_URI']);
    parse_str($qry, $output);
    
    PHP:
    This is true craftsmanship from someone who is apparently learning the language by reading the manual backwards. A very creative mind, I might add. A real problem solver of the past.

    Touché!

    Speaking of the past... it was fun here once! I remember that! But then they crippled the user experience in an attempt to monetise the site, and it went down the drain from there...

    Even now they're telling me that my ad blocker blocks more than ads, and that it causes parts of the site to not work.

    Well dipshits, that's apparently so because you programmed it to do just that. Get your head out of your rectum.
     
    nico_swd, Jul 10, 2018 IP
  18. deathshadow

    deathshadow Acclaimed Member

    Messages:
    9,732
    Likes Received:
    1,998
    Best Answers:
    253
    Trophy Points:
    515
    #18
    Actually that would be forwards; "p" comes before "s" for str_replace... and as much as we rely on $_GET it's in a different section instead of listed as part of the library.

    Though yeah, why isn't this just using $_GET? I was so horrified by the rest I didn't even notice that gem... funny since it's the first line of actual code.
     
    deathshadow, Jul 10, 2018 IP