Dani 4,653 The Queen of DaniWeb Administrator Featured Poster Premium Member

Huh??!!

rproffitt commented: The OP appears to have the usual social media accounts (maryamarmybts4). +0
Dani 4,653 The Queen of DaniWeb Administrator Featured Poster Premium Member

This appears to be a homework question. What does it mean by formulate an average reward problem? Is this a coding challenge? What have you tried so far? Where are you stuck? How can we help?

Dani 4,653 The Queen of DaniWeb Administrator Featured Poster Premium Member

Yes, I've heard good things about Udemy. Also Lynda. Udacity. Coursera. Codecademy. PluralSight. Khan Academy. Lots out there.

Dani 4,653 The Queen of DaniWeb Administrator Featured Poster Premium Member

Where will those div values come from? Will it be known fixed (constant) values or dynamic?

I don't think it really matters how or why we ended up with a series of <div>s that each contain a number. All that matters is they're in the DOM as so when it is time to select a handful of them.

Dani 4,653 The Queen of DaniWeb Administrator Featured Poster Premium Member

I would just like to add, I would not recommend doing it the way Papa_Don suggets. In his code, he is first doing a SELECT query to see if a duplicate row exists, and if it does, throw an error message. Otherwise, he assumes you can INSERT the record successfully. There are two reasons not to do it this way.

The first is because it's an extra SELECT query for no reason. It's more efficient to do an INSERT and then check the resulting status of that INSERT, than to do a SELECT followed by an INSERT.

The second reason is simply because it can easily introduce a race condition when the app is utilized by multiple users simultaneously. It doesn't account for an INSERT query introducing a duplicate record at the very instant or milliseconds after the SELECT query is performed by a different client, two similar INSERTS happening simultaneously, etc.

For example, an end-user can accidentally double-click the submit button and the script is executed twice. Both SELECTs might run on the server before either INSERT is run, resulting in duplicate rows being added near-simultaneously.

Dani 4,653 The Queen of DaniWeb Administrator Featured Poster Premium Member

HitNSplit, may I ask what the PRIMARY and UNIQUE indexes of the MySQL table look like? The reason I ask is because you have ON DUPLICATE KEY specified. If the primary key for the table is username, then basically if it tries to insert a new record with a specific username, and the username is already taken, it will overwrite that record with the new username while leaving the other columns of the original record. I highly doubt this is what you're trying to do.

What you can do instead is just INSERT IGNORE the new record into the table without overwriting anything if the username/id/whatever your primary key is already exists. In other words, completely remove the ON DUPLICATE KEY UPDATE part of the query. The IGNORE keyword will allow you to insert a new record into the table without giving an error if a duplicate key exists. Then, right after, you can SELECT ROW_COUNT(); which will return how many rows were inserted/updated as a result of the immediately previous SQL query. If 0 rows were inserted/updated, you know the insert failed because there was a duplicate record, and you can give the user an error message. If 1 row is returned, you know the new record was inserted successfully.

Good luck.

Dani 4,653 The Queen of DaniWeb Administrator Featured Poster Premium Member

