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

By storing information about the user id or user session as a cookie in the end-user's web browser.

Keep in mind, if you just want to simply store user id as a cookie without messing with PHP sessions, encrypt it so that it can't just be changed to a different id by the end-user.

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

If I understand you correctly, you want the second dropdown list to appear in the web browser as soon as the primary category is selected, before the user hits the submit button, is that correct? If so, you will need to do this on the web browser side with Javascript. An example of it being done successfully can be found here on Stack Overflow

If this isn't what you're trying to do, let me know.

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

Give people a reason to come back. Give them the ability to create an account and then show them personalized content if they're logged in. In my experience, starting a mailing list has been the best way.

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

This is completely irrelevant, but perhaps it will help in the future. PHP has a built-in filter_var() function that automatically validates that an appropriately formatted email, URL, etc. have been typed in. The only reason I bring this up is because for some reason I thought that phone numbers might be included in that function, so I checked, but alas they're not.

You can change line 7 to be:

if (!empty($_POST['billing_phone']) && ! (preg_match('/^[0-9]{10}$/D', $_POST['billing_phone'] ))){

This should only show the error message if it's both not empty and doesn't match the criteria.

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

There are two very different ways to accomplish what you're asking. The first is, as I believe has been suggested above, to use Javascript to create a scrolling message that overlays on top of where you would display your video on a website. Remember, everything in a DOM document (webpage) is layered, so you can always choose which elements to overlay on top of all other elements.

Secondly, and I'm not sure anyone would actually want to tackle this, but programatically alter the video itself to add an overlay to it. I'm personally not sure how to do this, but I'm relatively sure it could be done.

rproffitt commented: I have worked in video editing on the backend systems. But would not do such on a mobile today. Too messy. But overlay on playback. Sure thing. +15
Dani 4,653 The Queen of DaniWeb Administrator Featured Poster Premium Member

What code is getting this error?

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

This seems like a homework assignment. What do you have so far? Where are you stuck?

Abhirami_1 commented: I applied for RPA developer job they given 3 tasks to do I don't know much about C++ I checked google but I am stuck . +0
Dani 4,653 The Queen of DaniWeb Administrator Featured Poster Premium Member

Also, I noticed you changed my code to:

header("Content-Disposition:attachment; filename=".$file);

This is incorrect. You don't want the filename to be a full path, as $file denotes. Go back to my initial value here.

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

Hi and welcome to DaniWeb!!

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

When I comment our the echoing of the contents I just get the output of the 2 <a href="..." ... </a> lines as a single line:

As I keep pointing out, you are still including HTML code. In the code above, the lines 1, 2, 13, and 14 are all HTML that cannot exist if you're trying to print a PDF. Also, you aren't seeing any of the PDF contents because you're not echo'ing out the PDF contents (you commented out line 11).

Please, please, please just try the five lines of code I provided to you, and it should work.

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

SEO existed long before those search engines did. I was doing SEO back in 1996 on GoTo.com, Ask Jeeves, Etc. Long before Google was born.

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

It’s not working because you’re still doing the same thing wrong of including HTML output on the same Page as you’re trying to spit out PDF contents.

What happens when you use the code I provided to you?

As far as having to echo the contents of the PDF out, my readfile() function is shorthand for both reading and then echoing out a file contents. It’s just like doing file_get_contents() and then echo() in one.

Your problem is you are still printing echo’ing out HTML code, even though it’s clear that’s what is breaking it.

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

I don't use any antivirus software on my macOS. For Windows, just whatever comes with Windows 10, as rproffitt says.

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

The headers have to be spit out before any other contents on the page. Also, are trying to spit out the contents of a PDF file and HTML on the same page. You can't do that. The webpage needs to be either HTML or a PDF file, not both.

For a PDF file, listscores.php should look as so:

<?php
$file = $_GET['file'];
header("Content-type:application/pdf");
header("Content-Disposition:attachment; filename='printout.pdf'");
readfile($file);

And that's it in the entire php file. Just those 5 lines. (Of course, this is very insecure because you're essentially letting someone download any file on the web server, depending upon the path they pass in as a URL parameter.)

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

Hi Ed. Thanks for posting this here. I tried to help you via our little one-on-one chat, but the private chat isn't really conducive to posting code and such.

The problem seems to be that you are using the listscores.php to point the browser to this PDF file. However, web browsers typically interpret the output of PHP files as plaintext HTML markup, and the PDF is essentially binary data.

When you try to load the .pdf file directly, the web browser knows how to correctly handle .pdf files, and so it treats it as such. When you try to load the .pdf file by way of .php, the web browser assumes HTML is the output of the .php file.

It would help if you could show us the contents of listscores.php

However, in lieu of that, adding the following PHP headers to listscores.php just before you echo anything out should resolve the problem for you:

header("Content-type:application/pdf");
header("Content-Disposition:attachment; filename='printout.pdf'");
Dani 4,653 The Queen of DaniWeb Administrator Featured Poster Premium Member

Sorry, I'm not quite understanding what you are trying to accomplish.

On line 22, you are splitting the $num variable into an array, so the value of $num, after line 22 executes, is now:

