Feat-descr: | I have a redirect that already goes to the correct page on mysql-redir, and a conditional, with function call, on post.post-number; combine, and test. |
Stack: | 100% PHP, no HTML. |
Impl-details: | For best practice, I will put it at the top of the document. |
Test-case: | When I change the text inside of the include function call to ‘lucy’, and attempt to access the page, it should automatically redirect back to post.post-number without showing the page. |
Dependency testing: | Minimal, because the redirect is its own line of code and precedes other code. |
<?php
include 'C:\wamp64\www\personal-dash\php_local_libs\login.functions-inc.php';
$post_ID = $_GET['post_ID'];
$output = check_edit_perm('lucy');
if ($output != 1) {
header("Location: http://personal-dash/post.post-number.php?post_ID=$post_ID");
// correct.header-redir: header("Location: post.post-number.php?post_ID=$post_ID");
// correct-URL: include 'C:\wamp64\www\personal-dash\php_local_libs\login.functions-inc.php';
}
echo $output
?>
<!-- test-URL http://personal-dash/testing-progress/conditional.static-redir,test.php?post_ID=1 -->
<!-- Testing-log, in reverse-chron
Output only test: echo $output displays 1 when the check_edit_perm param=blind, null, when other #expected.
Redir-test: param=blind; there is no redirect, and an output of 1 is shown #expected
Redir.test-2: param=lucy;
Issue: there is a problem, using an absolute link, in Location: of header.
Only relative links, seem to work.
Fix: Location: accepts URL in this format: http://personal-dash/post.post-number.php?post_ID=$post_ID
Ref: https://www.php.net/manual/en/function.header.php
Re-test: correctly redirects to http://personal-dash/post.post-number.php?post_ID=1 ✅ -->
<!-- push to /personal-dash/dash-edit.php 10/19/22 20:52 EDT-->
Hu: From here, our code is ready to merge<WP.MIC-H2S51> Fin.v-1
H3S1: Saving dev-time with technical product management:
It took me 15 minutes to write the following description:
I can display a checkbox for creating a forward link on the page create page directly. This checkbox will only display if session_username matches $GET[‘back_author’]. Since the back URL is propagated, I have the data to be able to do a record search, and find if there’s an open spot. I can say “The previous page has an empty slot on xx, would you like to link the new page”? The setting for this checkbox will be posted, along with the button and a form # to insert-redir. There, after I calculate the new post_iD, I just need a one line UPDATE # statement to add to an empty column, the number of which should be posted or getted from the page create form, # the new post_ID, the session_username, in the same table that the INSERTION is happening. Order doesn’t matter, since the URL can be inserted independently of the page being created. Title will also be fed from the page create form, as for the INSERT, and be set as the text for that link. All of this will only happen, if that box is checked. From last time, the checkbox can only post a static value, but this value can be variable controlled # I can generate a variable from the db_empty_search, and plug this # into the checkbox value, “link$x”, or just “$x” and post this, to the redir; minimal is fine, since the name of the checkbox is the identifier; on the redir, I can read the exact length # of the string, or the int in the string, and pass this to the UPDATE statement, to specify the text# and url# to add the forward link. Db_empty_search: I need to find the earliest text and url, both, since some people might store their info latently at times. Search call from this page is fine: not much else going on, and a relatively low frequency compared to other pages. Loop through the text# and url# columns in the list, with a while, end the loop when both == “”, probably just call select_single_grid, assign the value to a variable-obj, and compare them. Return the # when the while loop ends, or false, and if false, the entire option, including checkbox, is not displayed. This should be the first line in this add. empty_link_slot should be a function defined on the MySQL Inc. Since the new link is presumed to be internal, no need to add new tab checkbox, and default it to self #
And I was able to replicate this functionality, almost entirely, in 1:40, with code, and testing all sides:
H4S1: 11/7/22 dev<fbno>
1a) Create a users-tb with i) username column and iii) passwords column, that’s all for now #mvp
1b) Manually add a username for the user ‘blind’, as a row, in this table #
1c) Manually add a second user, ‘lucy’, with a different password, in the table #
1d) Create a new input item, on the login page, where users can enter a password, with no validation. https://www.w3schools.com/tags/att_input_type_password.asp
Fin.v-1
2a) On login redir, search the users-db for the user’s name. If it does not exist, return users to the login page, with a $_GET that indicates wrong_username, and upon this $_GET, that page will display a prompt, that the username’s input was not found. If and only if the username exists, now check the password, for the same row, in which the username was found. If the password is wrong, use a different $_GET, same logic, to bounce users back, and display the error message. If and only if both pass, proceed with login, as I had before, and make sure the user’s name is established # as the $_SESSION[‘username’]
3a) Create a new page, register.php
3b) Link this page from Index.php, but only if users are logged out, same row, copy logic for login.
3c) Add note that users should not set a secure password, upon account creation, because we can see it.
3d) On register.php, display 2 fields, to set a username, and a password. Both fields should be required: https://www.w3schools.com/tags/att_input_required.asp. Set an adequate length limit for each field.
3e) Create register.redir-php, and here we need to i) insert a new row, with the user input information, into users-tb ii) create a new table for this user, with the exact same parameters as the existing dash_blind_posts table, setting the user’s selected username, within the table name iii) auto add a row to the table with post_ID=1, see 4)
H4S2: 11/9/22 feat-dev:
4a) On Index, simply # add a partially hardcoded hyperlink with author=$_SESSION[‘username’]&post_ID=1, and call it “My.dash-home” in link text #
4b) Add a single conditional, on post.delete-confirm, that will block the confirm button, if the user attempts to delete post_ID=1
5a) $_GET post just the first integer of the post title, without a conditional check for now, to see what happens, into URL of next page; pull this $_GET, which terminates at post-create.php, into a pre-fill value for the Layer form, but increment it +1.
6a) Create url-lib.php, and create 2 general global variables, and call these as echoes and refs #: URLs are displayed in 3 paradigms in personal dash: HTTP form redirects, header redirects, and hyperlinks. URLs are displayed in 2 formats: forward, and back slash. Note that dreamhost uses https://
7a) Launch P-dash on dreamhost. Manually create db for now; users_tb needs to be created; dash_post tbs will auto-generate. Add security later, only share with a few friends atm. Import some rows from mine as an example. Don’t share link on strim, for now.
8) A move link feature: click “Move” on dash-edit<layered>, parallel with the “Save” button, but on the 4th column; clicking transitions to dash.edit-move.php; which will display an uneditable list of links & text, with checkbox on each row<table-gen>, a hybrid of dash-edit and post.post-number. Below, simply enter # the post_ID # that you’d like to move to. If there are not enough slots on that page, return a $_GET error.
11/13 Feat-Dev:
9) Search: Let’s implement search as a separate page for now, and make it accessible # from /index.php and /post.post-number.php. Later, we can think about integrating in-page, as this is a good feature candidate. On the search page, there will be a) an HTML dropdown, to select among the available search engines; each one will be associated with a custom search params generation control, subject to research b) a box to enter a search query, with text input c) a “Search” button. All searches, to external engines, will open in a new tab #
9a) Internal search: Internal search will be triggered, if the checkbox is internal, and will return i) containing URLs, ii) containing text, iii) containing page titles iv) containing notes. Words must be 100% match, to start; separation can be made by spaces; return a result, even if the $haystack contains more than just the $needle, but the $needle itself is 100% contained # 9b) Generation of an internal, index search-db, with text-based indexing i) the user can click to refactor this db periodically ii) the time of the last refactor will be stored, and displayed, on the level of a variable, in the file, rather than db<innovative!> iii) the index will contain 1) a column for the word, after they’ve been split 2) a column for the parent post title 3) a link to the parent post 4) the type, Link text, URL, Page-title, or Notes.
^ Display some helper text, to explain the search algorithm, with a code “click to reveal” controlled by JS, if necessary, for the code reveal<fbno>
^Build: I will start by creating a new tb, for each user<Turing>, dash_blind_search, with the relevant columns, and set the word-column as a text index; need to review<WP.MIC-H2S30,H3S2.H4S9>
See below: 11:47 for ideas on using post, array, str(pos) to generate some search. See W3Schools<a-r>for dropdown idea.
11/17 Feat-dev:
Goal: migrate all note-taking to p-dash:

