#PHP variables
Explore tagged Tumblr posts
Text
PHP Variables : Syntax, Types, Scope, and Best Practices
Learn all about PHP variables including syntax, data types, variable scope, and best practices. A beginner-friendly guide to mastering PHP variables with examples. PHP Variables – A Complete Guide for Beginners PHP (Hypertext Preprocessor) is a powerful server-side scripting language widely used for web development. One of the foundational concepts in PHP—and in any programming language—is…
#PHP array variable#PHP for beginners#PHP global variable#PHP local variable#PHP programming#PHP static variable#PHP string variable#PHP syntax#PHP tutorial#PHP variable example#PHP variable naming#PHP variable scope#PHP variable types#PHP variables
0 notes
Text
PHP Introduction II: PHP Basics On Demand | CoListy
Learn PHP basics including script building variable definition array usage and writing readable code for dynamic web development and career growth.
#php#phpbasics#programming#beginner#webdevelopment#scripting#arrays#variables#codingfundamentals#zendtraining#self-pacedcourse
1 note
·
View note
Text
[solved] Creating global php variable to manage request rates
[solved] Creating global php variable to manage request rates
In order to create a global PHP variable to manage request rates in WordPress, we first need to understand what request rates are and why they are important. Request rates refer to the rate at which requests are made to a server. In the case of WordPress, these requests could be for things like page views, API requests, or database queries. When request rates are too high, it can put a strain on…
View On WordPress
0 notes
Note
komaedas have you tried straw.page?
(i hope you don't mind if i make a big ollllle webdev post off this!)
i have never tried straw.page but it looks similar to carrd and other WYSIWYG editors (which is unappealing to me, since i know html/css/js and want full control of the code. and can't hide secrets in code comments.....)
my 2 cents as a web designer is if you're looking to learn web design or host long-term web projects, WYSIWYG editors suck doodooass. you don't learn the basics of coding, someone else does it for you! however, if you're just looking to quickly host images, links to your other social medias, write text entries/blogposts, WYSIWYG can be nice.
toyhouse, tumblr, deviantart, a lot of sites implement WYSIWYG for their post editors as well, but then you can run into issues relying on their main site features for things like the search system, user profiles, comments, etc. but it can be nice to just login to your account and host your information in one place, especially on a platform that's geared towards that specific type of information. (toyhouse is a better example of this, since you have a lot of control of how your profile/character pages look, even without a premium account) carrd can be nice if you just want to say "here's where to find me on other sites," for example. but sometimes you want a full website!
---------------------------------------
neocities hosting
currently, i host my website on neocities, but i would say the web2.0sphere has sucked some doodooass right now and i'm fiending for something better than it. it's a static web host, e.g. you can upload text, image, audio, and client-side (mostly javascript and css) files, and html pages. for the past few years, neocities' servers have gotten slower and slower and had total blackouts with no notices about why it's happening... and i'm realizing they host a lot of crypto sites that have crypto miners that eat up a ton of server resources. i don't think they're doing anything to limit bot or crypto mining activity and regular users are taking a hit.
↑ page 1 on neocitie's most viewed sites we find this site. this site has a crypto miner on it, just so i'm not making up claims without proof here. there is also a very populated #crypto tag on neocities (has porn in it tho so be warned...).
---------------------------------------
dynamic/server-side web hosting
$5/mo for neocities premium seems cheap until you realize... The Beautiful World of Server-side Web Hosting!
client-side AKA static web hosting (neocities, geocities) means you can upload images, audio, video, and other files that do not interact with the server where the website is hosted, like html, css, and javascript. the user reading your webpage does not send any information to the server like a username, password, their favourite colour, etc. - any variables handled by scripts like javascript will be forgotten when the page is reloaded, since there's no way to save it to the web server. server-side AKA dynamic web hosting can utilize any script like php, ruby, python, or perl, and has an SQL database to store variables like the aforementioned that would have previously had nowhere to be stored.
there are many places in 2024 you can host a website for free, including: infinityfree (i use this for my test websites :B has tons of subdomains to choose from) [unlimited sites, 5gb/unlimited storage], googiehost [1 site, 1gb/1mb storage], freehostia [5 sites/1 database, 250mb storage], freehosting [1 site, 10gb/unlimited storage]
if you want more features like extra websites, more storage, a dedicated e-mail, PHP configuration, etc, you can look into paying a lil shmoney for web hosting: there's hostinger (this is my promocode so i get. shmoney. if you. um. 🗿🗿🗿) [$2.40-3.99+/mo, 100 sites/300 databases, 100gb storage, 25k visits/mo], a2hosting [$1.75-12.99+/mo, 1 site/5 databases, 10gb/1gb storage], and cloudways [$10-11+/mo, 25gb/1gb]. i'm seeing people say to stay away from godaddy and hostgator. before you purchase a plan, look up coupons, too! (i usually renew my plan ahead of time when hostinger runs good sales/coupons LOL)
here's a big webhost comparison chart from r/HostingHostel circa jan 2024.
---------------------------------------
domain names
most of the free website hosts will give you a subdomain like yoursite.has-a-cool-website-69.org, and usually paid hosts expect you to bring your own domain name. i got my domain on namecheap (enticing registration prices, mid renewal prices), there's also porkbun, cloudflare, namesilo, and amazon route 53. don't use godaddy or squarespace. make sure you double check the promo price vs. the actual renewal price and don't get charged $120/mo when you thought it was $4/mo during a promo, certain TLDs (endings like .com, .org, .cool, etc) cost more and have a base price (.car costs $2,300?!?). look up coupons before you purchase these as well!
namecheap and porkbun offer something called "handshake domains," DO NOT BUY THESE. 🤣🤣🤣 they're usually cheaper and offer more appealing, hyper-specific endings like .iloveu, .8888, .catgirl, .dookie, .gethigh, .♥, .❣, and .✟. I WISH WE COULD HAVE THEM but they're literally unusable. in order to access a page using a handshake domain, you need to download a handshake resolver. every time the user connects to the site, they have to provide proof of work. aside from it being incredibly wasteful, you LITERALLY cannot just type in the URL and go to your own website, you need to download a handshake resolver, meaning everyday internet users cannot access your site.
---------------------------------------
hosting a static site on a dynamic webhost
you can host a static (html/css/js only) website on a dynamic web server without having to learn PHP and SQL! if you're coming from somewhere like neocities, the only thing you need to do is configure your website's properties. your hosting service will probably have tutorials to follow for this, and possibly already did some steps for you. you need to point the nameserver to your domain, install an SSL certificate, and connect to your site using FTP for future uploads. FTP is a faster, alternative way to upload files to your website instead of your webhost's file upload system; programs like WinSCP or FileZilla can upload using FTP for you.
if you wanna learn PHP and SQL and really get into webdev, i wrote a forum post at Mysidia Adoptables here, tho it's sorted geared at the mysidia script library itself (Mysidia Adoptables is a free virtual pet site script, tiny community. go check it out!)
---------------------------------------
file storage & backups
a problem i have run into a lot in my past like, 20 years of internet usage (/OLD) is that a site that is free, has a small community, and maybe sounds too good/cheap to be true, has a higher chance of going under. sometimes this happens to bigger sites like tinypic, photobucket, and imageshack, but for every site like that, there's like a million of baby sites that died with people's files. host your files/websites on a well-known site, or at least back it up and expect it to go under!
i used to host my images on something called "imgjoe" during the tinypic/imageshack era, it lasted about 3 years, and i lost everything hosted on there. more recently, komaedalovemail had its webpages hosted here on tumblr, and tumblr changed its UI so custom pages don't allow javascript, which prevented any new pages from being edited/added. another test site i made a couple years ago on hostinger's site called 000webhost went under/became a part of hostinger's paid-only plans, so i had to look very quickly for a new host or i'd lose my test site.
if you're broke like me, looking into physical file storage can be expensive. anything related to computers has gone through baaaaad inflation due to crypto, which again, I Freaquing Hate, and is killing mother nature. STOP MINING CRYPTO this is gonna be you in 1 year
...um i digress. ANYWAYS, you can archive your websites, which'll save your static assets on The Internet Archive (which could use your lovely donations right now btw), and/or archive.today (also taking donations). having a webhost service with lots of storage and automatic backups can be nice if you're worried about file loss or corruption, or just don't have enough storage on your computer at home!
if you're buying physical storage, be it hard drive, solid state drive, USB stick, whatever... get an actual brand like Western Digital or Seagate and don't fall for those cheap ones on Amazon that claim to have 8,000GB for $40 or you're going to spend 13 days in windows command prompt trying to repair the disk and thenthe power is gong to go out in your shit ass neighvborhood and you have to run it tagain and then Windows 10 tryes to update and itresets the /chkdsk agin while you're awayfrom town nad you're goig to start crytypting and kts just hnot going tot br the same aever agai nikt jus not ggiog to be the saeme
---------------------------------------
further webhosting options
there are other Advanced options when it comes to web hosting. for example, you can physically own and run your own webserver, e.g. with a computer or a raspberry pi. r/selfhosted might be a good place if you're looking into that!
if you know or are learning PHP, SQL, and other server-side languages, you can host a webserver on your computer using something like XAMPP (Apache, MariaDB, PHP, & Perl) with minimal storage space (the latest version takes up a little under 1gb on my computer rn). then, you can test your website without needing an internet connection or worrying about finding a hosting plan that can support your project until you've set everything up!
there's also many PHP frameworks which can be useful for beginners and wizards of the web alike. WordPress is one which you're no doubt familiar with for creating blog posts, and Bluehost is a decent hosting service tailored to WordPress specifically. there's full frameworks like Laravel, CakePHP, and Slim, which will usually handle security, user authentication, web routing, and database interactions that you can build off of. Laravel in particular is noob-friendly imo, and is used by a large populace, and it has many tutorials, example sites built with it, and specific app frameworks.
---------------------------------------
addendum: storing sensitive data
if you decide to host a server-side website, you'll most likely have a login/out functionality (user authentication), and have to store things like usernames, passwords, and e-mails. PLEASE don't launch your website until you're sure your site security is up to snuff!
when trying to check if your data is hackable... It's time to get into the Mind of a Hacker. OWASP has some good cheat sheets that list some of the bigger security concerns and how to mitigate them as a site owner, and you can look up filtered security issues on the Exploit Database.
this is kind of its own topic if you're coding a PHP website from scratch; most frameworks securely store sensitive data for you already. if you're writing your own PHP framework, refer to php.net's security articles and this guide on writing an .htaccess file.
---------------------------------------
but. i be on that phone... :(
ok one thing i see about straw.page that seems nice is that it advertises the ability to make webpages from your phone. WYSIWYG editors in general are more capable of this. i only started looking into this yesterday, but there ARE source code editor apps for mobile devices! if you have a webhosting plan, you can download/upload assets/code from your phone and whatnot and code on the go. i downloaded Runecode for iphone. it might suck ass to keep typing those brackets.... we'll see..... but sometimes you're stuck in the car and you're like damn i wanna code my site GRRRR I WANNA CODE MY SITE!!!


↑ code written in Runecode, then uploaded to Hostinger. Runecode didn't tell me i forgot a semicolon but Hostinger did... i guess you can code from your webhost's file uploader on mobile but i don't trust them since they tend not to autosave or prompt you before closing, and if the wifi dies idk what happens to your code.
---------------------------------------
ANYWAYS! HAPPY WEBSITE BUILDING~! HOPE THIS HELPS~!~!~!
-Mod 12 @eeyes
198 notes
·
View notes
Note
I do computer work but it's not very hard and kind of boring. How do I get to do hard computer work? Do I have to go to grad school?
hi i tend to miss these because of slipshod ublock custom filters im too birdbrained to fix.
i worked for a large american technology company which sold business machines internationally for close to a decade until laid off in successful accounting fraud scheme a few years ago. started as developer, erm, pardon me, i started as
junior developer
which is a role similar to routinely-executed court jester and human meatwave conscript meant to soak up enemy bullets to cause exhaustion of enemy bullet supply and finally guy that comes in big gross truck with a pump and a tank and a big hose used to suck the shit+piss out of portable toilet/malfunctioning sewer etc. this is for when you are 20 years old or so and they hit you with this work to calm your ass down a bit. my case was cloud bullshit on ancient rickety php stack. 5% keystrokes/clicks are php, 95% remainder is jira and other members of the axis of evil. LOT of dick sucking and butt fucking. Going into men's bathroom and making eye contact with cubicle neighbor before entering stall and fearlessly making disgusting noises. microwaving fish lunch thrice daily. you get the idea. meager paycheck but six figures takehome technically
next is staff dev, wait, god damn fucking tumblr, you can't adjust fonts mid-paragraph, and Big Text is just another type of font, in case you wanted Big Specific font. fucking fuck hold on. next step is
staff developer
no effective change besides greatly increased workload (click those motherfucking jira buttons!! suffer coworker's asinine bad-faith code review comments that HE AND HE ALONE must manually accept your responses to, on HIS time, before you are allowed to click the jira buttons that start the human meat sausage factory to get your 20 line maximum change into an RC and then release and then push candidate and then prod push!! pay raise one thousand dollars annually (lol). Emails. Now you deal with project manager too. speculate as to what sorts of grievous head injuries that man must suffer daily to describe his logic. his job is like the guy from office space that brings documents from one desk to another but he randomly reorders the words on the page in-flight. make plausibly-deniable wife fucking jokes about his wife in earshot. you're almost at the top of the suffering function. next is, no fucking cute font this time, senior developer, sounds cool right, lol, lmao, "senior" "developer" is like "tallest" "midgit".
no pay increase no workload increase but now manager emails you about extremely, extremely personal issues he's facing and also makes his most difficult problems from his boss your problems. one week will pass and then they will hit you with the "we're considering you for a team lead position". answer:
NO
answer no as this is the prescribed path, you take that role, you are maxxed out in workload, you are dealing with forty employee's worth of bullshit, another one thousand dollarinos a year raise, employer has solved efficiency problem with your sanity and burnout as variables. you're supposed to quit or kill yourself within seconds of hitting 30 y/o. don't fall for tricks. say "NO" in a creative way such as "i have tabulated some data and made it into excel pie chart quantifying diff. departments work output and am considering sending it to whoever Dave is, the guy that is one or two or three report levels over your boss' head, you know, his boss' boss' boss or whatever. or say "you are harassing me sexually, racistly" that kind of shit. make threat clearly.
was worth mentioning before, throughout all of this make as many friends and as much of a splash for yourself as possible as its time to trade on that goodwill, tell your boss you want an open relationship and you're going to fuck and suck other managers, and then find the good one with the good team of old fucking geriatric guys who could never be fooled into working more than a reasonable amount daily and also can kill people with their minds since they have been sitting on the bleeding edge of computing since 1969. their boss will usually be, suspiciously, one report rank higher than everyone else. e.g. their boss has a whole other boss + his reports under him. usually small team. go to their boss, say, hi, look at me, look at my beautiful plumage and captivating mating dance, please hire me, pleassseee. his team will say no, they will say things like "I don't know about that kiddo", "That guy seems like a candy-ass", they will read your papers and look at you in the eyes and say it is not compelling, the boss will kind of hire you anyway. if he doesn't you're fucked. if he does you're now a
STAFF ENGINEER
for fifteen minutes and then
ADVISORY/SENIOR/SPECIAL ENGINEER
and the suffering is over. no code minimal jira + squad of gremlin zerglings under your boss whom you can rank-pull and delegate bullshit to, they will be mostly suckers, take advantage of this. 80% of keystrokes/clicks will be in production of beautiful wonderful lovely .docx and .xlsx's, what a godsend, only in an emergency are you allowed to fuck with your zergling's code, usually in a cool way with bullshit procedure removed.
i worked on high performance computing shit. "what the fuck do you mean 2PB or so in and out a day on flash memory", "what the fuck do you mean special infiniband intel MPI library on CD-R stored in Craig's filing cabinet???". Meetings with company people: webcams off, responses optional, snideness allowed. Meetings with client: you must have your dress shirt starched and white glove the shit out of those motherfuckers. timezones = skill issue. i don't care where germany is, i don't give a shit, wake up at 3am for a 20m meeting i take on the toilet or while eating a boiled lobster complete with cracker + lobster bib. customers countable on one hand, invoices to customers not countable with 32 bits. no fucking mistakes ever allowed except for like whitepaper drafts, you cannot fuck the pumpkin on this one, your actual job relies on your ability to hit a button and suck down a week's worth of compute and millions of dollars, boiling swimming pool's worth of TDP, one mistake that leads result data to being able to be characterized as flawed and your balls are getting ripped off. Quarterly IRL meetings = normiepilled normiemaxxing. Dress sharp. leave at 5pm on the dot, go to bar with Old Fucker coworkers, drink wrecklessly with them, have a blast, let them give you a tour of a lab you are absolutely 100% not allowed to be inside, buildings that have posted weight limits per sq. ft. exceeding 250lbs, such a blast. every paycheck a FORTUNE every dinner a banquet every meeting an email every keystroke life or death. you get to meet /lib/doug mofos too one of whom i wrote a very poor kind of poem thing about. thats about it. hope this helps
146 notes
·
View notes
Text
Tierlist part 16: Perl, MetaGolfScript and Elixir
I love a good bit of golfing thus MetaGolfScript is a solid B tier. Now Perl... Perl is a wierd one. First of all the type system is just odd. As far as i can tell it is a mix between static and dynamic. Variables accessed with $ will are staticly scalars but can be any scalars... I don't know what to do with this. To the Soup that is C tier it goes. Apropro wierd now Elixir. A funktional language build around concurency you say? I'm intrigued. BUT DYNAMICLY TYPED! Why. Horible horible horible. You ruined my dreams, to the stew you go. (Note, Elixir is in no particular tier but a second fire under the crucible would be too hazardous so the PHP fire will be reused)
part 15
13 notes
·
View notes
Text
widowbase v3 and v4
Whooboi, there is a lot of discourse going on right now about JCINK coders. Perfect time for me to update some base skins!
For those who just want to streamline their coding process, I have updated my widowbase v3 to include a day/night theme toggle and made a few responsive tweaks to the vertical nav and sidebar. For those looking to learn how to use CSS grid and flexbox to create responsive forum designs, I added a new base, widowbase v4. This version includes some HTML templates that have a very ugly, extremely basic, but functional fluid grid layout. These templates also incorporate hidden divs (read as, display: none) that include the PHP variables frequently used inside those respective HTML templates, so you can easily delete everything I've done and start from scratch with your own. Then just delete the hidden div when you've used everything you need. Easy peasy!
For those of you just beginning your coding journey, I wish you the best of luck! It is such a fun and rewarding hobby. You are also free to rip apart any of the codes on my preview site and cobble them back together. These experiments can be a great learning tool! You are more than welcome to use any of my free resources as a base, as long as the finished product remains free. As for my actual skin bases (or template sets specifically labeled as bases), these can be used for free or paid skins. Make money or give it away, whatever works for you, just leave the credits given to resources intact so others can find out how to accomplish the same thing!
41 notes
·
View notes
Text
Wednesday 6th March 2024 - [ Week 1 Day 4 ]
Today I studied primarily on Codecademy's "Learn PHP Skill Path" and still on the basics but it's pretty easy??? Programming languages have a trend of starting off relatively the same, each having small differences.
What I learnt today:
🩵 Defining Functions 🩵 Invoking Functions 🩵 Return Statements 🩵 More on Return Statements 🩵 Return Values 🩵 Returning NULL 🩵 Parameters 🩵 Multiple Parameters 🩵 Default Parameters 🩵 Pass By Reference 🩵 Variable Scope
💌 Day 4: What has been easy so far from learning PHP?
Like I said in yesterday's post, learning the basic fundamentals is fair easy because most programming languages start off the same~!
[ The challenge ]
#5in5weeks#study challenge#programming#coding#studyblr#codeblr#studying#comp sci#progblr#tech#programmer#php#study#study hard#studyspiration#night study#stay productive
26 notes
·
View notes
Text
SysNotes devlog 3 - Ability to create a new profile
Welcome back to my SysNotes update! SysNotes is a system management app for people with DID, OSDD, and those who are otherwise plural.
(I will keep the intro text the same in all devlogs for context)
This devlog will be shorter than usual because I didn't want to lump it in with the next feature, which I expect will be quite long. In this devlog, I will add a way to create a new profile.
First Devlog (1) | Previous Devlog (2)
Quick Refactor before we jump in
"So I did some refactoring off-camera..." - originally, everything on the page was happening inside one component. I decided to split it up into the main page and the profile section, which is a new separate component. This will keep my code shorter and easier to maintain.
I also added a way to refer to each profile individually by their ID in the URL:
(Colin's profile is ID 4, which is shown in the URL)
I was also storing profile data as separate variables, which would be inconvenient to individually pass into the new main profile component. So I moved them all into one variable:
(old | new)
Design of the New Profile form
To be honest, I've been dreading this part since the beginning. I mean, how do I even lay this out? 💀
It is common for developers to avoid UI design because they are "coders not designers". I, for one, quite enjoy web design. Still, this task feels quite overwhelming to me. So, let's take this little mockup I made and turn it into something usable 💪
Too much stuff?
I think the biggest challenge here is the sheer number of inputs. And as the app grows, the number of inputs in this form will only increase.
The only mandatory input for a new profile is just their name. Therefore, the first step should be separating the Name field from the rest of the inputs.
The new and improved New Profile form is looking much better now:
...Yes, really! That's the whole form!
You are unlikely to know everything about an alter that has just split, so all those fields are completely unnecessary for an alter to be added to the list. Every other detail can be added later through the edit mode, where each field can be edited separately without needing one giant form.
Another big reason why I decided to forego the big form altogether is that the code for saving a new profile and the code for editing a profile would be almost exactly the same (including validation), and it wouldn't make sense to duplicate this code if I can just use it in one instance.
Saving a new profile
Let's add some validation to the input field to make sure that the user enters the name in a correct format.
As the Name is stored in the database as a string, it has the maximum length of 255 characters. Trying to save a longer name than this will cause errors, so we need to validate the input to make sure it's safe to insert into the database:
Here's what happens when I input a whole paragraph of Lorem Ipsum text and try to save it:
On the other hand, a shorter name saves just fine:
By the way, these flash messages are added in 2 ways: the success is a session message, and the error is an error stored separately by the validator. The flash messages originally have no styling, so I defined those myself using Tailwind's "@apply" for efficiency.
Once submitted, the name list automatically updates with our new profile:
(And if I click cancel it just empties the input)
Okay, let's click on Jenny's profile to see what it looks like! ...Oh
This is because the code tries to access Jenny's status, but she doesn't have one yet, she only has a name!
(When I pull the data from the database, I'm trying to access a non-existent value)
(And when I display the values I got from the database, the display may break if the value is NULL)
(This error applies to all profile fields, not just status, however the app crashes after just the first error it comes across so the remaining errors are not shown)
This can easily fixed by using PHP's "isset()" and/or "empty()" function, which checks if a variable has a value:
(I'm using a ternary operator as a more compact alternative to if-else. it basically goes: "if this condition is true ? then do it : if not, do something else")
(And here I just check if these values are not blank before rendering them)
Success, Jenny's profile shows!
Now, we just have to populate this profile with data about Jenny, and to do that we'll need to be able to edit each field. I will work on this in the next devlog, as I expect this to take quite some time.
Thanks so reading! As always, any suggestions are welcome!
5 notes
·
View notes
Text
29.07.2024
I kinda skipped a few days cause honestly it's been tiring. The past two weeks were nothing but exams but now full on classes start again. Almost a month and a half of senior year is done... Gosh, Time's flying... Right... So, I'm gonna change my tactics here alittle because when i write my goals down, i don't seem to achieve them to that level so I'm gonna be more specific about things that i already did.
Today I:
Completed one lesson in economics:
Topics I covered :-
Multiplier
Accelerator
Aggregate Demand and Supply
Effective Demand
Completed 20% of a lesson in business
Topics I covered :-
Capital market
Features of capital market
• Revised lesson 4 in computers
Topics I covered :-
Php basics, variables, data types, comments, operators
• Completed Economics assignment
Dates to remember:
August 5 (English assignment submission)
August 10 (Computer project)
I guess that's it... xD
#studyblr introduction#studyblr#study motivation#school#study blog#student#studyspo#studying#study aesthetic#high school#study tips#study buddy#studybrl#study break#study goals#goals#academic goals#academic girly#it girl#senior year#self improvement#student life#studyblr community#high school studyblr#high school tips#study hard#study#accounting#finances#economics
8 notes
·
View notes
Text
SQL Injection
perhaps, the direct association with the SQLi is:
' OR 1=1 -- -
but what does it mean?
Imagine, you have a login form with a username and a password. Of course, it has a database connected to it. When you wish a login and submit your credentials, the app sends a request to the database in order to check whether your data is correct and is it possible to let you in.
the following PHP code demonstrates a dynamic SQL query in a login from. The user and password variables from the POST request is concatenated directly into the SQL statement.
$query ="SELECT * FROM users WHERE username='" +$_POST["user"] + "' AND password= '" + $_POST["password"]$ + '";"
"In a world of locked rooms, the man with the key is king",
and there is definitely one key as a SQL statement:
' OR 1=1-- -
supplying this value inside the name parameter, the query might return more than one user.
most applications will process the first user returned, meaning that the attacker can exploit this and log in as the first user the query returned
the double-dash (--) sequence is a comment indicator in SQL and causes the rest of the query to be commented out
in SQL, a string is enclosed within either a single quote (') or a double quote ("). The single quote (') in the input is used to close the string literal.
If the attacker enters ' OR 1=1-- - in the name parameter and leaves the password blank, the query above will result in the following SQL statement:
SELECT * FROM users WHERE username = '' OR 1=1-- -' AND password = ''
executing the SQL statement above, all the users in the users table are returned -> the attacker bypasses the application's authentication mechanism and is logged in as the first user returned by the query.
The reason for using -- - instead of -- is primarily because of how MySQL handles the double-dash comment style: comment style requires the second dash to be followed by at least one whitespace or control character (such as a space, tab, newline, and so on). The safest solution for inline SQL comment is to use --<space><any character> such as -- - because if it is URL-encoded into --%20- it will still be decoded as -- -.
4 notes
·
View notes
Text
PHP Variables : Syntax, Types, Scope, and Best Practices
Learn all about PHP variables including syntax, data types, variable scope, and best practices. A beginner-friendly guide to mastering PHP variables with examples. PHP Variables – A Complete Guide for Beginners PHP (Hypertext Preprocessor) is a powerful server-side scripting language widely used for web development. One of the foundational concepts in PHP—and in any programming language—is…
#PHP array variable#PHP for beginners#PHP global variable#PHP local variable#PHP programming#PHP static variable#PHP string variable#PHP syntax#PHP tutorial#PHP variable example#PHP variable naming#PHP variable scope#PHP variable types#PHP variables
0 notes
Text
How the fuck is PHP a serious language? "Yeah I'm going to make a scripting language with no experience as a fun personal project. It's going to have zero consistency and half the features feel incomplete. It'll be used on 75% of websites in 2024."
I'm casting arrays as objects and then using variables to access the object properties. A serious language would never allow this to happen.
#PHP#software development#things that make you go “this will never pass code review”#but this actually solves a problem so maybe?
3 notes
·
View notes
Text
Mastering Web Development: A Comprehensive Guide for Beginners
In the vast landscape of technology, web development stands as a crucial cornerstone. It encompasses the art and science of building websites, ranging from simple static pages to complex web applications. Whether you're aiming to pursue a career in software development or seeking to enhance your digital presence, understanding web development is essential.
In this comprehensive guide, we'll take you through the fundamental concepts and practical skills needed to master web development from scratch. Let's dive in!
1. Understanding HTML (Hypertext Markup Language)
HTML serves as the backbone of every web page, providing the structure and content. It uses tags to define different elements such as headings, paragraphs, images, and links. By mastering HTML, you'll be able to create well-structured and semantically meaningful web documents.
2. Exploring CSS (Cascading Style Sheets)
CSS is the language used to style HTML elements, enhancing their appearance and layout. With CSS, you can customize colors, fonts, spacing, and more, giving your website a polished and professional look. Understanding CSS selectors and properties is essential for effective styling.
3. Introduction to JavaScript
JavaScript is a versatile programming language that adds interactivity and dynamic behavior to web pages. From simple animations to complex web applications, JavaScript powers a wide range of functionalities. Learning JavaScript fundamentals such as variables, functions, and events is crucial for web development.
4. Building Responsive Websites
In today's mobile-centric world, it's essential to create websites that adapt seamlessly to various screen sizes and devices. Responsive web design achieves this by using fluid grids, flexible images, and media queries. Mastering responsive design principles ensures that your websites look great on desktops, tablets, and smartphones.
5. Introduction to Version Control with Git
Git is a powerful tool for tracking changes in your codebase and collaborating with other developers. By learning Git basics such as branching, merging, and committing, you can streamline your development workflow and effectively manage project versions.
6. Introduction to Front-End Frameworks
Front-end frameworks like Bootstrap, Foundation, and Materialise provide pre-designed components and stylesheets to expedite web development. By leveraging these frameworks, you can create responsive and visually appealing websites with less effort and code.
7. Introduction to Back-End Development
While front-end development focuses on the user interface, back-end development deals with server-side logic and database management. Learning back-end languages such as Node.js, Python, or PHP enables you to build dynamic web applications and handle user interactions efficiently.
8. Deploying Your Website
Once you've developed your website, it's time to make it accessible to the world. Deploying a website involves selecting a web hosting provider, uploading your files, and configuring domain settings. Understanding the deployment process ensures that your website goes live smoothly.
9. Conclusion and Next Steps
Congratulations on completing this comprehensive guide to mastering web development! By now, you've gained a solid understanding of HTML, CSS, JavaScript, version control, frameworks, and deployment. As you continue your journey in web development, remember to stay curious, practice regularly, and explore advanced topics to further refine your skills.
Resources for Further Learning:
Online tutorials and documentation
Interactive coding platforms
Community forums and discussion groups
Next Steps:
Explore advanced topics such as web performance optimization, server-side rendering, and progressive web apps.
Build real-world projects to apply your skills and showcase your portfolio.
Stay updated with the latest trends and technologies in web development through blogs, podcasts, and conferences.
With dedication and perseverance, you'll continue to evolve as a proficient web developer, creating innovative solutions and contributing to the ever-changing digital landscape . Happy coding!
4 notes
·
View notes
Text
Computer Language
Computer languages, also known as programming languages, are formal languages used to communicate instructions to a computer. These instructions are written in a syntax that computers can understand and execute. There are numerous programming languages, each with its own syntax, semantics, and purpose. Here are some of the main types of programming languages:
1.Low-Level Languages:
Machine Language: This is the lowest level of programming language, consisting of binary code (0s and 1s) that directly corresponds to instructions executed by the computer's hardware. It is specific to the computer's architecture.
Assembly Language: Assembly language uses mnemonic codes to represent machine instructions. It is a human-readable form of machine language and closely tied to the computer's hardware architecture
2.High-Level Languages:
Procedural Languages: Procedural languages, such as C, Pascal, and BASIC, focus on defining sequences of steps or procedures to perform tasks. They use constructs like loops, conditionals, and subroutines.
Object-Oriented Languages: Object-oriented languages, like Java, C++, and Python, organize code around objects, which are instances of classes containing data and methods. They emphasize concepts like encapsulation, inheritance, and polymorphism.
Functional Languages: Functional languages, such as Haskell, Lisp, and Erlang, treat computation as the evaluation of mathematical functions. They emphasize immutable data and higher-order functions.
Scripting Languages: Scripting languages, like JavaScript, PHP, and Ruby, are designed for automating tasks, building web applications, and gluing together different software components. They typically have dynamic typing and are interpreted rather than compiled.
Domain-Specific Languages (DSLs): DSLs are specialized languages tailored to a specific domain or problem space. Examples include SQL for database querying, HTML/CSS for web development, and MATLAB for numerical computation.
3.Other Types:
Markup Languages: Markup languages, such as HTML, XML, and Markdown, are used to annotate text with formatting instructions. They are not programming languages in the traditional sense but are essential for structuring and presenting data.
Query Languages: Query languages, like SQL (Structured Query Language), are used to interact with databases by retrieving, manipulating, and managing data.
Constraint Programming Languages: Constraint programming languages, such as Prolog, focus on specifying constraints and relationships among variables to solve combinatorial optimization problems.
2 notes
·
View notes
Text
JavaScript Frameworks
Step 1) Polyfill
Most JS frameworks started from a need to create polyfills. A Polyfill is a js script that add features to JavaScript that you expect to be standard across all web browsers. Before the modern era; browsers lacked standardization for many different features between HTML/JS/and CSS (and still do a bit if you're on the bleeding edge of the W3 standards)
Polyfill was how you ensured certain functions were available AND worked the same between browsers.
JQuery is an early Polyfill tool with a lot of extra features added that makes JS quicker and easier to type, and is still in use in most every website to date. This is the core standard of frameworks these days, but many are unhappy with it due to performance reasons AND because plain JS has incorporated many features that were once unique to JQuery.
JQuery still edges out, because of the very small amount of typing used to write a JQuery app vs plain JS; which saves on time and bandwidth for small-scale applications.
Many other frameworks even use JQuery as a base library.
Step 2) Encapsulated DOM
Storing data on an element Node starts becoming an issue when you're dealing with multiple elements simultaneously, and need to store data as close as possible to the DOMNode you just grabbed from your HTML, and probably don't want to have to search for it again.
Encapsulation allows you to store your data in an object right next to your element so they're not so far apart.
HTML added the "data-attributes" feature, but that's more of "loading off the hard drive instead of the Memory" situation, where it's convenient, but slow if you need to do it multiple times.
Encapsulation also allows for promise style coding, and functional coding. I forgot the exact terminology used,but it's where your scripting is designed around calling many different functions back-to-back instead of manipulating variables and doing loops manually.
Step 3) Optimization
Many frameworks do a lot of heavy lifting when it comes to caching frequently used DOM calls, among other data tools, DOM traversal, and provides standardization for commonly used programming patterns so that you don't have to learn a new one Everytime you join a new project. (you will still have to learn a new one if you join a new project.)
These optimizations are to reduce reflowing/redrawing the page, and to reduce the plain JS calls that are performance reductive. A lot of these optimatizations done, however, I would suspect should just be built into the core JS engine.
(Yes I know it's vanilla JS, I don't know why plain is synonymous with Vanilla, but it feels weird to use vanilla instead of plain.)
Step 4) Custom Element and component development
This was a tool to put XML tags or custom HTML tags on Page that used specific rules to create controls that weren't inherent to the HTML standard. It also helped linked multiple input and other data components together so that the data is centrally located and easy to send from page to page or page to server.
Step 5) Back-end development
This actually started with frameworks like PHP, ASP, JSP, and eventually resulted in Node.JS. these were ways to dynamically generate a webpage on the server in order to host it to the user. (I have not seen a truly dynamic webpage to this day, however, and I suspect a lot of the optimization work is actually being lost simply by programmers being over reliant on frameworks doing the work for them. I have made this mistake. That's how I know.)
The backend then becomes disjointed from front-end development because of the multitude of different languages, hence Node.JS. which creates a way to do server-side scripting in the same JavaScript that front-end developers were more familiar with.
React.JS and Angular 2.0 are more of back end frameworks used to generate dynamic web-page without relying on the User environment to perform secure transactions.
Step 6) use "Framework" as a catch-all while meaning none of these;
Polyfill isn't really needed as much anymore unless your target demographic is an impoverished nation using hack-ware and windows 95 PCs. (And even then, they could possible install Linux which can use modern lightweight browsers...)
Encapsulation is still needed, as well as libraries that perform commonly used calculations and tasks, I would argue that libraries aren't going anywhere. I would also argue that some frameworks are just bloat ware.
One Framework I was researching ( I won't name names here) was simply a remapping of commands from a Canvas Context to an encapsulated element, and nothing more. There was literally more comments than code. And by more comments, I mean several pages of documentation per 3 lines of code.
Custom Components go hand in hand with encapsulation, but I suspect that there's a bit more than is necessary with these pieces of frameworks, especially on the front end. Tho... If it saves a lot of repetition, who am I to complain?
Back-end development is where things get hairy, everything communicates through HTTP and on the front end the AJAX interface. On the back end? There's two ways data is given, either through a non-html returning web call, *or* through functions that do a lot of heavy lifting for you already.
Which obfuscates how the data is used.
But I haven't really found a bad use of either method. But again; I suspect many things about performance impacts that I can't prove. Specifically because the tools in use are already widely accepted and used.
But since I'm a lightweight reductionist when it comes to coding. (Except when I'm not because use-cases exist) I can't help but think most every framework work, both front-end and Back-end suffers from a lot of bloat.
And that bloat makes it hard to select which framework would be the match for the project you're working on. And because of that; you could find yourself at the tail end of a development cycle realizing; You're going to have to maintain this as is, in the exact wrong solution that does not fit the scope of the project in anyway.
Well. That's what junior developers are for anyway...
2 notes
·
View notes