If you're using jQuery (which it doesn't look like you are, but I thought i'd just mention it in case), you can do something as simple as $('figure img) to find all images that are children of figures, or $('img[src="images/start.png"]) to find all images that have images/start.png as their source URI, etc.

Dani 4,653 The Queen of DaniWeb Administrator Featured Poster Premium Member

You shouldn't need to. The foundation of the Google algorithm is that Google follows links across the web to eventually discover, on its own, every unique webpage worthy of indexing. Part of the Google algorithm is the concept that the more incoming links there are pointing to a webpage from higher quality sources (pages that have a high number of incoming links themselves), the more important that webpage is.

If you have a brand new website that nobody knows about yet, link to it from your Facebook, Twitter, LinkedIn, etc. Tell people about it. Share it with friends of yours who own blogs. Just don't spam :) Google will discover it on its own.

All that being said, the article that rproffitt linked you to talks about setting up a Google Search Console account. That's highly recommended to do as well, because it gives some valuable insight into how Google sees and indexes the pages of your website. However, it isn't required to be crawled, indexed, or show up in the Google search results.

Good luck.

Dani 4,653 The Queen of DaniWeb Administrator Featured Poster Premium Member

I have also been in desperate hope of some magic converter tool that translated all of my jQuery into vanilla JS. Unfortunately, I have yet to find one that works and doesn't break the code.

However, I've been very slowly converting, little by little, by following various articles online such as:

BWBama85 commented: Thanks, I will check those out. +0
Dani 4,653 The Queen of DaniWeb Administrator Featured Poster Premium Member

Hi Andrew,

Welcome to DaniWeb!! I guess my confusion is why this blue chip communications/media company does not already have the methods in place to collect sensitive data from its own employees without all sensitive information being visible? That sounds a bit like a security nightmare, to be honest.

All that being said, yes, it's thoroughly possible to create a simple web-based form, hosted on Company B's intranet, provided that Company B's intranet has an SSL certificate installed. The contents of the form can be populated via a server-side script into a database. Let's make it simple, and make it a simple MySQL database. The connection can be encrypted. From there, a script can be written such that only the non-sensitive fields can be accessed by the vetting employees. The vetting employees can flag the records as valid as they process through them.

In terms of completely automating the process, that would come down to what system is currently in place that has a list of all company employees. Although I'm not well versed in enterprise systems, I'm fairly confident there would be a way to write a script to cross reference the information employees are filling out in the form with the company's employee database, such that no humans need to be involved in the vetting process at all.

From a technical perspective, my personal experince is limited to PHP/MySQL. If I were tasked with doing this project, it would be a simple HTML form, a simple one-table MySQL …

Dani 4,653 The Queen of DaniWeb Administrator Featured Poster Premium Member

Sorry, I just saw this now. Do you mind sharing the solution so it could help other people in the future?

Based on the code I am seeing, I would expect that after var swal2container = $("#swal2container").text(); the value of swal2container would be test. You're saying it wasn't?

Dani 4,653 The Queen of DaniWeb Administrator Featured Poster Premium Member

If you use InnoDB, it supports row level locking, which means that the individual row is locked during an INSERT command. If you use something like MyISAM, it uses table level locking, meaning the entire table is locked during an INSERT command of any single row, but it has the added benefit of the DELAYED keyword. When a client uses INSERT DELAYED, it gets an okay from the server at once, and the row is queued to be inserted when the table is not in use by any other thread.

That being said, MYSQL might not be the best fit if there are thousands of simultaneous inserts. I've found that MySQL works great for read-heavy databases, but not so much for write-heavy ones. At DaniWeb, we use Redis for API requests that require many simultaneous reads + writes, including handling our OAuth authentication and API tokens.

You might want to investigate if you're using the right tool for the job.

Dani 4,653 The Queen of DaniWeb Administrator Featured Poster Premium Member

Without reading all your code, it's a good strategy to have an articles table that contains records of articles and their category_id, and then a second categories table of category_ids and their parent_id. In this way, for each article, you can traverse the list up to generate its parents.

The way that I am doing this on DaniWeb is by loading all of the categories into memory on every page, and using PHP to generate the breadcrumbs with a recursive function. I find this infinitely easier than using MySQL to generate the breadcrumb list, as MySQL isn't really cut out for this type of recursion.

Dani 4,653 The Queen of DaniWeb Administrator Featured Poster Premium Member

Hello there! Welcome to DaniWeb!!

Dani 4,653 The Queen of DaniWeb Administrator Featured Poster Premium Member

Mary, I’m sorry you’re upset, but you copied code exactly you found on the Internet.

DaniWeb is designed as a learning aid to help you learn. Not to just plagiarize what has been posted.

Good luck in your studies!

Dani 4,653 The Queen of DaniWeb Administrator Featured Poster Premium Member

Sarahle, please reply to the topic instead of commenting on the post. :)

Dani 4,653 The Queen of DaniWeb Administrator Featured Poster Premium Member

