Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

PHP 

Code Structure

Make a file, called core.php
and in this write this code.
PHP Code

<?php 
require_once('dbinit.php');
require_once(
'session.php'); 
and then in your database file, include your database connection.
For the session.php file, use this code. 
PHP Code

<?php 
session_start
();
session_regenerate_id(true);
//Endless Possibilities 

and then include the core.php inside all of your pages. Most likely, if you know a lot of php, you do not need this but for newcomers this makes things MUCH easier.
Hi, where is dbinit.php and session.php ? I dont understand the purpose of this code...
(Mar 29, 2018 10:34 PM)maype Wrote:  Hi, where is dbinit.php and session.php ? I dont understand the purpose of this code...

Read the post. It says it.

Not the best way to do this but it’ll work.z
(Mar 29, 2018 10:38 PM)Charger Wrote:  Read the post. It says it.

Not the best way to do this but it’ll work.z
My posts here are dedicated to beginners.
Wtf is this? How can you even call it structure? It's just two damn files without anything interesting in it. Oo
I do not feel like this will help people. Beginners more than likely are not going to have the files you have already included. You haven't even explained what this even does and why it would be useful.

hi
(Apr 1, 2018 12:52 PM)Anxuein Wrote:  I do not feel like this will help people. Beginners more than likely are not going to have the files you have already included. You haven't even explained what this even does and why it would be useful.

Most beginners are opening a new database connection on every page and adding session start on each page.
(Apr 1, 2018 01:28 PM)yrnGarry Wrote:  Most beginners are opening a new database  connection on every page and adding session start on each page.
You seem like a nice guy so I'm not going to be mean.

But he's right. I never messed with databases until later on, and if I did, I still wouldn't understand the purpose of this code. One of the first posts in this thread shows that a beginner has no idea what any of this means. Perhaps you should elaborate more on what this and the files are.

Je t'aime
[Image: fpZ5a5g.png]

(Apr 22, 2022 04:39 PM)-Scrub Wrote:  Jokes on you, I'm not smart enough to know what he's talking about.
(Apr 1, 2018 01:54 PM)Nachfolger Wrote:  You seem like a nice guy so I'm not going to be mean.

But he's right. I never messed with databases until later on, and if I did, I still wouldn't understand the purpose of this code. One of the first posts in this thread shows that a beginner has no idea what any of this means. Perhaps you should elaborate more on what this and the files are.

Alright
if your code is for beginners you should probably document what each line is doing so a beginner would understand this instead of just copying snippets lol
(Apr 1, 2018 04:19 PM)Jоey Wrote:  if your code is for beginners you should probably document what each line is doing so a beginner would understand this instead of just copying snippets lol
This.

I've seen a post of yours saying that your are planning on making a "Security Tutorial"
I think you should make it now. We'll see how "advanced" you are with PHP actually.
[Image: vibesignature.gif]


“Whatever Your Mind Can Conceive and Believe, It Can Achieve.” – Napoleon Hill
(Mar 28, 2018 01:59 PM)yrnGarry Wrote:  Make a file, called core.php
and in this write this code.
PHP Code

<?php 
require_once('dbinit.php');
require_once(
'session.php'); 
and then in your database file, include your database connection.
For the session.php file, use this code. 
PHP Code

<?php 
session_start
();
session_regenerate_id(true);
//Endless Possibilities 

and then include the core.php inside all of your pages. Most likely, if you know a lot of php, you do not need this but for newcomers this makes things MUCH easier.
Or just make a file called config.php with session and db and include it in your header ?


Possibly Related Threads...
Thread / Author Replies Views Last Post
by SnoctrizMar 1, 2024 06:00 PM 7 244 Mar 1, 2024 06:00 PM
Last Post: Hexicidal
[Javascript]  by VirtualFrostJan 14, 2020 05:31 PM 3 144 Jan 14, 2020 05:31 PM
Last Post: VirtualFrost
[PHP] by FaberCastellJan 6, 2018 03:51 PM 2 130 Jan 6, 2018 03:51 PM
Last Post: AppleJuice