It is currently Wed Feb 11, 2026 8:55 am



Reply to topic  [ 35 posts ]  Go to page Previous  1, 2, 3  Next
Offered a small php and mySQL task 
Author Message
Minor Diety
User avatar

Joined: Fri Apr 11, 2003 2:17 pm
Posts: 7740
Location: Centre of the sun
Reply with quote
Post 
So i suppose the question is: What is that script referring to?

This bit, in particular:

Code:
country = document.getElementById('country').value;

_________________
"Well a very, very hevate, ah, heavy duh burtation tonight. We had a very derrist derrison, bite, let's go ahead and terrist teysond those fullabit who have the pit." - Serene Branson


Tue Mar 07, 2006 8:30 pm
Profile
Duke
User avatar

Joined: Mon Mar 31, 2003 8:59 am
Posts: 1358
Location: right behind you
Reply with quote
Post 
That's all javascript. PHP is server side, so you will never see it unless you download the pages via ftp.


Tue Mar 07, 2006 8:42 pm
Profile YIM WWW
Minor Diety
User avatar

Joined: Fri Apr 11, 2003 2:17 pm
Posts: 7740
Location: Centre of the sun
Reply with quote
Post 
Great, so does that mean, ill have to get my head around JS too?

Heres my response code to that:

Code:
                                         _.._
                                  .,c="""  _JLccccc,
                              ,r="     ,,-'         "=c
                           ,J"    ,c$?$ $ `$c          `=,
                        ,c"'  ,J"" J ( j'   "$.           "c,
 ?????????????""""""???"=hcJ$"    JL   `r    `$r             "$q
 `.`.`.`.`.`.`.`.`.`.`.`.`J"     j'L   `L   \  ?c               "g
 `.`.`.`.`.`.`.`.`.`.`.`.J      j'`?c   ?.   t  `$.               `=hc,;c???
 `.`.`.`.`.`.`.`.`.`.`_,$      z'.`.?L   $   `h   "=c,      ,cJ????""`.`.`.`
 `.`.`.`.`.`,cPP?"""'? J    ;,?.`z$$h`"$.'L3, `L  $    "" $`.`.`.`.`.`.`.`.`
 `.`.`.,c??"        ,f $   / $.`.,,,`"=`?h`?$c    `r 3r  .$`.`.`.`.`.`.`.`.`
 "hcr="             j  F  j  P.`$$$h3$,`.`???$c    `cc$r.P.`.`.`.`.`.`.,r`.`
 `.$                ( J  d$ j'.`?.$$$$`.`.,`.`="$c.,cP"" $.`.$??"??$hc$".`.`
 `.`h               ( $  $$ $`.`.`.""""`.J:`hJ?$h,`.$   JF.`$"      .$.`.`.`
 `.`.?.             `j' ($$ $`.`.`.`.`.`f.`?$$$$$$r'3  J"`.J" \    .P`.`.`.`
 `.`.`?.             $  ($' $`.`.`.`.;`.`.`.`"?$??"`$ .F',$F   L  .P.`.`.`.`
 `.`.`.?.           j'  ($' $`.`.`.`"=cj'.`.`.`.`.`,P $'$l?F   $ j'`.`.`.`.`
 `.`.`.`?,          `$.  ? '$`.`.`.`.`.`.`.`.`.`.`,$  $$j'j'   $z?.`.`.`.`.`
 `.`.`.`.?,         ( $    j'`.`.J$I?$c,.`.`.`.`.J$F  $cJ      3F`.`.`.`.`.`
 `.`.`.`.``h          j'   $h`.`.?6$cI$9;`.`.`.c$$" .$" L    .P".`.`.`.`.`.`
 `.`.`.`.`.`?.        $   J$?,.`.`.??i???`.`.`.`$F.P$$  ?   J?.`.`.`.`.`.`,P
 `.`.`.`.`.`."h.      $  J$$.?.`.`.`.`.`.`.`.`,$$,c'`$   L,P.`.`.`.`.`.`.,F
 h.`.`.`.`.`.`.?h    J  J3$$.`3`.`.`.`.`.`.`.J$$"$   $   J"`.`.`.`.`.`.`,P
 `h`.`.`.`.`.`.`.?h .F J'<$F.`.?h_.`.`.`.,c$$$$$ $  ,P J?`.`.`.`.`.`.`.,P
   $.`.`.`.`.`.`.`.?$ J' <$`.`.`.`?=hc=?"'J$$$$" $  $.P`.`.`.`.`.`.`.`,P
    $`.`.`.`.`.`.`.`f $  <$`.`.`.`.`.`.`.;$$$$   F  $?.`.`.`.`.`.`.`.,F
     ?.`.`.`.`.`.`.(f $. j'`.`.`.`.`.`.`.$$$P   JF JF`.`.`.`.`.`.`.`,F
      ",.`.`.`.`.`.`$'F  J)`.`.`.`.`.`.`J$P    Jl$$?.`.`.`.`.`.`.`.,F;
       "i`.`.`.`.`.`? $ ($.`.`.`.`.`.`.z$"    J$"J"`.`.`.`.`.`.`.`,P }     j
        ?`.`.`.`.`.`.?`  P.`h`.,c`.`.`J" ,' z$"'J".`.`.`.`.`.`.`.,P j      f
         ?.`.`.`.`.`.`h  F.`$'z?.`.`,",$" zP"`.`?`.`.`.`.`.`.`.`,P ,      j'
          ?`.`.`.`.`.`.??'.<$$.`.`.J$"j'c$.`.`.`.`.`.`.`.`.`.`.j'  $     j .
           $.`.`.`.`.`.`.`.$?`.`.`.`.,$?.`.`.`.`.`.`.`.`.`.`.`JF  .F    J"L
            $`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.J$   $   .P   k
            `h,c.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.,$$$   `h  P
            ,P"`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`,$"$$    $ $
          ,P.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.;$F $$r    ?c,  _c"
        ,P"`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`;$'F  $$       ""
      .$"`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.,P  $  `$$
     J?`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`,$   $     "=,_
   ,P`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`$$   ?         "=cccc"
 ,$"h`.`.`.`.`.`.`.`.`.`.,cc,`.`.`.`.`.`.`.`.`.`.`.`.JP$.  `t     -c   3,
 $`.3`.`.`.`.`.`.`.;.`.`$,c,3`.`.`.`.`.`.;;`.`.`.`.`;$ `L   $       3.  ?.
 $$iJ`.`.`.`.`.`.`;;.`.`$?;t$).`.`.`.`.`;;;`.`.`.`.,$'  $   `L       $   $
 ?$F;`.`.`.`.`.`.`;;.`.``$iP"`.`.`.`.`.`;;:`.`.`.`.$$   $    3.      $   3
 `h;;,.`.`.`.`.`.`?;;`.`.`.`.`.`.`.`.`.;;3.`.`.`.`,$$  j'L    $     J"   $
  ?;;;;,.`.`.`;;.`$;;;.`.`.`.`.`.`.`.`;;;P.`.`.`.`$$F  j ?.    `"??"    v'
  `h;;;;;;,;;;;).`?h;;,`.`.`.`.`.`.`;;;;$`.`.`.`.f'$F  J  ?,         .$"
    ?c;;;;;;;;F`.`.$h;;;,`.`.`.`.,;;;;;$'`.`.`.`f  $)  $   `"?????c=" 4r
     ?c;;;;;;F.`.`.`?y;;;;;;;,;;;;;;;iP`.`.`.`.J'  $   $              j'
      `"?jj$F;.`.`.`.`$y;;;;;;;;;;;jP".`.`.`.`;$   $   F              j'
           3;;.`.`.`.`.`?hijjjjid$?".`.`.`.`.,f    $   F              j'
            h;.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`,;$'  ;F   L              P
            ?h.`.`.`.`.`.`.`.`.`.`.`.`.`.`.,;;$   $    ? ,cc         $
            `$;`.`.`.`.`.`.`.`.`.`.`.`.`.`,;;;$   $     "   ?.     z"
             ?;`.`.`.`.`.`.`.`.`.`.`.`.`.;;;;;$   `r         h.,zJ"
              h;.`.`.`.`.`.`.`.`.`.`.`.`;;;;;;$    ?        `$
              `h;;;,.`.`.`.`.`.`.`.`.`.`;;;;;;$     $       .F
               $;;;;;;.`.`.`.`.`.`.`.`.,;;;;;;$      "hcc$  $
               `h;;;;;,`.`.`.`.`.`.`.`.;;;;;;;$.           j'
                ?;;;;;;;.`.`.`.`.`.`.`.;;;;;;;9L,         J'
                 ?;;;;;;;`.`.`.`.`.`.`.;;;;;;;;h "cc,__,c"
                  $;';;;;,.`.`.`.`.`.`.;;;;;;';9r
                   $;`.`.`.`.`.`.`.`.`.;;`.`;`.`?c.
                    $;.`.`.`.`.`.`.`.`.;.`.`.`.`.`."c._
                     h;`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`."?c,
                     ?;;.?;`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`."=c_
                      $;.`$h.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`."c
                      ?;;`.$)`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`."h.
                       h;`.`?`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`?.
                       `C;;`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.?c
                        $;;,.`.`.`.`.`.`.`;;.`.`.`.`.`.`.`.`.`.`.`.`.`.h
                        ?;;;;`.`.`.`.`.`.;;;;`.`.`.`.`.`.`.`.`.`.`.`.`.`h
                         h.;;;;`.`.`.`.`.;;;;';`.`.`.`.`.`.`.`.`.`.`.`.`?L
                         ?.`;;;;.`.`.`.`.`;;;;;`.`.`.`.`.`.`.`.`.`.`.`.`.3.
                          ?`.;;;;`.`.`.`.`.;;;;`.`.`.`.`.`.`.`.`.`.`.`.`.`$
                           $`.;;;;,`.`.`.`.`.;$`.`.`.`.`.`.`.`.`.`.`.`.`.``L
                            $`.`;;;;.`.`.`.`.;$`.`.`.`.`.`.`.`.`.`.`.`.`.`.$
                             $;`.;;;;;.`.`.`.;9`.`.`.`.`.`.`.`.`.`.`.`.`.`.3
                              $;,`.`;;.`.`.`.;?`.`.`.`.`.`.`.`.`.`.`.`.`.`.3
                               $h;;`.`.`.`.`.;;L.`.`.`.`.`.`.`.`.`.`.`.`.`.3
                               $'"$;;;;;;;;;;;j$.`.`.`.`.`.`.`.`.`.`.`.`.`.$
                               $.```?;;;;;;jjJ?$.`.`.`.`.`.`.`.`.`.`.`.`.`.$
                              J'`.`.`"hiii?";;;?h`.`.`.`.`.`.`.`.`.`.`.`.`.$
                            ,$`.`.`.`.``?i;;;;;;$`.`.`.`.`.`.`.`.`.`.`.`.`j'
                           c"`.`.`.`.`.`.?$i;;;;$`.`.`.`.`.`.`.`.`.`.`.`.`$
                         .P`.`.`.`.`.`.`.`.`?iii9`.`.`.`.`.`.`.`.`.`.`.`.`f
                        z?.`.`.`.`.`.`.`.`.`.`.`3).`.`.`.`.`.`.`.`.`.`.`.j'
                       J'`.`.`.`.`.`.`.`.`.`.`.`?).`.`.`.`.`.`.`.`.`.`.`.3
                     j"`.`.`.`.`.`.`.`.`.`.`.`.`.h.`.`.`.`.`.`.`.`.`.`.`.3
                   ,P`.`.`.`.`.`.`.`.`.`.`.`.`.`.$.`.`.`.`.`.`.`.`.`.`.`.3


Tue Mar 07, 2006 8:53 pm
Profile
Minor Diety
User avatar

Joined: Fri Apr 11, 2003 2:17 pm
Posts: 7740
Location: Centre of the sun
Reply with quote
Post 
Whoa, that didnt work as planned. Maybe i should stick to php.

_________________
"Well a very, very hevate, ah, heavy duh burtation tonight. We had a very derrist derrison, bite, let's go ahead and terrist teysond those fullabit who have the pit." - Serene Branson


Tue Mar 07, 2006 8:55 pm
Profile
Duke
User avatar

Joined: Mon Mar 31, 2003 8:59 am
Posts: 1358
Location: right behind you
Reply with quote
Post 
Probably not. It depends on whether you can edit the form directly. But like I said earlier, if you have only 5 hours, I wouldn't bother.


Tue Mar 07, 2006 9:08 pm
Profile YIM WWW
Minor Diety
User avatar

Joined: Fri Apr 11, 2003 2:17 pm
Posts: 7740
Location: Centre of the sun
Reply with quote
Post 
I have until tomorrow night to decide.

Its for £32.50 btw. Im toying with the idea of giving it to someone else for a £10, and me keeping the rest.

:lol:

But then again, they might ask me for more, and it would be hard to dig myself out from that hole.


Tue Mar 07, 2006 9:16 pm
Profile
Felix Rex
User avatar

Joined: Fri Mar 28, 2003 6:01 pm
Posts: 16704
Location: On a slope
Reply with quote
Post 
I wouldn't bother. You don't know enough.

The code you posted, as Pig says, is javascript. Specifically it looks like an AJAX implementation. Not that it matters, but it has nothing to do with PHP.

Given more information and access to their production environment, I could probably get something like that up and running in an hour or less. But I know php.

Here's a quick outline of what I'd do. I may have fuxored something here or there (especially the sql query) but the general idea is solid.

Code:
<?
// grab the client ip address
$client_ip = $_SERVER['REMOTE_ADDR'];

//format ip address into the format the table expects
//I'd have to see the table...who knows how it's set up
$exploded_client_ip = explode(".",$client_ip);
$query_ip = $exploded_client_ip[1] .$exploded_client_ip[2] .$exploded_client_ip[3]

//connect to the database
$host = "";
$username = "";
$password = "";
$db = mysql_connect($host, $username, $password);
mysql_select_db("",$db);

//grab db information
$select =    "SELECT countryname, "
      .   "(SELECT countryname "
      .   "FROM country_ip_lookup "
      .   "WHERE countryip = 'query_ip') as selected_countryname "
      .   "FROM country_ip_lookup_table "
      .   "ORDER BY countryname ASC";

$result = mysql_query($select);

//build select box
echo '<select name="country">';
while($row = mysql_fetch_array($result)){
   echo '<option="' .$row['countryname'] .'"';
   if($row['countrname'] == $row['selected_countryname']){
      echo 'selected';
   }
   echo '>' .$row['countryname'];
}
echo '</select>';
?>


*edit* OMFG, Pig is right on...PHPbb sucks my balls. HTMLEntities or something SURE WOULD BE FUCKING NICE.


Wed Mar 08, 2006 10:54 am
Profile WWW
Minor Diety
User avatar

Joined: Fri Apr 11, 2003 2:17 pm
Posts: 7740
Location: Centre of the sun
Reply with quote
Post 
Looks like i'll be turning this task down.

_________________
"Well a very, very hevate, ah, heavy duh burtation tonight. We had a very derrist derrison, bite, let's go ahead and terrist teysond those fullabit who have the pit." - Serene Branson


Wed Mar 08, 2006 11:06 am
Profile
King
User avatar

Joined: Wed Apr 16, 2003 2:18 pm
Posts: 1976
Location: Sexy Town
Reply with quote
Post 
Correct me if Im wrong but wouldnt having the webserver trying to figure out what country the person is from cause it to use bandwidth in doing a whois or ping?

I mean when a client connects to a website, he just brings his IP with him. The ip/data packet doesnt contain "country" information right? The server who have to execute some kind of command to get it , right? So if you have 100 people hitting your site the server is trying to get 100 peoples country info which would cause some unnessary server loads.


Wed Mar 08, 2006 11:26 am
Profile ICQ YIM
Minor Diety
User avatar

Joined: Fri Apr 11, 2003 2:17 pm
Posts: 7740
Location: Centre of the sun
Reply with quote
Post 
The country name is stored in a MySQL table beside the IP range. This is queried. I dont know all the details.

_________________
"Well a very, very hevate, ah, heavy duh burtation tonight. We had a very derrist derrison, bite, let's go ahead and terrist teysond those fullabit who have the pit." - Serene Branson


Wed Mar 08, 2006 1:21 pm
Profile
King
User avatar

Joined: Wed Apr 16, 2003 2:18 pm
Posts: 1976
Location: Sexy Town
Reply with quote
Post 
no no. Im talking about when you visit a website the packets of data you send to the webserver doesnt contain your country of origin. It just sends your IP address in the packet. For the webserver to know what your country it is it would need to take your IP address and run scripts/command/ something to to query your ip address and figure out what country you are from. That would require server resources and or bandwidth to find that out. Which would be really unnessary give it only takes an extra 2 secs to select your country.


Last edited by ElevenBravo on Wed Mar 08, 2006 1:51 pm, edited 1 time in total.



Wed Mar 08, 2006 1:34 pm
Profile ICQ YIM
Felix Rex
User avatar

Joined: Fri Mar 28, 2003 6:01 pm
Posts: 16704
Location: On a slope
Reply with quote
Post 
nah, not necessarily. Different IP rangers are reserved for different countries. Like China is 99.0.0.0 - 99.255.255.255 (not really, but an example). These ranges are available, so you could just grab the requesting IP and then bounce it off a database.

_________________
They who can give up essential liberty to obtain a little temporary safety, deserve neither liberty nor safety.


Wed Mar 08, 2006 1:41 pm
Profile WWW
Minor Diety
User avatar

Joined: Fri Apr 11, 2003 2:17 pm
Posts: 7740
Location: Centre of the sun
Reply with quote
Post 
Satis/Pig

Don't get your hopes high. Would you be interested in implementing this for £15 via paypal if my boss aprooves of the idea?

Obviously, ill provide more info/links/access to resources.


Wed Mar 08, 2006 2:39 pm
Profile
Felix Rex
User avatar

Joined: Fri Mar 28, 2003 6:01 pm
Posts: 16704
Location: On a slope
Reply with quote
Post 
give me the csv and I'll do it. Not in the next 5 hours, though.

And how are you going to pay me?

_________________
They who can give up essential liberty to obtain a little temporary safety, deserve neither liberty nor safety.


Wed Mar 08, 2006 4:18 pm
Profile WWW
Minor Diety
User avatar

Joined: Fri Apr 11, 2003 2:17 pm
Posts: 7740
Location: Centre of the sun
Reply with quote
Post 
Again, dont get your hopes high, i havent got an aprooval yet.

No, of course not in the next 5 hrs. Don't know the exact time frame he wants it for, but im pretty sure its not due before Sunday night.

I'd pay (like i said!!!) via paypal. I think paypal charge something like 5% for transactions under £50, so i'd actually have to put through £17.50.

Might get the reply tomorrow.

_________________
"Well a very, very hevate, ah, heavy duh burtation tonight. We had a very derrist derrison, bite, let's go ahead and terrist teysond those fullabit who have the pit." - Serene Branson


Wed Mar 08, 2006 5:07 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 35 posts ]  Go to page Previous  1, 2, 3  Next

Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by STSoftware.