As rproffitt states, your MySQL query on lines 12 and 13 are happening outside of the loop, and just for the latest value of $val after the loop finishes executing (what $val last was in the last iteration of the loop).

What I think you're trying to accomplish is insert multiple rows at once. You can do that with a MySQL query like this to insert three rows simultaneously:

INSERT INTO customer_order (quantity, fast_image, menu_name, price)
VALUES (a, b, c, d), (e, f, g, h), (i, j, k, l)

This code is thoroughly untested, but try something roughly along these lines:

$insert_data = array();

foreach($_SESSION['cart'] as $keys => $val)
{
    // Add to array
    $insert_data[] = "('$val[0]', '$val[1]', '$val[2]', '$val[3]')";
}

$implode=implode(",",$insert_data);

$query="INSERT INTO `customer_order` (`quantity`, `fast_image`, `menu_name`, `price`) VALUES $implode";

$mysql_query=mysql_query($query);
Dani 4,653 The Queen of DaniWeb Administrator Featured Poster Premium Member

I'm not quite sure what you're trying to accomplish, but would using something like Swagger work?

Swagger is a JSON file that essentially documents your API, and then there are a handful of different Swagger tools that let you feed in that JSON file, and then they spit out documentation, example code in various languages, etc.

For example, the DaniWeb Connect API swagger file looks like this: https://www.daniweb.com/connect/developers/swagger

By passing that file in, you can then use the Swagger UI here: https://petstore.swagger.io/?url=https://www.daniweb.com/connect/developers/swagger

Notice that it lets you pass parameters and generate responses on the fly.

Is this something like what you're trying to accomplish?

Dani 4,653 The Queen of DaniWeb Administrator Featured Poster Premium Member

Unfortunately there are no Assembly tutorials already existing on DaniWeb. Assembly experts are urged to create some ;) hint hint

However, you can of course simply do a Google search for assembly tutorials.

Then, you can come here to DaniWeb with any specific questions you have or are confused by through your journey.

Good luck learning!

Dani 4,653 The Queen of DaniWeb Administrator Featured Poster Premium Member

Ummm, what are you trying to say??

Dani 4,653 The Queen of DaniWeb Administrator Featured Poster Premium Member

I think you're conflating to things.

The first thing is reputation points. That's the little badge next to your username with a number next to a trophy icon. You gain reputation points whenm people leave comments on your posts.

The other thing is the little text next to your username. Yours right now, for example, says Newbie Poster. That's your member badge and can be changed via your community profile here: https://www.daniweb.com/connect/profile/community

Dani 4,653 The Queen of DaniWeb Administrator Featured Poster Premium Member

Which lines in the code above correspond to lines 118-120 of public.php?

Also, I'm including the image here for reference.

6926d234978766542f544ed1e31e465c.png

Dani 4,653 The Queen of DaniWeb Administrator Featured Poster Premium Member

I forgot to mention, your site ranks very poorly for CLS! In fact, your poor cumulative layout shift score is most likely the reason you fail Google’s core web vitals assessment, now a speed factor in mobile searches.

You can improve this metric by setting fixed dimensions for every element on your pages, so every element has space waiting for it. This way, as things load, they aren’t shifting content around the page.

Good luck!

Dani 4,653 The Queen of DaniWeb Administrator Featured Poster Premium Member

Content isn’t just for the benefit of the OP. Regardless of motivation behind why it was started in the first place, there’s nothing wrong with having the discussion. 99.5% of our traffic comes from people coming from a google search to read a discussion whose participants are long gone.

Plus, i prefer to moderate content when necessary and not to police motivation. You’re not going to understand the motivation behind an anonymous person who posted text on the Internet 90% of the time, and there’s nothing wrong with having a different motivation than the next fella.

As was pointed out, member profiles and forum signatures offer absolutely no benefit for SEO.

Dani 4,653 The Queen of DaniWeb Administrator Featured Poster Premium Member

I got Pfizer as well. It made me very groggy the rest of the day. Also, muscle soreness in my arm. No other symptoms thankfully. I have the second dose scheduled for three weeks from now.

