Jump to content

AGuyFawkesMask

Members
  • Posts

    44
  • Joined

  • Last visited

Posts posted by AGuyFawkesMask

  1. Yes, the code that's generated for the custom fields needs to be "exact", it relies on the proper naming of the fields. Ideally, for formatting issues, fix them via CSS, but that's not always possible.

    That error is a database error saying the fields didn't match... your code field is missing? It seems like you added a bunch of fields to the pilots table - those should be custom fields (because if you hardcode changes, you'll have troubles updating later on)

    Thanks for the reply, Nabeel! I decided to make use of your methods that you already have in place (via registration_customfields.tpl) for that exact reason. It ended up that I was missing the code field (which I ended up hiding).

  2. After enabling debug mode via local.config.php (as per Nabeel's signature), it came back with the following code:

    =====
    Time: 01.14.12 14:59:12
    =====
    Time: 01.14.12 14:59:12
    Backtrace: DB::write_debug > DB::query > RegistrationData::AddUser > Registration->ProcessRegistration > Registration->index > call_user_func_array > MainController::RunAllActions
    Query: INSERT INTO phpvms_pilots (firstname, lastname, month, day, year, gender, location, hub, email, code, vatsimid, publicity, password, salt, confirmed, joindate, lastip) VALUES ('Test', 'Pilot', '', '', '', '', 'US', 'KLAS', 'test@pilot.com', '', '', '', '48579fbcfbaa56b1464ed25f66c13b53', 'ad0832637b523dfae0a62ae4d1303f11', 0, NOW(), '24.185.108.47')
    Error: (1452) - Cannot add or update a child row: a foreign key constraint fails (`flybl110_bluwave/phpvms_pilots`, CONSTRAINT `phpvms_pilots_ibfk_1` FOREIGN KEY (`code`) REFERENCES `phpvms_airlines` (`code`) ON UPDATE CASCADE)
    =====
    
    
    =====
    
    

    I'm starting to get the feeling that this error might be very easy to fix. As easy as editing a file I seemed to have missed. Can anyone tell me what the required registration files are to edit when adding custom fields manually? (Not via the admin panel.) So far I've edited registration_mainform.tpl, Registration.php, and RegistrationData.class.php

    Good news! After vigorously searching through this forum for solutions to my problem, I was able to solve it by changing the formating in the registration_customfields.tpl file :D Everything's working wonderfully! The only thing that I need to now is add a "Confirm email address" field.

    Has anyone implemented this at any point in their registration form? I'm interesting in learning the basics of how those people carried out that function on this form.

    Thanks in advance!

  3. After enabling debug mode via local.config.php (as per Nabeel's signature), it came back with the following code:

    =====
    Time: 01.14.12 14:59:12
    =====
    Time: 01.14.12 14:59:12
    Backtrace: DB::write_debug > DB::query > RegistrationData::AddUser > Registration->ProcessRegistration > Registration->index > call_user_func_array > MainController::RunAllActions
    Query: INSERT INTO phpvms_pilots (firstname, lastname, month, day, year, gender, location, hub, email, code, vatsimid, publicity, password, salt, confirmed, joindate, lastip) VALUES ('Test', 'Pilot', '', '', '', '', 'US', 'KLAS', 'test@pilot.com', '', '', '', '48579fbcfbaa56b1464ed25f66c13b53', 'ad0832637b523dfae0a62ae4d1303f11', 0, NOW(), '24.185.108.47')
    Error: (1452) - Cannot add or update a child row: a foreign key constraint fails (`flybl110_bluwave/phpvms_pilots`, CONSTRAINT `phpvms_pilots_ibfk_1` FOREIGN KEY (`code`) REFERENCES `phpvms_airlines` (`code`) ON UPDATE CASCADE)
    =====
    
    
    =====
    
    

    I'm starting to get the feeling that this error might be very easy to fix. As easy as editing a file I seemed to have missed. Can anyone tell me what the required registration files are to edit when adding custom fields manually? (Not via the admin panel.) So far I've edited registration_mainform.tpl, Registration.php, and RegistrationData.class.php

  4. Hi all,

    Happy New Year. I'm experiencing a few issues with my registration page after I edited it for formatting, while at the same time adding a few additional fields. I understand that Nabeel gives admins the option to add custom fields via the Admin Panel, but I noticed that when that happens, I'm faced with a huge problem when it comes to formatting. As a result, I formatted the registration_mainform.tpl as I needed it to be formatted and took out the code that included the custom fields. I then manually added those custom fields and created columns in my phpvms_pilots database on my server.

    After doing so, upon registering a test pilot, I'm encountering this error:

    Cannot add or update a child row: a foreign key constraint fails (`flybl110_bluwave/phpvms_pilots`, CONSTRAINT `phpvms_pilots_ibfk_1` FOREIGN KEY (`code`) REFERENCES `phpvms_airlines` (`code`) ON UPDATE CASCADE)

    Does anyone know what I can do to solve this error? I can provide additional code if needed. (Sorry for the trouble. I've been getting such a headache from this since Wednesday night!)

  5. I'm an admin and I still cant

    Right, and so am I, but being an admin alone shouldn't have anything to do with what Txmmy is talking about. He's referring to the permissions of the avatars folder on your server, which should be under public_html/lib/avatars

    Have you Set enough permissions for the Avatar image Folder on your Server ?

    I think I have the right ones set. 755, correct?

  6. Hello and Happy New Year to all,

    At my virtual airline, each pilot is required to submit two (2) PIREPs each month. I'm curious to know how I can modify either my app.config.php or local.config.php file to verify this for each pilot before declaring them inactive.

    I'm also looking to obtain a script that will send a pilot three (3) emails: 1) One email that alerts them that I've reached inactive status and need to complete two (2) flights to remain active. 2) Another email that gets sent out two (2) weeks after the previous one which will warn them that they are nearing termination. And 3) the third one will alert them that they are terminated following two (2) weeks of the second email.

    I'm not incredibly advanced with PHP, but I do know enough to get by. With a little help from the talent on this forum, I'm sure we can put this together.

    Thanks in advance!

    • Like 1
  7. Hello all,

    I'm a little embarrassed to make this post, as I think I was the one responsible for this glitch. When a member on my site goes to upload their own avatar via profile_edit.tpl, a message at the top of profile_main.tpl says "Profile saved!" but the avatar is never changed.

    There aren't any error messages associated with this glitch, which is why I'm uploading the files that I think are related to it.

    Would anyone be able to help me out with this? If someone could just point me in the direction of where I have to look, it would be much appreciated.

    Thanks in advance!

    profile_edit.tpl

    <h3>Edit Profile</h3>
    <form action="<?php echo url('/profile');?>" method="post" enctype="multipart/form-data">
    <dl>
    <dt><strong>Name:</strong> <?php echo $userinfo->firstname . ' ' . $userinfo->lastname;?></dt><br />
    
    <dt><strong>Email address:</strong> <input type="text" name="email" value="<?php echo $userinfo->email;?>" size="40" />
    	<?php 
    		if(isset($email_error) && $email_error == true)
    		echo '<p class="error">Please enter your email address</p>'; ?>
    </dt><br />
    
    <dt><strong>Location:</strong> <select name="location">
    	<?php
    		foreach($countries as $countryCode=>$countryName)
    		{ if($userinfo->location == $countryCode)
    			$sel = 'selected="selected"';
    		  else	
    			$sel = '';
    			echo '<option value="'.$countryCode.'" '.$sel.'>'.$countryName.'</option>';	} ?>
    	</select>
    	<?php 
    		if(isset($location_error) &&  $location_error == true)
    		echo '<p class="error">Please enter your location</p>'; ?>
    </dt><br />
    
    <dt><strong>ID badge background:</strong> <select name="bgimage">
    	<?php
    		foreach($bgimages as $image)
    		{ if($userinfo->bgimage == $image)
    			$sel = 'selected="selected"';
    		  else	
    			$sel = '';
    			echo '<option value="'.$image.'" '.$sel.'>'.$image.'</option>'; } ?>
    	</select>
    </dt><br />
    
    <?php
    if($customfields)
    {
    	foreach($customfields as $field)
    	{
    		echo '<dt>'.$field->title.'</dt>
    			  <dd>';
    
    		if($field->type == 'dropdown')
    		{
    			$field_values = SettingsData::GetField($field->fieldid);				
    			$values = explode(',', $field_values->value);
    
    
    			echo "<select name=\"{$field->fieldname}\">";
    
    			if(is_array($values))
    			{						
    				foreach($values as $val)
    				{
    					$val = trim($val);
    
    					if($val == $field->value)
    						$sel = " selected ";
    					else
    						$sel = '';
    
    					echo "<option value=\"{$val}\" {$sel}>{$val}</option>";
    				}
    			}
    
    			echo '</select>';
    		}
    		elseif($field->type == 'textarea')
    		{
    			echo '<textarea class="customfield_textarea"></textarea>';
    		}
    		else
    		{
    			echo '<input type="text" name="'.$field->fieldname.'" value="'.$field->value.'" />';
    		}
    
    		echo '</dd>';
    	}
    }
    ?>
    
    <dt><strong>Avatar:</strong> <input type="hidden" name="MAX_FILE_SIZE" value="<?php echo Config::Get('AVATAR_FILE_SIZE');?>" /><input type="file" name="avatar" size="40"> Your image will be resized to <?php echo Config::Get('AVATAR_MAX_HEIGHT').' x '.Config::Get('AVATAR_MAX_WIDTH');?>px.	</dt><br />
    
    <dt><strong>Current avatar:</strong> <?php	
    		if(!file_exists(SITE_ROOT.AVATAR_PATH.'/'.$pilotcode.'.png'))
    		{
    			echo 'You have not selected an avatar. (Pick one and get a reward!)';
    		}
    		else
    		{
    		?>
    		<img src="<?php	echo SITE_URL.AVATAR_PATH.'/'.$pilotcode.'.png';?>" />
    		<?php
    		}
    		?></dt><br />
    
    <dt><input type="hidden" name="action" value="saveprofile" />
    	<input type="submit" name="submit" value="Save changes" />
    </dt>
    </dl>
    </form>

  8. 1318713282[/url]' post='40881']

    Try this,

    <?php
    error_reporting(E_ALL);
    ini_set('display_errors', 'on');
    include '/PUT YOUR PATH HERE/public_html/core/codon.config.php';
    $allpilots = PilotData::getAllPilots();
    foreach($allpilots as $pilot)
    {
    }
    ?>
    <h3>Pilot Hours Validation</h3>
    <p>To Quick search name or pilot id hit Ctrl + F and and type in data.</p>
    <?php
    
      if(!$allpilots)
    
      {
    
         echo 'There are no pilots!</div>';
    
         return;
    
      }
    
    ?>
    
    <table width="380" cellspacing="1" cellpadding="5" border="1">
     <thead>
       <tr>
         <th width="60px">Pilot ID</th>
         <th width="200px">Name</th>
         <th width="55px">Hours</th>
         <th width="65px">Active/Inactive</th>
         <th>Vatsim ID</th>
       </tr>
     </thead>
    
    <tbody>
    
    <?php
    
    foreach($allpilots as $pilot)
    
    {
    
      /* 
    
         To include a custom field, use the following example:
    
    
    
         <td>
    
        	<?php echo PilotData::GetFieldValue($pilot->pilotid, 'VATSIM ID'); ?>
    
         </td>
    
    
    
         For instance, if you added a field called "IVAO Callsign":
    
    
    
        	echo PilotData::GetFieldValue($pilot->pilotid, 'IVAO Callsign');
    
       */
    
    ?>
    
    <tr>
    
      <td width="1%" nowrap><a href="<?php echo SITE_URL?>/index.php/profile/view/<?php echo $pilot->pilotid?>">
    
        	<?php echo PilotData::GetPilotCode($pilot->code, $pilot->pilotid)?></a>
    
      </td>
    
      <td>
    
         <div align="left"><img src="<?php echo Countries::getCountryImage($pilot->location);?>" 
    
        	alt="<?php echo Countries::getCountryName($pilot->location);?>" />
    <?php echo $pilot->firstname.' '.$pilot->lastname?>
        	</div></td>
      <td><div align="center"><?php echo $pilot->totalhours?></div></td>
    <td><div align="center"><?php
       If ($pilot->retired == 0)
             { echo '<img src="/images/green-status.gif" />'; }
       else
             { echo '<img src="/images/red-status.gif" />'; }
    ?></div></td>
    </div></td>
    <td><?php echo PilotData::GetFieldValue($pilot->pilotid, 'VATSIM ID'); ?></td>
    <?php
    
    }
    
    ?>
    </div>
    </tbody>
    </table>
    

    You get the idea you can edit the thing to suite your needs, this is a php file that site in my root directory so Aerosoft can validate pilot hours.All you will need to update is your path to your codon config file.

    Thanks, Mark! This worked out perfectly. All I have to do now is edit the styling of it and such.

    @itrobb For some reason your php include code didn't work and it gave me errors, but it might just be because my server doesn't support php includes.

    Either way, everything's working now. Thanks, all.

  9. Thanks for the input, guys. But, for some reason, I'm still experiencing an issue. I'd be delighted to share my code with you as long you tell me what to share and I'll post it. The issue I'm experiencing is that, upon clicking on the link that would bring me to index.php/pilots, it appears to log out the user. But once the user wishes to return to the pilot center (to file PIREPs, etc.), they don't have to log in.

    It's almost like the system claims the user isn't logged in or something when in reality, they are. Maybe I'm just missing a snippet of code or something.

    Any ideas?

  10. Thanks for the insight, Nabeel, but I don't think I fully understand what you're saying. More likely, I probably didn't explain what I'm trying to do clearly enough for you to understand.

    I like the way you have the "pages" section of the system setup. I can log into my admin center and edit them, create new ones, etc. It works perfectly. But what I'm trying to do is create a page via the admin center which can display the pilot roster. I understand that I might have to edit the page by hand via an external file editor and I am perfectly comfortable with that, I just need to determine how can I can go about implementing that code.

    Here is what I have so far:

    <p>
    <?php
    if(!$allpilots)
    {
    	echo 'There are no pilots!';
    	return;
    }
    ?>
    <table id="tabledlist" class="tablesorter">
    <thead>
    <tr>
    <th>Pilot ID</th>
    <th>Name</th>
    <th>Rank</th>
    <th>Flights</th>
    <th>Hours</th>
    </tr>
    </thead>
    <tbody>
    <?php
    foreach($allpilots as $pilot)
    {
    /* 
    	To include a custom field, use the following example:
    
    	<td>
    		<?php echo PilotData::GetFieldValue($pilot->pilotid, 'VATSIM ID'); ?>
    	</td>
    
    	For instance, if you added a field called "IVAO Callsign":
    
    		echo PilotData::GetFieldValue($pilot->pilotid, 'IVAO Callsign');		
     */
    
     // To skip a retired pilot, uncomment the next line:
     //if($pilot->retired == 1) { continue; }
    ?>
    <tr>
    <td width="1%" nowrap><a href="<?php echo url('/profile/view/'.$pilot->pilotid);?>">
    		<?php echo PilotData::GetPilotCode($pilot->code, $pilot->pilotid)?></a>
    </td>
    <td>
    	<img src="<?php echo Countries::getCountryImage($pilot->location);?>" 
    		alt="<?php echo Countries::getCountryName($pilot->location);?>" />
    
    	<?php echo $pilot->firstname.' '.$pilot->lastname?>
    </td>
    <td><img src="<?php echo $pilot->rankimage?>" alt="<?php echo $pilot->rank;?>" /></td>
    <td><?php echo $pilot->totalflights?></td>
    <td><?php echo Util::AddTime($pilot->totalhours, $pilot->transferhours); ?></td>
    <?php
    }
    ?>
    </tbody>
    </table>
    
    </p>

    The problem that I'm having is that, upon entering this code into a page, I receive the error message "There are no pilots!"

    I checked my database (just to be sure) that I had pilots registered and I do, and I also surfed the addons forms and didn't exactly find what I was looking for.

    Sorry to be a bother, but is there any other insight that you could provide me with? It would be much appreciated. Thanks in advance!

  11. Hello everyone,

    I'm trying to implement the pilot roster on a page via the admin control panel via phpVMS, but I can't figure out how to do this. The reason why I want to do this is so the roster can be displayed to the public. I tried using an iFrame, considering the whole phpVMS internal page system is made up of .htm files.

    I'm not incredibly php-savvy, but I do know some stuff. Hopefully, with some help, I'll be able to get what I need done.

    Thanks in advance,

  12. Sorry to bump this ancient topic, but was this ever resolved in a future version of phpVMS? Perhaps the current version? I'm assuming it was, but I've been hunting this particular item down all afternoon and I can't seem to find the right file & directory.

    Thanks.

×
×
  • Create New...