DragonPrime - LoGD Resource Community
Welcome Guest
  • Good evening, Guest.
    Please log in, or register.
  • May 25, 2013, 11:20:02 PM
Home Forums News Links Downloads Login Register Advanced Search
* * *
DragonPrime Menu
Login
 
 
Resource Pages
IRC Channels
Search

Pages: [1]   Go Down
  Print  
Author Topic: Httpget Char  (Read 203 times)
0 Members and 1 Guest are viewing this topic.
Aeo
Mod God
*****
Offline Offline

Posts: 1084


Doctor.. Who?


View Profile WWW
« on: July 21, 2012, 01:59:03 PM »

If the URL of Bobby Joe's bio is http://www.evolutionathens.net/bio.php?char=BobbyJoe&ret=%2Fvillage.php, and I used the following code --

Code:
$char = httpget('char');

-- then $char would be 'BobbyJoe', correct?

How do I convert that to BobbyJoe's Account ID number?
« Last Edit: July 21, 2012, 02:12:39 PM by Aeolus » Logged


Time Lords Online - A Doctor Who RPG! Open Now!
~ My Modules: PM me if you'd like me to code something! Smiley ~
Brendan
I am Brendan.
Mod God
*****
Offline Offline

Posts: 823


View Profile
« Reply #1 on: July 21, 2012, 02:01:25 PM »

The char in the url stores there id not name.
Logged
Aeo
Mod God
*****
Offline Offline

Posts: 1084


Doctor.. Who?


View Profile WWW
« Reply #2 on: July 21, 2012, 02:04:17 PM »

The char in the url stores there id not name.

Below is a screenshot of the URL bar when viewing my bio.



i.e. At times, it does store the name. If it didn't, I probably wouldn't have posted this thread.
Logged


Time Lords Online - A Doctor Who RPG! Open Now!
~ My Modules: PM me if you'd like me to code something! Smiley ~
Brendan
I am Brendan.
Mod God
*****
Offline Offline

Posts: 823


View Profile
« Reply #3 on: July 21, 2012, 02:11:54 PM »

Oh i see, well you could do a query.

Code:
<?php
$char 
httpget('char');
$sql db_query("SELECT acctid FROM " db_prefix("accounts") . " WHERE login = '$char'");
$row db_fetch_assoc($sql);
$acctid $row['acctid'];

Would only work if the char is the name though and not the id.

So you could do a check on the char

Code:
<?php
$char 
httpget('char');
if (!
is_numeric($char)){
//char is the name, execute the query
}else{
//char is the id
}
?>

« Last Edit: July 21, 2012, 02:14:47 PM by Brendan » Logged
Aeo
Mod God
*****
Offline Offline

Posts: 1084


Doctor.. Who?


View Profile WWW
« Reply #4 on: July 21, 2012, 02:14:27 PM »

Oh i see, well you could do a query.

Code:
<?php
$char 
httpget('char');
$sql db_query("SELECT acctid FROM " db_prefix("accounts") . " WHERE login = '$char'");
$row db_fetch_assoc($sql);
$acctid $row['acctid'];

Thanks for that! Cheesy

Would only work if the char is the name though and not the id.

Is there a PHP command, or function, that can tell the difference between if a string is numeric or alphabetical?
Logged


Time Lords Online - A Doctor Who RPG! Open Now!
~ My Modules: PM me if you'd like me to code something! Smiley ~
Brendan
I am Brendan.
Mod God
*****
Offline Offline

Posts: 823


View Profile
« Reply #5 on: July 21, 2012, 02:15:23 PM »

Oh i see, well you could do a query.

Code:
<?php
$char 
httpget('char');
$sql db_query("SELECT acctid FROM " db_prefix("accounts") . " WHERE login = '$char'");
$row db_fetch_assoc($sql);
$acctid $row['acctid'];

Thanks for that! Cheesy

Would only work if the char is the name though and not the id.

Is there a PHP command, or function, that can tell the difference between if a string is numeric or alphabetical?

Just edited my post as you said that  Smiley
Logged
Loscil Derails
Militia
**
Offline Offline

Posts: 51



View Profile
« Reply #6 on: July 21, 2012, 02:16:17 PM »

Oh i see, well you could do a query.

Code:
<?php
$char 
httpget('char');
$sql db_query("SELECT acctid FROM " db_prefix("accounts") . " WHERE login = '$char'");
$row db_fetch_assoc($sql);
$acctid $row['acctid'];

Thanks for that! Cheesy

Would only work if the char is the name though and not the id.

Is there a PHP command, or function, that can tell the difference between if a string is numeric or alphabetical?

is_numeric()
Logged

Your specimen is being processed...
Aeo
Mod God
*****
Offline Offline

Posts: 1084


Doctor.. Who?


View Profile WWW
« Reply #7 on: July 21, 2012, 02:19:30 PM »

Just edited my post as you said that  Smiley

My thanks to you! Grin (And belatedly to valor. xD)
Logged


Time Lords Online - A Doctor Who RPG! Open Now!
~ My Modules: PM me if you'd like me to code something! Smiley ~
Brendan
I am Brendan.
Mod God
*****
Offline Offline

Posts: 823


View Profile
« Reply #8 on: July 21, 2012, 02:20:44 PM »

No problem  Smiley
Logged
Pages: [1]   Go Up
  Print  
 
Jump to:  


*
DragonPrime Notices
Welcome to DragonPrime - The LoGD Resource Community!

Support Us
$100 raised this year
Your help is greatly appreciated!
Who's Online
24 Guests, 0 Users
DragonPrime LoGD
Recent Topics
Home Forums News Links Downloads Login Register Advanced Search