1,075,913 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?

Posts by blocblue which have been Voted Up

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

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

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

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 using a unique filename doesn't resolve the issue, you'll need to debug your code at each stage. To do this, you could write the upload progress for each image to a log file. E.g.
- Image uploaded (to temporary directory)
- Image extension allowed / disallowed
- Image filename
- Image moved to images directory
- SQL query
- Image inserted into database

This would then allow you to see where it's failing for each.

blocblue
Practically a Posting Shark
837 posts since Jan 2008
Reputation Points: 272
Solved Threads: 161
Skill Endorsements: 12

Are you getting any errors when uploading the files either on screen or in the server error log?

Do the images you're trying to upload exceed the filesize limit?

Are the 50 images appearing in the database?

Are the 50 images being successfully uploaded into your images directory?

blocblue
Practically a Posting Shark
837 posts since Jan 2008
Reputation Points: 272
Solved Threads: 161
Skill Endorsements: 12

Do you have permission from the third party site to use their content?
If so, could they not provide you with a data feed?

blocblue
Practically a Posting Shark
837 posts since Jan 2008
Reputation Points: 272
Solved Threads: 161
Skill Endorsements: 12
$string = 'username Membership Fee' or 'Username29473 Membership Fee';
$string = explode(' ', $string);
$username = $string[0];
blocblue
Practically a Posting Shark
837 posts since Jan 2008
Reputation Points: 272
Solved Threads: 161
Skill Endorsements: 12

You can get a list of the child taxonomies using the get_terms function. Simply pass the current taxonomy value as the parent argument.

http://codex.wordpress.org/Function_Reference/get_terms

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

Why have you started a new thread, asking the same question when someone has already taken the time to respond to your first thread?
http://www.daniweb.com/web-development/php/threads/442914/suggestions-please

blocblue
Practically a Posting Shark
837 posts since Jan 2008
Reputation Points: 272
Solved Threads: 161
Skill Endorsements: 12

In order to log into the site, both your username and encrypted (yet unsalted) password are stored in an encrypted cookie that uses the same salt for everyone. So, even if you did gain access to the database, you wouldn't be able to do very much with it because you'd be unable to rebuild a usable cookie in order to log in.

Isn't the point that most hackers will attempt to find the raw passwords from the hashes stored in a compromised database using dictionary attacks and the like?

They'd then be able to login using the standard website login functionality.

blocblue
Practically a Posting Shark
837 posts since Jan 2008
Reputation Points: 272
Solved Threads: 161
Skill Endorsements: 12

Sorry, it should have been a comma to separate the arguments in array_merge not a plus.

It'll be limited because adding two arrays with a + overwrites duplicate indexes. array_merge doesn't overwrite duplicate numeric keys.

blocblue
Practically a Posting Shark
837 posts since Jan 2008
Reputation Points: 272
Solved Threads: 161
Skill Endorsements: 12

According to the PHP docs, money_format is unsupported on Windows environments. Are you running Windows?

As an alternative, you could try number_format.

number_format(0, 2);    // 0.00
number_format(1.00, 2); // 1.00
number_format(1.2, 2);  // 1.20
blocblue
Practically a Posting Shark
837 posts since Jan 2008
Reputation Points: 272
Solved Threads: 161
Skill Endorsements: 12

When looking for a book, make sure you buy one for the correct version of the framework. Zend 1.8 is rather old.

The framework is on version 2.0.5, and was heavily rewritten for the release of version 2 to include the new PHP 5.3 features. Version 2 is therefore not backwards compatible with any previous versions.

blocblue
Practically a Posting Shark
837 posts since Jan 2008
Reputation Points: 272
Solved Threads: 161
Skill Endorsements: 12

@diafol hit the nail on the head.

I was going to suggest that if you were unable to remove the blank lines from your CSV, that you instead test for their presence when iterating through the data.

If the blank lines are truly empty, i.e. there are no spaces or anything, then adding something like the following should solve the issue. See lines 11 and 12.

<?php

$handle = fopen('csv.csv', 'r');
$row_count = 0;
echo '<html><body><table>';

// Iterate through each line of CSV file
while(($line = fgetcsv($handle)) !== false)
{
    // Skip line if empty
    if(! $line)
        continue;

    $row_class = $row_count % 2 ? '' : 'dark';
    $cell_count = 0;

    echo "<tr class=\"{$row_class}\">";

    // Iterate through each line value
    foreach($line as $value)
    {
        $cell_class = $cell_count % 2 ? '' : 'light';

        echo "<td class=\"{$cell_class}\">" . htmlspecialchars($value) . '</td>';
        $cell_count += 1;
    }

    echo '</tr>';
    $row_count += 1;
}

echo '</table></body></html>';
fclose($handle);
blocblue
Practically a Posting Shark
837 posts since Jan 2008
Reputation Points: 272
Solved Threads: 161
Skill Endorsements: 12

That's what you posted in your OP, which consequently you said isn't what you want.

Can you put the data into context? What is the relationship between table 1 and 2 for you to need a left join rather than inner join? Without explaining that, I can only assume the result you want is:

SELECT a.col1 FROM table1 a LEFT JOIN table2 b ON (a.id = b.table_a_id)

UNION 

SELECT b.col1 FROM table1 a LEFT JOIN table2 b ON (a.id = b.table_a_id)

However, this will include NULL values where there isn't a joining value in table b.

blocblue
Practically a Posting Shark
837 posts since Jan 2008
Reputation Points: 272
Solved Threads: 161
Skill Endorsements: 12

Here is a snapshot of the csv viewed in excel... it skips a line in the csv, so it would skip a line as seen on the site.

So you want a blank line? Because your original post alludes to that being the problem.

What exactly are you trying to do, and what exactly is the problem?

blocblue
Practically a Posting Shark
837 posts since Jan 2008
Reputation Points: 272
Solved Threads: 161
Skill Endorsements: 12

Line 30 probably should not be commented out, unless I've overlooked a closing </tr> tag somewhere else.

It may also be helpful if you could post a sample of your CSV file too, just to check that all lines contain the same number of comma separated values and no blank lines.

blocblue
Practically a Posting Shark
837 posts since Jan 2008
Reputation Points: 272
Solved Threads: 161
Skill Endorsements: 12
 
© 2013 DaniWeb® LLC
Page rendered in 0.1600 seconds using 2.75MB