Dani 4,653 The Queen of DaniWeb Administrator Featured Poster Premium Member

Ugh, don't get me started on how horrible WordPress is for page speed. Looking at your site though, it's a billion times better than most! You haven't fallen into the trap of installing a billion plugins or using a heavy downloadable theme.

I checked your homepage out with Google PageSpeed Insights and it looks like your biggest delay is in the initial server response time. You're most likely on a shared web server, so that can sometimes cause issues depending on the other sites on the same server and how much traffic you get.

Also check out WebPageTest.org. They have the same complaint that PageSpeed Insights has about your web server being the biggest bottleneck.

I see you're using Cloudflare. You might wish to use them to cache your HTML pages for non-logged in users. I believe with a Cloudflare Pro account, you can cache resources based on whether a cookie is present.

Good luck!

rproffitt commented: Thanks for elaborating. The speed from my testing was very good for the hosting and such. +0
Dani 4,653 The Queen of DaniWeb Administrator Featured Poster Premium Member

You need an FTP client to upload a file from your local computer to a web server. You can download one of many free ftp clients. Linux, MacOS, and Windows have simple clients built in as well. As a reminder, you will need a user account with ftp privileges on the weever you want to upload to.

Dani 4,653 The Queen of DaniWeb Administrator Featured Poster Premium Member

So AJAX stands for asynchronous javascript and xml, and I use jQuery for all my AJAX commands. Are you having an Ajax issue going on?

Dani 4,653 The Queen of DaniWeb Administrator Featured Poster Premium Member

For me, the best experience has come from reading webmaster forums and then experimenting. Check out Digital Point, Sitepoint, Black Hat Forums, and WebmasterWorld. WebmasterWorld used to be the beer resource for me years ago, but I’m not sure how they stack up today.

Also, I would highly highly recommend Aaron Wall’s SEOBook ebook. It’s a great overview of everything you need to know. However, this was many years ago, so I’m not sure how up to date it is today.

Good luck!!

rproffitt commented: +1 +15
Dani 4,653 The Queen of DaniWeb Administrator Featured Poster Premium Member

I’m sorry to hear that. Covid time has been really hard on everyone around the world. Hang in there, and participate in virtual meetups.

Dani 4,653 The Queen of DaniWeb Administrator Featured Poster Premium Member

Huh?? I have no idea what you’re asking. What project? Is it a project you’re working on? Is it a homework assignment? Huhhhhh??

Dani 4,653 The Queen of DaniWeb Administrator Featured Poster Premium Member

Please show the work you have and where you’re stuck. We are a free community of members helping members, and so you’re going to have a rough time convincing people to just do your homework entirely for you for free.

Dani 4,653 The Queen of DaniWeb Administrator Featured Poster Premium Member

Sorry, most community members here won’t take the time to help you unless you put in some effort. Show us what you have tried so far and where you’re stuck or what isn’t working. We have nothing to gain by doing someone else’s homework for them.

Dani 4,653 The Queen of DaniWeb Administrator Featured Poster Premium Member

I’m scheduled to get the vaccine tomorrow. What should I expect? I don’t know which one I’m getting yet.

Dani 4,653 The Queen of DaniWeb Administrator Featured Poster Premium Member

Thanks for the comment. That makes me think you need to use the following function to convert numerics to strings.

PHP is an untyped language. There's no need to type cast it to a string. Use the PHP substr() function to get the digit you want (first, last, middle.)

rproffitt commented: Hmm, my reading was they were making a string, not extracting. +15
RC_820 commented: where i can reply my post? i want reply for the answer +0
Dani 4,653 The Queen of DaniWeb Administrator Featured Poster Premium Member

I'm sorry, I'm still very confused what you're trying to do.

I see on line 14 of the code above, you have $_GET['name']. That means that the page is meant to be loaded as file.php?name=Foo with a query string like that. If you're talking about clicking the Submit button on a form, I suspect submitting the form as a POST request and so you're looking for $_POST['name'] instead.

