Jump to content

alecks

Members
  • Posts

    80
  • Joined

  • Last visited

    Never

Posts posted by alecks

  1. I know some basic javascript, but I'm pretty much a newbie to it. What I want to do I think is pretty simple, but I cannot find any guidance on it. Please help :D

     

    I have a couple of links like <a href="" id="about">about</a> and a header <h1 id="description">description</h1>. When the links are hovered over, I want to change 'description' to be a description of the link. I can do this with onMouseOver, but that is not xhtml valid and I would like it to be, if possible. How do I do this?

     

    Thanks

  2. Use single quotes in the query and wrapping the new values in brackets {} isnt really necessary. Table and row names should be wrapped in `s

    $SeUs = $_SESSION['user'];
    $PoUS = $_POST['atkuser'];
    mysql_query ("UPDATE `characters` SET `temphealth` = '$currentHealthYou' WHERE `user` = '$SeUs'");
    mysql_query ("UPDATE `characters` SET `temphealth` = '$currentHealthEnemy' WHERE `user` = '$PoUs'");
    

     

    Test the queries in phpmyadmin or something... we cannot really help if we do not know what the table's structure is or what the values of $SeUs and $PoUs are supposed to be

  3. use sessions or cookies

     

    1. start_session() on each page

    2. if he goes to a url like ?style=1, set $_SESSION['style'] to 1

    3. on each page check $_SESSION['style']; if it is 1, load style1.css, if it is 2, load style2.css

  4. if you made a script as a separate file, and in the header put a meta refresh, then had that script embedded in an iframe on the page you wanted it to show, you could make a fake dynamic javascript countdown.

     

    countdown.php

    <META HTTP-EQUIV="refresh" CONTENT="2">
    <?php
    $mins = 10*ceil(floatval(date("i")/10));
    $hour = date("G");
    if($mins >60){
    $mins = $mins-60;
    $hour++;
    }
    echo "The Time is : ".$hours.":".$mins;
    ?>
    

     

    index.html

    <iframe src="countdown.php" width="300" height="100" />
    

     

    It'll refresh every 2 seconds... if you want to change it just set the content in the meta tag.

  5. I don't mean that at all, because that wouldn't help :/

    I want strtotime to assume that any date strings given to it are in a certain format, for example m-d-yyyy. I want this because sometimes when a date is given to it it will think that it is in a different format, d-m-yyyy for example. For example, if I gave it the m-d-yyyy date 1-8-2008, it will give me back a timestamp for 8-1-2008, which is not what I want. 

  6. just a quick question: the function strtotime converts strings formatted like dates into unix timestamps. This is great, but how do I tell it to only expect one format? for example: the date 1-08-2008 could be interpreted as January 8th, 2008, or August 1st, 2008. I want it mm-dd-yyyy.

     

    thanks

  7. functions like mysql_real_escape_string in php simply return the escaped string, they don't assign it to certain variables like more object oriented languages do... you have to do that yourself

    for example:

     

    while ($row = mysql_fetch_row($seriesresult)){
       $seriesID = $row[0];
       $date = mysql_real_escape_string($_POST['date']);
       // ...
       mysql_query("INSERT INTO race_table (raceDate, hostName, factor, boatsInRace, seriesID) VALUES ($date" //...
    }
    

  8. you could do

     

    $random = rand(1,2);
    switch ($random) {
       case 1:
          $random = "DESC";
          break;
       case 2:
          $random = "ASC";
          break;
    }
    

     

    And then the query would be "SELECT * FROM table ORDER BY `id` ".$random."" (assuming there is an id column)

    You could of course expand the random range and add more options

     

    or actually

     

    $random = rand(0,1);
    $options = array("DESC","ASC");
    

     

    "SELECT * FROM table ORDER BY `id` ".$options[$random].""

  9. Hashing algorithms such as md5, sha1, are one way operations. They are used in password databases because if a hacker were to gain access to a database of hashed passwords, be couldn't do anything with it because theoretically there is no way he could get the base strings (un-hashed passwords) for those hashes. However, programs such as Ophcrack use precompiled tables of hash values, called 'rainbow tables,' to try and get the base string. These rainbow tables can become insanely huge, 15gb+ in most cases. There are some online databases, but they are often incomplete :/, ex. http://md5.rednoize.com/

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