Jump to content

callesson

Members
  • Posts

    53
  • Joined

  • Last visited

    Never

Posts posted by callesson

  1. Hello there!

     

    Im new with javascript and im having this script that i got from school. And im trying to modify it a little bit. I have added a js script so the slideshow starts by it self. It works fine, but I want the pictures to like fade in, like smode. So it doesn't just change photo all quick.

     

    Here is the code

     

    Code from school.

    $(document).ready(function () {
      // hide all but first image if we have js
      $('.large-images li:not(:first)').hide();
      // show thumbnails if we have js
      $('.small-images').show();
      // control the visibility of the control buttons
      $('.large-images img, .controls').bind("mouseenter", showControls).bind("mouseleave", hideControls);
      
      hideControls();
      
      function showControls() {
        $('.controls').show();
      }
    
      function hideControls() {
        $('.controls').hide();
      }
      
      $('.prev').bind("click", function() {
        prev();
        return false;
      });
      
      $('.next').bind("click", function() {
        next();
        return false;
      });
      
      $('.small-images a').bind("click", function() {
        display($(this).parent().attr('value'));
        return false;
      });
    });
    
    function prev() {
      var total = $(".large-images li").length;
      var current = $(".large-images li:visible").attr('value');
      if(current > 1) {
        display(parseInt(current)-1);
      } else {
        display(total);
      }
    }
    
    function next() {
      var total = $(".large-images li").length;
      var current = $(".large-images li:visible").attr('value');
      if(current < total) {
        display(parseInt(current)+1);
      } else {
        display(1);
      }
    }
    
    function display(num) {
      $(".large-images li").hide();
      $(".large-images li[value='"+num+"']").show();
      $('.small-images a').removeClass('selected');
      $(".small-images li[value='"+num+"'] a").addClass('selected');
    }
    

     

    Self start.

    <script language="JavaScript1.1">
    var image1=new Image()
    image1.src="/bilder/tokyo1.jpg"
    var image2=new Image()
    image2.src="/bilder/tokyo2.jpg"
    var image3=new Image()
    image3.src="/bilder/tokyo3.jpg"
    var image4=new Image()
    image4.src="/bilder/tokyo4.jpg"
    </script>
    <script>
    <!--
    //variable that will increment through the images
    var step=1
    function slideit(){
    //if browser does not support the image object, exit.
    if (!document.images)
    return
    document.images.slide.src=eval("image"+step+".src")
    if (step<4)
    step++
    else
    step=1
    //call function "slideit()" every 2.5 seconds
    setTimeout("slideit()",2500)
    }
    slideit()
    //-->
    </script>
    

  2. Hello

     

    I would like a Modal window, something like this

    ( http://telligent.com/cfs-filesystemfile.ashx/__key/CommunityServer-Discussions-Components-Files/287/8510.modal_2D00_window_2D00_upload_2D00_file.jpg )

    to popup when someone on my website gets an error. For exampel "Wrong username" Then I want the Modal window to display "Wrong..."

    Im checking for errors with php, and if wrong username is true, then I want the window.

    I have no idea how to make one, so if someone knows a tutorial or something then your welcome  :)

     

  3. Siric:

    I do not have my code right here, but its as simply as this ( Do not correct this code)

    <form ... method="post">
    ...
    <input type="submit" name="submit"/>
    ...
    

    ...
    if(isset($_POST['submit']))
    {
    $time = date() + 10 min;
    
    $up = mysql_query("UPDATE table SET time=$time where user=$_SESSION...");
    }
    then next time:
    $select = mysql_query("SELECT * FROM table where user=$_SESSION...");
    $time = $row[time];
    $date = date();
    if(isset($_POST['submit']) && $date < $time)
    {
    echo "You cant do this now... Time left x";
    }
    

    theocas:

    Well, I could check on that. But i havent worked with cookies before.

  4. Sry for that. No dont want you to do it for me xD

     

    Well im stuck at the

     

    Calculating, and Checking so its the right day.

     

    Right now Im adding a time into the Database (Date() + 10 or 30 min) when the submit is set,  then next time its set it will check if date() is > then Database time.

     

    And for the second thing, I just want an idea. Cause I have no idea how to do it.

  5. Sure thing, I just wanted help to be confirmed first :D Maybe nobody wanna help me :( haha. But okey lets explain.

    First Thing:

    I have a submit button that will rederict you to another page. If that submit is set then your not gonna be able to use it again after like 10 or 30 min. So I would like to check that, and without problems with like if its another day or something. Also I would like to calculate the time thats left so I could display it.

    __

    Sec Thing:

    I want something to update every hour. Like for each hour update something +10. I would like it to check like this.

    If you logout, and then you login after 2 h you will get 20 of something. And also if you are loged in it will update.  But if there is another way, feel glad to tell :)

    __

    Ty!

  6. Hello Everyone!

     

    I would like some help with php, sql and a text input.

    Is there a way to get 3 values from one textbox?

    Like if I have a textbox were i write

     

    "  .gold 100 Admin  "

     

    So example :

     

    $firstword = gold
    $sec = 100
    $third = Admin
    
    and then a sqlupdate ("UPDATE $firstword=$firstword +$sec WHERE user=$third");

    And I only want it to be one textbox.

    Ty in advance!

  7. Well... If you want to display the info so.

     

    <?php
    $conn = mysql_connect(HOST,USER,PASS);
    $db = mysql_select_db("*******") or die( "Unable to select database");
    
    if(isset($_GET["id"]))
    {
    $gethotel= mysql_query ("SELECT * FROM hoteltable WHERE id='$_GET[id]'") or die(mysql_error());
    $count = mysql_num_rows($gethotel);
         if($count == 1)
         {
         $row = mysql_fetch_assoc($gethotel);
         {
         $hotelname= $row['link_text'];
         $address = $row['address '];
         $telephone= $row['telephone'];
           echo "<strong> $hotelname </strong><br /> $address : $telephone <br /><br />";
         }
         }
    elseif($count==0)
    {
    echo "There is no hotel with that name found!";
    }
    }
    else
    {
    echo "There is no hotel found!";
    }
    
    
    ?>
    

  8. Ty it did work :)

     

    But is there a way to make the text echo out info from the link name.

    Like if I hover Calle then SELECT * FROM table WHERE name=Calle then echo out info ?

     

    __

     

    No worries i found out my self

  9. Yea it kinda is haha^^.(Btw, im not even sure i need the hidden thing, lol)

    Here is my Form

     
    echo "<form action='gear.php' method='post'>";
    echo "Head - <a href=\"items.php?sida=$Head\">".$Head."</a>
    <input type='submit' name='Unequip1' value='UnEquip'/><input type='text' name='hidden1' value='$Head'/>";
    echo "<br>Shoulders - <a href=\"items.php?sida=$Shoulders\">".$Shoulders."</a>
     <input type='submit' name='Unequip2' value='UnEquip'/><input type='text' name='hidden2' value='$Shoulders'/>";
    echo "<br>Chest - <a href=\"inventory.php?sida=$chest\">".$chest."</a>
     <input type='submit' name='Unequip3' value='UnEquip'/><input type='text' name='hidden3' value='$chest'/>";
    echo "<br>Hands - <a href=\"inventory.php?sida=$Hands\">".$Hands."</a>
     <input type='submit' name='Unequip4' value='UnEquip'/><input type='text' name='hidden4' value='$Hands'/>";
    echo "<br>Legs - <a href=\"inventory.php?sida=$Legs\">".$Legs."</a>
     <input type='submit' name='Unequip5' value='UnEquip'/><input type='text' name='hidden5' value='$Legs'/>";
        echo "<br>Shoes - <a href=\"inventory.php?sida=$Shoes\">".$Shoes."</a>
     <input type='submit' name='Unequip6' value='UnEquip'/><input type='text' name='hidden6' value='$Shoes'/>";	
    echo "<br>Weapon - <a href=\"inventory.php?sida=$weapon\">".$weapon."</a>
     <input type='submit' name='Unequip7' value='UnEquip'/><input type='text' name='hidden7' value='$weapon'/>";
    echo "</form>";
    }
    

    The Unequip Code, Only the thirst submit, Unequip1.

    if(isset($_POST['Unequip1']))
    {
    $query = mysql_query("SELECT * FROM inventory  WHERE user='$_SESSION[myusername]'");
    while($row = mysql_fetch_array($query))
    {
    $Full1 = $row['Full1'];
    $Full2 = $row['Full2'];
    $Full3 = $row['Full3'];
    
    $name_id = $_POST['hidden1'];
    $query = mysql_query("SELECT * FROM chars  WHERE user='$_SESSION[myusername]'");
    while($row = mysql_fetch_array($query))
    {
    
    $fetchitem = mysql_query("SELECT * FROM items WHERE item_name='$name_id'");
    while($row = mysql_fetch_array($fetchitem))
    {
    
    $name = $row['item_name'];
    $class = $row['class'];
    $item_armor = $row['item_armor'];
    $item_strength = $row['item_strength'];
    $item_aglillity = $row['item_agillity'];
    $item_intellect = $row['item_intellect'];
    $item_dmg = $row['item_dmg'];
    $item_dmgmax = $row['item_dmgmax'];
    $item_stamina = $row['item_stamina'];
    
    $stam_10 = 	$item_stamina * 10;
    $int_10 = 	$item_intellect * 10;
    if($Full1 == 0)
    {	
    $update1=mysql_query("UPDATE inventory SET Slot1='$name', Full1=1 WHERE user='$_SESSION[myusername]'");
    $update2=mysql_query("UPDATE chars SET $class='Nothing' WHERE User='$_SESSION[myusername]'");
    $update3=mysql_query("UPDATE chars SET Hpmax=Hpmax -$stam_10, Mpmax=Mpmax -$int_10, Stamina=Stamina -$item_stamina, Damagemax=Damagemax -$item_dmgmax, Damage=Damage -$item_dmg, armor=armor -$item_armor, intellect=intellect -$item_intellect, agility=agility -$item_aglillity, strength=strength -$item_strength  WHERE User='$_SESSION[myusername]'");
    header("Location:gear.php");
    }
    elseif($Full2 == 0)
    {	
    $update1=mysql_query("UPDATE inventory SET Slot2='$name', Full2=2 WHERE user='$_SESSION[myusername]'");
    $update2=mysql_query("UPDATE chars SET $class='Nothing' WHERE User='$_SESSION[myusername]'");
    $update3=mysql_query("UPDATE chars SET Hpmax=Hpmax -$stam_10, Mpmax=Mpmax -$int_10, Stamina=Stamina -$item_stamina, Damagemax=Damagemax -$item_dmgmax, Damage=Damage -$item_dmg, armor=armor -$item_armor, intellect=intellect -$item_intellect, agility=agility -$item_aglillity, strength=strength -$item_strength  WHERE User='$_SESSION[myusername]'");
    header("Location:gear.php");
    }
    elseif($Full3 == 0)
    {		
    $update1=mysql_query("UPDATE inventory SET Slot3='$name', Full3=3 WHERE user='$_SESSION[myusername]'");
    $update2=mysql_query("UPDATE chars SET $class='Nothing' WHERE User='$_SESSION[myusername]'");
    $update3=mysql_query("UPDATE chars SET Hpmax=Hpmax -$stam_10, Mpmax=Mpmax -$int_10, Stamina=Stamina -$item_stamina, Damagemax=Damagemax -$item_dmgmax, Damage=Damage -$item_dmg, armor=armor -$item_armor, intellect=intellect -$item_intellect, agility=agility -$item_aglillity, strength=strength -$item_strength  WHERE User='$_SESSION[myusername]'");
    header("Location:gear.php");
    }
    elseif($Full1 != 0 && $Full2 != 0  && $Full3 != 0)
    {		
    header("Location:inventoryfull.php");
    }
    $select = mysql_query("SELECT * FROM bankslot2 WHERE user='$_SESSION[myusername]'");
    $count=mysql_num_rows($select);
    {
    $fetchitem = mysql_query("SELECT * FROM bankslot2 WHERE User='$_SESSION[myusername]'");
    while($row = mysql_fetch_array($fetchitem))
    {
    $slot1 = $row['Full1'];
    $slot2 = $row['Full2'];
    
    if($Full1 == 1 && $Full2==2 && $Full3==3 && $count==1 && $slot1==0)
    {
    $update5=mysql_query("UPDATE Bankslot2 SET Bankslot1='$name', Full1=1 WHERE user='$_SESSION[myusername]'");
    $update2=mysql_query("UPDATE chars SET $class='Nothing' WHERE User='$_SESSION[myusername]'");
    $update3=mysql_query("UPDATE chars SET Hpmax=Hpmax -$stam_10, Mpmax=Mpmax -$int_10, Stamina=Stamina -$item_stamina, Damagemax=Damagemax -$item_dmgmax, Damage=Damage -$item_dmg, armor=armor -$item_armor, intellect=intellect -$item_intellect, agility=agility -$item_aglillity, strength=strength -$item_strength  WHERE User='$_SESSION[myusername]'");
    header("Location:bank.php");
    }
    elseif($Full1 == 1 && $Full2==2 && $Full3==3 && $count==1 && $slot2==0)
    {
    $update5=mysql_query("UPDATE Bankslot2 SET Bankslot2='$name', Full2=2 WHERE user='$_SESSION[myusername]'");
    $update2=mysql_query("UPDATE chars SET $class='Nothing' WHERE User='$_SESSION[myusername]'");
    $update3=mysql_query("UPDATE chars SET Hpmax=Hpmax -$stam_10, Mpmax=Mpmax -$int_10, Stamina=Stamina -$item_stamina, Damagemax=Damagemax -$item_dmgmax, Damage=Damage -$item_dmg, armor=armor -$item_armor, intellect=intellect -$item_intellect, agility=agility -$item_aglillity, strength=strength -$item_strength  WHERE User='$_SESSION[myusername]'");
    
    header("Location:bank.php");
    }
    elseif($Full1 == 1 && $Full2==2 && $Full3==3 && $count==1 && $slot2==2 && $slot1==1)
    {
    header("Location:bankslotisfull.php");
    }
    }
    }
    //Bankslot4 ----------------------------*
    $select = mysql_query("SELECT * FROM bankslot4 WHERE user='$_SESSION[myusername]'");
    $count=mysql_num_rows($select);
    {
    $fetchitem = mysql_query("SELECT * FROM bankslot4 WHERE User='$_SESSION[myusername]'");
    while($row = mysql_fetch_array($fetchitem))
    {
    $slot1 = $row['Full1'];
    $slot2 = $row['Full2'];
    $slot3 = $row['Full3'];
    $slot4 = $row['Full4'];
    if($Full1 == 1 && $Full2==2 && $Full3==3 && $count==1 && $slot1==0)
    {
    $update5=mysql_query("UPDATE Bankslot4 SET Bankslot1='$name', Full1=1 WHERE user='$_SESSION[myusername]'");
    $update2=mysql_query("UPDATE chars SET $class='Nothing' WHERE User='$_SESSION[myusername]'");
    $update3=mysql_query("UPDATE chars SET Hpmax=Hpmax -$stam_10, Mpmax=Mpmax -$int_10, Stamina=Stamina -$item_stamina, Damagemax=Damagemax -$item_dmgmax, Damage=Damage -$item_dmg, armor=armor -$item_armor, intellect=intellect -$item_intellect, agility=agility -$item_aglillity, strength=strength -$item_strength  WHERE User='$_SESSION[myusername]'");
    header("Location:bank.php");
    }
    elseif($Full1 == 1 && $Full2==2 && $Full3==3 && $count==1 && $slot2==0)
    {
    $update5=mysql_query("UPDATE Bankslot4 SET Bankslot2='$name', Full2=2 WHERE user='$_SESSION[myusername]'");
    $update2=mysql_query("UPDATE chars SET $class='Nothing' WHERE User='$_SESSION[myusername]'");
    $update3=mysql_query("UPDATE chars SET Hpmax=Hpmax -$stam_10, Mpmax=Mpmax -$int_10, Stamina=Stamina -$item_stamina, Damagemax=Damagemax -$item_dmgmax, Damage=Damage -$item_dmg, armor=armor -$item_armor, intellect=intellect -$item_intellect, agility=agility -$item_aglillity, strength=strength -$item_strength  WHERE User='$_SESSION[myusername]'");
    
    header("Location:bank.php");
    }
    elseif($Full1 == 1 && $Full2==2 && $Full3==3 && $count==1 && $slot3==0)
    {
    $update5=mysql_query("UPDATE Bankslot4 SET Bankslot3='$name', Full3=3 WHERE user='$_SESSION[myusername]'");
    $update2=mysql_query("UPDATE chars SET $class='Nothing' WHERE User='$_SESSION[myusername]'");
    $update3=mysql_query("UPDATE chars SET Hpmax=Hpmax -$stam_10, Mpmax=Mpmax -$int_10, Stamina=Stamina -$item_stamina, Damagemax=Damagemax -$item_dmgmax, Damage=Damage -$item_dmg, armor=armor -$item_armor, intellect=intellect -$item_intellect, agility=agility -$item_aglillity, strength=strength -$item_strength  WHERE User='$_SESSION[myusername]'");
    
    header("Location:bank.php");
    }
    elseif($Full1 == 1 && $Full2==2 && $Full3==3 && $count==1 && $slot4==0)
    {
    $update5=mysql_query("UPDATE Bankslot4 SET Bankslot4='$name', Full4=4 WHERE user='$_SESSION[myusername]'");
    $update2=mysql_query("UPDATE chars SET $class='Nothing' WHERE User='$_SESSION[myusername]'");
    $update3=mysql_query("UPDATE chars SET Hpmax=Hpmax -$stam_10, Mpmax=Mpmax -$int_10, Stamina=Stamina -$item_stamina, Damagemax=Damagemax -$item_dmgmax, Damage=Damage -$item_dmg, armor=armor -$item_armor, intellect=intellect -$item_intellect, agility=agility -$item_aglillity, strength=strength -$item_strength  WHERE User='$_SESSION[myusername]'");
    
    header("Location:bank.php");
    }
    elseif($Full1 == 1 && $Full2==2 && $Full3==3 && $count==1 && $slot2==2 && $slot1==1 && $slot3==3 && $slot4==4)
    {
    header("Location:bankslotisfull.php");
    }
    }
    }
    }
    }
    }
    }
    Then comes Unequip2, then 3. .. 
    

  10. Hey guys :)

     

    (RP Game)

    I would like my code to be very very less than it is. Right now I have my gear page were i have Head, Weapon, Chest etc... Foreach gear slot I have a button and a hidden form. If I press Un-eqiup on Head the code will check for the hidden value that is equal to my head, and the head will be un-equiped. I have 7 Slots and thats 7 codes that are the same, only an unique hidden.

     

    Is there another way to do it?

    Tell me if you want to see the code!

     

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