Jump to content

floridaflatlander

Members
  • Posts

    671
  • Joined

  • Last visited

  • Days Won

    1

Posts posted by floridaflatlander

  1. If I had only one pic per category I'd use something like

     

    id | cat_name | image_path | url | summary or what ever  |

     

    echo  '<a href="'.$row['url'].'"><img class="image1" src="'.$row['image_path'].'" alt="'.$row['cat_name/summary or any column you want'].'></a><br />';

     

    or

     

    echo  '<a href="'.$row['url'].'"><img class="image1" src="'.$row['image_path'].'" alt="'.$row['cat_name'].' - '.$row['summary or any column you want'].'></a><br />';

  2. Could I put property id? because each property has its own unique id?

     

    It lookes like you have two unique ids. You probably only need one.  Is id an auto_increment? Anyway as long as they're unique you can use them.

     

    Okay we have

     

    id | property_id | image_path

    id | cat_name

     

    so you could do

     

    echo  '<a href="xxxx.com/category.php?cat='.$row['id or property_id'].'"><img class="image1" src="'.$row['image_path'].'" alt='.$row['cat_name or any column you want'].'></a><br />';

  3. What would I put in "xxxx.com" because the links are going to all be different depending on which image is displayed.

     

    I was assuming you have a table like

     

    cat_id | cat_name | summary | image_name |

    1 | dogs | dogs are great |dogpic.jpg

    2 | cat | cats are better | catpic.jpg

     

    so xxxx.com/category.php?cat='.$row['cat_id']. would become  xxxx.com/category.php?cat=1 and it would be a picture of a dog and a link to the dog category.

     

     

    It would look more like this if I did it

     

    echo  '<a href="xxxx.com/category.php?cat='.$row['cat_id'].'"><img class="image1" src="/image-folder-path/'.$row['image_name'].'" alt='.$row['summary'].'></a><br />';

     

    and your source would end up like this

     

    <a href="xxxx.com/category.php?cat=1"><img class="image1" src="/image-folder-path/'docpic.jpg"' alt="dogs are great"></a><br />

  4. Say you have a category table that has all your cats info including a column for the image location, we'll call it image_path.

     

    run a sql statement to display the categories image_path and cat_id

     

    while (this stuff) {

    echo  '<a href="xxxx.com/category.php?cat='.$row['cat_id'].'"><img class="image1" src="'.$row['image_path'].' alt='.$row['summary'].'></a><br />';

    }

  5. ...if they get your config file, the order you hash the pw & salt and your tables(salt & hashed passwordsdb) you have ... problems.

     

     

    5. ......, instead use sha1(md5($password).$password). It's hard to explain why without getting deep into how hash algos work. There's plenty of info out there if you want to dive deeper.

     

    Whats the difference?

  6. Here is a very useful link http://onlinebusiness.about.com/od/searchengineoptimization/a/search-ranking.htm but when all is said and done it all boils down to content. To me all 10 of these factors hinges on content one way or another.

     

    You don't need different names web site names, just the content that people are looking for, also as a note people say key words but many times they're talking about key phrases. Have them on your page, the higher up the better, Like tab title and an h1 title on the page that says Dallas Air Conditioning Service.

     

    When someone clicks on my domain, which would come up on the search, instead of seeing the generic text,

     

     

    When someone searches for Dallas Air Conditioning Service, they'll see your page title like the one on the tab at the top here and they'll click it and it will go to your site.

     

    Also get people that you do business with to link to your site using "Dallas Air Conditioning Service" not your company name.

  7. I think wordpress allows you to add a general salt (the same one for everybody) on their config page. if you did this you could hash it and the password anyway you want, md5 then sha1 etc.

     

    And yes if they get your config file, the order you hash the pw & salt and your db tables you have a sh*t pot full of problems.

  8. I'd go to the phpbb forums, this should be a standard problem for people moving a forum and you should have people there that could point you in the right direction.

    For example, smf has a file repair_settings that walks you through many of the things you're talking about.

  9. Wow, talk about a jury rig.

     

    Anyway, I borrowed/took this preg_match from stack flow. As I walk through this I get, table_column LIKE '%"Grizzly Bear"%'  and I can't remove the double quotes in  '%"Grizzly Bear"%'

        // Extract the search keywords into an array
        $clean_search = str_replace(',', ' ', $user_search);
        preg_match('"([^\\"]+)"', $clean_search, $multi_words); // added
        
        $clean_search = str_replace("$multi_words[0]", ' ', $clean_search); // I'll make this a loop later
        $search_words = explode(' ', $clean_search);
        $final_search_words = array();
        if (count($search_words) > 0) {
          foreach ($search_words as $word) {
            if (!empty($word)) {
    $final_search_words[] = $word;
            }
          }
        }
    
    $final_search_words[] = $multi_words[0];
    
        // Generate a WHERE clause using all of the search keywords
        $where_list = array();
        if (count($final_search_words) > 0) {
          foreach($final_search_words as $word) {
           $word = trim($word);
           $word = str_replace('"', '', $word); // I can get this to work for an underscore but not for double quotes for some reason
           $where_list[] = "table_column LIKE '%$word%'";
          }
        }

  10. I am now using an underscore for a two word search (Grizzly_Bear) it seems to do a good job but  I noticed the standard is double quotes “Grizzly Bear”

     

    So how to build a search for two word searches using double quotes? This is what I have so far ...

    $user_search = mysqli_real_escape_string($dbc, $_GET['usersearch']);
    
    $search_query = "SELECT * FROM db_table";
    
    // Extract the search keywords into an array
        $clean_search = str_replace(',', ' ', $user_search);
        $search_words = explode(' ', $clean_search);
        $final_search_words = array();
        if (count($search_words) > 0) {
          foreach ($search_words as $word) {
            if (!empty($word)) {
    		$trimmed_word = trim($word);
    		$trimmed_word = str_replace('_', ' ', $trimmed_word);
    		$final_search_words[] = $trimmed_word;
            }
          }
        }
    
        // Generate a WHERE clause using all of the search keywords
        $where_list = array();
        if (count($final_search_words) > 0) {
          foreach($final_search_words as $word) {
            $where_list[] = "table_column LIKE '%$word%'";
          }
        }
    
        $where_clause = implode(' OR ', $where_list);
    
        // Add the keyword WHERE clause to the search query
        if (!empty($where_clause)) {
          $search_query .= " WHERE $where_clause"; // This is the final query
        }

     

    Thanks

    SJ

  11. I was wondering if i can create tables for every article my website have to store the user allowed comments to vote;

    Is there any limit for how many table a database can have?!

    And this is a viable solution?!

     

    You can figuratively create as many tables as you want per db.

     

    If I had to guess right of the top of my head you could probably put all the votes for all the articles in one table. To create a table for each article would be a pain.

     

    If the votes are important make user join your site before they can vote and you can then make sure(more or less) that there is only only vote per person.

     

    What I like about cookies and/or sessions is that it would be easier and almost as accurate.  Average Joe's like me would have to go into the Firefox menu or IE's menu and delete their cookies to vote twice. I'm sure there are smarty pants out there somewhere that could make an automated system to delete their cookies and vote again but why would they do that for your site?

  12. I see a lot of functions in scripts in wordpress that are not 'defined' in that script file.

     

    Many are defined in places like wp-includes/general-template.php. To find out more about the locations various functions google the function name or as close to it as you can get and you'll find someone somewhere as probably ask the same same question.

  13. How anal are you about the voting ?

     

    If not very, use cookies/sessions and set them to expire in the distant future.

    Why would someone try to skew your voting? How many times would they do it?

    Most people would give it a one time try and if it didn't count again forget about it. They wouldn't go through the trouble of deleting cookies to vote again.

    Cookies would be alot  easier and I'd use that unless it is for an important pole or info.

    As a note and for comparison I pretty sure my coppermine photo album uses cookies.

     

  14. How anal are you about the voting, if you want to make sure someone only votes once then you may need to register members but even this has flaws. As far as ip address some people's change often, my ip address(I have comcast) only changes very yr or so. You could also use cookies, it would be easier and if someone wanted to vote twice they'd have to delete their cookies and vote again.

  15. What are you getting the indefined index on, user_firstname or user_priority? Both?

     

    anyway try,

     

    if (isset($_SESSION['user_priority']) &&  ($_SESSION['user_priority'] == '1')) {

    header("Location: AdminSection.php"); 

    } else ...

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.