PHP help please.

Yeah i see what you're saying and i don't mind using new code i don't yet understand if you can break it down and explain what a given command or piece of code does.

MySQL is available to use but that would mean additional coding and learning, though i understand the basics of retrieving and inputting data in MySQL there's always that issue of ensuring you are doing everything in a way where people can't start using SQL injections on your site, not an extra i want to wrestle with when i know little about the language.

The server where i'll be plonking the pages onto has just been taken down due to SQL injections (was running an older modified version of DragonflyCMS). The forums area had 1 thread containing over 8000 posts to porn images and videos embedded from guest accounts, although guest accounts and HTML in forum posts were disabled...

It's just an extra thing to have to worry about if i start sending and retrieving data from a database.

The other admin has written his own mini CMS (for personal use - very basic functions) with his also limited knowledge so i'll proberly work a mixture of my own work and his.

Just need him to reply to my messages and then we'll compare notes.... :) He's working over the weekend though, so i can't expect him to reply.

The function i was referring for the header and footer would mean you use....

header ();

your page / content here

footer ();

A little quicker (marginal i know) to deal with then using an include for every page.

However currently i use require_once for the header and footer instead of include so pages can't be loaded without the header and footer, but i'm sure you know how that works anyway... ;)
 
The function i was referring for the header and footer would mean you use....

header ();

your page / content here

footer ();

A little quicker (marginal i know) to deal with then using an include for every page.

well header() is already a php function so you can't use that name. and functions? why? :confused:

and your method of using

index.php?articles

is completely unworkable. you can't use $_GET to check it. you can do horrible text comparisons using stristr but that's totally retarded way of doing things given the tools at your disposal. now if everything has a value

index.php?this=something

then we can work with that no problems at all. i did try explain this once already but you said no. :(

as for sanitising user input for mysql, that's a trivial matter. at this point, you'll only be retrieving data eg

articles.php?id=12

$id = intval($_GET['id']);

using intval(), if id isn't a whole number, it's assigned the value of 0. now it's safe to use in a query. that's that. :p
 
index.php?this was only applicable to the root page for the given section, though it doesn't have to be that way now i've had some thinking on it.

If i'm only retrieving data from a database how am i putting in there in the first place?

If you're suggesting writing the database tables then i might aswell just be writing a PHP scripted page in less time, if i'm not writing the MySQL tables then i would be inputting data.

Unless i'm misunderstanding again... :(

header() was only an example, it could be myhead() myfoot() for all it matters, was an idea.

In total honesty i don't know what functions, strings or arrays are best used for what. There's lots to read about them, but very little defining what their best uses are, but i think that's down to the given person writing the PHP.

So whether i store, for example, my content in a case/switch or array, or use a database, there's nothing clear and defining i've seen to suggest what should be used where, and why, since there's seems to be many different ways to archive the same thing in PHP.
 
well most hosts provide phpmyadmin as a tool for managing databases. you can create tables/update content using that.

and yes there are zillions of ways of achieving the same things in php. just do what works for you. i'm guessing this is a personal project presumably just to learn a little php? obviously you'd be using wordpress if that wasn't the case. :p
 
Yeah it's just a personal project to make a site to store any guides, tutorials or projects i'd like to share.

Handy for referring friends to......

Even for simple things like Reghacks in Vista for extra context shortcuts etc...

A place to host anything i make, so others can find it and use it..... whatever 'it' may be...

It also saves me from having to keep 100's of bookmarks for things i can't remember off the top of my head ifi can just plonk them on my own page(s).

Code hasn't been the end of my problems either, i have been having issues getting connected via FTP again, connected to my friends server, then could never get connected again. 4 FTP clients later (all with same settings) and i finally get connected. Server users a custom port to just to be a pain also. WS_FTP was the only client that will now work for me connecting to a server on port 7022 ssh.
 
Last edited:
Back
Top Bottom