Then I see you have the SQL query to select all rows from the group_requests table that are useen and not accepted. I'm not seeing anything that uses this variable $name.

Then I'm seeing you are looping through the results, and for each request sender, you have a button that does, much to my surprise, do a GET request when submitting the form, not a POST request. So clicking the accept button should redirect you to file.php?accept=accept.

What do you mean by getting the sender variable out of the while loop?

Dani 4,653 The Queen of DaniWeb Administrator Featured Poster Premium Member

This seems incredibly inefficient. I can think of three ways to do this:

  1. Each time you want to perform a search, open each text file, one by one, search if the word exists in that file, and then spit out the files that matched.
  2. Create a database (e.g. MySQL) in advance of all the words in each text file. Update the database based on how often the text files may change. Each time you want to perform a search, simply query the database for which text files match the word(s) being searched for.
  3. Use a third-party search indexer such as Sphinx or Lucene.
Dani 4,653 The Queen of DaniWeb Administrator Featured Poster Premium Member

Are you getting any notices or warnings in your error log? Temporarily use debug mode to write all php notices/warnings to the error log.

Dani 4,653 The Queen of DaniWeb Administrator Featured Poster Premium Member

Oh sorry, I misread your initial post. You wrote everything for $6, not $6 and up. That might work out because no one expects to pay $5 at fiverr anymore. Everything is an up-charge there.

Good luck!! :)

6Maxi commented: It's OK Dani, Yes you have got it right. Everything for $6. +0
Dani 4,653 The Queen of DaniWeb Administrator Featured Poster Premium Member

I don't have the time right now to read your code, but you could use javascript to make an HTML button disabled after clicking it, until it's processed by the server. Personally, I use jQuery, but I do realize jQuery is going out of favor recently.

Dani 4,653 The Queen of DaniWeb Administrator Featured Poster Premium Member

This is an 8 year old thread. I don't think keywords in a URL are as important as they once were. However, there can be some advantages to using directory structure in a URL to signal to the user where in the hierarchy of the site they are, especially if the site's navigational structure is not very simple.

Dani 4,653 The Queen of DaniWeb Administrator Featured Poster Premium Member

OK, I see the updated question now.

You should be able to do this by, each time that a user logs in, store a cookie in their web browser with a random token / string. Then, store a flag in the database for the user of that same token / string. Each time that they load a page on your site, compare the value in user's cookie to see if it matches the value associated with the user in the database. If they don't match, log the user out. If they do match, then you know the latest login was performed from that browser.

Dani 4,653 The Queen of DaniWeb Administrator Featured Poster Premium Member

I don’t have experience with CI4 but I wrote DaniWeb on CI3. What do you mean about double login? Maybe I can do some research and help.

Rico_2 commented: I've edited my question +0
Dani 4,653 The Queen of DaniWeb Administrator Featured Poster Premium Member

Hi Edna! Nice to meet you.

Dani 4,653 The Queen of DaniWeb Administrator Featured Poster Premium Member

Hi there. Nice to meet you.

Dani 4,653 The Queen of DaniWeb Administrator Featured Poster Premium Member

Where in NY are you from? Born and raised on Long Island, but I moved to California 4 years ago.

bruce.hagen commented: Hi Dani, I was born in Minnesota, Moved to California when I was 9. I work remotely from my home. +0
Dani 4,653 The Queen of DaniWeb Administrator Featured Poster Premium Member

Payment gateways? Paypal, Braintree, and Stripe. Like those?

Dani 4,653 The Queen of DaniWeb Administrator Featured Poster Premium Member

Hi there and welcome to DaniWeb!

puja13 commented: thank you +0
Dani 4,653 The Queen of DaniWeb Administrator Featured Poster Premium Member

Hi there. Welcome to DaniWeb!!

satheeshsoft commented: thanks +0
Dani 4,653 The Queen of DaniWeb Administrator Featured Poster Premium Member

Hi there. Welcome to DaniWeb :)

It does, however, seem like you are in India.