Jump to content

interpim

Members
  • Posts

    303
  • Joined

  • Last visited

    Never

Posts posted by interpim

  1. Thanks for the help... that worked, but now I am getting a problem with the image not showing up on-top of the smaller images.

     

    I have tried changing the zIndex, but it isn't working

     

    <div class=a4>
    <img id='big4' src='images/wood/DSCN0238.JPG' width='137px' height='103px' 
    onmouseover="this.style.width='912px';this.style.height='684px'; this.style.zIndex='50'"  
    onmouseout="this.style.width='137px';this.style.height='103px'; this.style.zIndex='-1'"  >
    </div>

     

  2. Hi all... Javascript noob here.  I am wondering if anyone can help me out with some code.

     

    I am writing this page dynamically, that is the reason I am building it the way I am.  Basically I want to have the 100% sized image popup when a user moves his mouse over the smaller image.

     

    here is my page so far... i can't get the popup to occur :/  http://interpim.com/pigs_test.php

     

    code below.

     

    <style type="text/css">
    <!-- .a1{
    position:absolute;
    top: 100px;
    left: 100px;
    }.a2{
    position:absolute;
    top: 100px;
    left: 250px;
    }.a3{
    position:absolute;
    top: 100px;
    left: 400px;
    }.a4{
    position:absolute;
    top: 250px;
    left: 100px;
    }.a5{
    position:absolute;
    top: 250px;
    left: 250px;
    }.a6{
    position:absolute;
    top: 250px;
    left: 400px;
    }.a7{
    position:absolute;
    top: 400px;
    left: 100px;
    }.a8{
    position:absolute;
    top: 400px;
    left: 250px;
    }.a9{
    position:absolute;
    top: 400px;
    left: 400px;
    }--></style>
    <div class=a1>
    <img src='images/wood/DSCN0235.JPG' width=15% height=15% 
    onmouseover="src='images/wood/DSCN0235.JPG' width='100%' height='100%' " 
    onmouseout="src='images/wood/DSCN0235.JPG' width='15%' height='15%' " >
    </div>
    <div class=a2>
    <img src='images/wood/DSCN0236.JPG' width=15% height=15% 
    onmouseover="src='images/wood/DSCN0236.JPG' width='100%' height='100%' " 
    onmouseout="src='images/wood/DSCN0236.JPG' width='15%' height='15%' " >
    </div>
    <div class=a3>
    <img src='images/wood/DSCN0237.JPG' width=15% height=15% 
    onmouseover="src='images/wood/DSCN0237.JPG' width='100%' height='100%' " 
    onmouseout="src='images/wood/DSCN0237.JPG' width='15%' height='15%' " >
    </div>
    <div class=a4>
    <img src='images/wood/DSCN0238.JPG' width=15% height=15% 
    onmouseover="src='images/wood/DSCN0238.JPG' width='100%' height='100%' " 
    onmouseout="src='images/wood/DSCN0238.JPG' width='15%' height='15%' " >
    </div>
    <div class=a5>
    <img src='images/wood/DSCN0239.JPG' width=15% height=15% 
    onmouseover="src='images/wood/DSCN0239.JPG' width='100%' height='100%' " 
    onmouseout="src='images/wood/DSCN0239.JPG' width='15%' height='15%' " >
    </div>
    
    <div class=a6>
    <img src='images/wood/DSCN0240.JPG' width=15% height=15% 
    onmouseover="src='images/wood/DSCN0240.JPG' width='100%' height='100%' " 
    onmouseout="src='images/wood/DSCN0240.JPG' width='15%' height='15%' " >
    </div>
    <div class=a7>
    <img src='images/wood/DSCN0241.JPG' width=15% height=15% 
    onmouseover="src='images/wood/DSCN0241.JPG' width='100%' height='100%' " 
    onmouseout="src='images/wood/DSCN0241.JPG' width='15%' height='15%' " >
    </div>
    <div class=a8>
    <img src='images/wood/DSCN0242.JPG' width=15% height=15% 
    onmouseover="src='images/wood/DSCN0242.JPG' width='100%' height='100%' " 
    onmouseout="src='images/wood/DSCN0242.JPG' width='15%' height='15%' " >
    </div>
    <div class=a9>
    <img src='images/wood/DSCN0243.JPG' width=15% height=15% 
    onmouseover="src='images/wood/DSCN0243.JPG' width='100%' height='100%' " 
    onmouseout="src='images/wood/DSCN0243.JPG' width='15%' height='15%' " >
    </div>

     

  3. OK, i have sat through, baby stepping my way through learning Ajax.

     

    Well, I thought i had a fairly decent working start on something after about 10 hours of playing around and coding/recoding things.

     

    Then, i checked it in Internet Explorer, and well, it doesn't work :(

     

    So can anyone tell me why it isn't working?

    here is the site

    http://interpim.com/vn_emblem

     

    and here is my code

     

    <head>
    <SCRIPT Language="JavaScript">
    var z = 11;
    var x = 1;
    var y = 1;
    var sh = 1;
    var col = 1;
    function getHTTPObject() {
        var xmlhttp;
        if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
            try {
                xmlhttp = new XMLHttpRequest();
            } catch (e) {
                xmlhttp = false;
            }
        }
        return xmlhttp;
    }
    
    var http = getHTTPObject();
    
    function ajaxbackFunction(){
       z=z-1 ;
       if(z <= 0){
       z = 278;
       }
       document.form.pic_num.value=z;
       http.open('GET', 'ajax.php?pic='+z, true);
       http.send(z);
       http.onreadystatechange=function(){
          if(http.readyState==4){
            document.getElementById('somediv').innerHTML = http.responseText; // this will put the returned code from ajax.php into a div with id "somediv"
    
    
          }
       }
    }
    function loadImage(){
    document.getElementById('somediv').innerHTML = "<img src='order/012.gif'>";
    document.getElementById('shape').innerHTML = "<img src='order/shape1.gif'>";
    document.getElementById('base').innerHTML = "<img src='images/base1.gif'>";
    document.getElementById('shape').innerHTML = "<img src='order/sh1col1.gif'>";
    }
    
    function ajaxFunction(){
       z=z+1 ;
       if(z >= 279){
       z = 1;
       }
       document.form.pic_num.value=z;
       http.open('GET', 'ajax.php?pic='+z, true);
       http.send(z);
       http.onreadystatechange=function(){
          if(http.readyState==4){
            document.getElementById('somediv').innerHTML = http.responseText; // this will put the returned code from ajax.php into a div with id "somediv"
          }
       }
    }
    
    function shape_fwd(){
       x = x + 1;
       if(x >= 6){
       x = 1;
       }
       document.shape_form.shape_num.value=x;
       http.open('GET', 'shape.php?pic='+x, true);
       http.send(x);
       http.onreadystatechange=function(){
          if(http.readyState==4){
            document.getElementById('shape').innerHTML = http.responseText; 
          }
       }
    }
    function shape_back(){
       x=x-1 ;
       if(x <= 0){
       x = 5;
       }
       document.shape_form.shape_num.value=x;
       http.open('GET', 'shape.php?pic='+x, true);
       http.send(x);
       http.onreadystatechange=function(){
          if(http.readyState==4){
            document.getElementById('shape').innerHTML = http.responseText; 
          }
       }
    }
    function base_fwd(){
       y = y + 1;
       if(y >= 4){
       y = 1;
       }
       document.base_form.base_num.value=y;
       http.open('GET', 'base.php?pic='+y, true);
       http.send(y);
       http.onreadystatechange=function(){
          if(http.readyState==4){
            document.getElementById('base').innerHTML = http.responseText; 
          }
       }
    }
    function base_back(){
       y=y-1 ;
       if(y <= 0){
       y = 3;
       }
       document.base_form.base_num.value=y;
       http.open('GET', 'base.php?pic='+y, true);
       http.send(y);
       http.onreadystatechange=function(){
          if(http.readyState==4){
            document.getElementById('base').innerHTML = http.responseText; 
          }
       }
    }
    function pat_color_fwd(){
       col = col + 1;
       if(col >= 4){
       col = 1;
       }
       document.pat_color_form.pat_color_num.value=col;
       http.open('GET', 'pattern.php?pic='+sh +'&col='+col, true);
       http.send(sh,col);
       http.onreadystatechange=function(){
          if(http.readyState==4){
            document.getElementById('pattern').innerHTML = http.responseText; 
          }
       }
    }
    function pat_color_back(){
       col=col-1 ;
       if(col <= 0){
       col = 3;
       }
       document.pat_color_form.pat_color_num.value=col;
       http.open('GET', 'pattern.php?pic='+sh +'&col='+col, true);
       http.send(sh,col);
       http.onreadystatechange=function(){
          if(http.readyState==4){
            document.getElementById('pattern').innerHTML = http.responseText; 
          }
       }
    }
    </script>
    <style type="text/css" title="currentStyle" media="screen">
    	@import "style.css";
    		</style>
    
    </head>
    <BODY onLoad="javascript: loadImage()">
    <div id='somediv'>
    </div>
    
    <div id='bg'>
    <img src='bg.gif'>
    </div>
    
    <div id='base_click'>
    <form name='base_form'>
    <input type="button" name="base_down" value="<<" onclick="base_back()">
    <input type="text" name="base_num" size='5'>
    <input type="button" name="base_up" value=">>" onclick="base_fwd()">
    </form>
    </div>
    
    <div id='shape_click'>
    <form name='shape_form'>
    <input type="button" name="shape_down" value="<<" onclick="shape_back()">
    <input type="text" name="shape_num" size='5'>
    <input type="button" name="shape_up" value=">>" onclick="shape_fwd()">
    </form>
    </div>
    
    <div id='pattern_click'>
    <form name='pattern_form'>
    <input type="button" name="pattern_down" value="<<" onclick="pattern_back()">
    <input type="text" name="pattern_num" size='5'>
    <input type="button" name="pattern_up" value=">>" onclick="pattern_fwd()">
    </form>
    </div>
    <div id='pat_color_click'>
    <form name='pat_color_form'>
    <input type="button" name="pat_color_down" value="<<" onclick="pat_color_back()">
    <input type="text" name="pat_color_num" size='5'>
    <input type="button" name="pat_color_up" value=">>" onclick="pat_color_fwd()">
    </form>
    </div>
    <div id='emblem_click'
    <form name='form'>
    <input type="button" name="backbutton" value="<<" onclick="ajaxbackFunction()">
    <input type="text" name="pic_num" size='5'>
    <input type="button" name="thisbutton" value=">>" onclick="ajaxFunction()">
    </form> 
    </div>
    
    <div id='overlay'>
    <img src='images/overlay.png'>
    </div>
    <div id='base'>
    </div>
    <div id='pattern'>
    </div>
    <div id='shape'>
    </div>

  4. If you can't tell from the code below, i am a beginner at Ajax... can someone please explain to me what I am doing wrong.  I've followed a couple of tuts but can't get anything back.

     

    I would be happy with getting anything back from the backend php file LOL.

    I can adjust the code to give me what I need, but basically all i need is to click a button or link to increment a number and return a url based on that number.

     

    this is my html page

    <SCRIPT Language="JavaScript">
    function getHTTPObject() {
        var xmlhttp;
        if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
            try {
                xmlhttp = new XMLHttpRequest();
            } catch (e) {
                xmlhttp = false;
            }
        }
        return xmlhttp;
    }
    var http = getHTTPObject();
    
    
    function ajaxFunction(somevar){
       http.open('GET', 'ajax.php?pic='+pic, true);
       http.send(null);
       http.onreadystatechange=function(){
          if(http.readyState==4){
             document.getElementById('somediv').innerHTML = http.responseText; // this will put the returned code from ajax.php into a div with id "somediv"
          }
       }
    }
    </script>
    <div name='somediv'>
    
    </div>
    <p>
    <p><a href="javascript: ajaxFunction('somediv','pic')">Click to Test</a></p>
    </p>

     

    Here is ajax.php

    <?php
    $pic = $_GET['pic'];
    if($pic == ''){
    $pic = 1;
    }
    $pic = $pic + 1;
    echo "<img src=" . $pic . ">";
    ?>

  5. Any idea why this isn't working in Internet Explorer?  This works fine in Firefox.  What do I need to do to get it to work? 

     

    page is http://interpim.com/emblems

     

    <form method='post' action='' bgcolor=#333333>
    <input type='image' value='1' alt='Order' src='order.gif' name='order' >
    <input type='image' value='1' alt='Destruction' src='des.gif' name='destro' >
    </form>
    
    
    $realm_order = $_POST['order'];
    $realm_destro = $_POST['destro'];
    if($realm_destro == 1){
    //various bits of code
    }
    if($realm_order == 1){
    //different bits of code
    }
    
    

  6. I've tried the Ajax Tutorials on W3 Schools...

     

    the problem i think i am running into is, I don't understand how to pass data back and forth from client to server.

     

    I can build a function in php to do what i need.  How do I pass data from the javascript clientside to the php script?  do i need a seperate php file for each function? or can I build several functions in php on 1 file, and call them by name with the javascript?

  7. OK... im having trouble interpreting the tutorials I have read. 

     

    Could someone point me to a tutorial, or show me and example of a page with a single image element which that image can be changed based on what is in a folder...

     

    for example... i have an image css box.  the image in that box can be changed by either of 2 buttons, one is a forward and the other is a back. 

     

    All I want to do is cycle through the images in that directory.

     

    Any help is appreciated.  I know PHP, and am weak on Javascript. 

  8. Hi all,

     

    I have never used AJax before, but I am fairly decent at programming PHP and i know very little javascript.  I am a quick learner though, and I believe I have a use for AJAX in a project I have currently.

     

    What I want to build is an image previewer.

     

    I have the images, but I want to stack them (all images have transparency) and have the user able to click a button to change one of the images that are stacked at a time.

     

    This is for building a banner previewer for a game, which allows you to change the colors and then select your emblem and shape.  So I need to be able to combine all possible combinations and I would like to do it without a new page request for every image changed.

     

    If anyone could point me in the direction of a good tutorial for somethign like this, or have any recommendations please help me out.

     

    Thanks

  9. This doesn't complete... just continually tries to load :/

     

    function char_parse($name,$server,$class){
    $URL="http://realmwar.warhammeronline.com/realmwar/UserLoginAuthentication.war";
    $ch = curl_init();   
    curl_setopt($ch, CURLOPT_URL,"$URL"); 
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
    curl_setopt($ch, CURLOPT_COOKIEFILE, "cookiefilename");
    curl_setopt($ch, CURLOPT_COOKIEJAR, "cookiefilename");
    curl_setopt($ch, CURLOPT_POST, 1);
    curl_setopt($ch, CURLOPT_POSTFIELDS, "user=$beta_username&password=$beta_password");
    $pageResults = curl_exec($ch);    
    
    curl_setopt($ch, CURLOPT_URL, "http://realmwar.warhammeronline.com/realmwar/CharacterSearch.war?characterKeyword=$name&server=$server&career=$class");
    $blah = curl_exec($ch);
    $blah = explode("TableBoxRow2",$blah);
    $info = explode("</a>",$blah[1]); 
    $info = explode('"',$info[0]);
    $info = $info[1];
    $char_url = "http://realmwar.warhammeronline.com/realmwar/" . $info;
    curl_setopt($ch, CURLOPT_URL, $char_url);
    $char_page = curl_exec($ch);
    $char_page = explode("charprofile",$char_page);
    $char_page = explode("<!--infobox-->",$char_page[1]);
    $char_page = $char_page[0];
    $char_page = explode("</div>",$char_page);
    $name = $char_page[1];
    $career = $char_page[2];
    $rank = $char_page[4];
    $renown = $char_page[10];
    
    Return compact('name', 'career', 'rank', 'renown') ;
    }
    
    
    
    

  10. <form method='post' action='build_userpage.php'>
    SERVER:  <input type='text' name='server'>
    Main Character: <input type='text' name='main'>Class: <input type='text' name='main_class'>
    Alt: <input type='text' name='alt1'>Class: <input type='text' name='alt1_class'>
    Alt: <input type='text' name='alt2'>Class: <input type='text' name='alt2_class'>
    Alt: <input type='text' name='alt3'>Class: <input type='text' name='alt3_class'>
    Alt: <input type='text' name='alt4'>Class: <input type='text' name='alt4_class'>
    etc.....
    <input type='submit' value='create'></form>
    

  11. So, here is the problem I need to find a solution for...

     

    I have a form, which entry into is repetitive, although not all parts of the form will be required to be filled in.

     

    basically i have the following values.

     

    alt1, class1

    alt2, class2

    alt3, class3

    alt4, class4 etc...

     

    so I want to cycle through these, and assign these to variables when the page is processed, if they contain data.

    How can I build a variable name using for each of these without physically typing a block of code for each numbered name since the type of data will be the same.

     

    So far I have this

     

    $j = 1;
    while($j < 10){
    $var = "alt" . $j;
    
    #This is where I cannot figure out how to get the value in $var to actually be the variable...
    
    
    $j++;
    }
    

     

    Am I on the right track?  and if so, what am I missing here?

  12. I guess it cannot hurt to post how I am getting there, i edited out username/password info.

     

    $player_start = $_POST['player_start'];
    $server = $_POST['server'];
    
    $pagenum = $player_start;
    $pageend = $player_start + 25;
    
    
    $URL="http://realmwar.warhammeronline.com/realmwar/UserLoginAuthentication.war";
    $ch = curl_init();   
    curl_setopt($ch, CURLOPT_URL,"$URL"); 
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
    curl_setopt($ch, CURLOPT_COOKIEFILE, "cookiefilename");
    curl_setopt($ch, CURLOPT_COOKIEJAR, "cookiefilename");
    curl_setopt($ch, CURLOPT_POST, 1);
    curl_setopt($ch, CURLOPT_POSTFIELDS, "user=xxxxxx&password=xxxxxxx");
    $pageResults = curl_exec($ch);    
    
    while($pagenum < $pageend){
    
    curl_setopt($ch, CURLOPT_URL, "http://realmwar.warhammeronline.com/realmwar/CharacterInfo.war?id=$pagenum&server=$server");
    $blah = curl_exec($ch);
    
    #### code for parsing the data from the HTML ##### 

  13. well... I cannot really show the meat of the file... it parses a webpage for a video game this is still under NDA.  The only information I am passing to db_build.php is a server number and a character number.  with that it builds the URL which retrieves each page and parses the data from it and submits it into my database.

  14. Well... I also want to lessen the load on the server I am retrieving from.  And I think iterating through those 60k+ pages for about 50 different servers all at once would put a heck of a load on them.  I was thinking running 25 every 5 minutes would be ideal... I know it would take about 8 days of parsing to get through the first 60k, but I can accept that.  You are right though, my php page is timing out with any more than 25, and still does every once in a while.

     

    I am parsing the HTML from a server that isn't mine, the data is updated continuously, so I will need to run the script quite often.  maybe less as time goes on as my database is nearer completion.

     

     

  15. So, I have a form that I built that will setup a script to parse a website based on an id number...  It works, but it is manual :(  What I want to be able to do is set up a CRON job to run this automattically, updating the number so it steps up each time and not parsing the same pages constantly.  Then when it reaches a certain number I want it to reset to 0 and start over on a different server.

     

    here is my form

    <table><tr><td align ='right'><form method='post' action='db_build.php'>
    Server:</td><td><select name='server'>
    <option value='122'>Warpstone</option>
    <option value='130'>Tyrion</option>
    </select></td></tr><tr><td align='right'>
    Starting Player ID:</td><td><input type='text' name='player_start'></td></tr><tr><td>
    Only 25 players will be parsed!</td><td>
    <input type='submit' value='start parse'></td></tr></table>
    </form>
    

     

    I have been putting the numbers in manually and going back and adding 25 to the last number.  But, there are 60,000+ pages for each server and it is quite the effort to sit at a computer and retype the input everytime it loads.

     

    My server cannot process much more than 25 players at a time, so I cannot just set it to go and walk away. 

     

    I have tried writing a script that will submit post data and update a text file with the last number used, then used a CRON to run that, but for some reason it will not run.

     

    I really think the problem is the CRON I have setup, I don't know much about it, and it isn't running at all I think.

     

    So if I want to run a php script, how would I actually set up the CRON?

    If host matters I use bluehost.com

  16. hmmm... can you explain the cookie jar?  I have a cURL set up already for it.

    $URL="http://realmwar.warhammeronline.com/realmwar/Index.war";
    $ch = curl_init();   
    curl_setopt($ch, CURLOPT_URL,"$URL"); 
    curl_setopt($ch, CURLOPT_POST, 1);
    curl_setopt($ch, CURLOPT_POSTFIELDS, "war_username=$user_name&war_password=$pword");curl_exec ($ch);    
    curl_close ($ch); 
    

  17. So, I built a parser that will parse the HTML of a page, but the page I want to parse requires a username and a password to get to it.

     

    I have a username and password, but I cannot get my script to access the pages.

     

    I have tried cURL (maybe incorrectly) and it doesn't work...

    I have tried passing the variables to the page which it looks like the page requires me to do and it doesn't work

     

    I am trying to login to this page here http://realmwar.warhammeronline.com/realmwar/Index.war

     

    The parser just gets redirected back to this page when it cycles through the URL's I pass to it instead of the actual pages, indicating it isn't logging in.  I am using WAMPP on the same machine that I have logged into the site with, but I still cannot get to it... can anyone offer any suggestions?

  18. Great Thanks :)

     

    It doesn't seem to be working for me though...

     

    anyone see anything wrong with this code?

     

    $URL="http://realmwar.warhammeronline.com/realmwar/Index.war";
    $ch = curl_init();   
    curl_setopt($ch, CURLOPT_URL,"http://$URL"); 
    curl_setopt($ch, CURLOPT_POST, 1);
    curl_setopt($ch, CURLOPT_POSTFIELDS, "war_username=$user_name&war_password=$pword");curl_exec ($ch);    
    curl_close ($ch); 
    
    
    

  19. Hi all,

     

    I have a form which has a bunch of drop down boxes to select from.... these submit to a results page which runs a query into a database I have.

     

    The problem I am having is I have a field called min_level which is an integer, and the form lets teh user select between levels to search for... so for instance, my user wants to find something with a min_level between 5 and 15 I want only the items which have a number between that to show up in the query.

     

    The problem is, I am getting all results as long as the query goes from 0 to the max allowable amount,

    when I adjust the settings I am getting back odd results, as in nothing showing up, or only certain ones.

     

    the script I have basically goes like this

     

    $sql = "Select * From items where career = '$career'";
    
    if($min_lvl != ''){
    $sql = $sql . " and min_level >= $min_lvl";
    }
    if($max_lvl != ''){
    $sql = $sql . " and =< $max_lvl";
    }
    
    
    

     

    The reason I am using the statements is to give the user the option of using more or less search features for an item database I am building for an online video game.

     

    If anyone could square me away I would appreciate it :)

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