Search found 326 matches

by Strider64
Mon Mar 23, 2020 3:24 am
Forum: PHP coding => General
Topic: FATAL ERROR $THIS->
Replies: 3
Views: 53

Re: FATAL ERROR $THIS->

No offense. but do you seriously think someone is going to even try to fix your problem? My best advice is to learn PHP Object-Oriented Programming by a video tutorial or a book.
by Strider64
Thu Mar 19, 2020 3:15 am
Forum: PHP coding => General
Topic: Problem with data pagination
Replies: 5
Views: 225

Re: Problem with data pagination

Maybe the following will clear it up?

Code: Select all

$pageIndex = $_GET['pageindex'];
where pageindex is the location of your array (data) so you can have pagination.

You will have to have an anchor element something like the following

Code: Select all

<a  title="Next Page" href="example.php?pageindex=1">1</a>
by Strider64
Wed Mar 18, 2020 10:11 am
Forum: PHP coding => General
Topic: Show result of columns
Replies: 2
Views: 107

Re: Show result of columns

Over the years I have found doing a mockup of the HTML/PHP first then adding the PHP has save me time, anguish and even shortens the php code. For example, here's a small CMS that I create for my personal website: blog.php <?php require_once '../private/initialize.php'; use Library\Read\Read; $displ...
by Strider64
Sun Mar 15, 2020 2:15 am
Forum: PHP coding => General
Topic: My PHP needs a slight edit, AS to JS
Replies: 3
Views: 153

Re: My PHP needs a slight edit, AS to JS

I haven't used Actionscript since 2011 and it brings back memories. Anyways I take it you a converting some kind of Flash Application over to Javascript Canvas? A game? I don't know too much about Canvas. Do you want to send a email to the user or do you just want to use the user's name? if it's the...
by Strider64
Sun Mar 08, 2020 2:49 am
Forum: phpMyAdmin
Topic: Register/Login not connecting to PHPMyAdmin
Replies: 2
Views: 203

Re: Register/Login not connecting to PHPMyAdmin

