Jump to content

Recommended Posts

  • Administrators
Posted

Looks good, you can dynamically generate that with something liek:

createid.php?pilotid=XXX123

And inside, you can use the API with something like:

include 'core/codon.inc.php';

$pilotid = DB::escape($_GET['pilotid']);
$pilot_info = PilotData::getPilotData($pilotid);

// Now you can create that badge...
$pilotinfo->hub;
$pilotinfo->totalhours;
$avatar_link = PilotData::getPilotAvatar($pilotid);
//etc

Posted

Looks good, you can dynamically generate that with something liek:

createid.php?pilotid=XXX123

And inside, you can use the API with something like:

include 'core/codon.inc.php';

$pilotid = DB::escape($_GET['pilotid']);
$pilot_info = PilotData::getPilotData($pilotid);

// Now you can create that badge...
$pilotinfo->hub;
$pilotinfo->totalhours;
$avatar_link = PilotData::getPilotAvatar($pilotid);
//etc

The only problem im having is where should i put my file so i can include it on the profile page because i want to place my ID card when the avatar is?

At the moment is says file not found when i try to include it, and i've tried placing my file in the Profile module folder

Also im having issues getting the pilot data, it pulls the avatar no problem but it isn't retrieving anything else?

function CreateID($pilotid){

include 'core/codon.config.php';
$pilotid = DB::escape($pilotid);
$pilotinfo = PilotData::getPilotData($pilotid);

// DEBUG ECHO
echo $pilotinfo->hub;
echo $pilotinfo->totalhours;
echo $pilotinfo->pilotid;

All 3 of those DEBUG Echo's don't print on the screen?

Posted

Ok i have worked out why it wasn't getting the pilot info, because its being given the full pilot id which is TVA0001 which is not how pilot ids aren't stored in the database so what suggestions are there for getting the id in the correct format to retrieve their data?

  • Administrators
Posted

Ok i have worked out why it wasn't getting the pilot info, because its being given the full pilot id which is TVA0001 which is not how pilot ids aren't stored in the database so what suggestions are there for getting the id in the correct format to retrieve their data?

Pilot IDs are stored in the id column which is numeric only.

You can place it in a file called createid.php in the same folder as the index.php, or you can create a module. Either way is fine, but for simplicity's sake, you can create a file in the same directory as the index.php file

Posted

Pilot IDs are stored in the id column which is numeric only.

You can place it in a file called createid.php in the same folder as the index.php, or you can create a module. Either way is fine, but for simplicity's sake, you can create a file in the same directory as the index.php file

ok that is where the file is placed at the moment in a folder called PilotIDs in the root folder but when i try to include the file in the Profile template, it says the createid.php file does not exist

Warning: include(../PilotIDs/createids.php) [function.include]: failed to open stream: No such file or directory in /home/.philadelphia/homer09001/testdomain.dth-scripts.com/PHPVMS/core/templates/profile_main.tpl on line 8

Warning: include() [function.include]: Failed opening '../PilotIDs/createids.php' for inclusion (include_path='.:/usr/local/php5/lib/php:/usr/local/lib/php') in /home/.philadelphia/homer09001/testdomain.dth-scripts.com/PHPVMS/core/templates/profile_main.tpl on line 8

Fatal error: Call to undefined function createid() in /home/.philadelphia/homer09001/testdomain.dth-scripts.com/PHPVMS/core/templates/profile_main.tpl on line 9

on the other point of the pilot id number, how can i clean it so its only the actual numeric entry?

Its obviously done in PHPVMS before with the login script but i can work it out?

  • Administrators
Posted

Hang on a sec, i think i've been getting the id the wrong way, i can't check until i can get the id card showing in the profile.

regarding the placement of the file:

phpVMS: http://testdomain.dt...pts.com/PHPVMS/

createid.php: http://testdomain.dt...HPVMS/PilotIDs/

The ID if you're linking to it from the pilot profile, just use $pilot->pilotid, which is the numeric ID

Posted (edited)

The ID if you're linking to it from the pilot profile, just use $pilot->pilotid, which is the numeric ID

Fatal error: Cannot redeclare codon_autoload() (previously declared in /home/.philadelphia/homer09001/testdomain.dth-scripts.com/PHPVMS/core/classes/autoload.php:42) in /home/.philadelphia/homer09001/testdomain.dth-scripts.com/PHPVMS/core/classes/autoload.php on line 65

this is when this include is in my script: include 'core/codon.config.php';

without it i can load the profile page but my image is broken?

Edit: if i change include 'core/codon.config.php'; to require_once it lets me load the Profile page but my image is still broken????

Edited by homer09001
  • Administrators
Posted

this is when this include is in my script: include 'core/codon.config.php';

without it i can load the profile page but my image is broken?

Edit: if i change include 'core/codon.config.php'; to require_once it lets me load the Profile page but my image is still broken????

How are you linking to the change image page? Is it an <img src="">?

  • Administrators
Posted

no just

<? include "PilotIDs/createid.php"; ?>

I've tried wrapping it in an img tag but that yields the same result?

try

<img src="/PilotIDs/createid.php?pilotid=<?php echo $pilot->pilotid;?>" />

Then inside that createid.php with that above code to include the codon.inc.php and the other stuff, and then create your image

Posted

try

<img src="/PilotIDs/createid.php?pilotid=<?php echo $pilot->pilotid;?>" />

Then inside that createid.php with that above code to include the codon.inc.php and the other stuff, and then create your image

Thanks Nabeel got it eventualy

Has to change the code you gave me a bit to get it to work:

<img src="/PHPVMS/PilotIDs/createid.php?pilotid=<?php echo $userinfo->pilotid;?>" />

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...