Bug: Fix the apostraphe ” SQL issue, some research, before strim.
- Create a Notes page, accessible from index, with an XML formatting, allowed, not HTML, here, only, where I can mark up a text field, URL field, and notes entry, that is associated with a #), auto-inserted into the Notes of a future note, as a pre.note-insert.
- Allow me to add and edit history in a messaging style; format a heading, that becomes the text, with the word heading, a notes section, and URL, but all are optional; for existing notes, click to edit. Future: port these over to Flare, as the beginning of email, which is a Flare service, until future differentiation<Turing>
11/18 Feat-dev:
Make p-dash into a personal to-do list, by allowing users to add tags:
- Add tags to each link, as an attribute.
- Tags are part of additional settings, which can be clicked to reveal; possibly, and this could be good, add a tag field above Notes; select the post #, and which tag to add. Tags are user-invented. “To-Do” can be a tag. Auto-fill tags. Filter by all links, on a links general page, which I will also have to build here, to see a list of all To Do items. Filter by multiple tags, such as Upwork, and To-Do, to see my To-Do items, for just Upwork.
- Add a “Watch-Later” queue of unassociated streams, triggered by an on-hold gesture and reformat the (+) New-Page on post.post-number to (+) – Page, where holding down on Page, can bring up a dropdown, to select a link on release, that auto-extracts what’s in the clipboard, and adds it as a link to the watch-Queue. Make this intuitive, and as fast, at minimum, as bookmarks. This will be displayed on the Link-list # in an agnostic bucket #
References:
https://stackoverflow.com/questions/19323010/execute-php-function-with-onclick
https://www.w3schools.com/jsref/tryit.asp?filename=tryjsref_onclick_dropdown