Jump to content

SharkBait

Members
  • Posts

    845
  • Joined

  • Last visited

    Never

Posts posted by SharkBait

  1. Remember that search engines don't like websites that are built for them. Websites should be built for your intended audience.

    You could create the URLs to be human readable IE:

     

      myplace.com/page?id=339&view=kitchen&man=LG   

     

    might want to look something like: 

     

      myplace.com/products/kitchen/fridges/LG54e

     

    Remember Content is King - Search Engines bots crawl your webpage in text. Load up Lynx as a browser and see how your site looks in all text (or strip your CSS to remove graphics/styles etc).

     

    Use proper tags - H1, H2, h3, <strong> etc to place emphase on things

     

    997740 - Sure Google accounts for less than 50%, but 49.2% is still a BIG gap from the next engine being Yahoo at 23.8%.

     

     

  2. I don't think there is a way to get to the MAC address or anything like that to identify the user. Hoping also that the user's machine isn't having their MAC Address cloned in the first place (some network devices do this).

     

    IPs aren't perfect either since people can behind proxies or again other network devices. Take my connection for example. To the internet the building I work at comes from all 1 IP address, but of course internally we are on a different subnet. So if I were to log into this site, I would have the same IP external address as my buddy downstairs in a different department.

     

    As for cookies between browsers. I don't know many people who surf using different browsers. I for one do all my surfing using Firefox. I have Safari, Opera, IE(5 & 6) for development needs, but I don't regularly use them.

  3. With the checkbox name change it to something like name='check[]' and you can add a value='$cid'

     

    That will create an array for $_POST['check'] for which you can then loop through to see which ones were checked.

     

    One that were not checked will not go into the $_POST['check'].

     

     

  4. You could have a flag that is like 0 = Not read and 1 = Read

     

    So when they log in, you would look for all items that are 0 = Not Read and then when they view them you change it to 1 for being read.

     

    Psuedo Example (if you're using a database of sorts like MySQL)

     

    Johnny logs in and see 4 new items (SELECT * FROM meh WHERE read = 0) Results = 4 items unread

     

    Johnny views each item individually and it is marked as being seen/read (UPDATE meh SET read = 1 WHERE id = 'some_id') some_id = unique identifier of each row item in the table for the events he looks at.

  5.  

    Not sure about mulli-line query, but you can have the script execute multiple single queries.

     

    IE:

    
    $str = "CREATE TABLE myTable( 
              id INT,
              data VARCHAR(100)
            ) ";
    $qry = mysql_query($str);
    
    $str = "INSERT INTO myTable (id, data) VALUES ( 1, "This is fun")";
    $qry = mysql_query($str);
    
    

     

    granted that's a quick n dirty version.

  6. Only thing I can think of is you have output before the session_start() function. Put your includes below that.

     

    you don't need to check for the $_SESSION either. just do:

    <?php
    
    session_start();
    
    // rest of script
    ?>
    

     

    If it says headers are already sent, it's saying that the page has already started to load prior to setting up some other header information. IE perhaps you have an error being reported prior to the session_start()

  7. I am just curious who out there runs a blog or contributes to a blog.  I have a blog and love reading other people's blogs. It's also a good way to network too.

     

    If you own a blog you can win a Samsung Bluetooth Headset too.. details on the link in my signature ;)

  8. At the top of the script you show it being password.php but the form is sending it's info to password2.php

     

    The code looks familiar.. is it from a quickstart guide to PHP and MySQL book?

     

    I try outputting the form's values when I am debugging scripts like this. It helps ensure that the various fields are filled out.

     

    using something like print_r($_POST); will show you the field names and their values.

     

    Try not to use the @ when when you need to debug. This supresses the errors if there are any.

     

    You can also do something like $result = mysql_query($query) or die ("MySQL Error: {$query}<br />". mysql_error(); which will tell you if there is an error with your query.

     

    Just a couple troubleshooting tips

  9. Ok after looking over your code this is what I came up with. Shortened it a bit to clean up bits that were a bit repetitive. If it is wrong then.. your logic in the code is wrong :)

    <?php
    if (isset($_GET['mode']) && $_GET['mode'] == "slient"){
    $extList['gif'] = 'image/gif';
    $username = "not_showing_you";
    $password = "get_real";
    $host = "00_I_C_U_8_1_2";
    $db = "cant_show";
    $link = mysql_connect($host, $username, $password) or die("connection error");
    mysql_select_db($db, $link);
       	$sql = "select * from `table` where `table_row` not in ('some_data', 'some_data2', 'some_data3') and `table_row` not like '%this_data%' and `table_row` !='' and `table_row` like '%symbol%' and `table_row_2` like '%something%'";
       	$session_count = 0;
       	$result = mysql_query($sql);
    
    // Get number of results
    $session_count = mysql_num_rows();
    
       	$sql = "select * from `table` where `table_row` not in ('some_data') and `table_row` not like '%this_data%' and `table_row` !='' and `table_row` like '%something%' and pref_name like '%something%';";
       	$result = mysql_query($sql);
    
    // get number of results and add to previous total
    $session_count += mysql_num_rows();
    
    $file = "stats2.php";
       	include($file);
    
       	if ($count != $session_count){
            $selected = "bad";
            $content = "<?php\n\$count = '{$session_count}'\n\$status='bad';\n?>";
       	} else {
            $selected = "good";
            $content = "<?php\n\$count = '{$session_count}'\n\$status='good';\n?>";
       	}
    
    $fh = fopen($file, "w+");
    fwrite($fh, $content);
    fclose($fh);
    
    include($selected.".gif");
    }
    
    if($_GET["image"] == "good"){
    include("good.gif");
    }
    if($_GET["image"] == "bad"){
    include("bad.gif");
    }
    ?>
    
    

  10. I don't see where $count is first set (i'm working with your code in notepad++

     

    if($count1 == $count2) {
      // use good.gif
    } else {
      // user bad.gif
    }
    

     

    You can't use include('image.gif') as that includes the code for the page. You would need to do something like

    echo "<img src=\"{$selected}.gif\" />";
    

     

    To display it to the screen.

     

     

  11. Not sure why you use a counter while you're going through the first while() loop for your query. You can just use

    $session_count = mysql_num_rows();
    

    and that will tell you how many rows it retrieved from your query.

     

    And I don't see any dynamically generated images in the script either. I need coffee i think!

  12. In your input values you would need to do something like:

     

    <td><input name="name" type="text" id="name" size="30" value="<?php if(isset($_POST['name'])) echo $_POST['name'];?>" /></td>
    

     

    As for the screen refreshing. When you're using a submit it will always refresh. To have the page not refresh you'd probably use javascript/ajax sort of thing.

     

    I normally put my form processing code above the form and do the

     

    <?php
    if(isset($_POST['submit'])) {
       // form process stuff here
    }
    ?>
    <!--
      Form code here
    -->
    
    

     

    That way if the form is 'submitted' it will show the form still.

×
×
  • 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.