Do you have error reporting turned on? /* Turn on error reporting */ ini_set('display_errors', 1); ini_set('display_startup_errors', 1); if (filter_input(INPUT_SERVER, 'SERVER_NAME', FILTER_SANITIZE_URL) == "localhost") { error_reporting(-1); // -1 = on || 0 = off } else { error_reporting(0); // -1 ...
by Strider64
Fri Mar 06, 2020 4:28 am
Forum: PHP coding => General
Topic: Coding Help
Replies: 1
Views: 132

Re: Coding Help

I don't use bootstrap, but why are you using a bootstrap plugin for CSS? I had to use bootstrap for a tutorial I was following and simply used the css that bootstrap provided at the top of my HTML page. Anyways here's the link what I'm talking about -> https://getbootstrap.com/docs/4.4/getting-start...
by Strider64
Tue Mar 03, 2020 5:28 pm
Forum: PHP Scripts
Topic: Need help converting a tiny script from PHP5 to 7
Replies: 2
Views: 241

Re: Need help converting a tiny script from PHP5 to 7

While I don't use mysql(i) istead I use PDO (Which I recommend) shouldn't the following line be?

Code: Select all

while($row = mysqli_fetch_assoc($result))
or

Code: Select all

while($row = mysqli_fetch_array($result,MYSQLI_ASSOC))
instead of

Code: Select all

while ($row = mysql_fetch_array($result))
by Strider64
Tue Feb 25, 2020 4:22 am
Forum: PHP coding => General
Topic: Problems with My Validate Class in PHP OOP
Replies: 2
Views: 200

Re: Problems with My Validate Class in PHP OOP

When you doing PHP OPP the idea is to break everything do as much as possible in Objects. Ideally a class should be very basic, but even I tend to go little overboard. Here is my form validation class and note I don't use it any more, plus I don't like password requirements any more. I would simple ...
by Strider64
Sat Feb 22, 2020 5:54 pm
Forum: PHP coding => General
Topic: PHP PDO Registration OOP Class Not submitting to DB
Replies: 8
Views: 254

Re: PHP PDO Registration OOP Class Not submitting to DB

I personally would try to keep my PHP and HTML as separated as much as possible. Here's an old registration form that I did a long time ago. It is not the greatest but shows what I trying to say. <?php include_once 'vendor/swiftmailer/swiftmailer/lib/swift_required.php'; require_once 'lib/includes/u...
by Strider64
Sat Jan 25, 2020 5:51 am
Forum: mySQL & php coding
Topic: Deleting a single row with a button
Replies: 1
Views: 122

Re: Deleting a single row with a button

My first suggestion is to try to keep your HTML separated as much as possible from PHP code. Here's an example of my delete blog post -> <h1>The Miniature Journal</h1> <div id="gallery" class="picture-box" data-total="{$journal|count}" > {counter start=-1 skip=1 print=false} <div class="article"> {f...
by Strider64
Fri Nov 01, 2019 9:28 am
Forum: mySQL & php coding
Topic: Google reCAPTCHA V2 Response Error
Replies: 1
Views: 182

Re: Google reCAPTCHA V2 Response Error

I know this thread is over two weeks old, but here's my contact page PHP <?php require_once '../private/initialize.php'; if (is_logged_in()) { $smarty->assign('display_status', true); } else { $smarty->assign('display_status', false); } use Library\Database\Database as DB; use Library\Email\Email; $...
by Strider64
Wed Apr 04, 2018 1:32 pm
Forum: PHP coding => General
Topic: Captcha Validation
Replies: 2
Views: 742

Re: Captcha Validation

This is how I go about using Google's Captcha : if (hash_equals($_SESSION['token'], $token)) { /* The Following to get response back from Google recaptcah */ $url = "https://www.google.com/recaptcha/api/siteverify"; $remoteServer = filter_input(INPUT_SERVER, 'REMOTE_ADDR', FILTER_SANITIZE_URL); $res...
by Strider64
Tue Nov 21, 2017 4:59 am
Forum: PHP coding => General
Topic: style php results in html and css
Replies: 4
Views: 1125

Re: style php results in html and css

Twig ( https://twig.symfony.com/ ) or Smarty ( https://www.smarty.net/ ) -> I use Smarty. Templating makes it easier to develop secure pages and give people with little programming to help with the design portion of the website. Here's just a small example of what I mean taking from my cms template ...
by Strider64
Sun Nov 05, 2017 8:17 am
Forum: Your Scripts
Topic: OPINION: Make/Accessible, a lightweight PHP package that let you test singleton and encapsulated classes.
Replies: 1
Views: 1863

Re: OPINION: Make/Accessible, a lightweight PHP package that let you test singleton and encapsulated classes.

First of all I have been told by PHP gurus that one should not be using too many singleton classes and second if one writes a class that the class should be able to be UNIT tested without using a PHP package.
by Strider64
Thu Nov 02, 2017 4:05 am
Forum: PHP General
Topic: datetime-local input will not pull php echo
Replies: 2
Views: 834

Re: datetime-local input will not pull php echo

You could had simply done this -> $myDate = new DateTime($currentstartdate, new DateTimeZone("Europe/London")); echo $myDate->format("d/m/Y H:i"); though I don't think that is your problem, I think you need to look into using sessions for the variable $row['start_date']; for when you refresh you pag...
by Strider64
Sat Oct 21, 2017 1:21 pm
Forum: PHP coding => Mail
Topic: SMTP failure when posting contact form
Replies: 2
Views: 1710

Re: SMTP failure when posting contact form

I was having a similar problem and came across this fix for PHPMailer -> if (filter_input(INPUT_SERVER, 'SERVER_NAME', FILTER_SANITIZE_URL) == "localhost") { $mail->isSmtp(); // Local Host: $mail->Port = EMAIL_PORT; // Local Host Port: (Usually 587) } else { $mail->isSendMail(); // Remote Host: } Fo...
by Strider64
Fri Oct 06, 2017 1:39 pm
Forum: Your Scripts
Topic: PHP PDO Read and Write Tutorial
Replies: 0
Views: 2146

PHP PDO Read and Write Tutorial

A simple tutorial to help you create a small cms blog using PHP, PDO and MySQL I always wanted to create a tutorial on how to insert data to a database table, so here it is. You first must modify the config.php file to set your connection strings in order to get the rest of the files to run properly...
by Strider64
Sun Oct 01, 2017 10:30 am
Forum: mySQL & php coding
Topic: My script has stopped connecting to a database
Replies: 2
Views: 1343

Re: My script has stopped connecting to a database

Looks like you `might` be using a local connection instead of the remote server credentials? What I do is this in a configuration file: if (filter_input(INPUT_SERVER, 'SERVER_NAME', FILTER_SANITIZE_URL) == "localhost") { define('DATABASE_HOST', 'localhost'); // usually localhost define('DATABASE_NAM...
by Strider64
Tue Sep 26, 2017 8:29 am
Forum: PHP General
Topic: Keep track of login tries
Replies: 5
Views: 1471

Re: Keep track of login tries

You could also store the login attempts in a MySQL Database Table. If you are attempting to write a script prevent a brute force attack, I'll just say that is a tough task and I gave up on it for the attackers have the upperhand on this one. That is why I tell people to use tougher passwords than th...
by Strider64
Fri Sep 22, 2017 3:16 am
Forum: mySQL & php coding
Topic: php mysql login function
Replies: 3
Views: 2064

Re: php mysql login function

Here's a better way of doing it , doesn't use obsolete mysql and is more secure: <?php session_start(); $db_options = array( /* important! use actual prepared statements (default: emulate prepared statements) */ PDO::ATTR_EMULATE_PREPARES => false /* throw exceptions on errors (default: stay silent)...
by Strider64
Thu Sep 21, 2017 4:15 am
Forum: PHP Scripts
Topic: password_verify returning false
Replies: 1
Views: 1850

Re: password_verify returning false

I don't know why you are using FETCH_ALL to get a single user? I would do something like the following: <?php $db = DB::getInstance(); $pdo = $db->getConnection(); // This is just my connection string setup: /* Setup the Query for reading in login data from database table */ $query = 'SELECT * FROM ...
by Strider64
Tue Sep 19, 2017 8:23 pm
Forum: PHP coding => General
Topic: php 7.0 beta and session_start
Replies: 1
Views: 587

Re: php 7.0 beta and session_start

I don't know if this will help you but all I do when I end a session is the following -> // Function to forcibly end the session function end_session() { // Use both for compatibility with all browsers // and all versions of PHP. session_unset(); session_destroy(); } Sorry I'm not much help for I'm ...
by Strider64
Thu Sep 14, 2017 2:35 pm
Forum: PHP General
Topic: How would I add to a dropmenu using php?
Replies: 2
Views: 1507

Re: How would I add to a dropmenu using php?

Here's how I go about doing something like this. I first try to keep the PDO and the HTML separated as much as possible. First I grab all the records that I want by calling function: <?php use Library\Database\Database as DB; function getUserInfo() { $db = DB::getInstance(); $pdo = $db->getConnectio...
by Strider64
Thu Sep 07, 2017 7:50 am
Forum: mySQL & php coding
Topic: Getting a simple php script to display results
Replies: 14
Views: 3625

Re: Getting a simple php script to display results

Do you have error reporting turned on? /* Turn on error reporting */ ini_set('display_errors', 1); ini_set('display_startup_errors', 1); if (filter_input(INPUT_SERVER, 'SERVER_NAME', FILTER_SANITIZE_URL) == "localhost") { error_reporting(-1); // -1 = on || 0 = off } else { error_reporting(0); // -1 ...
by Strider64
Wed Sep 06, 2017 3:24 am
Forum: Your Scripts
Topic: Simple PHP Class to put images into HTML slider format
Replies: 0
Views: 1801

Simple PHP Class to put images into HTML slider format

This simple class will enable you to put all the images of a particular directory into HTML format so that you can use it for a slider or rotator. I'm only providing the PHP, for you should be able to create your own slider from the HTML that is generated. Here's my index.php of my website: <?php re...