Array
(
    [0] => 1
    [1] => 1
    [2] => 1
    [3] => 1
    [4] => 1
    [5] => 1
    [6] => 1
    [7] => 1
    [8] => 1
    [9] => 1
)

Then you're taking that array and passing it in along with a $size of 4. I'm not quite sure what combin() is supposed to do? Why is there recursion? What are combinations? What are you combining?

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

I will preface this by saying I know nothing about game development or Unity. However, I suspect there would be some way to create an SDK for other developers to be able to utilize?

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

Creating the database on your database server isn't something we can do for you via a message forum. That's like saying, "Install this app on my phone." I can't exactly do it without physical access to your phone, of course. Do you have a specific question about how to do it?

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

Are you sure the library is called graphics and the files for that library are installed on the computer?

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

Yes, I don't remember what it's called, but there is a way to directly convert a website into an app. Ignore me when it comes to this.

However, I think there might also be a way to create an app icon that functions as a URL bookmark, but I'm not sure.

rproffitt commented: Thanks for this. Yes, there is some app maker that does nothing but launch the browser. You can choose the ICON for the app too. +15
Dani 4,653 The Queen of DaniWeb Administrator Featured Poster Premium Member

Domain age plays a big role in SEO directly because it tells Google that the website has been around awhile, and is most likely a legitimate company, and not a fly-by-night temp site or "doorway page".

Indirectly, domain age is probably one of the most important, if not the most important, factors in SEO, because the longer a domain has existed, the more people have found it and shared it on their social media, the more other webpages have most likely been linking to it over time, and the more backlinks it has built up.

As you point out, all of his social media URLs are one thing. Whatever they are, don't change the domain from that. Those social media links are essentially vouches for the domain that it's been around awhile, people are talking about it, and it's a real company. Destroying that can be a real killer to the company's long term gains.

Good luck!

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

HI Fred! Welcome to DaniWeb. I hope you stick around and join our little community here. I'll try to remember to refer to you as Fred when I see you around.

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

Sorry, I'm not understanding your question. What are you trying to accomplish? Are you trying to build a database for an ecommerce clothing store?

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

Sorry, we're just an English only community, but I assume you're trying to say Hello World :)

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

Also, don’t underestimate the power of social media. It’s common for employers to stalk potential employees on Facebook to get the inside scoop into what they aren’t saying on their resumes or interviews. Also, check LinkedIn.

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

There are lots of tools online where you can verify the identity of people. Most cost money. One of the more reputable ones I could recommend is WhitePages.com

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

I get this is a homework question, and we typically won't just do someone's homework for them without them showing any effort themselves, but I think this can be a learning opportunity for anyone who sees this.

$array = array ('Main', 'Photo Gallery', 120, 'Rustam', 'Services', 'Lesson 12', 'Link');

I'd like to begin by saying you accidentally had a typo in your code above. There should not be a space between the dollar sign and the word array. The reason is that the variable is $array, as PHP variables are preceded by a dollar sign. Having a space there would introduce a bug.

We now have this comma-delimited array of strings. An array of this type can almost be thought of as a list ... a list of these strings. We can use PHP to take this PHP array and spit it out as an HTML list. There are two types of HTML lists, ordered and unordered. Ordered lists are preceded by numbers (e.g. List Item 1, 2, 3, etc.) and unordered lists are preceded by bullet points. We denote them with the HTML <ol> and <ul> respectively. Let's spit out an unordered list:

echo '<ul>';

Now, let's loop through the array, and spit out each item in the array as an HTML list item. We use double quotes here because single quotes (as we used above) are literal, in that it will echo everything exactly as contained in the single quotes, but double quotes processes variables.

foreach ($array AS …
Dani 4,653 The Queen of DaniWeb Administrator Featured Poster Premium Member

Post comments show up when you vote on a post and provide a comment while doing so. If you revoke/change your vote, your comment gets deleted as well. I received an email that you left me a post comment and upvoted the post, but then when I viewed the post, it was gone.

As for editing/deleting posts, you can only do so for the first handful of minutes after posting, to correct typos and that sort of thing. We had way too many students/people who would post a question, get the help they needed, and then go back and edit their original question saying, "Problem solved. No help needed." completely breaking the thread and devaluing all the replies.

If you hover over a recent post, there should be a little pencil icon to edit it.

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

This is very weird.

Papa Don, I just got an email saying you commented on my post writing:

Dani, I see your point. You are correct that I am doing both a SELECT and a INSERT statement. I would be more efficient to do the single INSERT.

However, I don't see your comment :-/ Did you delete it?

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

Also ... it looks like you signed up 5 days ago and posted this topic 5 days ago as well, right after you signed up.

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

Hi there and welcome to DaniWeb!!

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

Hi,

You had posted your code just as plain text, so I converted it to a code snippet. However, I'm confused by the reason for your post. Do you have a question about your code? The topic title is inserting into a MySQL database with PHP, and that looks just like what you're attempting to do here. Are you intending to just post example code?

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

Hi there! Welcome to DaniWeb from sunny California.

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

Hi there! Welcome to DaniWeb.

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

It was my understanding from the OP’s question that only the basic name and employer ID were required for the vetting process. The additional sensitive information requested in the form was a requirement of the benefits themselves. That’s why they are saying that they don’t want this sensitive information to be accessible to the vetters.

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!!