You cannot upload a PDF file and then just read it's content. The file content is encoded.
There are ways to extract the content of a PDF as plain text, but this won't work with images.
Alternatively, you could use file_get_contents to read the content of the file, as is, store this as a BLOB in the database, although I agree with others that you just reference the file location in the database, then set the headers to write the PDF content to the HTTP response to return it to the user as a PDF again.
blocblue
Practically a Posting Shark
837 posts since Jan 2008
Reputation Points: 272
Solved Threads: 161
Skill Endorsements: 12
blocblue
Practically a Posting Shark
837 posts since Jan 2008
Reputation Points: 272
Solved Threads: 161
Skill Endorsements: 12
The click event is bound upon DOM ready state. If you change the DOM thereafter by adding new elements, these will not have the click event bound to them.
You can either, rebind the click event (a little pointless), or you could use the on function.
$(document)
.on({click: function(event) {
console.log($(this).val());
alert($(this).val());
}}, '#option1')
blocblue
Practically a Posting Shark
837 posts since Jan 2008
Reputation Points: 272
Solved Threads: 161
Skill Endorsements: 12
URL encode is used to encode certain characters within a URL. It's not used to encode all characters and certainly isn't a means of encryption.
24 URL encoded is 24.
blocblue
Practically a Posting Shark
837 posts since Jan 2008
Reputation Points: 272
Solved Threads: 161
Skill Endorsements: 12
This assumes that time is a MySQL DateTime field.
DATE_ADD(`time`, INTERVAL 1 HOUR)
blocblue
Practically a Posting Shark
837 posts since Jan 2008
Reputation Points: 272
Solved Threads: 161
Skill Endorsements: 12
I suggested a foreach loop because it removes the complexity.
It's more complicated with a while loop. You'll need to look into the use of the current, next and perhaps end functions for arrays.
blocblue
Practically a Posting Shark
837 posts since Jan 2008
Reputation Points: 272
Solved Threads: 161
Skill Endorsements: 12
I've used a foreach loop instead, but something like the following should work.
$month = null;
foreach($data as $row)
{
if(is_null($month) || $month <> $row['month']) {
$month = $row['month'];
echo "<strong>{$month}</strong><br />";
}
echo "{$row['name']}<br />";
}
blocblue
Practically a Posting Shark
837 posts since Jan 2008
Reputation Points: 272
Solved Threads: 161
Skill Endorsements: 12
Try:
<?php if(! $viewee['name'] && ! $viewee['occupation'] && ! $viewee['education']): ?>
<!-- Display your message here -->
<?php endif; ?>
<div id="container1">
<div id="friends-cta">
<?php echo $viewee['name']; ?>
</div>
<div id="friends-ata">
<?php echo $viewee['occupation']; ?>
</div>
<div id="friends-emp">
<?php echo $viewee['education']; ?>
</div>
</div>
blocblue
Practically a Posting Shark
837 posts since Jan 2008
Reputation Points: 272
Solved Threads: 161
Skill Endorsements: 12
Is the file less than 50000 bytes and is there definitely not an error code set in the $_FILES array?
Perhaps try adding an else to the if statement on line 6, to var_dump the $_FILES array.
blocblue
Practically a Posting Shark
837 posts since Jan 2008
Reputation Points: 272
Solved Threads: 161
Skill Endorsements: 12
You should be able to view the local server of another computer on your network using it's network IP address.
You can find this on Windows via the command prompt using ipconfig -all.
If you're using multiple vhosts, you'll need to update the hosts file on the remote (non-hosting) machine.
blocblue
Practically a Posting Shark
837 posts since Jan 2008
Reputation Points: 272
Solved Threads: 161
Skill Endorsements: 12
Are you using PHP 5.2 or above?
If so, you could use to validate the email address as a whole:
filter_var('bob@example.com', FILTER_VALIDATE_EMAIL);
And then using strpos and substr extract the domain element and do a string comparison to restrict the domain.
blocblue
Practically a Posting Shark
837 posts since Jan 2008
Reputation Points: 272
Solved Threads: 161
Skill Endorsements: 12
Without seeing your full database schema, it's difficult to know whether this is correct. Also, it's advisable to include the table alias with column names referenced in the query.
$sql = "SELECT `i`.*
FROM `items` `i`
INNER JOIN `categories` `c` ON (`c`.`id` = `i`.`item_cat`)
WHERE (`c`.`id` = {$cat_id} OR `c`.`parent_id` = {$cat_id})
AND `ad_active` = 1
ORDER BY `ad_date`";
blocblue
Practically a Posting Shark
837 posts since Jan 2008
Reputation Points: 272
Solved Threads: 161
Skill Endorsements: 12
Something like the following should let you find all items in a specified category (including sub categories).
I wasn't sure what your table names were, so I've called them items and categories.
SELECT `i`.*
FROM `items` `i`
INNER JOIN `categories` `c` ON (`c`.`id` = `i`.`item_cat`)
WHERE (`c`.`id` = 1 OR `c`.`parent_id` = 1);
blocblue
Practically a Posting Shark
837 posts since Jan 2008
Reputation Points: 272
Solved Threads: 161
Skill Endorsements: 12
Post your database schema for the articles, category and sub category tables and the PHP code you already have.
blocblue
Practically a Posting Shark
837 posts since Jan 2008
Reputation Points: 272
Solved Threads: 161
Skill Endorsements: 12
I have used the same code on another part of the site and it works perfectly.
I don't see that you've reinitialised the $files array anywhere. It could be populated with the results of the last time you used the code.
Add $files = array(); immediately after line 4.
blocblue
Practically a Posting Shark
837 posts since Jan 2008
Reputation Points: 272
Solved Threads: 161
Skill Endorsements: 12
If I understand your explanation, you're asking how to redirect the user to the folder on their computer which contains the file they downloaded from your website?
In short - it's not possible. Neither PHP or any front-end languages have access to the filesystem on the user's computer to do this.
blocblue
Practically a Posting Shark
837 posts since Jan 2008
Reputation Points: 272
Solved Threads: 161
Skill Endorsements: 12
What have you tried thus far?
I would suggest you try one of the PHP XML libraries to parse the content from the feed. SimpleXML is an easy one to start with.
blocblue
Practically a Posting Shark
837 posts since Jan 2008
Reputation Points: 272
Solved Threads: 161
Skill Endorsements: 12
Hiding form fields doesn't really help improve security. However to create a hidden field, simply use the hidden type attribute:
<input type="hidden" ... />
blocblue
Practically a Posting Shark
837 posts since Jan 2008
Reputation Points: 272
Solved Threads: 161
Skill Endorsements: 12
What have you got so far. Post your code.
blocblue
Practically a Posting Shark
837 posts since Jan 2008
Reputation Points: 272
Solved Threads: 161
Skill Endorsements: 12
Looks like you're missing the author and possibly other values from your insert query.
Either explicitly list each field you intend to provide a value for or ensure you provide a value for all fields.
blocblue
Practically a Posting Shark
837 posts since Jan 2008
Reputation Points: 272
Solved Threads: 161
Skill Endorsements: 12