Language: PHP

Untitled PHP (10-Mar @ 08:36)

Syntax Highlighted Code

  1. sdfsdgdsfg

Plain Code

sdfsdgdsfg

Untitled PHP (9-Mar @ 14:09)

Syntax Highlighted Code

  1. dd

Plain Code

dd

Untitled PHP (8-Mar @ 01:00)

Syntax Highlighted Code

  1. ddssdf
  2. sd
  3. f
  4. sd
  5. sdfdsf

Plain Code

ddssdf
sd
f
sd
sdfdsf

Untitled PHP (7-Mar @ 21:39)

Syntax Highlighted Code

  1. <?
  2. ?>

Plain Code

<?
phpInfo();
?>

Untitled PHP (7-Mar @ 15:59)

Syntax Highlighted Code

  1. <?php echo 'A ver' ?>

Plain Code

<?php echo 'A ver' ?>

Untitled PHP (6-Mar @ 18:57)

Syntax Highlighted Code

  1. <?php
  2.  echo "nader";
  3. ?>

Plain Code

<?php
 echo "nader";
?>

Untitled PHP (6-Mar @ 11:04)

Syntax Highlighted Code

  1. <?
  2. echo "Hello";
  3. ?>

Plain Code

<?
echo "Hello";
?>

teste (3-Mar @ 14:49)

Syntax Highlighted Code

  1. teste

Plain Code

teste

Untitled PHP (24-Feb @ 19:22)

Syntax Highlighted Code

  1. <?
  2.   include_once '../config/config.php';
  3.   include_once $setts['themDir'] . "/_classes/membersarea/migration/accountMigrationMain.class.php";
  4.  
  5. [163 more lines...]

Plain Code

<?
  include_once '../config/config.php';
  include_once $setts['themDir'] . "/_classes/membersarea/migration/accountMigrationMain.class.php";

  $bbParserObj = new BBparser();

  function parceDetailFinal($text) {
      global $bbParserObj;
      $text = str_replace("\n", "<br>", $text);
      return $bbParserObj->BB_Parse(addSpecialChars($text),false);
  }

  function getUahAmountConverted($amount, $currency) {
      if ($currency == 'UAH') {
          return (float)$amount;
      }

      $currency = empty($currency) ? 'USD' : $currency;
      $getCurrentCurrency = getSqlRow("SELECT * FROM probid_currencies WHERE symbol = '" . $currency . "'");

      $getAllCurrencies = mysql_query("SELECT * FROM probid_currencies WHERE symbol != '" . $currency . "'");
      while($convert = mysql_fetch_array($getAllCurrencies)) {
          $converted = $amount * ($getCurrentCurrency['converter'] / $convert['converter']);
          if ($convert['symbol'] == 'UAH') {
              return (float)$converted;
          }
      }
  }

  function convertFuncCallback(&$e) {
      $e = iconv('windows-1251', 'utf-8//IGNORE', $e);
  }

  function migrationCronCriticalError($migrationID, $soapFault) {
      $faultTrace = $soapFault->getTrace();
      mysql_query("INSERT INTO probid_migration_item_error VALUES (NULL, ".(int)$migrationID.", '".mysql_real_escape_string($faultTrace[1]['function'])."', '".mysql_real_escape_string(soapExceptionFaultEncoded($soapFault->getMessage()))."', NOW())");
      mysql_query("UPDATE probid_migration_item SET state = 'error' WHERE id = ".(int)$migrationID);
  }


  // Some auction options
  $arrayDurationAuction = array( 3 => 0, 5 => 1, 7 => 2, 10 => 3, 14 => 4, 21 => 5);
  $arrayQueryMethods = array(
      'current' => 'SELECT * FROM probid_auctions AS a LEFT JOIN probid_migration_item_state AS s ON (a.id = s.auc_item_id AND a.ownerid = s.auc_user_id) WHERE s.id IS NULL AND a.ownerid = %s AND a.closed = 0 AND a.deleted != 1 AND a.active = 1'
      'closed' => 'SELECT * FROM probid_auctions_closed AS c LEFT JOIN probid_migration_item_state AS s ON (c.id = s.auc_item_id AND c.ownerid = s.auc_user_id) WHERE s.id IS NULL AND c.ownerid = %s AND c.closed = 1 AND c.deleted != 1 AND c.active = 1 AND DATE_ADD(c.enddate, INTERVAL 2 MONTH) > NOW()'
      'limit' => 100
  );

  mb_internal_encoding("UTF-8");

  $query = mysql_query("SELECT * FROM probid_migration_item WHERE state = 'work' ORDER BY id LIMIT 1");

  while ($dataApp = mysql_fetch_assoc($query)) {
      // Connect to SOAP server
      try {
          $soapClient = new SoapClient(accountMigrationMain::$soapConfig['soapURL']);
      } catch (Exception $soapFault) {
          migrationCronCriticalError($dataApp['id'], $soapFault);
          break;
      }
      // Get local version ID
      try {
          $soapSysVersion = $soapClient->doQuerySysStatus(1, accountMigrationMain::$soapConfig['countryID'], accountMigrationMain::$soapConfig['apiKey']);
      } catch (Exception $soapFault) {
          migrationCronCriticalError($dataApp['id'], $soapFault);
          break;
      }

      array_walk($dataApp, 'convertFuncCallback');
      // Try to login
      try {
          $soapUserSession = $soapClient->doLogin($dataApp['aukro_login'], $dataApp['aukro_pass'], accountMigrationMain::$soapConfig['countryID'], accountMigrationMain::$soapConfig['apiKey'], $soapSysVersion['ver-key']);
      } catch (Exception $soapFault) {
          migrationCronCriticalError($dataApp['id'], $soapFault);
          break;
      }
      // Get user personal data
      try {
          $soapUserInfo = $soapClient->doGetMyData($soapUserSession['session-handle-part']);
      } catch (Exception $soapFault) {
          migrationCronCriticalError($dataApp['id'], $soapFault);
          break;
      }
      // Prepare query
      if ($dataApp['move_current'] == 'Y' && $dataApp['move_closed'] == 'N') { // only current item's
          $queryItems = mysql_query(sprintf($arrayQueryMethods['current'], (int)$dataApp['auc_id']) . " LIMIT " . $arrayQueryMethods['limit']);
      } else if ($dataApp['move_current'] == 'N' && $dataApp['move_closed'] == 'Y') { // only closed item's
          $queryItems = mysql_query(sprintf($arrayQueryMethods['closed'], (int)$dataApp['auc_id']) . " LIMIT " . $arrayQueryMethods['limit']);
      } else if ($dataApp['move_current'] == 'Y' && $dataApp['move_closed'] == 'Y') { // all item's
          $queryItems = mysql_query("(" . sprintf($arrayQueryMethods['current'], (int)$dataApp['auc_id']) . ") UNION (" . sprintf($arrayQueryMethods['closed'], (int)$dataApp['auc_id']) . ") LIMIT " . $arrayQueryMethods['limit']);
      }
      if (mysql_num_rows($queryItems) == 0) {
          mysql_query("UPDATE probid_migration_item SET state = 'complete' WHERE id = ".(int)$dataApp['id']);
      }
      while ($dataItem = mysql_fetch_assoc($queryItems)) {
         $dataItem['description'] = parceDetailFinal($dataItem['description']);
         $dataItem['itemname'] = addSpecialChars($dataItem['itemname']);
         array_walk($dataItem, 'convertFuncCallback');
         $affectedArray = array(
             array('fid' => 1, 'fvalue-string' => mb_strcut($dataItem['itemname'], 0, 49)), // itemname
             array('fid' => 2, 'fvalue-int' => 28721), // category
             array('fid' => 4, 'fvalue-int' => array_key_exists($dataItem['duration'], $arrayDurationAuction) ? $arrayDurationAuction[$dataItem['duration']] : 1), // duration
             array('fid' => 5, 'fvalue-int' => 1), // quantity
             array('fid' => 6, 'fvalue-float' => getUahAmountConverted($dataItem['bidstart'], $dataItem['currency'])), // start bid
             array('fid' => 9, 'fvalue-int' => (int)$soapUserInfo['user-data']->{'user-country-id'}), // country
             array('fid' => 10, 'fvalue-int' => (int)$soapUserInfo['user-data']->{'user-state-id'}), // state
             array('fid' => 11, 'fvalue-string' => $soapUserInfo['user-data']->{'user-city'}), // city
             array('fid' => 12, 'fvalue-int' => $dataItem['sc'] == 'SP' ? 0 : 1), // delivery
             array('fid' => 13, 'fvalue-int' => empty($dataItem['shipping_details']) ? 1 : 16), // delivery additional
             array('fid' => 24, 'fvalue-string' => $dataItem['description']), // description
             array('fid' => 27, 'fvalue-string' => mb_strcut($dataItem['shipping_details'], 0, 450)), // shipping_details
             array('fid' => 40, 'fvalue-int' => 1) // pay method
         );

         if ($dataItem['rp'] == 'Y' && $soapUserInfo['user-data']->{'user-rating'} >=3) { // reserv price
            $affectedArray[] = array('fid' => 7, 'fvalue-float' => getUahAmountConverted($dataItem['rpvalue'], $dataItem['currency']));
         }

         if ($dataItem['bn'] == 'Y') { // buy now
            $affectedArray[] = array('fid' => 8, 'fvalue-float' => getUahAmountConverted($dataItem['bnvalue'], $dataItem['currency']));
         }

         if ($dataItem['sc'] == 'SD') { //self delivery
            $affectedArray[] = array('fid' => 35, 'fvalue-int' => 1);
         }

         // Parce image's
         $userImageArray = array_merge((array)$dataItem['picpath'], getUserImages($dataItem['ownerid'], '1 day'));

         $imageInterator = 16;
         foreach ($userImageArray as $singleImage) {
             $fileImageName = strpos($singleImage, "http://") === false ? $site_root . $singleImage : $singleImage;
             if (!empty($singleImage) && file_exists($fileImageName)) {
                 $imageCode = @file_get_contents($fileImageName);
                 if(!empty($imageCode) && $imageInterator < 22) {
                     $affectedArray[] = array('fid' => $imageInterator++, 'fvalue-image' => $imageCode);
                 }
             }
         }


         // Add obligatory field
         $obligatoryField = array('fvalue-string', 'fvalue-int', 'fvalue-float', 'fvalue-image', 'fvalue-text', 'fvalue-datetime', 'fvalue-boolean');

         foreach ($affectedArray as &$propertyArray) {
            foreach ($obligatoryField as $oblField) {
              if (array_key_exists($oblField, $propertyArray)) continue;
              $propertyArray[$oblField] = '';
            }
         }

         // Post new auction to aukro
         try {
             $postResult = $soapClient->doNewAuctionExt($soapUserSession['session-handle-part'], $affectedArray, 0, 565551486);
             mysql_query("INSERT INTO probid_migration_item_state VALUES(NULL, ".(int)$dataItem['ownerid'].", ".(int)$dataItem['id'].", ".(int)$postResult['item-id'].", 'done', NOW())");
         } catch(Exception $soapFault) {
             mysql_query("INSERT INTO probid_migration_item_state VALUES(NULL, ".(int)$dataItem['ownerid'].", ".(int)$dataItem['id'].", 0, 'error', NOW())");
             $lastStateID = mysql_insert_id();
             if ($lastStateID > 0) {
                 mysql_query("INSERT INTO probid_migration_item_state_error VALUES(NULL, ".$lastStateID.", '".mysql_real_escape_string(soapExceptionFaultEncoded($soapFault->getMessage()))."'))");
             }
         }


      }
      mysql_free_result($queryItems);
  }
?>

Untitled PHP (28-Jan @ 22:49)

Syntax Highlighted Code

  1. <?php
  2.     $x++;
  3. ?>

Plain Code

<?php
    $x++;
?>

templates/subsilver2/ucp_register.html (26-Jan @ 13:06)

desbest.myopenid.com

Syntax Highlighted Code

  1. <!-- INCLUDE overall_header.html -->
  2.  
  3. <script type="text/javascript">
  4. // <![CDATA[
  5. [114 more lines...]

Plain Code

<!-- INCLUDE overall_header.html -->

<script type="text/javascript">
// <![CDATA[
    /**
    * Change language
    */
    function change_language(lang_iso)
    {
        document.forms['register'].change_lang.value = lang_iso;
        document.forms['register'].submit.click();
    }

// ]]>
</script>

<form name="register" method="post" action="{S_UCP_ACTION}">

<table class="tablebg" width="100%" cellspacing="1">
<tr>
    <th colspan="2" valign="middle">{L_REGISTRATION}</th>
</tr>

<!-- IF ERROR -->
    <tr>
        <td class="row3" colspan="2" align="center"><span class="gensmall error">{ERROR}</span></td>
    </tr>
<!-- ENDIF -->

<!-- IF L_REG_COND -->
    <tr>
        <td class="row2" colspan="2"><span class="gensmall">{L_REG_COND}</span></td>
    </tr>
<!-- ENDIF -->
<!-- IF .profile_fields -->
    <tr>
        <td class="row2" colspan="2"><span class="gensmall">{L_ITEMS_REQUIRED}</span></td>
    </tr>
<!-- ENDIF -->
<!-- desbest edit starts -->
<tr>
    <td class="row1"><span class="gen">What is is 5+2?</span></td>
    <td class="row2">
        <input type="text" class="post" style="width: 200px" name="math_question" value="{MATH_QUESTION}"size="6" maxlength="6" value="" />
    </td>
</tr>
<!-- desbest edit ends -->
<tr>
    <td class="row1" width="38%"><b class="genmed">{L_USERNAME}: </b><br /><span class="gensmall">{L_USERNAME_EXPLAIN}</span></td>
    <td class="row2"><input class="post" type="text" name="username" size="25" value="{USERNAME}" /></td>
</tr>
<tr>
    <td class="row1"><b class="genmed">{L_EMAIL_ADDRESS}: </b></td>
    <td class="row2"><input class="post" type="text" name="email" size="25" maxlength="100" value="{EMAIL}" /></td>
</tr>
<tr>
    <td class="row1"><b class="genmed">{L_CONFIRM_EMAIL}: </b></td>
    <td class="row2"><input class="post" type="text" name="email_confirm" size="25" maxlength="100" value="{EMAIL_CONFIRM}" /></td>
</tr>
<tr>
    <td class="row1"><b class="genmed">{L_PASSWORD}: </b><br /><span class="gensmall">{L_PASSWORD_EXPLAIN}</span></td>
    <td class="row2"><input class="post" type="password" name="new_password" size="25" value="{PASSWORD}" /></td>
</tr>
<tr>
    <td class="row1"><b class="genmed">{L_CONFIRM_PASSWORD}: </b></td>
    <td class="row2"><input class="post" type="password" name="password_confirm" size="25" value="{PASSWORD_CONFIRM}" /></td>
</tr>
<tr>
    <td class="row1"><b class="genmed">{L_LANGUAGE}: </b></td>
    <td class="row2"><select name="lang" onchange="change_language(this.value); return false;">{S_LANG_OPTIONS}</select></td>
</tr>
<tr>
    <td class="row1"><b class="genmed">{L_TIMEZONE}: </b></td>
    <td class="row2"><select name="tz">{S_TZ_OPTIONS}</select></td>
</tr>
<!-- BEGIN profile_fields -->
    <tr>
        <td class="row1" width="35%">
            <b class="genmed">{profile_fields.LANG_NAME}: </b>
            <!-- IF profile_fields.S_REQUIRED --><b>*</b><!-- ENDIF -->
            <!-- IF profile_fields.LANG_EXPLAIN --><br /><span class="gensmall">{profile_fields.LANG_EXPLAIN}</span><!-- ENDIF -->
        </td>
        <td class="row2">{profile_fields.FIELD}<!-- IF profile_fields.ERROR --><br /><span class="gensmall error">{profile_fields.ERROR}</span><!-- ENDIF --></td>
    </tr>
<!-- END profile_fields -->

<!-- IF S_CONFIRM_CODE -->
    <tr>
        <th colspan="2" valign="middle">{L_CONFIRMATION}</th>
    </tr>
    <tr>
        <td class="row3" colspan="2"><span class="gensmall">{L_CONFIRM_EXPLAIN}</span></td>
    </tr>
    <tr>
        <td class="row1" colspan="2" align="center">{CONFIRM_IMG}</td>
    </tr>
    <tr>
        <td class="row1"><b class="genmed">{L_CONFIRM_CODE}: </b><br /><span class="gensmall">{L_CONFIRM_CODE_EXPLAIN}</span></td>
        <td class="row2"><input class="post" type="text" name="confirm_code" size="8" maxlength="8" /></td>
    </tr>
<!-- ENDIF -->

<!-- IF S_COPPA -->
    <tr>
        <th colspan="2" valign="middle">{L_COPPA_COMPLIANCE}</th>
    </tr>
    <tr>
        <td class="row3" colspan="2"><span class="gensmall">{L_COPPA_EXPLAIN}</span></td>
    </tr>
<!-- ENDIF -->

<tr>
    <td class="cat" colspan="2" align="center">{S_HIDDEN_FIELDS}<input class="btnmain" type="submit" name="submit" id="submit" value="{L_SUBMIT}" />  <input class="btnlite" type="reset" value="{L_RESET}" name="reset" /></td>
</tr>
</table>
{S_FORM_TOKEN}
</form>

<!-- INCLUDE overall_footer.html -->

includes/ucp/ucp_register.php (26-Jan @ 13:04)

desbest.myopenid.com

Syntax Highlighted Code

  1. <?php
  2. /**
  3. *
  4. * @package ucp
  5. [575 more lines...]

Plain Code

<?php
/**
*
* @package ucp
* @version $Id: ucp_register.php 8782 2008-08-23 17:20:55Z acydburn $
* @copyright (c) 2005 phpBB Group
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/

/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
    exit;
}

/**
* ucp_register
* Board registration
* @package ucp
*/
class ucp_register
{
    var $u_action;

    function main($id, $mode)
    {
        global $config, $db, $user, $auth, $template, $phpbb_root_path, $phpEx;

        //
        if ($config['require_activation'] == USER_ACTIVATION_DISABLE)
        {
            trigger_error('UCP_REGISTER_DISABLE');
        }

        include($phpbb_root_path . 'includes/functions_profile_fields.' . $phpEx);

        $confirm_id        = request_var('confirm_id', '');
        $coppa            = (isset($_REQUEST['coppa'])) ? ((!empty($_REQUEST['coppa'])) ? 1 : 0) : false;
        $agreed            = (!empty($_POST['agreed'])) ? 1 : 0;
        $submit            = (isset($_POST['submit'])) ? true : false;
        $change_lang    = request_var('change_lang', '');
        $user_lang        = request_var('lang', $user->lang_name);

        if ($agreed)
        {
            add_form_key('ucp_register');
        }
        else
        {
            add_form_key('ucp_register_terms');
        }


        if ($change_lang || $user_lang != $config['default_lang'])
        {
            $use_lang = ($change_lang) ? basename($change_lang) : basename($user_lang);

            if (file_exists($user->lang_path . $use_lang . '/'))
            {
                if ($change_lang)
                {
                    $submit = false;

                    // Setting back agreed to let the user view the agreement in his/her language
                    $agreed = (empty($_GET['change_lang'])) ? 0 : $agreed;
                }

                $user->lang_name = $lang = $use_lang;
                $user->lang = array();
                $user->add_lang(array('common', 'ucp'));
            }
            else
            {
                $change_lang = '';
                $user_lang = $user->lang_name;
            }
        }

        $cp = new custom_profile();

        $error = $cp_data = $cp_error = array();


        if (!$agreed || ($coppa === false && $config['coppa_enable']) || ($coppa && !$config['coppa_enable']))
        {
            $add_lang = ($change_lang) ? '&change_lang=' . urlencode($change_lang) : '';
            $add_coppa = ($coppa !== false) ? '&coppa=' . $coppa : '';

            $s_hidden_fields = ($confirm_id) ? array('confirm_id' => $confirm_id) : array();

            // If we change the language, we want to pass on some more possible parameter.
            if ($change_lang)
            {
                // We do not include the password
                $s_hidden_fields = array_merge($s_hidden_fields, array(
                    'username'            => utf8_normalize_nfc(request_var('username', '', true)),
                    'email'                => strtolower(request_var('email', '')),
                    'email_confirm'        => strtolower(request_var('email_confirm', '')),
                    'confirm_code'        => request_var('confirm_code', ''),
                    'confirm_id'        => request_var('confirm_id', ''),
                    'lang'                => $user->lang_name,
                    'tz'                => request_var('tz', (float) $config['board_timezone']),
                ));
            }

            if ($coppa === false && $config['coppa_enable'])
            {
                $now = getdate();
                $coppa_birthday = $user->format_date(mktime($now['hours'] + $user->data['user_dst'], $now['minutes'], $now['seconds'], $now['mon'], $now['mday'] - 1, $now['year'] - 13), $user->lang['DATE_FORMAT']);
                unset($now);

                $template->assign_vars(array(
                    'L_COPPA_NO'        => sprintf($user->lang['UCP_COPPA_BEFORE'], $coppa_birthday),
                    'L_COPPA_YES'        => sprintf($user->lang['UCP_COPPA_ON_AFTER'], $coppa_birthday),

                    'U_COPPA_NO'        => append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=register&coppa=0' . $add_lang),
                    'U_COPPA_YES'        => append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=register&coppa=1' . $add_lang),

                    'S_SHOW_COPPA'        => true,
                    'S_HIDDEN_FIELDS'    => build_hidden_fields($s_hidden_fields),
                    'S_UCP_ACTION'        => append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=register' . $add_lang),
                ));
            }
            else
            {
                $template->assign_vars(array(
                    'L_TERMS_OF_USE'    => sprintf($user->lang['TERMS_OF_USE_CONTENT'], $config['sitename'], generate_board_url()),

                    'S_SHOW_COPPA'        => false,
                    'S_REGISTRATION'    => true,
                    'S_HIDDEN_FIELDS'    => build_hidden_fields($s_hidden_fields),
                    'S_UCP_ACTION'        => append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=register' . $add_lang . $add_coppa),
                    )
                );
            }

            $this->tpl_name = 'ucp_agreement';
            return;
        }


        // Try to manually determine the timezone and adjust the dst if the server date/time complies with the default setting +/- 1
        $timezone = date('Z') / 3600;
        $is_dst = date('I');

        if ($config['board_timezone'] == $timezone || $config['board_timezone'] == ($timezone - 1))
        {
            $timezone = ($is_dst) ? $timezone - 1 : $timezone;

            if (!isset($user->lang['tz_zones'][(string) $timezone]))
            {
                $timezone = $config['board_timezone'];
            }
        }
        else
        {
            $is_dst = $config['board_dst'];
            $timezone = $config['board_timezone'];
        }

        //desbest edit: (look for math_question as that is the added edit)
        $data = array(
            'username'            => utf8_normalize_nfc(request_var('username', '', true)),
            'math_question'            => request_var('math_question', '', true),
            'new_password'        => request_var('new_password', '', true),
            'password_confirm'    => request_var('password_confirm', '', true),
            'email'                => strtolower(request_var('email', '')),
            'email_confirm'        => strtolower(request_var('email_confirm', '')),
            'confirm_code'        => request_var('confirm_code', ''),
            'lang'                => basename(request_var('lang', $user->lang_name)),
            'tz'                => request_var('tz', (float) $timezone),
        );

        // Check and initialize some variables if needed
        if ($submit)
        {
            $error = validate_data($data, array(
                'username'            => array(
                    array('string', false, $config['min_name_chars'], $config['max_name_chars']),
                    array('username', '')),
                'new_password'        => array(
                    array('string', false, $config['min_pass_chars'], $config['max_pass_chars']),
                    array('password')),
                'password_confirm'    => array('string', false, $config['min_pass_chars'], $config['max_pass_chars']),
                'email'                => array(
                    array('string', false, 6, 60),
                    array('email')),
                'email_confirm'        => array('string', false, 6, 60),
                'confirm_code'        => array('string', !$config['enable_confirm'], 5, 8),
                'tz'                => array('num', false, -14, 14),
                'lang'                => array('match', false, '#^[a-z_\-]{2,}$#i'),
            ));
            if (!check_form_key('ucp_register'))
            {
                $error[] = $user->lang['FORM_INVALID'];
            }
            
            //desbest edit starts
            if ($data['math_question'] != "7")
            {
                $error[] = "You silly spambot failed to get the question right";
                //echo "<h1>".$data['math_question']."question is wrong</h1>";
                //$error[] = $user->lang['MATH_QUESTION_ERROR'];
            }
            //desbest edit ends

            // Replace "error" strings with their real, localised form
            $error = preg_replace('#^([A-Z_]+)$#e', "(!empty(\$user->lang['\\1'])) ? \$user->lang['\\1'] : '\\1'", $error);

            // DNSBL check
            if ($config['check_dnsbl'])
            {
                if (($dnsbl = $user->check_dnsbl('register')) !== false)
                {
                    $error[] = sprintf($user->lang['IP_BLACKLISTED'], $user->ip, $dnsbl[1]);
                }
            }

            // validate custom profile fields
            $cp->submit_cp_field('register', $user->get_iso_lang_id(), $cp_data, $error);
            
            
            }
            

            //desbest edit: validation begins
            // Visual Confirmation handling
            $wrong_confirm = false;
            if ($config['enable_confirm'])
            {
                if (!$confirm_id)
                {
                    $error[] = $user->lang['CONFIRM_CODE_WRONG'];
                    $wrong_confirm = true;
                }
                else
                {
                    $sql = 'SELECT code
                        FROM ' . CONFIRM_TABLE . "
                        WHERE confirm_id = '" . $db->sql_escape($confirm_id) . "'
                            AND session_id = '" . $db->sql_escape($user->session_id) . "'
                            AND confirm_type = " . CONFIRM_REG;
                    $result = $db->sql_query($sql);
                    $row = $db->sql_fetchrow($result);
                    $db->sql_freeresult($result);

                    if ($row)
                    {
                        if (strcasecmp($row['code'], $data['confirm_code']) === 0)
                        {
                            $sql = 'DELETE FROM ' . CONFIRM_TABLE . "
                                WHERE confirm_id = '" . $db->sql_escape($confirm_id) . "'
                                    AND session_id = '" . $db->sql_escape($user->session_id) . "'
                                    AND confirm_type = " . CONFIRM_REG;
                            $db->sql_query($sql);
                        }
                        else
                        {
                            $error[] = $user->lang['CONFIRM_CODE_WRONG'];
                            $wrong_confirm = true;
                        }
                    }
                    else
                    {
                        $error[] = $user->lang['CONFIRM_CODE_WRONG'];
                        $wrong_confirm = true;
                    }
                }
            }
                //desbest edit
                //$damath = $user->lang['MATH_QUESTION_ERROR']; /* print_r($user->lang); */ exit();
                
                
                                                
            if (!sizeof($error))
            {
                if ($data['new_password'] != $data['password_confirm'])
                {
                    $error[] = $user->lang['NEW_PASSWORD_ERROR'];
                }

                if ($data['email'] != $data['email_confirm'])
                {
                    $error[] = $user->lang['NEW_EMAIL_ERROR'];
                }
            
            
            


            if (!sizeof($error))
            {
                $server_url = generate_board_url();

                // Which group by default?
                $group_name = ($coppa) ? 'REGISTERED_COPPA' : 'REGISTERED';

                $sql = 'SELECT group_id
                    FROM ' . GROUPS_TABLE . "
                    WHERE group_name = '" . $db->sql_escape($group_name) . "'
                        AND group_type = " . GROUP_SPECIAL;
                $result = $db->sql_query($sql);
                $row = $db->sql_fetchrow($result);
                $db->sql_freeresult($result);

                if (!$row)
                {
                    trigger_error('NO_GROUP');
                }

                $group_id = $row['group_id'];

                if (($coppa ||
                    $config['require_activation'] == USER_ACTIVATION_SELF ||
                    $config['require_activation'] == USER_ACTIVATION_ADMIN) && $config['email_enable'])
                {
                    $user_actkey = gen_rand_string(10);
                    $key_len = 54 - (strlen($server_url));
                    $key_len = ($key_len < 6) ? 6 : $key_len;
                    $user_actkey = substr($user_actkey, 0, $key_len);

                    $user_type = USER_INACTIVE;
                    $user_inactive_reason = INACTIVE_REGISTER;
                    $user_inactive_time = time();
                }
                else
                {
                    $user_type = USER_NORMAL;
                    $user_actkey = '';
                    $user_inactive_reason = 0;
                    $user_inactive_time = 0;
                }

                $user_row = array(
                    'username'                => $data['username'],
                    'user_password'            => phpbb_hash($data['new_password']),
                    'user_email'            => $data['email'],
                    'group_id'                => (int) $group_id,
                    'user_timezone'            => (float) $data['tz'],
                    'user_dst'                => $is_dst,
                    'user_lang'                => $data['lang'],
                    'user_type'                => $user_type,
                    'user_actkey'            => $user_actkey,
                    'user_ip'                => $user->ip,
                    'user_regdate'            => time(),
                    'user_inactive_reason'    => $user_inactive_reason,
                    'user_inactive_time'    => $user_inactive_time,
                );

                // Register user...
                $user_id = user_add($user_row, $cp_data);

                // This should not happen, because the required variables are listed above...
                if ($user_id === false)
                {
                    trigger_error('NO_USER', E_USER_ERROR);
                }

                if ($coppa && $config['email_enable'])
                {
                    $message = $user->lang['ACCOUNT_COPPA'];
                    $email_template = 'coppa_welcome_inactive';
                }
                else if ($config['require_activation'] == USER_ACTIVATION_SELF && $config['email_enable'])
                {
                    $message = $user->lang['ACCOUNT_INACTIVE'];
                    $email_template = 'user_welcome_inactive';
                }
                else if ($config['require_activation'] == USER_ACTIVATION_ADMIN && $config['email_enable'])
                {
                    $message = $user->lang['ACCOUNT_INACTIVE_ADMIN'];
                    $email_template = 'admin_welcome_inactive';
                }
                else
                {
                    $message = $user->lang['ACCOUNT_ADDED'];
                    $email_template = 'user_welcome';
                }

                if ($config['email_enable'])
                {
                    include_once($phpbb_root_path . 'includes/functions_messenger.' . $phpEx);

                    $messenger = new messenger(false);

                    $messenger->template($email_template, $data['lang']);

                    $messenger->to($data['email'], $data['username']);

                    $messenger->headers('X-AntiAbuse: Board servername - ' . $config['server_name']);
                    $messenger->headers('X-AntiAbuse: User_id - ' . $user->data['user_id']);
                    $messenger->headers('X-AntiAbuse: Username - ' . $user->data['username']);
                    $messenger->headers('X-AntiAbuse: User IP - ' . $user->ip);

                    $messenger->assign_vars(array(
                        'WELCOME_MSG'    => htmlspecialchars_decode(sprintf($user->lang['WELCOME_SUBJECT'], $config['sitename'])),
                        'USERNAME'        => htmlspecialchars_decode($data['username']),
                        'PASSWORD'        => htmlspecialchars_decode($data['new_password']),
                        'U_ACTIVATE'    => "$server_url/ucp.$phpEx?mode=activate&u=$user_id&k=$user_actkey")
                    );

                    if ($coppa)
                    {
                        $messenger->assign_vars(array(
                            'FAX_INFO'        => $config['coppa_fax'],
                            'MAIL_INFO'        => $config['coppa_mail'],
                            'EMAIL_ADDRESS'    => $data['email'])
                        );
                    }

                    $messenger->send(NOTIFY_EMAIL);

                    if ($config['require_activation'] == USER_ACTIVATION_ADMIN)
                    {
                        // Grab an array of user_id's with a_user permissions ... these users can activate a user
                        $admin_ary = $auth->acl_get_list(false, 'a_user', false);
                        $admin_ary = (!empty($admin_ary[0]['a_user'])) ? $admin_ary[0]['a_user'] : array();

                        // Also include founders
                        $where_sql = ' WHERE user_type = ' . USER_FOUNDER;

                        if (sizeof($admin_ary))
                        {
                            $where_sql .= ' OR ' . $db->sql_in_set('user_id', $admin_ary);
                        }

                        $sql = 'SELECT user_id, username, user_email, user_lang, user_jabber, user_notify_type
                            FROM ' . USERS_TABLE . ' ' .
                            $where_sql;
                        $result = $db->sql_query($sql);

                        while ($row = $db->sql_fetchrow($result))
                        {
                            $messenger->template('admin_activate', $row['user_lang']);
                            $messenger->to($row['user_email'], $row['username']);
                            $messenger->im($row['user_jabber'], $row['username']);

                            $messenger->assign_vars(array(
                                'USERNAME'            => htmlspecialchars_decode($data['username']),
                                'U_USER_DETAILS'    => "$server_url/memberlist.$phpEx?mode=viewprofile&u=$user_id",
                                'U_ACTIVATE'        => "$server_url/ucp.$phpEx?mode=activate&u=$user_id&k=$user_actkey")
                            );

                            $messenger->send($row['user_notify_type']);
                        }
                        $db->sql_freeresult($result);
                    }
                }

                $message = $message . '<br /><br />' . sprintf($user->lang['RETURN_INDEX'], '<a href="' . append_sid("{$phpbb_root_path}index.$phpEx") . '">', '</a>');
                trigger_error($message);
            }
        }

        $s_hidden_fields = array(
            'agreed'        => 'true',
            'change_lang'    => 0,
        );

        if ($config['coppa_enable'])
        {
            $s_hidden_fields['coppa'] = $coppa;
        }
        $s_hidden_fields = build_hidden_fields($s_hidden_fields);

        $confirm_image = '';

        // Visual Confirmation - Show images

        if ($config['enable_confirm'])
        {
            if ($change_lang)
            {
                $str = '&change_lang=' . $change_lang;
                $sql = 'SELECT code
                        FROM ' . CONFIRM_TABLE . "
                        WHERE confirm_id = '" . $db->sql_escape($confirm_id) . "'
                            AND session_id = '" . $db->sql_escape($user->session_id) . "'
                            AND confirm_type = " . CONFIRM_REG;
                $result = $db->sql_query($sql);
                if (!$row = $db->sql_fetchrow($result))
                {
                    $confirm_id = '';
                }
                $db->sql_freeresult($result);
            }
            else
            {
                $str = '';
            }
            if (!$change_lang || !$confirm_id)
            {
                $user->confirm_gc(CONFIRM_REG);

                $sql = 'SELECT COUNT(session_id) AS attempts
                    FROM ' . CONFIRM_TABLE . "
                    WHERE session_id = '" . $db->sql_escape($user->session_id) . "'
                        AND confirm_type = " . CONFIRM_REG;
                $result = $db->sql_query($sql);
                $attempts = (int) $db->sql_fetchfield('attempts');
                $db->sql_freeresult($result);

                if ($config['max_reg_attempts'] && $attempts > $config['max_reg_attempts'])
                {
                    trigger_error('TOO_MANY_REGISTERS');
                }

                $code = gen_rand_string(mt_rand(5, 8));
                $confirm_id = md5(unique_id($user->ip));
                $seed = hexdec(substr(unique_id(), 4, 10));

                // compute $seed % 0x7fffffff
                $seed -= 0x7fffffff * floor($seed / 0x7fffffff);

                $sql = 'INSERT INTO ' . CONFIRM_TABLE . ' ' . $db->sql_build_array('INSERT', array(
                    'confirm_id'    => (string) $confirm_id,
                    'session_id'    => (string) $user->session_id,
                    'confirm_type'    => (int) CONFIRM_REG,
                    'code'            => (string) $code,
                    'seed'            => (int) $seed)
                );
                $db->sql_query($sql);
            }
            $confirm_image = '<img src="' . append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=confirm&id=' . $confirm_id . '&type=' . CONFIRM_REG . $str) . '" alt="" title="" />';
            $s_hidden_fields .= '<input type="hidden" name="confirm_id" value="' . $confirm_id . '" />';
        }

        //
        $l_reg_cond = '';
        switch ($config['require_activation'])
        {
            case USER_ACTIVATION_SELF:
                $l_reg_cond = $user->lang['UCP_EMAIL_ACTIVATE'];
            break;

            case USER_ACTIVATION_ADMIN:
                $l_reg_cond = $user->lang['UCP_ADMIN_ACTIVATE'];
            break;
        }

        $template->assign_vars(array(
            'ERROR'                => (sizeof($error)) ? implode('<br />', $error) : '',
            'USERNAME'            => $data['username'],
            'PASSWORD'            => $data['new_password'],
            'MATH_QUESTION'            => $data['math_question'],
            'PASSWORD_CONFIRM'    => $data['password_confirm'],
            'EMAIL'                => $data['email'],
            'EMAIL_CONFIRM'        => $data['email_confirm'],
            'CONFIRM_IMG'        => $confirm_image,

            'L_CONFIRM_EXPLAIN'            => sprintf($user->lang['CONFIRM_EXPLAIN'], '<a href="mailto:' . htmlspecialchars($config['board_contact']) . '">', '</a>'),
            'L_REG_COND'                => $l_reg_cond,
            'L_USERNAME_EXPLAIN'        => sprintf($user->lang[$config['allow_name_chars'] . '_EXPLAIN'], $config['min_name_chars'], $config['max_name_chars']),
            'L_PASSWORD_EXPLAIN'        => sprintf($user->lang[$config['pass_complex'] . '_EXPLAIN'], $config['min_pass_chars'], $config['max_pass_chars']),

            'S_LANG_OPTIONS'    => language_select($data['lang']),
            'S_TZ_OPTIONS'        => tz_select($data['tz']),
            'S_CONFIRM_CODE'    => ($config['enable_confirm']) ? true : false,
            'S_COPPA'            => $coppa,
            'S_HIDDEN_FIELDS'    => $s_hidden_fields,
            'S_UCP_ACTION'        => append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=register'),
            )
        );

        //
        $user->profile_fields = array();

        // Generate profile fields -> Template Block Variable profile_fields
        $cp->generate_profile_fields('register', $user->get_iso_lang_id());

        //
        $this->tpl_name = 'ucp_register';
        $this->page_title = 'UCP_REGISTRATION';
    }
}

?>

soundcloud.php debug (15-Jan @ 22:32)

desbest.myopenid.com

Syntax Highlighted Code

  1. <?php
  2. /**
  3.  * API Wrapper for SoundCloud written in PHP with support for authication using OAuth.
  4.  *
  5. [187 more lines...]

Plain Code

<?php
/**
 * API Wrapper for SoundCloud written in PHP with support for authication using OAuth.
 *
 * @author Anton Lindqvist <anton@qvister.se>
 * @version 1.1
 * @link http://github.com/mptre/php-soundcloud/
 */
        // desbest edit. uncomment the lines below 
        //if the api fails to generate a token
        //one line at a time. working DoWnWaRdS
        //echo "$consumer_key<br> $consumer_secret,<br>  "; 
//        echo "$oauth_token <br> $oauth_token_secret"; 
        //exit();
        //
        
class Soundcloud {
    const VERSION = '1.1';
    const URL_API = 'http://api.soundcloud.com/';
    const URL_OAUTH = 'http://api.soundcloud.com/oauth/';

    function __construct($consumer_key, $consumer_secret, $oauth_token = NULL, $oauth_token_secret = NULL) {
        $this->sha1_method = new OAuthSignatureMethod_HMAC_SHA1() or die ("could not sha1 method");
        $this->consumer = new OAuthConsumer($consumer_key, $consumer_secret)or die ("could not make a consumer");

        if (!empty($oauth_token) && !empty($oauth_token_secret)) {
            $this->token = new OAuthConsumer($oauth_token, $oauth_token_secret);
        } else {
            echo "<span style=\"background-color: yellow;\">This yellow section is coming from soundcloud.php
            <br>A token could not be generated.
            <br>$oauth_token and $oauth_token_secret
            </span><hr>";
            $this->token = NULL;
        }
    }

    function get_authorize_url($token) {
        if (is_array($token)) {
            $token = $token['oauth_token'];
        }

        return $this->_get_url('authorize') . sprintf('?oauth_token=%s', $token);
    }

    function get_request_token($oauth_callback) {
        $request = $this->request(
            $this->_get_url('request'),
            'POST',
            array('oauth_callback' => $oauth_callback)
        );
        $token = $this->_parse_response($request);

        $this->token = new OAuthConsumer(
            $token['oauth_token'],
            $token['oauth_token_secret']
        );

        return $token;
    }

    function get_access_token($token) {
        $response = $this->request(
            $this->_get_url('access'),
            'POST',
            array('oauth_verifier' => $token)
        );
        $token = $this->_parse_response($response);
        $this->token = new OAuthConsumer(
            $token['oauth_token'],
            $token['oauth_token_secret']
        );

        return $token;
    }

    function request($resource, $method = 'GET', $args = array(), $headers = NULL) {
        if (!preg_match('/http:\/\//', $resource)) {
            $url = self::URL_API . $resource;
        } else {
            $url = $resource;
        }

        if (stristr($headers['Content-Type'], 'multipart/form-data')) {
            $body = FALSE;
        } elseif (stristr($headers['Content-Type'], 'application/xml')) {
            $body = FALSE;
        } else {
            $body = TRUE;
        }

        $request = OAuthRequest::from_consumer_and_token(
            $this->consumer,
            $this->token,
            $method,
            $url,
            ($body === TRUE) ? $args : NULL
        );
        $request->sign_request($this->sha1_method, $this->consumer, $this->token);

        return $this->_curl(
            $request->get_normalized_http_url(),
            $request,
            $args,
            $headers
        );
    }

    private function _build_header($headers) {
        $h = array();

        if (count($headers) > 0) {
            foreach ($headers as $key => $val) {
                $h[] = $key . ': ' . $val;
            }

            return $h;
        } else {
            return $headers;
        }
    }

    private function _curl($url, $request, $post_data = NULL, $headers = NULL) {
        $ch = curl_init();
        $mime = (stristr($headers['Content-Type'], 'multipart/form-data')) ? TRUE : FALSE;
        $headers['User-Agent'] = (isset($headers['User-Agent']))
            ? $headers['User-Agent']
            : 'PHP SoundCloud/' . self::VERSION;
        $headers = (is_array($headers)) ? $this->_build_header($headers) : array();
        $options = array(
            CURLOPT_URL => $url,
            CURLOPT_HEADER => FALSE,
            CURLOPT_RETURNTRANSFER => TRUE
        );

        if (in_array($request->get_normalized_http_method(), array('DELETE', 'PUT'))) {
            $options[CURLOPT_CUSTOMREQUEST] = $request->get_normalized_http_method();
            $options[CURLOPT_POSTFIELDS] = '';
        }

        if (is_array($post_data) && count($post_data) > 0 || $mime === TRUE) {
            $options[CURLOPT_POSTFIELDS] = (is_array($post_data) && count($post_data) == 1)
                ? ((isset($post_data[0])) ? $post_data[0] : $post_data)
                : $post_data;
            $options[CURLOPT_POST] = TRUE;
        }

        $headers[] = $request->to_header();
        $options[CURLOPT_HTTPHEADER] = $headers;

        curl_setopt_array($ch, $options);

        $response = curl_exec($ch);
        $this->http_status = curl_getinfo($ch, CURLINFO_HTTP_CODE);

        curl_close($ch);

        return $response;
    }

    private function _get_url($type) {
        switch ($type) {
            case 'access':
                $method = 'access_token';
                break;
            case 'authorize':
                $method = 'authorize';
                break;
            case 'request':
                $method = 'request_token';
                break;
        }

        return self::URL_OAUTH . $method;
    }

    private function _parse_response($response) {
        $return = array();
        $response = explode('&', $response);

        foreach ($response as $r) {
            if (strstr($r, '=')) {
                list($key, $val) = explode('=', $r);

                if (!empty($key) && !empty($val)) {
                    $return[urldecode($key)] = urldecode($val);
                }
            }
        }

        return (count($return) > 0) ? $return : FALSE;
    }
}

Untitled PHP (13-Jan @ 20:38)

Syntax Highlighted Code

  1. <?php
  2.  
  3. for ($i = 0; $i <= 10; $i++){
  4. [4 more lines...]

Plain Code

<?php
session_start();

for ($i = 0; $i <= 10; $i++){
     echo "Bonjour numero $i";
}

session_destroy();
?>

Fresherplay Soundcloud Authentication (import.php) (13-Jan @ 18:43)

desbest.myopenid.com

Syntax Highlighted Code

  1. <?php
  2. require_once 'oauth.php';
  3. require_once 'soundcloud.php';
  4. [336 more lines...]

Plain Code

<?php
error_reporting(E_ALL);
require_once 'oauth.php';
require_once 'soundcloud.php';

session_start();

// Clear the session i.e delete all stored tokens.
if (isset($_GET['logout'])) {
    session_destroy();
}

// Change these four variables, note the that temporary path must be writable by the server.
$consumer_key = '6Sg4X3oTeaq5U6qJGJehw';
$consumer_secret = '6JBq9Qz2UHBMfSWS26tYx7jP6YUlW6DZqQxSMXENc2c';
$callback_url = 'http://fresherplay.tk/';
$tmp_path = 'temp/';

// Variables used for verifying the status of the "OAuth dance".
$oauth_token = (isset($_GET['oauth_verifier']))
    ? $_GET['oauth_verifier']
    : ((isset($_SESSION['oauth_access_token'])) ? $_SESSION['oauth_access_token'] : NULL);
$oauth_request_token = (isset($_SESSION['oauth_request_token']))
    ? $_SESSION['oauth_request_token']
    : NULL;
$oauth_request_token_secret = (isset($_SESSION['oauth_request_token_secret']))
    ? $_SESSION['oauth_request_token_secret']
    : NULL;

if (isset($oauth_token) && isset($oauth_request_token) && isset($oauth_request_token_secret)) {
    // Retreive access tokens if missing.
    if (!isset($_SESSION['oauth_access_token']) && !isset($_SESSION['oauth_access_token_secret'])) {
        $soundcloud = new Soundcloud(
            $consumer_key,
            $consumer_secret,
            $_SESSION['oauth_request_token'],
            $_SESSION['oauth_request_token_secret']
        );
        $token = $soundcloud->get_access_token($oauth_token);
        $_SESSION['oauth_access_token'] = $token['oauth_token'];
        $_SESSION['oauth_access_token_secret'] = $token['oauth_token_secret'];
    }

    // Construct a fully authicated connection with SoundCloud.
    $soundcloud = new Soundcloud(
        $consumer_key,
        $consumer_secret,
        $_SESSION['oauth_access_token'],
        $_SESSION['oauth_access_token_secret']
    );

    // Get basic info about the authicated visitor.
    $me = $soundcloud->request('me');
    $me = new SimpleXMLElement($me);
    $me = get_object_vars($me);
    $mytracks = $soundcloud->request('me/tracks/');
    $mytracks = new SimpleXMLElement($mytracks);
    $mytracks = get_object_vars($mytracks);
    $x1 = $soundcloud->request('me/tracks/');
    $x1 = new SimpleXMLElement($x1);
    $x2 = $soundcloud->request('me/tracks/');
    $x2 = new SimpleXMLElement($x2);

    // If a track is submitted.
    if (isset($_POST['submit'])) {
        // We have to make sure it's a valid and supported format by SoundCloud.
        // Note that you also can include artwork for your tracks. Use the same
        // procedure as for the tracks. PNG, JPG, GIF allowed and a max size of 5MB.
        // The artwork field is called track[artwork_data].
        $mimes = array(
            'aac' => 'video/mp4',
            'aiff' => 'audio/x-aiff',
            'flac' => 'audio/flac',
            'mp3' => 'audio/mpeg',
            'ogg' => 'audio/ogg',
            'wav' => 'audio/x-wav'
        );
        $extension = explode('.', $_FILES['file']['name']);
        $extension = (isset($extension[count($extension) - 1]))
            ? $extension[count($extension) - 1]
            : NULL;
        $mime = (isset($mimes[$extension])) ? $mimes[$extension] : NULL;

        if (isset($mime)) {
            $tmp_file = $tmp_path . $_FILES['file']['name'];

            // Store the track temporary.
            if (move_uploaded_file($_FILES['file']['tmp_name'], $tmp_file)) {
                $post_data = array(
                    'track[title]' => stripslashes($_POST['title']),
                    'track[asset_data]' => realpath($tmp_file),
                    'track[sharing]' => 'private'
                );

                if ($response = $soundcloud->upload_track($post_data, $mime)) {
                    $response = new SimpleXMLElement($response);
                    $response = get_object_vars($response);
                    $message = 'Success! <a href="' . $response['permalink-url'] . '">Your track</a> has been uploaded!';

                    // Delete the temporary file.
                    unlink(realpath($tmp_file));
                } else {
                    $message = 'Something went wrong while talking to SoundCloud, please try again.';
                }
            } else {
                $message = 'Couldn\'t move file, make sure the temporary path is writable by the server.';
            }
        } else {
            $message = 'SoundCloud support .mp3, .aiff, .wav, .flac, .aac, and .ogg files. Please select a different file.';
        }
    }
} else {
    // This is the first step in the "OAuth dance" where we ask the visitior to authicate himself.
    $soundcloud = new Soundcloud($consumer_key, $consumer_secret);
    $token = $soundcloud->get_request_token($callback_url) 
       or die ("    <h1>Could not connect to soundcloud via the api</h1>    <br>Email fresherplay about this error     <br>Use the back button to go back")
       ;

    $_SESSION['oauth_request_token'] = $token['oauth_token'];
    $_SESSION['oauth_request_token_secret'] = $token['oauth_token_secret'];

    $login = $soundcloud->get_authorize_url($token['oauth_token']);
}
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Fresherplay</title>

<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="ui-core.js"></script>
<script type="text/javascript" src="flash.js"></script>
<script type="text/javascript" src="localscroll.js"></script>
<script type="text/javascript" src="hide.js"></script>
<script type='text/javascript' src='swfobject.js'></script>

<SCRIPT LANGUAGE="JavaScript">
<!-- Idea by:  Nic Wolfe -->
<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! http://javascript.internet.com -->

<!-- Begin
function popUp(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=528,height=158');");
}
// End -->
</script>


<script type="text/javascript">

// Array variable to hold a list of all player IDs on the page
var mediaPlayer = ['s1', 's2', 's3', 's4'];

// Add a listener to trigger function stopOtherPlayers whenever an item is played
function playerReady(obj) {
document.getElementById(obj.id).addControllerListener('ITEM', 'stopOtherPlayers');
}

// Loop through all player IDs and, unless the player ID is the currently selected player ID, tell them to stop
function stopOtherPlayers(obj) {
for ( var id in mediaPlayer ) {
if ( obj.id != mediaPlayer[id] ) document.getElementById(mediaPlayer[id]).sendEvent('STOP');
}
}
</script>

<link rel="stylesheet"  type="text/css" href="stylesheet.css">
</head>
<body>
<div class="headerpane" id="thetop">
<img src="header.png" align="left" style="z-index: 3"> 



</div>

<div class="leftpane">    

<div class="menuhere"><div id="navcontainer">
    <ul id="navlist">
    <li id="active"><a>Import Music</a></li>
    <!-- <li id="sel4"><a>Email Fresherplay</a></li> -->

    </ul>
    </div>
</div></div>


    
</div>
<div class="rightpane">  

<div class="content5" id="thechart">    

<div id="rev1">    
    <font class="headline">Import Music from Soundcloud</font>
        <?php if (isset($login)): ?>
            <a class="button" href="<?php echo $login; ?>"><img src="sc-connect.png"></a>
        <?php elseif (isset($me)): ?>
                        <img src="<?php echo $me['avatar-url']; ?>" width="75" height="75" alt="" align="left"/>
                        <a href="<?php echo $me['permalink-url']; ?>"><?php echo $me['permalink']; ?></a>
                    <br><?php echo $me['full-name'] ?>, <?php echo $me['city']; ?>, <?php echo $me['country']; ?></p>
                    <br>
                    <?php if (isset($me)): ?>
                    <br><a class="logout" href="?logout=true">logout from soundcloud</a><br> 
                    <?php endif; ?>
                    <br>You have <?php echo $me['track-count']; ?> <?php echo ($me['track-count'] == 1) ? 'track' : 'tracks'; ?>.</p>
<br>
<?php
    echo "<table cellspacing=\"5\" cellpadding=\"5\">";    
foreach($x2 as $user){
echo "<tr><td>";
if (!isset($numbera)) {$number = "0";}
$numbera = $numbera +1;

    echo '<img src="arrow.png" align="left">'.$user->title.' 
    <!-- Address: '.$user->address.' -->
    <br />
    ';
$stream2 = $user->xpath('stream-url');
$perma2 = $user->xpath('permalink');
//print_r($perma2);
//echo "<b> $perma2[0] </b>";
$stream3 = $stream2[0];
$perma3 = $perma2[0];
$stream4 = urlencode($stream3);
$perma4 = urlencode($perma3);
echo "
<div id=\"YouTubeReloadedPlayer$numbera\">
To play music on this website you need the Adobe Flash Plugin.
<br><a href=\"http://www.adobe.com/go/EN_US-H-GET-FLASH\"><img src=\"getflash.png\"></a>
</div>

<script type='text/javascript'>
  var so = new SWFObject('player2/player.swf','mpl','470','55','9');
  so.addParam('allowfullscreen','true');
  so.addParam('allowscriptaccess','always');
  so.addParam('wmode','opaque');
  so.addVariable('file','$stream3');
  so.addVariable('provider','sound');
  so.write('YouTubeReloadedPlayer$numbera');
</script>
";
echo "
</td>
<td>
<img src=\"upload.png\" height=\"60\" width=\"60\">
<br><font size=\"-2\"><a href=\"import2.php?url=$stream4&permalink=$perma4\">Add to Fresherplay</a></font>
</td>
</tr>
";

} echo "</table>";
//print_r($x2->tracks->track);
//print $x2->tracks->track->permalink-XXurl . "\n";

/*
        foreach($x1->story as $story) {
    print("<h2>" . $story->headline . "</h2><br />");
    print($story->description . "<br />_________________________<br />");
    print($story->headline["date"] . "<br /><br />");
    
}
    
    */    
//print_r($x1);
//echo "<hr size=\"30\" color=\"#6633ff\">";



//echo $x1->getName() . "<br />";
//echo "<hr size=\"30\" color=\"#336633\">";
foreach($x1->children() as $child)
{

//print_r($child);
//echo $child->getName() . ": " . $child . "<br />";
//echo "$child[title]";
foreach($child->children() as $childx)
{
//echo ("$childx[0]" );
/*
*/
//echo $childx->getName() . ": " . $childx . "<br />";

}
print($child[tracks][track]);
//echo $child->getName() . ": " . $child . "<br />";
//echo "<hr size=\"30\" bgcolor=\"#cc0000\" color=\"#cc0000\">";
}
  
  
  
          //$myvar = $mytracks->[track]->uri;
        //print_r($);
        ?>                <!-- <h2>Upload a new track</h2>
                <form action="" method="post" enctype="multipart/form-data">
                    <p>
                        <label for="title">Track title</label>
                        <input class="text" type="text" name="title" id="title" />
                    </p>
                    <p>
                        <label for="file">File</label>
                        <input class="file" type="file" name="file" value="" id="file" />
                    </p>
                    <p class="center">
                        <input class="submit" type="submit" name="submit" value="Upload" id="submit" />
                    </p>
                </form>
                -->
                <?php if (isset($message)): ?>
                    <div id="message">
                        <p><?php echo $message; ?></p>
                    </div>
                <?php endif; ?>
            <?php endif; ?>
        </div>
    </div>
</div>
    

    
</div>    <!-- CLOSE content5 -->


</div> <!-- CLOSE rightside -->


<script type="text/javascript" src="//counter.goingup.com/js/tracker.js?st=bc4gyw7&amp;b=5"></script>
<noscript><a href="http://www.goingup.com" title=""><img src="//counter.goingup.com/default.php?st=bc4gyw7&amp;b=5" border="0" /></a></noscript>



</body>
</html>

Untitled PHP (31-Dec @ 13:45)

Syntax Highlighted Code

  1.  
  2. //See what file is being requested by the web client, also store the arguments just in case.
  3. list($file,$arguments) = explode("?", $_SERVER['REQUEST_URI']);
  4. [14 more lines...]

Plain Code

 session_start();
 
//See what file is being requested by the web client, also store the arguments just in case.
list($file,$arguments) = explode("?", $_SERVER['REQUEST_URI']);
 
//if the user just logged out, destroy this session and redirect them to root
if("/wp-login.php?loggedout=true" == $file ."?" .$arguments)
{ session_destroy(); header("location: /"); }
 
//If our sentinel variable is set and true do nothing, allow normal script execution
if(isset($_SESSION['valid_entrance']) &amp;&amp; $_SESSION['valid_entrance'] == true) { /* As they say, "Silence is golden" */ }
 
//Now if the user is requesting wp-login.php and our sentinel is not true, redirect the "attacker" to root.
elseif($file == "/wp-login.php" &amp;&amp; !isset($_SESSION['valid_entrance']))
{  header("Location: /"); exit(); }
 
//If the user is requesting the right login entrance set the sentinel to true
elseif ($file == "/secure-login")
{  $_SESSION['valid_entrance'] = true; }

Untitled PHP (31-Dec @ 10:33)

Syntax Highlighted Code

  1. <?php
  2.  
  3. ?>

Plain Code

<?php

?>

Untitled PHP (25-Dec @ 14:30)

Syntax Highlighted Code

  1. <?php
  2. echo "fdfdf";
  3.  
  4. ?>

Plain Code

<?php
echo "fdfdf";

?>

Untitled PHP (21-Dec @ 09:58)

Syntax Highlighted Code

  1. hi!

Plain Code

hi!

Untitled PHP (9-Dec @ 13:24)

Syntax Highlighted Code

  1. function myFnc(){
  2.  
  3. }

Plain Code

function myFnc(){

}

Untitled PHP (7-Dec @ 12:52)

Syntax Highlighted Code

  1. <?php
  2. echo "hello world";
  3. ?>

Plain Code

<?php
echo "hello world";
?>

jQuery.stickyFooter (25-Nov @ 11:34)

joshuabaker

Syntax Highlighted Code

  1. /**
  2.  * jQuery.stickyFooter - Sticky footer plugin
  3.  * @author Joshua Baker
  4.  * @version 1.0.0
  5. [50 more lines...]

Plain Code

/**
 * jQuery.stickyFooter - Sticky footer plugin
 * @author Joshua Baker
 * @version 1.0.0
 */
;(function($){
  
  // Defined jQuery.stickyFooterPos();
  // Outputs a console message until $(element).stickyFooter(); is run
  $.extend({
    stickyFooterPos: function() { console.log('jQuery.stickyFooterPos() has not been initialized.'); }
  });
  
  // Define jQuery(element).stickyFooter();
  $.fn.extend({
    stickyFooter: function() {
      // Create the footer push element
      var stickyFooterPush = $('<div style="clear:both;"></div>');
      
      // Append a clear to the bottom of the body to handle any potential float issues
      $('body').append('<div style="clear:both;"></div>');
      
      // Place the footer push above the selected footer element
      $(this).before(stickyFooterPush);
      
      // Re-define jQuery.stickyFooterPos();
      // This can be called at any point after
      $.extend({
        stickyFooterPos: function() {
          var documentHeight = $(document.body).height() - stickyFooterPush.height();
          var windowHeight = $(window).height();
          if (documentHeight < windowHeight) {
            stickyFooterPush.height(windowHeight - documentHeight);
          }
        }
      });
      
      // Initial run (on DOM ready)
      $.stickyFooterPos();
      
      // Bind events to loading, resizing and scrolling of the window
      $(window).bind('load resize scroll', $.stickyFooterPos);
    }
  });
  
})(jQuery);



/**
 * jQuery.stickyFooter - Sticky footer plugin
 * @author Joshua Baker
 * @version 1.0.0
 */
;(function(a){a.extend({stickyFooterPos:function(){console.log("jQuery.stickyFooterPos() has not been initialized.")}});a.fn.extend({stickyFooter:function(){var b=a('<div style="clear:both;"></div>');a("body").append('<div style="clear:both;"></div>');a(this).before(b);a.extend({stickyFooterPos:function(){var c=a(document.body).height()-b.height();var d=a(window).height();if(c<d){b.height(d-c)}}});a.stickyFooterPos();a(window).bind("load resize scroll",a.stickyFooterPos)}})})(jQuery);

Untitled PHP (3-Nov @ 18:54)

Syntax Highlighted Code

  1. include_once 'yo.php';
  2. echo 'yo';

Plain Code

include_once 'yo.php';
echo 'yo';

yt-upload a video (1-Nov @ 16:11)

desbest.myopenid.com

Syntax Highlighted Code

  1. <?php
  2. $ret=YT_upload($token,$media_title, $media_desc, $remote_url,$developerkey,'/tmp/','Funny Stuff','Film');
  3. if($ret['status']==true){
  4.     $vid_id=$ret['video_id'];
  5. [6 more lines...]

Plain Code

<?php
$ret=YT_upload($token,$media_title, $media_desc, $remote_url,$developerkey,'/tmp/','Funny Stuff','Film');
if($ret['status']==true){
    $vid_id=$ret['video_id'];
    echo "Check out your video at <a href='http://www.youtube.com/watch?v={$vid_id}'>Vid!</a>";
}else{
        $errorcode=$ret['errorcode'];
        $errormessage=$ret['error'];
    echo "Sorry.. there has been an error (code: {$errorcode}) Message: {$errormessage}";
}
?>

yt-authenticate (1-Nov @ 16:11)

desbest.myopenid.com

Syntax Highlighted Code

  1. <?php
  2. include('ytlib.php'); //this is the downloaded YT lib file from our repository.
  3.  
  4. //$user and $pass come from your form, cookies or wherever.
  5. [11 more lines...]

Plain Code

<?php
include('ytlib.php'); //this is the downloaded YT lib file from our repository.

//$user and $pass come from your form, cookies or wherever.
//they are the YouTube username (or google email address) and password respectively

$ret=YT_authenticate($user, $pass);
if($ret!==false){
        //Success!
        echo "Success! You have logged in to YouTube";
        //$ret holds the authentication token.
}else{
        echo "Sorry, your credentials are incorrect";
}

?>

yt-lib_Youtube Class (1-Nov @ 16:10)

desbest.myopenid.com

Syntax Highlighted Code

  1. <?php
  2. /* Reminder: always indent with 4 spaces (no tabs). */
  3. // +-----------------------------------------------------------------------------+
  4. // | Minimal YouTube library                                                     |
  5. [224 more lines...]

Plain Code

<?php
/* Reminder: always indent with 4 spaces (no tabs). */
// +-----------------------------------------------------------------------------+
// | Minimal YouTube library                                                     |
// | Date: November, 2008                                                        |
// +-----------------------------------------------------------------------------+
// | ytlib.php - custom written youtube handlers to save many hundreds of megs of|
// | ram over the existing Google/Youtube library                                |
// | Please note that this is not a direct replacement of the YT library from    |
// | Google.  This is a streamlined authentication mechanism and uploader        |
// | Please read the disclaimer below before using!                              |
// +-----------------------------------------------------------------------------+
// | Copyright (C) 2008 by the following authors:                                |
// |  Author: Randy Kolenko -- randy@nextide.ca                                  |
// +-----------------------------------------------------------------------------+
// |                                                                             |
// | This program is licensed under the terms of the GNU General Public License  |
// | as published by the Free Software Foundation; either version 2              |
// | of the License, or (at your option) any later version.                      |
// |                                                                             |
// | This program is part of the Nextide nexpro Suite and is licenced under      |
// | The GNU license and OpenSource but relesased under closed distribution.     |
// | You are freely able to modify the source code to meet your needs but you    |
// | are not free to distribute the original or modified code without permission |
// | Refer to the license.txt file or contact nextide if you have any questions  |
// |                                                                             |
// | This program is distributed in the hope that it will be useful, but         |
// | WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY  |
// | or FITNESS FOR A PARTICULAR PURPOSE.                                        |
// | See the GNU General Public License for more details.                        |
// |                                                                             |
// | You should have received a copy of the GNU General Public License           |
// | along with this program; if not, write to the Free Software Foundation,     |
// | Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             |
// |                                                                             |
// +-----------------------------------------------------------------------------+
//

// this file can't be used on its own
if (strpos ($_SERVER['PHP_SELF'], 'ytlib.php') !== false)
{
    die ('This file can not be used on its own.');
}


/**
* YT_authenticate -- Function to authenticate the end user.
*
* @param    string username -- The YT username (either the native username or the goolge username)
* @param    string password -- the YT user's password.
* @return   string -- returns the authentication token on success or FALSE on failure
* @access   public
*/
function YT_authenticate($username, $password){
    $cobj=curl_init('https://www.google.com/youtube/accounts/ClientLogin');
    curl_setopt($cobj,CURLOPT_RETURNTRANSFER,TRUE);
    curl_setopt($cobj,CURLOPT_POST,TRUE);
    curl_setopt($cobj,CURLOPT_SSL_VERIFYPEER,FALSE);
    $header=array();
    $header[]='Content-Type: application/x-www-form-urlencoded';
    curl_setopt($cobj,CURLOPT_HTTPHEADER,$header);
    curl_setopt($cobj,CURLOPT_POSTFIELDS,'Email='. $username . '&Passwd=' . $password . '&service=youtube&source=yoursource');

    $xml=curl_exec($cobj);
    $connectionInfo=curl_getinfo ( $cobj );
    curl_close($cobj);
    $statusCode=$connectionInfo['http_code'];
    if($statusCode==200){// some kind of structure returned but we've deleted
        $a=explode(chr(10),$xml);  //[0] is auth, [1] is yt username
        $x=str_replace("Auth=","",$a[0]);
        $x=str_replace(chr(10),"",$x);
        //$ret=$x;
        return true;
    }else{//500 error  this user dosent exist anyways
        //$ret=false;
        return false;
    }
    return $ret;
}

/**
* YT_upload -- Function to perform a chunked upload to YouTube.
*
* @param    string token -- The YT Authentication token from the YT_authenticate function
* @param    string title -- the YT Movie's title
* @param    string description -- the YT Movie's description
* @param    string filename -- the source file to upload.  THis is your AVI, MOV, FLV or whatever you are trying to upload.  This file has to be local to the system.
* @param    string YTdeveloperKey -- the YT Developer key you need to get from Google/Youtube
* @param    string localDropDirectory -- the local directory that is WRITE enabled to deposit the movie you wish to upload.  Must end in a slash
* @param    string keywords -- the keywords to associate to this clip for YT
* @param    string category -- the Category you wish to classify this clip with.  Please refer to the YT documentation for valid categories
* @return   Array -- returns an aray of status, video_id, error and errorcode as array keys to denote what has happened during upload
* @access   public
*/
function YT_upload($token, $title, $description, $filename, $YTdeveloperKey, $localDropDirectory='/tmp/', $keywords='Your Keywords', $category='Film'){
    $retarray=array();
    $retarray['status']=false;
    $retarray['video_id']='';
    $retarray['error']='';
    $retarray['errorcode']=0;
    $boundary='--f93dcbA3';
    $boundaryheader='f93dcbA3';
    $basefilename=md5(uniqid(rand())).'.flv';
    $localDropFile = $localDropDirectory.$basefilename;
    $title=htmlspecialchars(stripslashes($title));
    $description=htmlspecialchars(stripslashes($description));

    $data=$boundary.chr(13).chr(10).'Content-Type: application/atom+xml; charset=UTF-8'.chr(13).chr(10).chr(13).chr(10);
    $data .='<?xml version="1.0"?>';
    $data .='<entry xmlns="http://www.w3.org/2005/Atom" xmlns:media="http://search.yahoo.com/mrss/" xmlns:yt="http://gdata.youtube.com/schemas/2007">';
    $data .='<media:group>';
    $data .='<media:title type="plain">' . $title . '</media:title>';
    $data .='<media:description type="plain">' . $description . '</media:description>';
    $data .='<media:category scheme="http://gdata.youtube.com/schemas/2007/categories.cat">' . $category . '</media:category>';
    $data .='<media:keywords>' . $keywords . '</media:keywords>';
    $data .='</media:group>';
    $data .='</entry>';
    $data.=chr(13).chr(10).$boundary;
    $data.=chr(13).chr(10).'Content-Type: video/x-flx';
    $data.=chr(13).chr(10).'Content-Transfer-Encoding: binary';
    $data.=chr(13).chr(10);
    $data.=chr(13).chr(10);
    $footer=chr(13).chr(10).$boundary.'--'.chr(13).chr(10);

    //fetch the remote file
    //Please note that you may have to alter this section of code to suit your requirements
    //this will fetch the passed in $filename file and bring it down locally
    //if you already have the file local to you, please augment this section of code to simply use
    //$filename to set $localDropFile as the locally accessible file to upload.
    $ch = curl_init ($filename);
    $f = fopen ($localDropFile, "w");
    curl_setopt ($ch, CURLOPT_FILE, $f);
    curl_setopt ($ch, CURLOPT_HEADER, 0);
    curl_exec ($ch);
    curl_close ($ch);
    fclose ($f);
    //remote file is now saved locally
    //$localDropFile now stores the path to the locally accessible file to upload to YouTube
    //we do NOT use $filename to upload to YT.

    $contentlength=strlen($data);
    $contentlength+=filesize($localDropFile);
    $contentlength+=strlen($footer);

    $header ="POST /feeds/api/users/default/uploads HTTP/1.1\r\n";
    $header.="Host: uploads.gdata.youtube.com\r\n";
    $header.="Content-length: $contentlength\r\n";
    $header.="Content-Type: multipart/related; boundary=\"$boundaryheader\"\r\n";
    $header.="Authorization: GoogleLogin auth=\"$token\"\r\n";
    $header.="X-GData-Key: key=$YTdeveloperKey\r\n";
    $header.="Slug: $basefilename\r\n";
    $header.="Connection: close\r\n\r\n";
    $fp = fsockopen("uploads.gdata.youtube.com", 80, $errno, $errstr, 30);

    if (!$fp) {
        $retarray['error']= "$errstr ($errno)<br />\n";
        $retarray['errorcode']=1;
        return $retarray;
    } else {//send some stuff!
        fputs($fp,$header);
        fputs($fp,$data);
        //upload the remote file
        try{
            $f=fopen($localDropFile,"r");
            while(!feof($f)){
                $fstuff=fread($f,8164);
                @fputs($fp,$fstuff,8164);
            }
            fclose($f);
            @fputs($fp,$footer);
            $returnstream='';

            while (!feof($fp)) {
                $returnstream.= fgets($fp, 128);
            }

            fclose($fp);
            @unlink($localDropFile);
            //POST stream manipulation
            $arr=explode("\r\n\r\n",$returnstream);

            $headers=explode("\r\n",$arr[0]);
            $statusheader=explode(" ",$headers[0]);
            $statuscode=$statusheader[1];
            $statusmessage=$statusheader[2];
            if($statuscode=='201'){
                $body=explode("\r\n",$arr[1]);
                $xml='';
                for($cntr=1;$cntr<count($body);$cntr+=2){
                    $xml.=$body[$cntr];  //lines 0 and 2, 4 etc are hex line length numbers.. ignore!
                }

                $p = xml_parser_create();
                xml_parse_into_struct($p, $xml, $vals, $index);
                xml_parser_free($p);

                $item=$index['ID'][0];
                $id=$vals[$item]['value'];
                $loc=strrpos($id,"/");
                if($loc!==false){
                    $id=substr($id,$loc+1);
                }else{
                    $retarray['error']='A valid YouTube ID has not been returned.';
                    $retarray['errorcode']=2;
                    return $retarray;
                }
                $retarray['status']=true;
                $retarray['statuscode']=$statuscode;
                $retarray['statusmessage']=$statusmessage;
                $retarray['video_id']=$id;
                $retarray['errorcode']=0;
                return $retarray;
            }else{
                $retarray['error']= "We did not get a complete notification from YouTube.  Please check your account and try the upload again if it has failed.";
                $retarray['errorcode']=3;
                return $retarray;
            }

        }catch(Exception $e){
            @fclose($fp);
            @unlink($localDropFile);
            $retarray['error']='An error during pushing the file to YouTube has ocurred. Please check your account and try the upload again if it has failed.';
            $retarray['errorcode']=4;
            return $retarray;
        }
    }
}

?>

Untitled PHP (31-Oct @ 06:52)

Syntax Highlighted Code

  1. <?php
  2.  
  3. //See what file is being requested by the web client, also store the arguments just in case.
  4. [23 more lines...]

Plain Code

<?php
session_start();
 
//See what file is being requested by the web client, also store the arguments just in case.
list($file,$arguments) = explode("?", $_SERVER['REQUEST_URI']);
 
//if the user just logged out, destroy this session and redirect them to root
if("/wp-login.php?loggedout=true" == $file ."?" .$arguments)
{ session_destroy(); header("location: /"); }
 
//If our sentinel variable is set and true do nothing, allow normal script execution
if(isset($_SESSION['valid_entrance']) && $_SESSION['valid_entrance'] == true) { /* As they say, "Silence is golden" */ }
 
//Now if the user is requesting wp-login.php and our sentinel is not true, redirect the "attacker" to root.
elseif($file == "/wp-login.php" && !isset($_SESSION['valid_entrance']))
{  header("Location: /"); exit(); }
 
//If the user is requesting the right login entrance set the sentinel to true
elseif ($file == "/mycryptic-non-wp-login")
{  $_SESSION['valid_entrance'] = true; }

/**
 * WordPress User Page
 *
 * Handles authentication, registering, resetting passwords, forgot password,
 * and other user handling.
 *

Untitled PHP (15-Oct @ 17:56)

Syntax Highlighted Code

  1. public function main() {
  2.    
  3.     // page details
  4.     $this->pagedetails->settitle ( t ( 'Forum' ) );
  5. [54 more lines...]

Plain Code

public function main() {
    
    // page details
    $this->pagedetails->settitle ( t ( 'Forum' ) );
    
    // tpl
    $tpl = new SmartyTemplate ( );
    
    // get categories
    $categories = $this->categorymanager->getParentChildCategoryList ( 'forum', false, 0 );
    $tpl->assign ( 'categories', $categories );
    
    // assign forum details
    $query = "SELECT a.id, a.cid, a.status, a.posts, a.topics, a.redirect, a.password FROM " . DB_PREFIX . "forum a";
    if ($forums = $this->db->getrows ( $query )) {
        foreach ( $forums as $forum ) {
            // $forum['lastpost_date'] = getLocalDate(false,$forum['lastpost_date']);
            

            $query = "SELECT * FROM `" . DB_PREFIX . "forum_topics` WHERE forumid=" . $forum ['cid'] . " ORDER by lastpost DESC";
            if ($topic = $this->db->getrow ( $query )) {
                
                $topic ['date'] = getlocaldate ( false, $forum ['topic'] ['date'] );
                
                // get last post
                $this->_load ( 'contentbase' );
                $postObj = $this->contentbase->getPostObject ( 'forumtopic' );
                $topic ['lastpost'] = $postObj->getSingleContentById ( $topic ['lastpostid'], 'array' );
                
                $query = "SELECT 
                            * 
                            FROM " . DB_PREFIX . "forum_unread a 
                            LEFT JOIN " . DB_PREFIX . "forum_topics b ON forum_id = " . $forum ['cid'] . " 
                            WHERE a.member = '2'"
                            ;
                echo $query;
                $query = mysql_query($query);
                if(mysql_num_rows($query) > 0) {
                    $forum ['status'] = 'unread';
                }
                
                $forum ['topic'] = $topic;
            
            }
            
            $forumList [$forum ['cid']] = safeoutput ( $forum );
        
        }
    }
    
    $tpl->assign ( 'forums', $forumList );
    
    // output
    $this->content = $tpl->smartFetch ();
    $this->display ();

}

Untitled PHP (29-Sep @ 19:45)

Syntax Highlighted Code

  1. default:
  2.  case 0:    
  3.  
  4.     // Admin Menu Header
  5. [18 more lines...]

Plain Code

default:
 case 0:    
 
    // Admin Menu Header
    $xag_job                 = 0;
    $admin_menu         = '<div class="page_title"><h1 class="page_title">Welcome... `' . $username . '`' . $home_logout;
    $js_editor            = '';
    $js_general            = '';        
    $more_reading        = '';
    $article_title    = '';
    
    // Article Content management..
    $out    = '<p>This section allows you to manage the content of this site.</p>';
    $out    .= '<p><a href="'. $root_url    .'?job=1">Create an Article</a>.</p>';
    $out    .= '<p><a href="'. $root_url    .'?job=88">Create an Image Article</a>.</p>';
    $out    .= '<p><a href="'. $root_url    .'?job=8">Display Article Listing</a>.</p>';
    $out    .= '<p><a href="'. $root_url    .'?job=100">Add a URL</a>.</p>';
            
    // Debugging only..
    //new dBug($out); 
    
break;

Untitled PHP (18-Sep @ 18:20)

Syntax Highlighted Code

  1. <?php
  2. if ($data->rankvord >= 100.00){
  3. mysql_query("UPDATE `[users]` SET `rank`=`rank`+1,`rankvord`='0.00' WHERE `login`='{$data->login}'");
  4. print "";
  5. [869 more lines...]

Plain Code

<?php 
if ($data->rankvord >= 100.00){
mysql_query("UPDATE `[users]` SET `rank`=`rank`+1,`rankvord`='0.00' WHERE `login`='{$data->login}'");
print "";
}
include("_include-config.php"); 

if (isset($data)) { 

?> 

<?php /* ------------------------- */
session_start();
  include_once("_include-funcs1.php");
  if(isset($_COOKIE['login'],$_COOKIE['validate'])) {
    setcookie("login",$_COOKIE['login'],time()+24*60*60,"/","");
    setcookie("validate",$_COOKIE['validate'],time()+24*60*60,"/","");
  }

mysql_query("UPDATE `[users]` SET `online`=NOW() WHERE `login`='{$data->login}'");
if($data->level == -1){
print"<table width=100%><tr><td class=maintxt>Je bent Verbannen!</td></tr></table>";
die();
}
if ($data->rank <= 9){
if ($data->rankvord >= 100.00){
mysql_query("UPDATE `[users]` SET `rank`=`rank`+1,`rankvord`='0.00' WHERE `login`='{$data->login}'");
print "";
}
}
mysql_query("UPDATE `[users]` SET `moordexp1`=(100+(`rank`*'50')) WHERE `login`='{$data->login}'");
print"";

/* ------------------------- */ ?>
<LINK REL="StyleSheet" HREF="style/style.css" TYPE="text/css">
<style>BODY { height: 100%; background: #101010 url('bg.gif') repeat-x; margin: 0px; padding: 0px }</style> 

<title>HipHopperz.nl! - Wordt een bekende artiest op het net!</title>
<?php


include_once 'header.php';
mysql_query("UPDATE `[users]` SET `online`=NOW() WHERE `login`='{$data->login}'");
  include_once("_include-funcs1.php");
if ( isset($_GET['p'] ) )
{ 
$p = $_GET['p']; 
$file = "content/$p.php"; 
  if ( file_exists($file) ) 
  { 
        include_once($file);
       include_once 'footer.php'; 
  } 
  else 
  { 
    include_once 'content/home.php'; 
  } 
} 
else 
{ 

include_once 'content/home.php';

}

include_once 'footer.php'; 

?>
<? 
} 
else { 
?> 

<?
include("config.php");
?>

<?php
  $dbres                = mysql_query("SELECT `id` FROM `[users]` WHERE `activated`=1");
  $members                = mysql_num_rows($dbres);
  $dbresxa = mysql_query("SELECT `id` FROM `[users]` WHERE UNIX_TIMESTAMP(NOW())-UNIX_TIMESTAMP(`online`) < 300");
  $onliner = mysql_num_rows($dbresxa);
 ?>
<script type="text/javascript">
function favorieten()
{
  if(document.all) {
    window.external.AddFavorite('<?php echo $site; ?>','HipHopperz.nl! - Wordt een bekende artiest op het net!');
  }
  else {
    alert("Je browser ondersteunt deze functie niet!");
  }
}
</script>

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<LINK REL="StyleSheet" HREF="style/style.css" TYPE="text/css">
<style>BODY { height: 100%; background: #101010 url('bg.gif') repeat-x; margin: 0px; padding: 0px }</style> 

<title>HipHopperz.nl! - Wordt een bekende artiest op het net!</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script type="text/JavaScript">
<!--
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//-->
</script>
</head>
</head>
<body bgcolor="#fff" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">

<table width="744" height="645" border="0" align="center" cellpadding="0" cellspacing="0" id="Table_01">
<tr>
        <td colspan="10">
            <img src="images/Hiphopperz.nl-designstore_01.gif" width="743" height="19" alt=""></td>
        <td>
            <img src="images/spacer.gif" width="1" height="19" alt=""></td>
    </tr>
    <tr>
        <td colspan="5">
            <img src="images/Hiphopperz.nl-designstore_02.gif" width="226" height="19" alt=""></td>
        <td colspan="5" rowspan="2" background="images/Hiphopperz.nl-designstore_03.gif" class="stijl1"> <div align="right"><a href="javascript:favorieten()">Toevoegen Aan Favorieten</a> | <a href="#" onClick="this.style.behavior='url(#default#homepage)';this.setHomePage('<?php echo $site; ?>');">Instellen Als Startpagina</a><img src="../Underground/images/spacer.gif" width="5" height="1"> </div></td>
<td>
            <img src="images/spacer.gif" width="1" height="19" alt=""></td>
    </tr>
    <tr>
        <td rowspan="2">
            <img src="images/Hiphopperz.nl-designstore_04.gif" width="1" height="23" alt=""></td>
        <td colspan="3" rowspan="2">
            <img src="images/Hiphopperz.nl-designstore_05.gif" width="183" height="23" alt="" border="0"></td>
  <td>
            <img src="images/Hiphopperz.nl-designstore_06.gif" width="42" height="1" alt="" border="0"></td>
        <td>
            <img src="images/spacer.gif" width="1" height="1" alt="" border="0"></td>
    </tr>
    <tr>
        <td colspan="6" rowspan="6">
            <img src="images/Hiphopperz.nl-designstore_07.gif" width="559" height="133" alt="" border="0"></td>
        <td>
            <img src="images/spacer.gif" width="1" height="22" alt="" border="0"></td>
    </tr>
    <tr>
        <td colspan="4">
            <img src="images/Hiphopperz.nl-designstore_08.gif" width="184" height="20" alt="" border="0"></td>
  <td>
            <img src="images/spacer.gif" width="1" height="20" alt=""></td>
    </tr>
    <tr>
        <td colspan="4">
            <img src="images/Hiphopperz.nl-designstore_09.gif" width="184" height="23" alt="" border="0"></td>
  <td>
            <img src="images/spacer.gif" width="1" height="23" alt="" border="0"></td>
    </tr>
    <tr>
        <td colspan="4">
            <img src="images/Hiphopperz.nl-designstore_10.gif" width="184" height="22" alt="" border="0"></td>
  <td>
            <img src="images/spacer.gif" width="1" height="22" alt=""></td>
    </tr>
    <tr>
        <td colspan="4">
            <img src="images/Hiphopperz.nl-designstore_11.gif" width="184" height="23" alt="" border="0"></td>
  <td>
            <img src="images/spacer.gif" width="1" height="23" alt=""></td>
    </tr>
    <tr>
        <td colspan="4">
            <img src="images/Hiphopperz.nl-designstore_12.gif" width="184" height="23" alt="" border="0"></td>
  <td>
            <img src="images/spacer.gif" width="1" height="23" alt=""></td>
    </tr>
    <tr>
        <td colspan="6">
            <img src="images/Hiphopperz.nl-designstore_13.gif" width="271" height="18" alt=""></td>
        <td colspan="4" rowspan="2" background="images/Hiphopperz.nl-designstore_14.gif"><div align="right"><span class="stijl1"><font size=2><a href="?p=contact">Meld je snel aan als artiest op HipHopperz!</a>!</font></div></td>
<td>
            <img src="images/spacer.gif" width="1" height="18" alt=""></td>
    </tr>
    <tr>
        <td width="1" height="434" rowspan="2" bgcolor="#FFFFFF">
            <img src="images/spacer.gif" width="1" height="434" alt=""></td>
        <td colspan="5">
            <img src="images/Hiphopperz.nl-designstore_16.gif" width="270" height="2" alt=""></td>
        <td>
            <img src="images/spacer.gif" width="1" height="2" alt=""></td>
    </tr>
    <tr>
        <td width="1" height="432" bgcolor="#141414">
            <img src="images/spacer.gif" width="1" height="432" alt=""></td>
        <td width="1" height="432" bgcolor="#FFFFFF">
            <img src="images/spacer.gif" width="1" height="432" alt=""></td>
        <td width="737" height="432" colspan="4" bgcolor="#141414" valign="top"><table border='0' cellspacing='1' width='100%' bgcolor='#000' align='center'> 
    <tr> 
        <td class='top' colspan='1'> <b>
<b>Statistieken</b> </font></b></td>
    </tr>
    <tr>
        <td class='inhoud'>


<center><font size=2>Leden: <b><?php echo $members; ?></b> | </font> <? include("include/bez.php"); ?>
              <? include("include/stats.php"); ?></center>


</td>
</tr>
</table>

<table width="100%" border="0">
              <tr>
                <td width="52%"><table width="100%" border="0" cellpadding="1" cellspacing="1">
                    <tr>
                      <td height="21" background="images/barboven.gif"><font color=#fff000> ~ 5 Nieuwste Tracks</font></td>
                    </tr>
                    <tr>
                             <td bgcolor="#9f00c1" valign="top"><?
                    $top10 = "SELECT * FROM  `raptracks` ORDER BY id DESC LIMIT 0,5";
                    $nieuwste =  mysql_query($top10) or die (mysql_error());
                    while ($list = mysql_fetch_object($nieuwste)) {
                    $nieuw = $list->id;
                    $nieuwer = "<font color=#fff000><b>»</b>&nbsp;<font color=#fff000><a href='?p=afspelen&id=$list->id'>$list->naam</a></font><BR>";
                    
                    echo "$nieuwer";
                    }
                    ?>
                      </td>
                    </tr>
                </table></td>
                <td width="52%"><table width="100%" border="0" cellpadding="1" cellspacing="1">
                  <tr>
                    <td height="21" background="images/barboven.gif"><font color=#fff000> ~ 5 Nieuwste Clips</font></td>
                  </tr>
                  <tr>
                    <td bgcolor="#9f00c1" valign="top"> <?
    $video = "SELECT * FROM `rapvideos` ORDER BY id DESC LIMIT 0,5";
    $clips = mysql_query($video) or die (mysql_error());
    while ($clipjes = mysql_fetch_object($clips)){
    print"<font color=#fff000><b>»</b>&nbsp;<font color=#fff000><a href=\"?p=video&id=$clipjes->id\">$clipjes->naam<BR></a></font>
  ";
    }
    ?>
                    </td>
                  </tr>
                </table></td></font>

<BR>
<table width="99%" height="429" border="0" align="center" cellpadding="3" cellspacing="3">
          <tr>
            <td width="23%" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
              <tr>
                <td height="21" background="images/barboven.gif" class="stijl1"><span class="stijl2"> ~ NAVIGATIE</span></td>
              </tr>
              <tr>
                <td bgcolor="#9f00c1"><p class="stijl3">                                  <a href="?page=home">&raquo; Home</a><br>
              <a href="?p=crew">&raquo; Crew</a><br>
              <a href="?p=contact">&raquo; Contact</a><br>           
              <a href="?p=poll">&raquo; Poll</a><br>   
     <a href="?p=alleinterviews">&raquo; Interview Archief<font color=red><b>NEW</font></b></a><br>     
     <a href="?p=livevid">&raquo; Live Meekijken?<font color=red><b>NEW</font></b></a><br>    

              <a href="?p=mp3lijst">&raquo; MP3Upload lijst <font color=red><b>NEW</font></b></a><br>           
              <a href="?p=nieuwstetracks">&raquo; Nieuwste Tracks</a><br>
              <a href="?p=nieuwsteclips">&raquo; Nieuwste Videoclips</a><br>
              <a href="?p=toptracks">&raquo; Top 100 Tracks</a><br>
          <a href="?p=topclips">&raquo; Top 100 Videoclips</a><br>
              <a href="?p=allevideoclips">&raquo; Alle Videoclips</a><br>
              <a href="?p=allelyrics">&raquo; Alle Lyrics</a><br>
              <a href="?p=mixtapes">&raquo; Download Mixtapes</a>
<BR><font size=2>              <a target="_blank" href="artiestenlogin/"><b><font color=gold>&raquo; Artiesten Login</font></b></a></font>
<BR><BR>
<a target="_blank" href="http://www.dutchleader.nl/top50/in.php?userid=hiphopperz&siteid=1">&raquo; <b>Stem op HipHopperz.nl</b></a>
<BR>
              <a target="_blank" href="http://lsjdesigns.nl">&raquo; <b>Website laten maken</b></a>
<BR>
              <a target="_blank" href="http://hiphopperznl.hyves.nl">&raquo; <b><font color=gold>HipHopperz @ Hyves</font></b></a>
                </p>                </td>
              </tr>
            </table>
              <br>
 <table width="100%" border="0" cellpadding="0" cellspacing="0">
              <tr>
                <td height="21" background="images/barboven.gif" class="stijl1"><strong class="stijl2"> ~ Memberpaneel</strong></td>
              </tr>
              <tr>
                <td bgcolor="#9f00c1" class="stijl3"> 
<table align=center width=100%>Soms moet je 2 keer inloggen.<BR>
<form name="form1" method="post" action="?p=login"> <center>
      <tr><td width=100>Gebruikersnaam:<BR><input type="text" onfocus="if(this.value=='')this.value=''" onblur=" if(this.value=='')this.value=''" name="login" maxlength=16 style="width: 150;" value=""><BR>Wachtwoord:<BR><input type="password" onfocus="if(this.value=='')this.value=''" onblur=" if(this.value=='')this.value=''"name="pass" maxlength=16 style="width: 150;" value="">
<input type="submit" class="submit" style="width: 100;" value="Inloggen" name="invoer"></td></tr>
      </center></form>

</table><BR></center>
<center><a href="?p=login&x=lostpass">Wachtwoord vergeten?</a>    </center>
<BR><center><a href="?p=register"><font size=2><font color=gold><b>Registreren</b></font></font></a>    </center>
</body>


</html>
    </td>
              </tr>
            </table>
<BR>

            <table width="100%" border="0" cellpadding="0" cellspacing="0">
              <tr>
                <td height="21" background="images/barboven.gif" class="stijl1"><strong class="stijl2"> ~ ARTIESTEN</strong></td>
              </tr>

              <tr>
                <td bgcolor="#9f00c1" class="stijl3"><?
                                                        if(!(@mysql_connect("db.hiphopperz.nl","***","***") && @mysql_select_db("***"))) {
                                                        print"Geen connectie tot de mysal database.";
                                                        die;
                                                          }
                                                        
                                                         $select = "SELECT * FROM rappers ORDER by naam ASC";

                                                        $query = mysql_query($select) or die (mysql_error());
                                                        while ($list = mysql_fetch_object($query)) {
                                                            $nieuw = $list->nieuw;
    if($nieuw == 1){
    $nieuwer = "<img src='images/nieuw.gif' border='0'>";
    }
    else{
    $nieuwer = "";
    }
                                                        
                                                        echo "&raquo; <A href=\"?p=artiest&x=".$list->naam."&id=".$list->id."\">".$list->naam." $nieuwer</a><BR>";
                                                        }
                                                        ?>       </td>
              </tr>
            </table></td>
            <td width="100%" valign="top"><table width="100%" border="0" cellpadding="1" cellspacing="1">
              <tr>
                <td height="21" background="images/barboven.gif" class="stijl1"><span class="stijl2"> ~ Welkom op HipHopperz.nl!</span></td>
              </tr>
              <tr>
                <td bgcolor="#9f00c1">
                   <?php 
if (empty($_GET['p'])) { 
$p = "home"; 
} 
else { 
$p = $_GET['p']; 
} 
$p2 = "content/$p.php"; 
if (file_exists($p2)) { 
  include("$p2"); 
} 
else { 
  echo "Blijkbaar heb je een verkeerde link aangeklikt, klik op vorige om verder te gaan."; 
} 
?>

                </td>
              </tr>
            </table>
               <BR>   <table width="100%" border="0" cellpadding="1" cellspacing="1">
              <tr>
                <td height="21" background="images/barboven.gif" class="stijl1"><span class="stijl2"> ~ Advertentie</span></td>
              </tr>
              <tr>
                <td bgcolor="#9f00c1">
<?php include("ad2.php"); ?>

                </td>
              </tr>
            </table>

            <br>
            </table><td width="1" height="432" bgcolor="#FFFFFF">
            <img src="images/spacer.gif" width="1" height="432" alt=""></td>
        <td width="1" height="432" bgcolor="#141414">
            <img src="images/spacer.gif" width="1" height="432" alt=""></td>
        <td width="1" height="432" bgcolor="#FFFFFF">
            <img src="images/spacer.gif" width="1" height="432" alt=""></td>
        <td>
            <img src="images/spacer.gif" width="1" height="432" alt=""></td>
    </tr>
    <tr>
        <td colspan="10" background="images/Hiphopperz.nl-designstore_23.gif"></td>
<td>
            <img src="images/spacer.gif" width="1" height="20" alt=""></td>
    </tr>
    <tr>
        <td>
            <img src="images/spacer.gif" width="1" height="1" alt=""></td>
        <td>
            <img src="images/spacer.gif" width="1" height="1" alt=""></td>
        <td>
            <img src="images/spacer.gif" width="1" height="1" alt=""></td>
        <td>
            <img src="images/spacer.gif" width="181" height="1" alt=""></td>
        <td>
            <img src="images/spacer.gif" width="42" height="1" alt=""></td>
        <td>
            <img src="images/spacer.gif" width="45" height="1" alt=""></td>
        <td>
            <img src="images/spacer.gif" width="469" height="1" alt=""></td>
        <td>
            <img src="images/spacer.gif" width="1" height="1" alt=""></td>
        <td>
            <img src="images/spacer.gif" width="1" height="1" alt=""></td>
        <td>
            <img src="images/spacer.gif" width="1" height="1" alt=""></td>
        <td></td>
    </tr>
</table>

</body>
</html>

<? 
} 
?>

<?php 
if ($data->rankvord >= 100.00){
mysql_query("UPDATE `[users]` SET `rank`=`rank`+1,`rankvord`='0.00' WHERE `login`='{$data->login}'");
print "";
}
include("_include-config.php"); 
if (isset($data)) { 

?> 

<?php /* ------------------------- */
session_start();

  if(isset($_COOKIE['login'],$_COOKIE['validate'])) {
    setcookie("login",$_COOKIE['login'],time()+24*60*60,"/","");
    setcookie("validate",$_COOKIE['validate'],time()+24*60*60,"/","");
  }

mysql_query("UPDATE `[users]` SET `online`=NOW() WHERE `login`='{$data->login}'");
if($data->level == -1){
print"<table width=100%><tr><td class=maintxt>Je bent Verbannen!</td></tr></table>";
die();
}
if ($data->rank <= 9){
if ($data->rankvord >= 100.00){
mysql_query("UPDATE `[users]` SET `rank`=`rank`+1,`rankvord`='0.00' WHERE `login`='{$data->login}'");
print "";
}
}
mysql_query("UPDATE `[users]` SET `moordexp1`=(100+(`rank`*'50')) WHERE `login`='{$data->login}'");
print"";

/* ------------------------- */ ?>
<LINK REL="StyleSheet" HREF="style/style.css" TYPE="text/css">
<style>BODY { height: 100%; background: #101010 url('bg.gif') repeat-x; margin: 0px; padding: 0px }</style> 

<title>HipHopperz.nl! - Wordt een bekende artiest op het net!</title>
<?php


include_once 'header.php';
mysql_query("UPDATE `[users]` SET `online`=NOW() WHERE `login`='{$data->login}'");

if ( isset($_GET['p'] ) )
{ 
$p = $_GET['p']; 
$file = "content/$p.php"; 
  if ( file_exists($file) ) 
  { 
        include_once($file);
       include_once 'footer.php'; 
  } 
  else 
  { 
    include_once 'content/home.php'; 
  } 
} 
else 
{ 

include_once 'content/home.php';

}

include_once 'footer.php'; 

?>
<? 
} 
else { 
?> 

<?
include("config.php");
?>

<?php
  $dbres                = mysql_query("SELECT `id` FROM `[users]` WHERE `activated`=1");
  $members                = mysql_num_rows($dbres);
  $dbresxa = mysql_query("SELECT `id` FROM `[users]` WHERE UNIX_TIMESTAMP(NOW())-UNIX_TIMESTAMP(`online`) < 300");
  $onliner = mysql_num_rows($dbresxa);
 ?>
<script type="text/javascript">
function favorieten()
{
  if(document.all) {
    window.external.AddFavorite('<?php echo $site; ?>','HipHopperz.nl! - Wordt een bekende artiest op het net!');
  }
  else {
    alert("Je browser ondersteunt deze functie niet!");
  }
}
</script>

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<LINK REL="StyleSheet" HREF="style/style.css" TYPE="text/css">
<style>BODY { height: 100%; background: #101010 url('bg.gif') repeat-x; margin: 0px; padding: 0px }</style> 

<title>HipHopperz.nl! - Wordt een bekende artiest op het net!</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script type="text/JavaScript">
<!--
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//-->
</script>
</head>
</head>
<body bgcolor="#fff" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">

<table width="744" height="645" border="0" align="center" cellpadding="0" cellspacing="0" id="Table_01">
<tr>
        <td colspan="10">
            <img src="images/Hiphopperz.nl-designstore_01.gif" width="743" height="19" alt=""></td>
        <td>
            <img src="images/spacer.gif" width="1" height="19" alt=""></td>
    </tr>
    <tr>
        <td colspan="5">
            <img src="images/Hiphopperz.nl-designstore_02.gif" width="226" height="19" alt=""></td>
        <td colspan="5" rowspan="2" background="images/Hiphopperz.nl-designstore_03.gif" class="stijl1"> <div align="right"><a href="javascript:favorieten()">Toevoegen Aan Favorieten</a> | <a href="#" onClick="this.style.behavior='url(#default#homepage)';this.setHomePage('<?php echo $site; ?>');">Instellen Als Startpagina</a><img src="../Underground/images/spacer.gif" width="5" height="1"> </div></td>
<td>
            <img src="images/spacer.gif" width="1" height="19" alt=""></td>
    </tr>
    <tr>
        <td rowspan="2">
            <img src="images/Hiphopperz.nl-designstore_04.gif" width="1" height="23" alt=""></td>
        <td colspan="3" rowspan="2">
            <img src="images/Hiphopperz.nl-designstore_05.gif" width="183" height="23" alt="" border="0"></td>
  <td>
            <img src="images/Hiphopperz.nl-designstore_06.gif" width="42" height="1" alt="" border="0"></td>
        <td>
            <img src="images/spacer.gif" width="1" height="1" alt="" border="0"></td>
    </tr>
    <tr>
        <td colspan="6" rowspan="6">
            <img src="images/Hiphopperz.nl-designstore_07.gif" width="559" height="133" alt="" border="0"></td>
        <td>
            <img src="images/spacer.gif" width="1" height="22" alt="" border="0"></td>
    </tr>
    <tr>
        <td colspan="4">
            <img src="images/Hiphopperz.nl-designstore_08.gif" width="184" height="20" alt="" border="0"></td>
  <td>
            <img src="images/spacer.gif" width="1" height="20" alt=""></td>
    </tr>
    <tr>
        <td colspan="4">
            <img src="images/Hiphopperz.nl-designstore_09.gif" width="184" height="23" alt="" border="0"></td>
  <td>
            <img src="images/spacer.gif" width="1" height="23" alt="" border="0"></td>
    </tr>
    <tr>
        <td colspan="4">
            <img src="images/Hiphopperz.nl-designstore_10.gif" width="184" height="22" alt="" border="0"></td>
  <td>
            <img src="images/spacer.gif" width="1" height="22" alt=""></td>
    </tr>
    <tr>
        <td colspan="4">
            <img src="images/Hiphopperz.nl-designstore_11.gif" width="184" height="23" alt="" border="0"></td>
  <td>
            <img src="images/spacer.gif" width="1" height="23" alt=""></td>
    </tr>
    <tr>
        <td colspan="4">
            <img src="images/Hiphopperz.nl-designstore_12.gif" width="184" height="23" alt="" border="0"></td>
  <td>
            <img src="images/spacer.gif" width="1" height="23" alt=""></td>
    </tr>
    <tr>
        <td colspan="6">
            <img src="images/Hiphopperz.nl-designstore_13.gif" width="271" height="18" alt=""></td>
        <td colspan="4" rowspan="2" background="images/Hiphopperz.nl-designstore_14.gif"><div align="right"><span class="stijl1"><font size=2><a href="?p=contact">Meld je snel aan als artiest op HipHopperz!</a>!</font></div></td>
<td>
            <img src="images/spacer.gif" width="1" height="18" alt=""></td>
    </tr>
    <tr>
        <td width="1" height="434" rowspan="2" bgcolor="#FFFFFF">
            <img src="images/spacer.gif" width="1" height="434" alt=""></td>
        <td colspan="5">
            <img src="images/Hiphopperz.nl-designstore_16.gif" width="270" height="2" alt=""></td>
        <td>
            <img src="images/spacer.gif" width="1" height="2" alt=""></td>
    </tr>
    <tr>
        <td width="1" height="432" bgcolor="#141414">
            <img src="images/spacer.gif" width="1" height="432" alt=""></td>
        <td width="1" height="432" bgcolor="#FFFFFF">
            <img src="images/spacer.gif" width="1" height="432" alt=""></td>
        <td width="737" height="432" colspan="4" bgcolor="#141414" valign="top"><table border='0' cellspacing='1' width='100%' bgcolor='#000' align='center'> 
    <tr> 
        <td class='top' colspan='2'> <b>
<b>Statistieken</b> </font></b></td>
    </tr>
    <tr>
        <td class='inhoud'>


<center><font size=2>Leden: <b><?php echo $members; ?></b> | </font> <? include("include/bez.php"); ?>
              <? include("include/stats.php"); ?></center>


</td>
</tr>
</table>

<table width="100%" border="0">
              <tr>
                <td width="52%"><table width="100%" border="0" cellpadding="1" cellspacing="1">
                    <tr>
                      <td height="21" background="images/barboven.gif"><font color=#fff000> ~ 5 Nieuwste Tracks</font></td>
                    </tr>
                    <tr>
                             <td bgcolor="#9f00c1" valign="top"><?
                    $top10 = "SELECT * FROM  `raptracks` ORDER BY id DESC LIMIT 0,5";
                    $nieuwste =  mysql_query($top10) or die (mysql_error());
                    while ($list = mysql_fetch_object($nieuwste)) {
                    $nieuw = $list->id;
                    $nieuwer = "<font color=#fff000><b>»</b>&nbsp;<font color=#fff000><a href='?p=afspelen&id=$list->id'>$list->naam</a></font><BR>";
                    
                    echo "$nieuwer";
                    }
                    ?>
                      </td>
                    </tr>
                </table></td>
                <td width="52%"><table width="100%" border="0" cellpadding="1" cellspacing="1">
                  <tr>
                    <td height="21" background="images/barboven.gif"><font color=#fff000> ~ 5 Nieuwste Clips</font></td>
                  </tr>
                  <tr>
                    <td bgcolor="#9f00c1" valign="top"> <?
    $video = "SELECT * FROM `rapvideos` ORDER BY id DESC LIMIT 0,5";
    $clips = mysql_query($video) or die (mysql_error());
    while ($clipjes = mysql_fetch_object($clips)){
    print"<font color=#fff000><b>»</b>&nbsp;<font color=#fff000><a href=\"?p=video&id=$clipjes->id\">$clipjes->naam<BR></a></font>
  ";
    }
    ?>
                    </td>
                  </tr>
                </table></td></font>

<BR>
<table width="99%" height="429" border="0" align="center" cellpadding="3" cellspacing="3">
          <tr>
            <td width="23%" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
              <tr>
                <td height="21" background="images/barboven.gif" class="stijl1"><span class="stijl2"> ~ NAVIGATIE</span></td>
              </tr>
              <tr>
                <td bgcolor="#9f00c1"><p class="stijl3">                                  <a href="?page=home">&raquo; Home</a><br>
              <a href="?p=crew">&raquo; Crew</a><br>
              <a href="?p=contact">&raquo; Contact</a><br>           
              <a href="?p=poll">&raquo; Poll</a><br>   
     <a href="?p=alleinterviews">&raquo; Interview Archief<font color=red><b>NEW</font></b></a><br>     
     <a href="?p=livevid">&raquo; Live Meekijken?<font color=red><b>NEW</font></b></a><br>    

              <a href="?p=mp3lijst">&raquo; MP3Upload lijst <font color=red><b>NEW</font></b></a><br>           
              <a href="?p=nieuwstetracks">&raquo; Nieuwste Tracks</a><br>
              <a href="?p=nieuwsteclips">&raquo; Nieuwste Videoclips</a><br>
              <a href="?p=toptracks">&raquo; Top 100 Tracks</a><br>
          <a href="?p=topclips">&raquo; Top 100 Videoclips</a><br>
              <a href="?p=allevideoclips">&raquo; Alle Videoclips</a><br>
              <a href="?p=allelyrics">&raquo; Alle Lyrics</a><br>
              <a href="?p=mixtapes">&raquo; Download Mixtapes</a>
<BR><font size=2>              <a target="_blank" href="artiestenlogin/"><b><font color=gold>&raquo; Artiesten Login</font></b></a></font>
<BR><BR>
              <a target="_blank" href="http://lsjdesigns.nl">&raquo; <b>Website laten maken</b></a>
<BR>
              <a target="_blank" href="http://hiphopperznl.hyves.nl">&raquo; <b><font color=gold>HipHopperz @ Hyves</font></b></a>
                </p>                </td>
              </tr>
            </table>
              <br>
 <table width="100%" border="0" cellpadding="0" cellspacing="0">
              <tr>
                <td height="21" background="images/barboven.gif" class="stijl1"><strong class="stijl2"> ~ Memberpaneel</strong></td>
              </tr>
              <tr>
                <td bgcolor="#9f00c1" class="stijl3"> 
<table align=center width=100%>Soms moet je 2 keer inloggen.<BR>
<form name="form1" method="post" action="?p=login"> <center>
      <tr><td width=100>Gebruikersnaam:<BR><input type="text" onfocus="if(this.value=='')this.value=''" onblur=" if(this.value=='')this.value=''" name="login" maxlength=16 style="width: 150;" value=""><BR>Wachtwoord:<BR><input type="password" onfocus="if(this.value=='')this.value=''" onblur=" if(this.value=='')this.value=''"name="pass" maxlength=16 style="width: 150;" value="">
<input type="submit" class="submit" style="width: 100;" value="Inloggen" name="invoer"></td></tr>
      </center></form>

</table><BR></center>
<center><a href="?p=login&x=lostpass">Wachtwoord vergeten?</a>    </center>
<BR><center><a href="?p=register"><font size=2><font color=gold><b>Registreren</b></font></font></a>    </center>
</body>


</html>
    </td>
              </tr>
            </table>
<BR>

            <table width="100%" border="0" cellpadding="0" cellspacing="0">
              <tr>
                <td height="21" background="images/barboven.gif" class="stijl1"><strong class="stijl2"> ~ ARTIESTEN</strong></td>
              </tr>

              <tr>
                <td bgcolor="#9f00c1" class="stijl3"><?
                                                        if(!(@mysql_connect("db.hiphopperz.nl","***","***") && @mysql_select_db("***"))) {
                                                        print"Geen connectie tot de mysal database.";
                                                        die;
                                                          }
                                                        
                                                         $select = "SELECT * FROM rappers ORDER by naam ASC";

                                                        $query = mysql_query($select) or die (mysql_error());
                                                        while ($list = mysql_fetch_object($query)) {
                                                            $nieuw = $list->nieuw;
    if($nieuw == 1){
    $nieuwer = "<img src='images/nieuw.gif' border='0'>";
    }
    else{
    $nieuwer = "";
    }
                                                        
                                                        echo "&raquo; <A href=\"?p=artiest&x=".$list->naam."&id=".$list->id."\">".$list->naam." $nieuwer</a><BR>";
                                                        }
                                                        ?>       </td>
              </tr>
            </table></td>
            <td width="100%" valign="top"><table width="100%" border="0" cellpadding="1" cellspacing="1">
              <tr>
                <td height="21" background="images/barboven.gif" class="stijl1"><span class="stijl2"> ~ Welkom op HipHopperz.nl!</span></td>
              </tr>
              <tr>
                <td bgcolor="#9f00c1">
                   <?php 
if (empty($_GET['p'])) { 
$p = "home"; 
} 
else { 
$p = $_GET['p']; 
} 
$p2 = "content/$p.php"; 
if (file_exists($p2)) { 
  include("$p2"); 
} 
else { 
  echo "Blijkbaar heb je een verkeerde link aangeklikt, klik op vorige om verder te gaan."; 
} 
?>

                </td>
              </tr>
            </table>
               <BR>   <table width="100%" border="0" cellpadding="1" cellspacing="1">
              <tr>
                <td height="21" background="images/barboven.gif" class="stijl1"><span class="stijl2"> ~ Advertentie</span></td>
              </tr>
              <tr>
                <td bgcolor="#9f00c1">
<?php include("ad2.php"); ?>

                </td>
              </tr>
            </table>

            <br>
            </table><td width="1" height="432" bgcolor="#FFFFFF">
            <img src="images/spacer.gif" width="1" height="432" alt=""></td>
        <td width="1" height="432" bgcolor="#141414">
            <img src="images/spacer.gif" width="1" height="432" alt=""></td>
        <td width="1" height="432" bgcolor="#FFFFFF">
            <img src="images/spacer.gif" width="1" height="432" alt=""></td>
        <td>
            <img src="images/spacer.gif" width="1" height="432" alt=""></td>
    </tr>
    <tr>
        <td colspan="10" background="images/Hiphopperz.nl-designstore_23.gif"></td>
<td>
            <img src="images/spacer.gif" width="1" height="20" alt=""></td>
    </tr>
    <tr>
        <td>
            <img src="images/spacer.gif" width="1" height="1" alt=""></td>
        <td>
            <img src="images/spacer.gif" width="1" height="1" alt=""></td>
        <td>
            <img src="images/spacer.gif" width="1" height="1" alt=""></td>
        <td>
            <img src="images/spacer.gif" width="181" height="1" alt=""></td>
        <td>
            <img src="images/spacer.gif" width="42" height="1" alt=""></td>
        <td>
            <img src="images/spacer.gif" width="45" height="1" alt=""></td>
        <td>
            <img src="images/spacer.gif" width="469" height="1" alt=""></td>
        <td>
            <img src="images/spacer.gif" width="1" height="1" alt=""></td>
        <td>
            <img src="images/spacer.gif" width="1" height="1" alt=""></td>
        <td>
            <img src="images/spacer.gif" width="1" height="1" alt=""></td>
        <td></td>
    </tr>
</table>

</body>
</html>

<? 
} 
?>

Untitled PHP (3-Sep @ 04:28)

Syntax Highlighted Code

  1. <?php
  2. error_reporting("E_ALL");
  3. echo "HIA DEWD";
  4. ?>

Plain Code

<?php
error_reporting("E_ALL");
echo "HIA DEWD";
?>

Untitled PHP (31-Aug @ 20:05)

Syntax Highlighted Code

  1. <?php
  2.  
  3. echo "hello";
  4.  
  5. ?>

Plain Code

<?php

echo "hello";

?>

Untitled PHP (9-Aug @ 07:50)

Syntax Highlighted Code

  1. <?php
  2.  
  3.  
  4. ?>

Plain Code

<?php


?>

Untitled PHP (30-Jul @ 21:31)

Syntax Highlighted Code

  1. if(isset($_GET['test']))
  2.  

Plain Code

if(isset($_GET['test']))

Untitled PHP (26-Jul @ 01:13)

Syntax Highlighted Code

  1. <?php
  2. echo "test";
  3. ?>

Plain Code

<?php
echo "test";
?>

Untitled PHP (26-Jul @ 01:01)

Syntax Highlighted Code

  1. <?php
  2.  
  3. echo 'hello';
  4.  
  5. ?>

Plain Code

<?php

echo 'hello';

?>

Untitled PHP (21-Jul @ 22:46)

Syntax Highlighted Code

  1. ÅŸi,l,

Plain Code

ÅŸi,l,

Untitled PHP (19-Jul @ 21:33)

Syntax Highlighted Code

  1. <?php
  2.  
  3. function omzetten($i)
  4. {
  5. [98 more lines...]

Plain Code

<?php

function omzetten($i)
{

    $eenheden = array('nul',
                      '&eacute;&eacute;n',
                      'twee',
                      'drie',
                      'vier',
                      'vijf',
                      'zes',
                      'zeven',
                      'acht',
                      'negen');
    
    $tientallen = array(1 => 'tien',
                      2 => 'twintig',
                      3 => 'dertig',
                      4 => 'veertig',
                      5 => 'vijftig',
                      6 => 'zestig',
                      7 => 'zeventig',
                      8 => 'tachtig',
                      9 => 'negentig');
    
    $tientallen_bijzonder = array(11 => 'elf',
                      12 => 'twaalf',
                      13 => 'dertien',
                      14 => 'veertien',
                      15 => 'vijftien',
                      16 => 'zestien',
                      17 => 'zeventien',
                      18 => 'achttien',
                      19 => 'negentien');
    
    $honderdtallen = array(1 => 'honderd',
                      2 => 'tweehonderd',
                      3 => 'driehonderd',
                      4 => 'vierhonderd',
                      5 => 'vijfhonderd',
                      6 => 'zeshonderd',
                      7 => 'zevenhonderd',
                      8 => 'achthonderd',
                      9 => 'negenhonderd');
    
    $duizendtallen = array(1 => 'duizend',
                           2 => 'tweeduizend',
                           3 => 'drieduizend',
                           4 => 'vierduizend',
                           5 => 'vijfduizend',
                           6 => 'zesduizend',
                           7 => 'zevenduizend',
                           8 => 'achtduizend',
                           9 => 'negenduizend');

                        $i='0000'.$i;    
            $duizend = substr($i, -4, 1);
            $honderd = substr($i, -3, 1);
            $tien = substr($i, -2, 1);
            $een = substr($i, -1, 1);
            
            $getal = '';
            if($duizend != 0)
                $getal = $duizendtallen[$duizend];
            
            if($honderd != 0)
                $getal .= $honderdtallen[$honderd];
            
            if(substr($i,-2) <= 10)
            {
                if($een != 0)
                    $getal .= $eenheden[$een];
                if($een != 0 && $tien != 0)
                    $getal .= 'en';
                
            }
            if(substr($i,-2) >= 20 || substr($i,-2) == 10)
            {
                if($een != 0)
                    $getal .= $eenheden[$een];
                if($een != 0 && $tien != 0)
                    $getal .= in_array(substr($eenheden[$een],-1),array('a','e','i','o','u')) ? '&euml;n' : 'en';
                if($tien != 0)
                    $getal .= $tientallen[$tien];
            }
            else
            {
                $getal .= $tientallen_bijzonder[substr($i,-2)];
            }
                return $i == 0 ? 'nul' : $getal;
}

for($i = 0; $i <= 9999; $i ++)
{
    
    echo omzetten($i)."\n";
    
}


?>

Untitled PHP (18-Jul @ 18:39)

Syntax Highlighted Code

  1. <?php
  2.  
  3. function omzetten($i)
  4. {
  5. [244 more lines...]

Plain Code

<?php

function omzetten($i)
{

    $eenheden = array('nul',
                      '&eacute;&eacute;n',
                      'twee',
                      'drie',
                      'vier',
                      'vijf',
                      'zes',
                      'zeven',
                      'acht',
                      'negen');
    
    $tientallen = array(1 => 'tien',
                      2 => 'twintig',
                      3 => 'dertig',
                      4 => 'veertig',
                      5 => 'vijftig',
                      6 => 'zestig',
                      7 => 'zeventig',
                      8 => 'tachtig',
                      9 => 'negentig');
    
    $tientallen_bijzonder = array(11 => 'elf',
                      12 => 'twaalf',
                      13 => 'dertien',
                      14 => 'veertien',
                      15 => 'vijftien',
                      16 => 'zestien',
                      17 => 'zeventien',
                      18 => 'achttien',
                      19 => 'negentien');
    
    $honderdtallen = array(1 => 'honderd',
                      2 => 'tweehonderd',
                      3 => 'driehonderd',
                      4 => 'vierhonderd',
                      5 => 'vijfhonderd',
                      6 => 'zeshonderd',
                      7 => 'zevenhonderd',
                      8 => 'achthonderd',
                      9 => 'negenhonderd');
    
    $duizendtallen = array(1 => 'duizend',
                           2 => 'tweeduizend',
                           3 => 'drieduizend',
                           4 => 'vierduizend',
                           5 => 'vijfduizend',
                           6 => 'zesduizend',
                           7 => 'zevenduizend',
                           8 => 'achtduizend',
                           9 => 'negenduizend');
    
    switch($i)
    {
        
        case strlen($i) == 4:
            $duizend = substr($i, -4, 1);
            $honderd = substr($i, -3, 1);
            $tien = substr($i, -2, 1);
            $een = substr($i, -1, 1);
            
            $getal = '';
            
            if($duizend != 0)
            {
                
                $getal = $duizendtallen[$duizend];
                
            }
            
            if($honderd != 0)
            {
                
                $getal .= $honderdtallen[$honderd];
                
            }
            
            if(substr($i,-2) <= 10)
            {

                if($een != 0)
                {
                    
                    $getal .= $eenheden[$een];
                    
                }
                if($een != 0 && $tien != 0)
                {
                    
                    $getal .= 'en';
                    
                }
                
            }
            if(substr($i,-2) >= 20 || substr($i,-2) == 10)
            {

                if($een != 0)
                {
                    
                    $getal .= $eenheden[$een];
                    
                }
                if($een != 0 && $tien != 0)
                {
                    
                    $getal .= in_array(substr($eenheden[$een],-1),array('a','e','i','o','u')) ? '&euml;n' : 'en';
                    
                }
                if($tien != 0)
                {
                    
                    $getal .= $tientallen[$tien];
                    
                }
                
            }
            else
            {
                
                $getal .= $tientallen_bijzonder[substr($i,-2)];
                
            }
        break;
        
        case strlen($i) == 3:
            $honderd = substr($i, -3, 1);
            $tien = substr($i, -2, 1);
            $een = substr($i, -1, 1);
            
            $getal = '';
            
            if($honderd != 0)
            {
                
                $getal = $honderdtallen[$honderd];
                
            }
            
            if(substr($i,-2) <= 10)
            {

                if($een != 0)
                {
                    
                    $getal .= $eenheden[$een];
                    
                }
                if($een != 0 && $tien != 0)
                {
                    
                    $getal .= 'en';
                    
                }
                
            }
            if(substr($i,-2) >= 20 || substr($i,-2) == 10)
            {

                if($een != 0)
                {
                    
                    $getal .= $eenheden[$een];
                    
                }
                if($een != 0 && $tien != 0)
                {
                    
                    $getal .= in_array(substr($eenheden[$een],-1),array('a','e','i','o','u')) ? '&euml;n' : 'en';
                    
                }
                if($tien != 0)
                {
                    
                    $getal .= $tientallen[$tien];
                    
                }
                
            }
            else
            {
                
                $getal .= $tientallen_bijzonder[substr($i,-2)];
                
            }
        break;
        
        case strlen($i) == 2:
            $tien = substr($i, -2, 1);
            $een = substr($i, -1, 1);
            
            $getal = '';
            
            if($i >= 20 || $i == 10)
            {

                if($een != 0)
                {
                    
                    $getal = $eenheden[$een];
                    
                }
                if($een != 0 && $tien != 0)
                {
                    
                    $getal .= in_array(substr($eenheden[$een],-1),array('a','e','i','o','u')) ? '&euml;n' : 'en';
                    
                }
                if($tien != 0)
                {
                    
                    $getal .= $tientallen[$tien];
                    
                }
                
            }
            else
            {
                
                $getal = $tientallen_bijzonder[$i];
                
            }
        break;
        
        case strlen($i) == 1:
            $een = substr($i, -1, 1);
            
            $getal = $eenheden[$een];
        break;
        
    }
    
    return $i == 0 ? 'nul' : $getal;
    
}

for($i = 9999; $i <= 9999; $i ++)
{
    
    echo omzetten($i).'<br />';
    
}


?>

Untitled PHP (18-Jul @ 16:55)

Syntax Highlighted Code

  1. <?php
  2.  
  3. function omzetten($i)
  4. {
  5. [164 more lines...]

Plain Code

<?php

function omzetten($i)
{

    $eenheden = array('nul',
                      'een',
                      'twee',
                      'drie',
                      'vier',
                      'vijf',
                      'zes',
                      'zeven',
                      'acht',
                      'negen');
    
    $tientallen = array(1 => 'tien',
                      2 => 'twintig',
                      3 => 'dertig',
                      4 => 'veertig',
                      5 => 'vijftig',
                      6 => 'zestig',
                      7 => 'zeventig',
                      8 => 'tachtig',
                      9 => 'negentig');
    
    $tientallen_bijzonder = array(11 => 'elf',
                      12 => 'twaalf',
                      13 => 'dertien',
                      14 => 'veertien',
                      15 => 'vijftien',
                      16 => 'zestien',
                      17 => 'zeventien',
                      18 => 'achttien',
                      19 => 'negentien');
    
    $honderdtallen = array(1 => 'honderd',
                      2 => 'tweehonderd',
                      3 => 'driehonderd',
                      4 => 'vierhonderd',
                      5 => 'vijfhonderd',
                      6 => 'zeshonderd',
                      7 => 'zevenhonderd',
                      8 => 'achthonderd',
                      9 => 'negenhonderd');
    
    switch($i)
    {
        
        case strlen($i) == 3:
            $honderd = substr($i, 0, 1);
            $tien = substr($i, 1, 1);
            $een = substr($i, 2, 1);
            
            $getal = '';
            
            if($honderd != 0)
            {
                
                $getal = $honderdtallen[$honderd];
                
            }
            
            if(substr($i,1,2) <= 10)
            {

                if($een != 0)
                {
                    
                    $getal .= $eenheden[$een];
                    
                }
                if($een != 0 && $tien != 0)
                {
                    
                    $getal .= 'en';
                    
                }
                
            }
            if(substr($i,1,2) >= 20 || substr($i,1,2) == 10)
            {

                if($een != 0)
                {
                    
                    $getal .= $eenheden[$een];
                    
                }
                if($een != 0 && $tien != 0)
                {
                    
                    $getal .= in_array(substr($eenheden[$een],-1),array('a','e','i','o','u')) ? '&euml;n' : 'en';
                    
                }
                if($tien != 0)
                {
                    
                    $getal .= $tientallen[$tien];
                    
                }
                
            }
            else
            {
                
                $getal .= $tientallen_bijzonder[substr($i,1,2)];
                
            }
        break;
        
        case strlen($i) == 2:
            $tien = substr($i, 0, 1);
            $een = substr($i, 1, 1);
            
            $getal = '';
            
            if($i >= 20 || $i == 10)
            {

                if($een != 0)
                {
                    
                    $getal = $eenheden[$een];
                    
                }
                if($een != 0 && $tien != 0)
                {
                    
                    $getal .= in_array(substr($eenheden[$een],-1),array('a','e','i','o','u')) ? '&euml;n' : 'en';
                    
                }
                if($tien != 0)
                {
                    
                    $getal .= $tientallen[$tien];
                    
                }
                
            }
            else
            {
                
                $getal = $tientallen_bijzonder[$i];
                
            }
        break;
        
        case strlen($i) == 1:
            $een = substr($i, 0, 1);
            
            $getal = $eenheden[$een];
        break;
        
    }
    
    return $i == 0 ? 'nul' : $getal;
    
}

for($i = 0; $i <= 1; $i ++)
{
    
    echo omzetten($i).'<br />';
    
}


?>

Untitled PHP (16-Jul @ 07:53)

Syntax Highlighted Code

  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3.  
  4.  
  5. [43 more lines...]

Plain Code

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">


<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Untitled Document</title>
<script type="text/javascript" src="http://www.liveband.com.au/music/js/audio-player.js"></script>
<script type="text/javascript">  
     AudioPlayer.setup("http://www.liveband.com.au/music/player.swf", {  
         width:"333",  
         initialvolume:"100",
         remaining:"yes",
         buffer:"5",
         bg:"201606",
         text:"000000",
         leftbg:"201606",
         lefticon:"7F6A4C",
         volslider:"7F6A4C",
         voltrack:"ffecd0",
         rightbg:"201606",
         rightbghover:"201606",
         righticon:"7F6A4C",
         righticonhover:"E9B432",
         track:"7F6A4C",
         loader:"e9b432",
         border:"201606",
         tracker:"e9b432",
         skip:"ae9b85",
         pagebg:"FFFFFF",
         transparentpagebg:"yes"  
     });  
</script>

</head>

<body>


<div id="audioplayer_1">Alternative content</div>
<script type="text/javascript">  AudioPlayer.embed("audioplayer_1", {  soundFile: "http://www.shopnuevaforma.com/media/audio/masmod_axiom/landing-strip.mp3,http://www.shopnuevaforma.com/media/audio/masmod_axiom/hyperventilate.mp3,http://www.shopnuevaforma.com/media/audio/masmod_axiom/eichler.mp3,http://www.shopnuevaforma.com/media/audio/masmod_axiom/phntm-rspr8r.mp3,http://www.shopnuevaforma.com/media/audio/masmod_axiom/memory-duct.mp3,http://www.shopnuevaforma.com/media/audio/masmod_axiom/wind-turbine.mp3,http://www.shopnuevaforma.com/media/audio/masmod_axiom/orbit.mp3,http://www.shopnuevaforma.com/media/audio/masmod_axiom/sharpest-grin.mp3,http://www.shopnuevaforma.com/media/audio/masmod_axiom/asphalt.mp3,http://www.shopnuevaforma.com/media/audio/masmod_axiom/lithograph.mp3",  titles: "Landing Strip,Hyperventilate,Eichler,Phntm Rspr8r,Memory Duct,Wind Turbine,Orbit Around A Sphere,Sharpest Grin,Asphalt,Lithograph",  artists: "Masmöd,Masmöd,Masmöd,Masmöd,Masmöd,Masmöd,Masmöd,Masmöd,Masmöd,Masmöd", autostart: "no", loop: "yes", animation:"no"  });  </script>



</body>
</html>

Untitled PHP (15-Jul @ 20:48)

Syntax Highlighted Code

  1. <?php
  2.  
  3. echo "hello world!";
  4.  
  5. ?>

Plain Code

<?php 

echo "hello world!";

?>

Untitled PHP (10-Jul @ 13:02)

Syntax Highlighted Code

  1. <?php
  2. echo "test";
  3.  
  4. ?>

Plain Code

<?php
echo "test";

?>

Untitled PHP (29-Jun @ 16:59)

Syntax Highlighted Code

  1. <?php
  2.  
  3. echo "fuck you";
  4.  
  5. ?>

Plain Code

<?php 

echo "fuck you";

?>

Untitled PHP (13-Jun @ 14:40)

Syntax Highlighted Code

  1.  
  2. class CaptchaImage {
  3.  
  4. [68 more lines...]

Plain Code

session_start();
 
class CaptchaImage {
 
    var $font = 'monofont.ttf';
     private $width     = "120";
    private $height = "40";
    private $tekens = "6";
     
    private function maakCode() {
        
        $tekens = 'abcdfghjkmnpqrstvwxyz123456789';
        
        $code = '';
        $i = 0;
        while ($i < 6) { 
            
            $code.= substr($tekens, mt_rand(0, strlen($tekens)-1), 1);
            $i++;
            
        }
        return $code;
        
    }
    
    public function CaptchaImage() {
           
        $code = $this->maakCode();
        
        /* font size will be 75% of the image height */
        $font_size     = $this->height * 0.75;
        $image         = imagecreate($this->width, $this->height);
        
        //De kleuren van de afbeelding aanamken
        $background_color     = imagecolorallocate($image, 255, 255, 255);
        $text_color         = imagecolorallocate($image, 20, 40, 100);
        $noise_color         = imagecolorallocate($image, 100, 120, 180);
              
        //Creeëren van de puntjes op de achtergrond
        for( $i=0; $i<($this->width * $this->height) / 3; $i++) {
            
            imagefilledellipse($image, mt_rand(0,$this->width), mt_rand(0,$this->height), 1, 1, $noise_color);
            
        }
              
        //Creeëren van de lijnen op de achtergrond
        for( $i=0; $i<($this->width * $this->height) / 150; $i++) {
            
            imageline($image, mt_rand(0,$this->width), mt_rand(0,$this->height), mt_rand(0,$this->width), mt_rand(0,$this->height), $noise_color);
        
        }
              
        //Creeëren van een tekstbox en de tekst er in plaatsen
        $textbox     = imagettfbbox($font_size, 0, $this->font, $code);
        $x             = ($this->width - $textbox[4])/2;
        $y             = ($this->height - $textbox[5])/2;
        
        imagettftext($image, $font_size, 0, $x, $y, $text_color, $this->font , $code);
              
        //De afbeelding naar de browser doorsturen en deze laten aanmaken
        header('Content-Type: image/jpeg');
        imagejpeg($image);
        imagedestroy($image);
        $_SESSION['security_code'] = $code;
        
    }
 
}
 
$captcha = new CaptchaImage();

?>
<img src="captcha.php" alt="captcha">

Untitled PHP (2-Jun @ 12:37)

Syntax Highlighted Code

  1. <?=isset($page)?$page:show_404()?>

Plain Code

<?=isset($page)?$page:show_404()?>

Untitled PHP (28-May @ 17:21)

Syntax Highlighted Code

  1. /*
  2.  
  3.                 CONNECTION DIAGRAM
  4.  
  5. [547 more lines...]

Plain Code

/*

                CONNECTION DIAGRAM

                      ------
                PB0 -|1   40|- PA0    
                PB1 -|2   39|- PA1    
                PB2 -|3   28|- PA2    
                PB3 -|4   37|- PA3    
                PB4 -|5   36|- PA4    
                PB5 -|6   35|- PA5    
                PB6 -|7   34|- PA6
                PB7 -|8   33|- PA7
                RESET -|9   32|- AREF
                VCC -|10  31|- GND
                GND -|11  30|- AVCC
              XTAL2 -|12  29|- PC7    UCNT1
              XTAL1 -|13  28|- PC6    UCNT2
                PD0 -|14  27|- PC5    UCNT3
    USARTTX        PD1 -|15  26|- PC4    LVL1
      APOLLOEN    PD2 -|16  25|- PC3    LVL2
    MDIR        PD3 -|17  24|- PC2    LVL3
    MSEL0        PD4 -|18  23|- PC1    LVL4
    MSEL1        PD5 -|19  22|- PC0
    PWMOUT        PD6 -|20  21|- PD7    HERMESEN
                      ------

*/


#include <avr/io.h>
#include <util/delay.h>
#include <stdio.h>
#include <inttypes.h>

#define BAUD 9600
#define MYUBRR F_CPU/16/BAUD-1

#define RAMPTIME        3000    // PWM ramping time (ms)
#define RAMPINTERVAL    300        // PWM ramping interval (ms)

#define LVL4            PC1    // Nivåbryter nivå 4
#define LVL3            PC2    // Nivåbryter nivå 3
#define LVL2            PC3    // Nivåbryter nivå 2
#define LVL1            PC4    // Nivåbryter nivå 1
#define UCNT3            PC5    // Enhetsteller nivå 3
#define UCNT2            PC6    // Enhetsteller nivå 2
#define UCNT1            PC7    // Enhetsteller nivå 1
#define SENSINPUTPIN    PINC // Porten sensorene er koblet til
#define SENSDDR            DDRC // Dataretningsregister for sensorer 

#define TEMP0    1            // Temperaturkanal 1
#define TEMP1    2            // Temperaturkanal 2
#define TEMP2    3            // Temperaturkanal 3
#define TEMP3    4            // Temperaturkanal 4

#define DOOR1    PA5            // Dørbryter 1
#define DOOR2    PA6            // Dørbryter 2
#define DOOR3    PA7            // Dørbryter 3
#define DOORPIN    PINA        // Porten dørbryterne er koblet til

#define HERMESEN    PD7        // Hermes enable
#define APOLLOEN    PD2        // Apollo enable
#define UCPORT        PORTD     // Porten enable-utgangene er på

#define MDIR        PD3        // Motor direction
#define MSEL0        PD4        // Motor selection bit0
#define MSEL1        PD5        // Motor selection bit1
#define PWMOUT        PD6        // Motor PWM channel
#define MOTORPORT    PORTD     // Porten motordriveren er koblet til
#define MOTORDDR    DDRD    // Dataretningsregister for motorport
#define HOME        4

#define HIS        PA0            // Aktiveringsbryter for bordet
#define HISPIN    PINA         // Porten aktiveringsbryteren står på

#define EMPTY 0

#define FORWARD 1
#define REVERSE 0
#define UP         1
#define DOWN    0

#define BOUNCELIMIT    30        // Avprelleingsteller grenseverdi

int sensecnt = 0;            // Avprellingsteller
int holdflag=0;                // Hold-flagg for avprelling

int lvlcnt1 = 1;            // Enhetsteller for nivå 1
int lvlcnt2 = 1;            // Enhetsteller for nivå 2
int lvlcnt3 = 1;            // Enhetsteller for nivå 3

int curtemp0 = 1023;        // Temperaturvariabel for nivå 1
int curtemp1 = 1023;        // Temperaturvariabel for nivå 2
int curtemp2 = 1023;        // Temperaturvariabel for nivå 3
int curtemp3 = 1023;        // Temperaturvariabel for nivå 4

int picklvl = EMPTY;
int motor = 1;
int motordir = FORWARD;

////////////////////////////////////////////////////////////////////////////////////////////////////////////////

/*
    Les inn verdi fra ADC-omforming
    @param int chan - Hvilken ADC-kanal det skal leses fra.
*/
int readADC (int chan){
    int i;
    int ADC_temp;
    int ADCx = 0;
        
    ADMUX  = chan; // Velg kanal

    ADMUX |= (1 << REFS0);                 // Sett referanse til AVCC med ekstern kodensator på AREF
    ADMUX &= ~(1<<REFS1);
    ADCSRA |= (1<<ADPS2)|(1<<ADPS0);     // Sett /16 presacling
    ADCSRA |= (1<<ADEN);                 // Aktiver ADCen

    for(i=0;i<8;i++) {                     // Kjør 8 omforminger av signalet, og bruk gjennomsnittet
        ADCSRA |= (1<<ADSC);             // Kjør en enkel omforming
        while(!(ADCSRA & 0x10));         // Vent til omformingen er ferdig. (ADIF-flagget settes)
        ADC_temp = ADCL;                 // Les nedre del av SAR-registeret
        ADC_temp += (ADCH<<8);             // Legg til øvre del av SAR-registert. (Dette må skiftes 8 plasser)
        ADCx += ADC_temp;                // Akkumuler verdien
    }
    ADCx = (ADCx>>3);                    // Del på 8 (Finn gjennomsnittsverdien)

    ADCSRA &= ~(1<<ADEN);                 // Deaktiver ADCen
    return ADCx;                        // Returner ADC-verdien

}

/*
    USART Initialiseringsrutine
    @param unsigned int baud - Overføringshastigheten
*/
void USARTInit( unsigned int baud ){
    
    UBRR0H = (unsigned char) (baud>>8);            // Sett overføringshastigheten
    UBRR0L = (unsigned char) baud;
    
    UCSR0B = (1<< TXEN0);                        // Aktiver USART-sendemodul
    UCSR0C = (1<<USBS0)|(1<<UCSZ01)|(1<<UCSZ00);// Sett rammeformat til: 1 start-, 8 data- og 2 stoppbit

}
/*
    USART Sending av ett tegn
    @param unsigned char data - Tegnet som skal sendes
*/
void USARTTransmitByte( unsigned char data ){
    
    while (!(UCSR0A & (1<<UDRE0)));    // Vent til USART-modulen er klar for sending
    UDR0 = data;                     // Start overføringen
}

/*
    USART Sending av tekststreng
    @param const char *str - Peker til hvilken streng som skal sendes
*/
void USARTTransmit(const char *str){
    while(*str) {
        USARTTransmitByte((unsigned char)(*str));
        str++;
    }
    USARTTransmitByte(0x04); // Send stopp-byte (EOT)
}

/*
    USART Initialiseringsrutine    
*/
void PWMInit(void){
    // Setter COM0A1 = 1, COM0A0 = 0 i TCCR0A => Clear OC0A on Compare Match, SET OC0A at BOTTOM (Non-Inverting mode)
    // Setter WGM01 = 1, WGM00 = 1 i TCCR0A, og WGM02 = 0 i TCCR0B => Fast-PWM mode        
    TCCR2A |= (0<<COM2B1) | (0<<COM2B0)| (1<<WGM21) | (1<<WGM20);
    TCCR2B &= ~(1<<WGM22);
    TCCR2B |= (1<<CS20); // Ingen skalering av PWM-frekvensen

    // Sett dataretning på de benyttede pinnene til ut.
    MOTORDDR |= (1<<PWMOUT) | (1<<MSEL1) | (1<<MSEL0) | (1<<MDIR);

}

/*
    Acpreller en puls fra en sensor/bryter
    @param unsigned int sens - Referanse til hvilken sensor som skal avprelles
    @param volatile uint8_t *port - Referanse til hvilken port sensoren er koblet på
*/
int debounce_pulse(unsigned int sens, volatile uint8_t *port){
int returnvar = 0;

    while(*port & (1<<sens)){
        sensecnt++;

        if(sensecnt >= BOUNCELIMIT){
            returnvar = 1;
        }
    }

    sensecnt=0;
    
    return returnvar;    
}

/*
    Avpreller en sensor/bryter som holdes inne
    @param unsigned int sens - Referanse til hvilken sensor som skal avprelles
    @param volatile uint8_t *port - Referanse til hvilken port sensoren er koblet på
*/
int debounce_hold(unsigned int sens, volatile uint8_t *pin) {
int returnvar = 0;

    if(holdflag){
        if(!(*pin & (1<<sens))){
            holdflag=0;
        }
    } else {
        if(*pin & (1<<sens)){
            _delay_us(500);
            if(*pin & (1<<sens)){
                returnvar = 1;
                holdflag=1;
            }
        }
    }

    return returnvar;
}

/*
    Lagrer temperaturer i "nåværende temperatur"-variabler
*/
void readtemps(){
    curtemp0 = readADC(TEMP0);
    curtemp1 = readADC(TEMP1);
    curtemp2 = readADC(TEMP3);
    curtemp3 = readADC(TEMP3);
}


/*
    Finner kaldeste nivå
    @returns int - Returnerer en referanse til det kaldeste nivået
*/
int getcoldestlevel(){
    int min = 1023;
    int coldest = 1;
    
    if(curtemp1 < min && lvlcnt1 > 0){
        coldest = 1;
        min = curtemp1;
    }


    if(curtemp2 < min && lvlcnt2 > 0){
        coldest = 2;
        min = curtemp2;
    }

    if(curtemp3 < min && lvlcnt3 > 0){
        coldest = 3;
        min = curtemp3;
    }

    return coldest;
}



/*
    Initialisering av dataretningsregisteret for sensorene    
*/
void SensorInit(){
    SENSDDR = 0x01; // Sett alle pinner på port C til innganger.
}

/*
    Sender systemstatus til Hermes via USART
*/
void SerialSendStatus(){

    char usarttext[40];
    int n;

    readtemps();            
    n=sprintf(usarttext,"T1%dT2%dT3%dC1%dC2%dC3%d", curtemp1, curtemp2, curtemp3, lvlcnt1, lvlcnt2, lvlcnt3);                        
    USARTTransmit(usarttext);
    
}

/*
    Initialisering av motor
    @param unsigned int motor - Hvilken motor som skal kjøres
    @param unsigned in direction - Hvilken retning motoren skal rotere i
*/
void motor_init(unsigned int motor, unsigned int direction){
    // Velg motor
    if(motor == 0){
        MOTORPORT &= ~(1<<MSEL0);    // 0
        MOTORPORT &= ~(1<<MSEL1);    // 0
    } else if (motor == 1){
        MOTORPORT |= (1<<MSEL0);    // 1
        MOTORPORT &= ~(1<<MSEL1);    // 0
    } else if (motor == 2){
        MOTORPORT &= ~(1<<MSEL0);    // 0
        MOTORPORT |= (1<<MSEL1);    // 1
    } else if (motor == 3){
        MOTORPORT |= (1<<MSEL0);    // 1
        MOTORPORT |= (1<<MSEL1);    // 1
    }

    if(direction){                // Sett retningen motoren skal kjøre
        MOTORPORT |= (1<<MDIR);
    } else {
        MOTORPORT &= ~(1<<MDIR);
    }    

}

/*
    Setter hastigheten (pådraget) til motorene
    @param unsigned int speed - Hastigheten i prosent av fullt pådrag
*/
void motor_setspeed(unsigned int speed){
    OCR2B = (255*speed)/100;
}

/*
    Start motoren
*/
void motor_start(){
    TCCR2A |= (1<<COM2B1);

}

/*
    Stopp motoren
*/
void motor_stop(){
    TCCR2A &= ~(1<<COM2B1);

}

/*
    Øker pådraget til motorene gradvis (såkalt ramping)
*/
void motor_rampup(){
    //int i = 1;
    for(int i = 1;i<=100;i++){
        _delay_ms(10);
        motor_setspeed((255*i)/100); // Kalkuler pådragsverdi fra prosentverdi.
    }
}

/*
    Reduserer pådraget til motorene gradvis (såkalt ramping)
*/
void motor_rampdown(){
    for(int i = 100;i>=1;i--){
        _delay_ms(10);
        motor_setspeed((255*i)/100); // Kalkuler pådragsverdi fra prosentverdi.
    }
}

/*
    Kjør heisen til ønsket nivå
    @param unsigned int level - Hvilket nivå heisen skal kjøre til
*/
void elevator_goto(unsigned int level){
    unsigned int dir;

    if(level < HOME){
        dir = DOWN;
    } else {
        dir = UP;
    }

    motor_init(level, dir);
    motor_setspeed(60);
    motor_start();
    
    while(1){
        if(level == 1){
            if(debounce_hold(LVL1, &SENSINPUTPIN)){
                break;    
            }
        } else if (level == 2){
            if(debounce_hold(LVL2, &SENSINPUTPIN)){
                break;    
            }
        } else if (level == 3){
            if(debounce_hold(LVL3, &SENSINPUTPIN)){
                break;    
            }
        } else if (level == HOME){
            if(debounce_hold(LVL3, &SENSINPUTPIN)){
                break;
            }
        }
    }
            
    motor_stop();
}

/*
    Roter et gitt nivå
    @param unsigned int level - Hvilket nivå som skal roteres
    @param unsigned int direction - Hvilken retnings skal nivået roteres i
    @param unsigned int duration - Hvor lenge skal nivået rotere. (0 for uendelig).
*/
void rotatelevel(unsigned int level, unsigned int direction, unsigned int duration){
    // Initialiser motoren med riktige verdier
    motor_init(level, direction);

    motor_setspeed(0); // Start motoren med 0 i pådrag
    motor_start();


    // Gradvis økning av pådrag (ramping) i 100*10ms = 1 sekund
    motor_rampup();

    // Motoren kjører nå på fullt pådrag

    if(duration > 0){
        _delay_ms(duration);

        // Gradvis redusering av pådrag i 1 sekund
        motor_rampdown();

        motor_setspeed(0);
        motor_stop();
    }

}

/*
    Starter dispenseringen av en enhet
    @param unsigned int level - Hvilket nivå det skal hentes en enhet fra
*/
void dispenseunit(unsigned int level){

    elevator_goto(level);

    UCPORT |= (1<<APOLLOEN); // Aktiver Apollo (Lyseffekter)
    
    rotatelevel(level, FORWARD, 5000);
    
    elevator_goto(HOME);

    UCPORT &= ~(1<<APOLLOEN); // Deaktiver Apollo (Lyseffekter)
}

/*
    Starter påfyllingsmodus for et gitt nivå
    @param unsigned int level - Hvilket nivå skal gå i påfyllingsmodus
    @param unsigned int sens - Hvilken sensor/bryter som skal avbryte påfyllingen
    @param volatile uint8_t *port - Hvilken port sensoren/bryteren er koblet til
*/
void startrefillmode(unsigned int level, unsigned int sens, volatile uint8_t *port){
    rotatelevel(level, FORWARD, 0);    // Roter nivået kontinuerlig
    int count = 0;

    while(debounce_hold(sens, port)){
        // Øk antallet enheter i hvertnivå når en enhet blir satt inn
        if(level == 1){
            if(debounce_pulse(UCNT1, &SENSINPUTPIN)){
                lvlcnt1++;
                count = 1;
            }
        } else if(level == 2){
            if(debounce_pulse(UCNT2, &SENSINPUTPIN)){
                lvlcnt2++;
                count = 1;
            }
        } else if(level == 3){
            if(debounce_pulse(UCNT3, &SENSINPUTPIN)){
                lvlcnt3++;
                count = 1;
            }
        }
        
        // Dersom en enhetsteller har økt, gi beskjed til Hermes.
        if(count){
            SerialSendStatus();
            count = 0;
        }    

    }

    // Stopp rotasjonen av platået når døren lukkes

    motor_rampdown();
    motor_setspeed(0);
    motor_stop();

}

/*
    HÃ¥ndtering av sensorer
*/
void handle_sensors(){

    if(debounce_hold(DOOR1, &DOORPIN)){ // Dersom dør 1 er åpnet...
        startrefillmode(1, DOOR1, &DOORPIN);             // ... start påfyllingsmodus i nivå 1
    }

    if(debounce_hold(DOOR2, &DOORPIN)){ // Dersom dør 1 er åpnet...
        startrefillmode(2, DOOR2, &DOORPIN);             // ... start påfyllingsmodus i nivå 1
    }

    if(debounce_hold(DOOR3, &DOORPIN)){ // Dersom dør 1 er åpnet...
        startrefillmode(3, DOOR3, &DOORPIN);             // ... start påfyllingsmodus i nivå 1
    }

    if(debounce_pulse(HIS, &HISPIN)){     // Dersom sensoren i bordplaten aktiveres...
        dispenseunit(getcoldestlevel());     // ... start dispenseringen av en enhet
    }


}

/*
    Hovedprogram
*/
int main(void){    
    
    USARTInit(MYUBRR);     // Initialiser USART
    PWMInit();             // Initialiser PWM
    SensorInit();        // Initialiser sensorport
    
    DDRA = 0x00;         // Alle pinner i port A settes til innganger.
    //ADCInit() ; // Init ADC

    //DDRD = 0xFF;     // Port D datadir: All out.


    UCPORT |= (1<<HERMESEN); // Enable Hermes

    int i=0;    

    for(;;){
        if(i++ >= 2000){ // Send status til Hermes ved jevne mellomrom.
            SerialSendStatus();
            i=0;
        }

        handle_sensors(); // HÃ¥ndter sensoraktivering/brytertrykk

    }

}

Untitled PHP (27-May @ 19:34)

Syntax Highlighted Code

  1. sfsdfsdfsfd

Plain Code

sfsdfsdfsfd

Untitled PHP (19-May @ 13:44)

Syntax Highlighted Code

  1. if($i="1") {
  2. $toto = "vas y ";
  3. }

Plain Code

if($i="1") {
$toto = "vas y ";
}

Untitled PHP (16-May @ 14:10)

Syntax Highlighted Code

  1. // Top of page.
  2. <?php include("forums/SSI.php"); ?>
  3.  
  4.  
  5. [18 more lines...]

Plain Code

// Top of page.
<?php include("forums/SSI.php"); ?>


// Huge fucking mess excuse for a smf news ssi puller.
<?php

$array = ssi_boardNews(26, 4, null, null, 'array');

    foreach ($array as $news)
    {
        echo '  
            <font face="Verdana"><b>', $news['subject'], '</b><br /><font size="1"><b>Posted On:</b> ', $news['time'], ' <b>By:</b> ', $news['poster']['link'], '<br /> 
                <font size="2"> ', $news['body'], '<br /><br /></font><font size="1">
                ', $news['link'], ' | ', $news['new_comment'], ' 
            <br /></font></font>';

        if (!$news['is_last'])
            echo '
            <br /><br />';
    }

?>

Untitled PHP (15-May @ 12:59)

Syntax Highlighted Code

  1. $subject = "Inregistrare Targul Agricol";
  2. $body = 'Pentru activarea contului dumneavoastra va rugam sa dati click <a href="http://'.$_SERVER['HTTP_HOST'].'/activare.php?key='.$codConfirmare.'">aici</a>!';
  3. $from = "office@targulagricol.ro";
  4.  
  5. [4 more lines...]

Plain Code

$subject = "Inregistrare Targul Agricol";
$body = 'Pentru activarea contului dumneavoastra va rugam sa dati click <a href="http://'.$_SERVER['HTTP_HOST'].'/activare.php?key='.$codConfirmare.'">aici</a>!';
$from = "office@targulagricol.ro";

$mail = new MailB(array('to' => $data['email'],'from' => $from,'subject' => $subject,'body' => $body));
//$mail->debug();
$mail->send();                                  

Untitled PHP (12-May @ 17:27)

Syntax Highlighted Code

  1. <?php
  2. echo "Blaa";
  3. ?>

Plain Code

<?php
echo "Blaa";
?>

Untitled PHP (5-May @ 03:03)

Syntax Highlighted Code

  1. <?php defined('SYSPATH') OR die('No direct access allowed.');
  2.  
  3. class Ask_Model extends Model
  4. {
  5. [34 more lines...]

Plain Code

<?php defined('SYSPATH') OR die('No direct access allowed.');

class Ask_Model extends Model
{
    protected $table_name = 'cbs_ask';

    public static function factory()
    {
        return new Ask_Model();
    }

    public function  __construct()
    {
        parent::__construct();
    }

    public function get_all()
    {
        $sql = "SELECT * FROM ".$this->table_name;

        return $this->db->query($sql)->result();
    }
    
    public function get_by_person($person_id)
    {
        $sql = "SELECT * FROM ".$this->table_name." WHERE is_public = 1 AND person_id = ".(int)$person_id;

        return $this->db->query($sql)->result();
    }

    public function insert($data)
    {
        $data['dt_create'] = date("Y-m-d H:i:s");

        $query = $this->db->insert($this->table_name, $data);

        return $query->insert_id();
    }
}

Untitled PHP (29-Apr @ 18:39)

Syntax Highlighted Code

  1. <?php
  2.  
  3. echo "hello world";
  4.  
  5. ?>

Plain Code

<?php

echo "hello world";

?>

Untitled PHP (22-Apr @ 12:33)

Syntax Highlighted Code

  1. <?php
  2.  
  3. /**
  4.  * @author shubby
  5. [70 more lines...]

Plain Code

<?php

/**
 * @author shubby
 * @copyright 2008
 */

session_start();
require_once("includes/tpl/Smarty.class.php");    
require('includes/tpl/SmartyPaginate.class.php');
$tpl = new Smarty;
$tpl->template_dir = 'templates';
$tpl->compile_dir  = 'templates_c/';
$tpl->config_dir   = 'configs/';
$tpl->cache_dir    = 'cache/';
$smarty->caching = true;

SmartyPaginate::reset();
SmartyPaginate::connect();
SmartyPaginate::setLimit(5);
SmartyPaginate::setPageLimit(5);


include("includes/config.php");

$var = explode("/", $_SERVER['REQUEST_URI']);
$link = string_to_filename(RemoveXSS($var[2]));


if($link != "" && $var[1] == "news") {

    $sql2 = "SELECT * FROM fritz_news WHERE news_link='$link'";
    $query = mysql_query($sql2);
    $result = mysql_affected_rows();
    
    if($result) {

        $row = mysql_fetch_array($query);
        $news_data = array('id' => $row[0], 'title' => stripslashes($row[1]), 'link' => stripslashes($row[2]), 'date' => cleanupdate($row[3]), 'message' => stripslashes($row[4]));
        
        $tpl->assign('news', $news_data);
        $tpl->assign('one_post', 'true');
        $tpl->display('home.tpl');
        
} else {
    $tpl->assign('error', 'The requested news post could not be found.');
    $tpl->display('error.tpl');
}

} else {

$sql = "SELECT SQL_CALC_FOUND_ROWS * FROM fritz_news ORDER BY news_date DESC LIMIT " . SmartyPaginate::getCurrentIndex() . ", " . SmartyPaginate::getLimit();

$result = mysql_query($sql);

$query = mysql_query("SELECT FOUND_ROWS() as total");
$row = mysql_fetch_array($query);
SmartyPaginate::setTotal($row['total']);
   
$news_data = array();

   for($i = 0; $i < mysql_num_rows($result); ++$i) {
      $news_data[$i] =  array('id' => mysql_result($result, $i, 'id'),
                           'title' => stripslashes(mysql_result($result, $i, 'news_title')),
                           'link' => stripslashes(mysql_result($result, $i, 'news_link')),
                           'date' => cleanupdate(mysql_result($result, $i, 'news_date')),
                           'message' => stripslashes(mysql_result($result, $i, 'news_message')));
   }
   SmartyPaginate::assign($tpl);
   $tpl->assign('news', $news_data);
   $tpl->assign('rss', 'true');
   $tpl->display('home.tpl');

}
?>

Untitled PHP (22-Apr @ 02:46)

Syntax Highlighted Code

  1. <?php
  2.  
  3.  
  4.  
  5. [138 more lines...]

Plain Code

<?php



$MailToAddress = "simon@boasfalas.com.br"; // your email address

$redirectURL = "b-resposta.html"; // the URL of the thank you page.



# optional settings

$MailSubject = "[Boas Falas - Visitante do Site]"; // the subject of the email

$MailToCC = ""; // CC (carbon copy) also send the email to this address (leave empty if you dont use it)

# in the $MailToCC field you can have more then one e-mail address like "a@yoursite.com, b@yoursite.com, c@yoursite.com"



# If you are asking for a name and an email address in your form, you can name the input fields "name" and "email".

# If you do this, the message will apear to come from that email address and you can simply click the reply button to answer it.

# You can use this scirpt to submit your forms or to receive orders by email.



# If you have a multiple selection box or multiple checkboxes, you MUST name the multiple list box or checkbox as "name[]" instead of just "name"

# you must also add "multiple" at the end of the tag like this: <select name="myselectname[]" multiple>

# you have to do the same with checkboxes



# This script was written by George A. & Calin S. from Web4Future.com

# There are no copyrights in the sent emails.



# SPAMASSASSIN RATING: 0.4



# DO NOT EDIT BELOW THIS LINE ==================================================================

# ver. 1.5

$w4fMessage = "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\"><html><head><title>$MailSubject</title><meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\"></head><body>";

if (count($_GET) >0) {

    reset($_GET);

    while(list($key, $val) = each($_GET)) {

        $GLOBALS[$key] = $val;

        if (is_array($val)) {

            $w4fMessage .= "<b>$key:</b> ";

            foreach ($val as $vala) {

                $vala =stripslashes($vala);

                $w4fMessage .= "$vala, ";

            }

            $w4fMessage .= "<br>";

        }

        else {

            $val = stripslashes($val);

            if (($key == "Submit") || ($key == "submit")) { }

            else {     if ($val == "") { $w4fMessage .= "$key: - <br>"; }

                    else { $w4fMessage .= "<b>$key:</b> $val<br>"; }

            }

        }

    } // end while

}//end if

else {

    reset($_POST);

    while(list($key, $val) = each($_POST)) {

        $GLOBALS[$key] = $val;

        if (is_array($val)) {

            $w4fMessage .= "<b>$key:</b> ";

            foreach ($val as $vala) {

                $vala =stripslashes($vala);

                $w4fMessage .= "$vala, ";

            }

            $w4fMessage .= "<br>";

        }

        else {

            $val = stripslashes($val);

            if (($key == "Submit") || ($key == "submit")) { }

            else {     if ($val == "") { $w4fMessage .= "$key: - <br>"; }

                    else { $w4fMessage .= "<b>$key:</b> $val<br>"; }

            }

        }

    } // end while

    }//end else

$w4fMessage = "<font face=verdana size=2>".$w4fMessage."</font></body></html>";

if (!mail($MailToAddress, $MailSubject, $w4fMessage, "From: $name <$email>\r\nReply-To: $name <$email>\r\nMessage-ID: <". md5(rand()."".time()) ."@". ereg_replace("www.","",$_SERVER["SERVER_NAME"]) .">\r\nMIME-Version: 1.0\r\nX-Priority: 3\r\nX-Mailer: PHP/" . phpversion()."\r\nX-MimeOLE: Produced By Web4Future Easiest Form2Mail v1.5\r\nBCc: $MailToCC\r\nContent-Type: text/html; charset=UTF-8\r\nContent-Transfer-Encoding: 8bit\r\n")) { echo "Error sending e-mail!";}

else { header("Location: ".$redirectURL); }

?>

Untitled PHP (18-Apr @ 23:28)

Syntax Highlighted Code

  1. <?php
  2. echo 'coucou';
  3.  
  4. ?>

Plain Code

<?php
echo 'coucou';

?>

Export emails of phpbb3 (15-Apr @ 17:30)

desbest.myopenid.com

Syntax Highlighted Code

  1. <?php
  2. include ("../forum/config.php");
  3. mysql_connect("$dbhost", "$dbuser", "$dbpasswd") or die(mysql_error());
  4. mysql_select_db("$dbname") or die(mysql_error());
  5. [52 more lines...]

Plain Code

<?php
include ("../forum/config.php");
mysql_connect("$dbhost", "$dbuser", "$dbpasswd") or die(mysql_error());
mysql_select_db("$dbname") or die(mysql_error());



// Get all the data from the "example" table
$result = mysql_query("SELECT * FROM phpbb_users") 
or die(mysql_error());  


echo "

<table id=\"Table_01\" width=\"790\" height=\"122\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">

    <tr>
            <td background=\"http://hostingz.org/images/version2_01.png\"  width=\"790\" height=\"122\">
                          <div class=\"menuhere\">  </div> 
        
        </td>
        
    </tr>
    <tr><td>
    <div style=\"margin-left: 8px; margin-right:8px;\">
    <font size=\"+2\">This page shows all the emails of the members who joined your phpbb3 forum.</font>
    <br><br>
    ";
    while($row = mysql_fetch_array( $result )) {
        // Print out the contents of each row into a table
        if ($row['user_email'] != ""){
            echo $row['user_email']; echo "<br>";
        }
    }
   echo "
    
    </div>
    </td></tr></table>


";
/*
echo "<table border='1'>";
echo "<tr> <th>Name</th> <th>Age</th> </tr>";
// keeps getting the next row until there are no more to get
while($row = mysql_fetch_array( $result )) {
    // Print out the contents of each row into a table
    echo "<tr><td>"; 
    echo $row['username'];
    echo "</td><td>"; 
    echo $row['user_email'];
    echo "</td></tr>"; 
} 

echo "</table>";
*/
?>

Untitled PHP (14-Apr @ 20:10)

Syntax Highlighted Code

  1.  
  2.  
  3. if($_GET['mode'] == "editDA"){
  4.    $sql = "UPDATE `database` SET promovare = 'da'";
  5. [11 more lines...]

Plain Code



if($_GET['mode'] == "editDA"){
   $sql = "UPDATE `database` SET promovare = 'da'";
   $qry = mysql_query($sql);
}
if($_GET['mode'] == "editNU"){
   $sql = "UPDATE `database` SET promovare = 'nu'";
   $qry = mysql_query($sql);
}


 // [...]

<td><?php if($row['promovare'] == "da") print '<a href="?mode=editDA&id=3">DA</a>'; else print '<a href="?mode=editNU&id=3">NU</a>'; ?></td>
// [...]

Untitled PHP (14-Apr @ 20:06)

Syntax Highlighted Code

  1.  
  2. if($_GET['mode'] == "edit"){
  3.    $sql = "UPDATE `database` SET promovare = 'da'";
  4.    $qry = mysql_query($sql);
  5. [6 more lines...]

Plain Code


if($_GET['mode'] == "edit"){
   $sql = "UPDATE `database` SET promovare = 'da'";
   $qry = mysql_query($sql);
}


 // [...]

<td><a href="?mode=edit&id=3">DA</a></td>
// [...]

Untitled PHP (6-Apr @ 08:34)

Syntax Highlighted Code

  1. <?php
  2.  
  3. echo "ceci est un test";
  4. ?>

Plain Code

<?php

echo "ceci est un test";
?>

Untitled PHP (1-Apr @ 04:59)

Syntax Highlighted Code

  1. <?php
  2. /*
  3. function GetUserData(int $user_id);
  4. gets all data regarding the user in the Users column of the specified user_id
  5. [40 more lines...]

Plain Code

<?php
/*
function GetUserData(int $user_id);
gets all data regarding the user in the Users column of the specified user_id
*/
function GetUserData($uid){
    $sql    = "SELECT * FROM Users WHERE user_id = '$uid' LIMIT 1";
    $query    = mysql_query($sql) or die("Failed to get data<hr>".mysql_error());
    return (mysql_num_rows($query) > 0 ? mysql_fetch_assoc($query) : false);
}
/*
function clean_vars(@ref $variable)
Takes any given variable and passes by reference to update the structure of the
variable in a recursive manor, parsing out any escape attempts held within the
variable given.
*/
function clean_vars(&$var){
    if(is_array($var)){
        foreach($var as $k=>$v){
            clean_vars(&$v);
            $var[$k] = $v;
        }
    } else {
        $var = addslashes((get_magic_quotes_gpc() ? stripslashes($var) : $var));
    }
}
function BuildSelect($arr,$cur,$name,$id=''){
    $id = ($id != '' ? $id : $name);
    $data = '<select name="'.$name.'" id="'.$id.'">';
    foreach($arr as $k=>$v){
        $data .='<option value="'.$k.'"'.($k == $cur || $v == $cur ? ' selected="selected"' : '').'>'.$v.'</option>';
    }
    $data .= '</select>';
    return $data;
}
function GetCardTypes(){
    $data    = array();
    $sql    = "SELECT id,name FROM CreditCardTypes";
    $query    = mysql_query($sql) or die("Failed to get Card Types<hr>".mysql_error());
    while($row = mysql_fetch_array($query)){
        $data[$row[0]] = $row[1];
    }
    return $data;
}
?>

Spambot protection for phpbb3 (11-Mar @ 23:00)

desbest.myopenid.com

Syntax Highlighted Code

  1. ==============================
  2. Edit your phpBB forum template
  3. ucp_register.html
  4. ==============================
  5. [58 more lines...]

Plain Code

==============================
Edit your phpBB forum template
ucp_register.html
==============================
find this
=============
<!-- IF .profile_fields -->
    <tr> 
        <td class="row2" colspan="2"><span class="gensmall">{L_ITEMS_REQUIRED}</span></td>
    </tr>
<!-- ENDIF -->
=============
replace with
=============
<!-- IF .profile_fields -->
    <tr> 
        <td class="row2" colspan="2"><span class="gensmall">{L_ITEMS_REQUIRED}</span></td>
    </tr>
<!-- ENDIF -->
<tr>
    <td class="row1"><span class="gen">How much is 5+2 *</span></td>
    <td class="row2">
        <input type="text" class="post" style="width: 200px" name="math_question" size="6" maxlength="6" value="" />
    </td>
</tr>

==============================
Edit your registration file
includes/ucp/ucp_register.php
==============================
=============
find this
=============
// validate custom profile fields
$cp->submit_cp_field('register', $user->get_iso_lang_id(), $cp_data, $error);
=============
replace with
=============
            // validate custom profile fields
            $cp->submit_cp_field('register', $user->get_iso_lang_id(), $cp_data, $error);

            //desbest edit spambot detector
            //http://www.thesamet.com/blog/2006/12/21/fighting-spam-on-phpbb-forums/ (phpbb2)    
            if (!isset($_POST['math_question']) || $_POST['math_question'] != '7') {
            $error[] = $user->lang['CAKE'];
            $wrong_confirm = true;
            }
            //desbest edit ends

==============================
Edit the language file
language/en/common.php
==============================
=============
find this
=============
    'CONFIRM_CODE_WRONG'    => 'The confirmation code you entered was incorrect.',
=============
replace with
=============
    'CONFIRM_CODE_WRONG'    => 'The confirmation code you entered was incorrect.',
    'CAKE'                    => 'You answered the mathematical question incorrectly..',

Untitled PHP (3-Mar @ 21:34)

Syntax Highlighted Code

  1. <?
  2. ?>

Plain Code

<?
phpinfo();
?>

Untitled PHP (1-Mar @ 09:52)

Syntax Highlighted Code

  1. lire
  2.  

Plain Code

lire 
echo

Untitled PHP (26-Feb @ 14:28)

Syntax Highlighted Code

  1. asdf

Plain Code

asdf

Untitled PHP (26-Feb @ 11:54)

Syntax Highlighted Code

  1. <?
  2.  
  3. /*============================================================================*/
  4.  
  5. [277 more lines...]

Plain Code

<?

/*============================================================================*/

/* ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: */
/*                                                                                                       */
/*                                            HEADER PHP(V3.4)                                            */
/*                                                                                                       */
/*                                        GLUCONE© [16/03/2007]                                          */
/*                                                                                                       */
/* ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: */

//session_start();// démarage de la session

//*************************************************************************GESTION DES DIRECTORY

$dir[RACINE]='../';
$dir[CLIENTGCM]='';
$dir[BASICGCM]='';
$dir[VERSIONGCM]='';

//*************************************************************************INCLUDES

include("{$dir[RACINE]}includes/MY_DATA.PHP");//____________________________MY_DATA

//include("{$dir[RACINE]}includes/DETECTBROWSER.PHP");//____________________DETECTBROWSER

//********************************************************************LANGUAGE

//$admin_language='true';
include("{$dir[RACINE]}includes/LANGUE.PHP");//___________________________LANGUE

//*************************************************************************FONCTIONS

//include("{$dir[RACINE]}includes/FORMSFUNCTION.PHP");//____________________FROMSFUNCTION.PHP

//include("{$dir[RACINE]}includes/LOGFUNCTION.PHP");//______________________LOGFUNCTION.PHP

//include("{$dir[RACINE]}includes/LOGADMIN.PHP");//______________________LOGADMIN.PHP

include("{$dir[RACINE]}includes/LOGMEMBERS2.6.3.PHP");//______________________LOGMEMBERS.PHP

//include("{$dir[RACINE]}includes/MENUFUNCTION.PHP");//_____________________________MENU.PHP

//include("{$dir[RACINE]}includes/IMAGESFUNCTION.PHP");//__________________________IMAGESFUNCTION.PHP

//include("{$dir[RACINE]}includes/MAILING.PHP");//__________________________MAILING.PHP

//include("{$dir[RACINE]}includes/CHECKFUNCTION.PHP");//____________________CHECKFUNCTION.PHP

//*************************************************************************FONCTIONS

//*************************************************************************CLASSES

require_once ($dir[RACINE].'classes/gc.php');//_____________________________Classes Gestion du Cache

require_once ($dir[RACINE].'classes/mysql.php');//_____________________________Classes Mysql

//require_once ($dir[RACINE].'classes/navmysql.php');//_____________________________Classes Navigation Mysql

require_once ($dir[RACINE].'classes/date.php');//_____________________________Classes DATE

require_once ($dir[RACINE].'classes/calendrier+.php');//_____________________________Classes création de calendrier

//require_once ($dir[RACINE].'classes/formulaire.php');//_____________________________Classes création de formulaire

//require_once ($dir[RACINE].'classes/checkformulaire.php');//_____________________________Classes création de formulaire

//require_once ($dir[RACINE].'classes/logfile.php');//_____________________________Classes gestion des logs textes

//require_once ($dir[RACINE].'classes/logfilemysql.php');//_____________________________Classes gestion des logs dans une table mysql

require_once ($dir[RACINE].'classes/menugcm.php');//_____________________________Classes gestion des menus sur le site client avec un module one

//require_once ($dir[RACINE].'classes/url.php');//_____________________________Classes gestion des urls

//require_once ($dir[RACINE].'classes/mailer.php');//_____________________________Classes gestion des envois de mails

//require_once ($dir[RACINE].'classes/controlmysql.php');//_____________________________Classe de contrôle via MySQL

//*************************************************************************CLASSES


//*************************************************************************CLASSES GCM

//require_once ($dir[RACINE].'classes/classes_gcm/logadmin.php');//_____________________________Classes session gcm admin

//*************************************************************************CLASSES GCM

require_once ($dir[RACINE].'classes/arborescence.php');//_____________________________Aborescence

require_once ($dir[RACINE].'requires/config.php');//_____________________________CONFIG

//*************************************************************************REQUETES MYSQL
$CAT_nom='cat_nom'.$langue;
$ONE_titre = 'one_titre'.$langue;
$ONE_content='one_content'.$langue;
$ONE_titre='one_titre'.$langue;
$ONE_meta='one_extras_pageTitre'.$langue;
$ONE_metakw='one_extras_pageKeywords'.$langue;
$ONE_metadesc='one_extras_pageDescription'.$langue;
$table = 'TXTclinic';

// Nouvelle instance
$Bdd = new MySQL();

// Connection à la base de donnée & Et sélection de la base
if(!$link = $Bdd -> connect($mysql_host,$mysql_member,$mysql_memberpassw,$db)) die($Bdd->return_error());

//*********************************************************************
//****  Construction du sous-menu     *********************************
// Sous-Catégories depuis la cat "interventions" (id 7) --> sous-menu
$Query = "SELECT cat_ID,$CAT_nom FROM ".$table."_cat WHERE cat_check='y' AND cat_idcat != '0' ORDER BY cat_ordre";

// Envoi de la requete :
if(!$Result = $Bdd->Send_Query($Query,$link)) die($Bdd->return_error());

$submenucats = array();
while($arr = $Bdd -> get_array($Result, 'BOTH'))
{
    $submenucats[$arr['cat_ID']] = $arr[$CAT_nom];
}
// !empty($_GET["cat"]) ? $selected_subcat = $_GET["cat"] : $selected_subcat = "";
//**** END sous-menu **************************************************
//*********************************************************************

//*********************************************************************
//**** Récupération de la fiche courante ******************************
!empty($_GET["cat"]) ? $cat = $_GET["cat"] : $cat = 1;
if (empty($_GET["id"])) {
    $Query = "SELECT one_ID,one_cat,$ONE_content,$ONE_titre,one_datein,one_extras_scrolloption FROM ".$table." WHERE one_check = 'y' AND one_cat = ".$cat." ORDER BY one_ordre LIMIT 0,1";
}
else {
    $Query = "SELECT one_ID,one_cat,$ONE_content,$ONE_titre,one_datein,one_extras_scrolloption FROM ".$table." WHERE one_ID = ".$_GET["id"]." AND one_check = 'y' LIMIT 0,1";
}
if (!$Result = $Bdd->Send_Query($Query,$link)) die($Bdd->return_error());
if($Bdd->num_rows()>0) {
    $arr = $Bdd->get_array($Result, 'BOTH');
    $clinic = array();
    $clinic['id'] = $arr['one_ID'];
    $clinic['titre'] = $arr[$ONE_titre];
    $clinic['content'] = $arr[$ONE_content];
    $clinic['datein'] = $arr['one_datein'];
    $clinic['one_cat'] = $arr["one_cat"];
    $clinic['scroll'] = $arr["one_extras_scrolloption"];
    $clinic["scroll"] == 1 ? $scroll_suffix = "Scroll" : $scroll_suffix = "";
}
$fil = array();
ariane($Bdd,$table,$CAT_nom,$clinic['one_cat'],&$fil);
$selected_subcat = $fil[1]["id"];
//*************************************************************************REQUETES MYSQL



$MenuActif='2';
$bgID='3';

            
require("{$dir[RACINE]}requires/req_header.php");//____________________________HEADER

if ($clinic["scroll"] == 1) {
    echo '
        <script src="'.$dir[RACINE].'js/mootools-1.2.1-core.js" type="text/javascript" ></script>
        <script src="'.$dir[RACINE].'js/mootools-1.2-more.js" type="text/javascript" ></script>
        <script src="'.$dir[RACINE].'js/scroller.js" type="text/javascript" ></script>
    ';
}
        
echo' 

<style type="text/css">

</style>




 
 
</head>


<body class="bgBody'.$bgID.'" onload="MM_preloadImages(';
require("{$dir[RACINE]}requires/req_preload.php");//____________________________PRELOAD
echo');">

<table width="100%" height="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td>
    
    
    <!-- /SECTION MAIN CONTAINER -->
    <div id="mainContainer">
        
        <!-- /SECTION LANGUAGE ZONE -->';
            require ($dir[RACINE].'requires/req_language.php');//____________________________LANGUAGE
        echo'    
        <!-- SECTION LANGUAGE ZONE/ -->
        
    
    
        <!-- /SECTION MAIN CONTENT -->
        <div id="mainContent" class="bgMain'.$bgID.'">
            
            
                
            <!-- /SECTION LOGO -->';

                require ($dir[RACINE].'requires/req_logo.php');//____________________________LOGO

            echo'
            <!-- SECTION LOGO/ -->
                        
            
            
            <!-- /SECTION MENUS -->';
            
                require ($dir[RACINE].'requires/req_menus.php');//____________________________MENUS
        
            echo'                    
            <!-- SECTION MENUS/ -->
                        
            
            
            <!-- /SECTION INFO ZONE -->';
            
                require ($dir[RACINE].'requires/req_infos.php');//____________________________MENUS
        
            echo'                    
            <!-- SECTION INFO ZONE/ -->
                    
                    
            <!-- /SECTION CONTENT ZONE -->
               <div id="contentZone">
                
                <div class="contentTitle">
                    <h1>'.$TR["MainTitle_".$menuConfig[$MenuActif]].'</h1>
                </div>
                ';
                if (!empty($clinic)) {
                    echo'
                     <div id="contentDetail'.$scroll_suffix.'">
                         <h2>'.$clinic["titre"].'</h2>
                        '.$clinic["content"].'
                     </div>';
                     if ($clinic["scroll"] == 1) {
                    echo'
                <div id="contentScroller">
                    <a href="#" id="intvntScrollUp" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage(\'up\',\'\',\''.$dir[RACINE].'images/bt_scrollUp_rl.png\',1)"><img src="'.$dir[RACINE].'images/bt_scrollUp_up.png" alt="'.$TR[altScrollUp].'" title="'.$TR[altScrollUp].'" name="up" width="20" height="20" border="0"></a>
                    <a href="#" id="intvntScrollDown" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage(\'down\',\'\',\''.$dir[RACINE].'images/bt_scrollDw_rl.png\',1)"><img src="'.$dir[RACINE].'images/bt_scrollDw_up.png" alt="'.$TR[altScrollDw].'" title="'.$TR[altScrollDw].'" name="down" width="20" height="20" border="0"></a>
                </div>
                        ';
                }
                 }
                 echo' 
               </div>       
                
            <!-- SECTION CONTENT ZONE/ -->
            
            
        </div>
        <!-- SECTION MAIN CONTENT/ -->
    
    
    </div>
    <!-- SECTION MAIN CONTAINER/ -->
    
    
     <!-- /SECTION FOOTER -->';
            
        require ($dir[RACINE].'requires/req_footer.php');//____________________________FOOTER
                
    echo'    
    <!-- SECTION FOOTER/ -->
    
    
    </td>
  </tr>
</table>
</body>
</html>';
?>

Untitled PHP (24-Feb @ 07:55)

Syntax Highlighted Code

  1. <?php
  2. /**
  3.  * BS_Image
  4.  *
  5. [395 more lines...]

Plain Code

<?php
/**
 * BS_Image
 *
 * @version   0.80
 * @todo      Support données EXIF
 *            Fonctions de cropping
 */

class BS_Image
{

    /**
     * Chemin vers l'image
     *
     * @var string
     */
    public $path;

    /**
     * Image GD2
     *
     * @var ressource
     */
    public $res;

    /**
     * Largeur de l'image en px
     *
     * @var int
     */
    public $width;

    /**
     * Hauteur de l'image en px
     *
     * @var int
     */
    public $height;

    /**
     * Type mime de l'image
     *
     * @var string
     */
    public $mime;

    /**
     * Orientation de l'image : H pour Horizontale, V pour Vertciale et Sq pour Carrée
     *
     * @var string
     */
    public $orientation;

    /**
     * Types mime acceptés en entrée / sortie
     *
     * @var string
     */
    protected $_mimeAccepted = array ('image/jpeg', 'image/png', 'image/gif');

    /**
     * Liste des types mimes reconnus selon leur extension
     *
     * @var string
     */
    protected $_mimeTypes = array (
    'bmp'=>'image/bmp',
    'gif'=>'image/gif',
    'jpeg'=>'image/jpeg',
    'jpg'=>'image/jpeg',
    'jpe'=>'image/jpeg',
    'png'=>'image/png',
    'tiff'=>'image/tiff',
    'tif'=>'image/tiff',
    'xbm'=>'image/x-xbitmap'
    );
    /**
     * Mémoire approximative, en octets, devant être alloués pour ouvrir ou traiter l'image
     *
     * @var int
     */
    protected $_memImage;

    /**
     * Constructeur
     *
     * @param string $path    Chemin vers le fichier image
     */
    public function __construct($path)
    {
        $this->load($path);
    }

    /**
     * Charge une image
     * Permet de charger une nouvelle image que celle définie dans le constructeur
     *
     * @param string $path    Chemin vers le fichier image
     */
    public function load($path)
    {
        $this->path = $path;

        if (!file_exists($this->path))
        {
            throw new Exception(IMG_FILE_DONT_EXISTS);
        }
        else
        {
            $this->_getImageInfo($this->path);

        }

    }

    /**
     * Prepare l'image a subir des transformations
     *
     * @param string $path        Chemin de destination du fichier image, avec son extension
     *                            Laissé à NULL, la sortie se fera vers le navigateur
     * @param bool   $interlace   Indique si le fichier sera de type progressif ou non
     */
    public function prepare($path = NULL, $interlace = TRUE)
    {
        $this->_prepare($this->mime, $interlace);

        $this->mime = (is_null($path))?$this->mime:$this->_getMimeFromExtension($path);

        $this->path = (is_null($path))?$this->path:$path;

        if (file_exists($this->path))
        {
            throw new Exception(IMG_FILE_ALREADY_EXISTS);
        }

    }

    /**
     * Récupère l'orientation de l'image
     * L'information est également accessible via $this->orientation
     *
     * @return    string
     */
    public function getOrientation()
    {
        if ($this->width === $this->height)
        {
            return $this->orientation = 'Sq';
        }

        return $this->orientation = ($this->width > $this->height)?'H':'V';
    }

    /**
     * Redimentionne l'image selon un ratio de 0 à 100
     *
     * @param int $ratio    Ratio, en %
     */
    public function resizeRatio($ratio)
    {

        $newWidth = $this->width*$ratio/100;

        $newHeight = $this->height*$ratio/100;

        $this->_resize($newWidth, $newHeight);

    }

    /**
     * Force le redimentionnement de l'image selon une largeur définie
     * (determine la nouvelle hauteur)
     *
     * @param int $XForce    Nouvelle largeur
     */
    public function resizeForceWidth($XForce)
    {
        $newWidth = $XForce;

        $newHeight = $this->height/($this->width/$XForce);

        $this->_resize($newWidth, $newHeight);

    }

    /**
     * Force le redimentionnement de l'image selon une hauteur définie
     * (determine la nouvelle largeur)
     *
     * @param int $XForce    Nouvelle hauteur
     */
    public function resizeForceHeight($YForce)
    {
        $newWidth = $this->width/($this->height/$YForce);

        $newHeight = $YForce;

        $this->_resize($newWidth, $newHeight);
    }

    /**
     * Tourne l'image
     *
     * @param int $angle        Angle de rotation, en degré anti-horaire
     */
    public function rotate($angle)
    {
        $this->res = imagerotate($this->res, $angle, 0);
    }

    /**
     * Envoi l'image vers la sortie, selon le paramètre défini dans la mathode $this->prepare()
     * @param int     $opt    Pour une image JPG, qualité de sortie
     */
    public function output($opt = 100)
    {

        switch($this->mime)
        {
            case 'image/jpeg':
                imagejpeg($this->res, $this->path, $opt);
                break;

            case 'image/png':
                imagepng($this->res, $this->path);
                break;

            case 'image/gif':
                imagegif($this->res, $this->path);
                break;
        }

        imagedestroy($this->res);

    }

    /**
     * Récupère les informations hauteur / largeur et type Mime de l'image
     *
     * @param string $path    Chemin vers le fichier image
     */
    private function _getImageInfo($file)
    {
        $info = getimagesize($file);

        $this->width = $info[0];

        $this->height = $info[1];

        $this->mime = image_type_to_mime_type($info[2]);

        if (!in_array($this->mime, $this->_mimeAccepted))
        {
            throw new Exception(IMG_MIME_NOT_SUPPORTED);
        }

    }

    /**
     * Construit la ressource
     *
     * @param string    $mime        Mime type de la ressource
     * @param bool      $interlace    Image progressive ou non
     */
    private function _prepare($mime, $interlace)
    {

        $this->_getUsedMemory();

        switch($mime)
        {
            case 'image/jpeg':

                $this->res = imagecreatefromjpeg($this->path);

                break;

            case 'image/png':

                $this->res = imagecreatefrompng($this->path);

                break;

            case 'image/gif':

                $this->res = imagecreatefromgif($this->path);

                break;
        }

        imageinterlace($this->res, $interlace);

        if (!is_resource($this->res))
        {
            throw new Exception(IMG_UNKOWN_MIME_TYPE);
        }
    }

    /**
     * Détermine si une nouvelle opération est possible, en fonction de la mémoire disponible
     *
     * @param int $moreWidth    Utilisé dans le cas d'un resize
     * @param int $moreHeight   Utilisé dans le cas d'un resize
     */
    private function _getUsedMemory($moreWidth = 0, $moreHeight = 0)
    {
        $memUsed = memory_get_usage();

        $memLimit = (int)ini_get('memory_limit')*1024*1024;

        $memAvailable = $memLimit-$memUsed;

        $this->_memImage = $this->width*$this->height*5.8;

        if ($moreWidth && $moreHeight)
        {
            if (($moreWidth*$moreHeight*5.8) > $memAvailable)
            {
                throw new Exception(IMG_COMPUTE_MEMORY_LIMIT);
            }
        }

        if (($this->_memImage > $memAvailable))
        {
            throw new Exception(IMG_OPEN_MEMORY_LIMIT);
        }

    }

    /**
     * Création d'une nouvelle ressource image
     *
     * @param  int         $newWidth     Dimensions de l'image en px
     * @param  int         $newHeight
     * @return ressource
     */
    private function _imageCreateTrueColor($newWidth, $newHeight)
    {
        $this->_getUsedMemory($newWidth, $newHeight);

        return imagecreatetruecolor($newWidth, $newHeight);
    }

    /**
     * Réalise le redimentionnement
     *
     * @param  int         $newWidth     Dimensions de l'image en px
     * @param  int         $newHeight
     */
    private function _resize($newWidth, $newHeight)
    {
        $copyRes = $this->_imagecreatetruecolor($newWidth, $newHeight);

        imagecopyresampled($copyRes, $this->res, 0, 0, 0, 0, $newWidth, $newHeight, $this->width, $this->height);

        $this->res = $copyRes;

        $this->width = $newWidth;

        $this->height = $newHeight;

    }

    /**
     * Déduit le type mime du fichier image chargé, selon son extension
     * ! Ne récupère pas l'info dans le header, l'info est peu sûre !
     *
     * @param  string    Chemin du fichier
     */
    private function _getMimeFromExtension($file)
    {
        $file = explode('.', basename($file));

        if (count($file) > 1)
        {
            $extension = strtolower($file[count($file)-1]);
        }

        if (array_key_exists($extension, $this->_mimeTypes))
        {
            return $this->_mimeTypes[$extension];
        }
    }

    /**
     * Destructeur
     */
    public function __destruct()
    {
        if (is_resource($this->res))
        {
            imagedestroy($this->res);
        }
    }

}

?>

blah (23-Feb @ 22:01)

Syntax Highlighted Code

  1. <?php
  2.  $blah = "this really sucks " ;
  3.  
  4. print $blah ;
  5. [3 more lines...]

Plain Code

<?php 
 $blah = "this really sucks " ; 

print $blah ; 

?>

Untitled PHP (17-Feb @ 11:18)

Syntax Highlighted Code

  1. <?php phpinfo(); ?>

Plain Code

<?php phpinfo(); ?>

Untitled PHP (15-Feb @ 09:28)

brayn

Syntax Highlighted Code

  1. <?php
  2.     $title = "Listare tari";
  3.     $page_title = "Listare tari";
  4.  
  5. [23 more lines...]

Plain Code

<?php
    $title = "Listare tari";
    $page_title = "Listare tari";

    require_once '_includes.php';
    
    $sql = "SELECT * FROM `tari` WHERE 1";
    $qry = mysql_query($sql);

    if(mysql_num_rows($qry) != 0){
        while ($row = mysql_fetch_assoc($qry)) {
            $arrTari[$row['id_tara']] = $row['nume_tara'];
        }
    }    
    
    require_once '_header.php';    
?>

    <h2>Tari</h2>
    <ul>
        <?php
        foreach ($arrTari as $id => $tara) {
            print '<li>'.$tara.' - <a href="locatii.php?mode=editTara&tara='.$tara.'&id='.$id.'">Editeaza</a></li>';
        }
        ?>        
    </ul>

<?php require_once '_footer.php'; ?>

Convert a alpha numeric value to a decimal (8-Feb @ 19:08)

Syntax Highlighted Code

  1. <?php
  2.  
  3. // Convert a alpha numeric value to a decimal
  4.  
  5. [2 more lines...]

Plain Code

<?php

// Convert a alpha numeric value to a decimal

echo base_convert("shs78h",36,10);

?>

HTML Code Special Characters (5-Feb @ 15:30)

desbest.myopenid.com

Syntax Highlighted Code

  1. <?php
  2.  
  3. if ($_POST[htmlentities_decode]){
  4.     $original = $_POST[original];
  5. [64 more lines...]

Plain Code

<?php

if ($_POST[htmlentities_decode]){
    $original = $_POST[original];
    echo "<span style=\"background-color:yellow\">HTML Entities Decode
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 
    <a href=\"test.php\">Return to the form</a>
    </span><hr>";
    $html_entity_decode = html_entity_decode($original);
    echo "$html_entity_decode";
}


if ($_POST[theform]){
    $original = $_POST[output];
    
    echo "<h2>Nothing</h3>";
    echo $original;
    echo "<hr size=\"20\" color=\"#ffcc00\">";
    
    echo "<h2>HTML Special Chars</h2>
    <h3>Convert special characters to HTML entities</h3>
    <span style=\"background-color:yellow\"><br>
<br><i> * &amp; (ampersand) becomes '&amp;amp;'
    <br>* &quot; (double quote) becomes '&amp;quot;' when ENT_NOQUOTES is not set.
    <br>* &#039; (single quote) becomes '&amp;#039;' only when ENT_QUOTES is set.
    <br>* &lt; (less than) becomes '&amp;lt;'
    <br>* &gt; (greater than) becomes '&amp;gt;'
</i></span><br>
    ";
    
    $htmlspecialchars = htmlspecialchars($original);
    echo "$htmlspecialchars";
    echo "<hr size=\"20\" color=\"#ffcc00\">";
    
/*    echo "<h3>HTML Special Chars Decode</h3>";
    $htmlspecialchars_decode = htmlspecialchars_decode($original);
    echo "$htmlspecialchars_decode";
    echo "<hr size=\"20\" color=\"#ffcc00\">"; */

     echo "<h2>HTML Entities</h2>
     <h3>Convert all applicable characters to HTML entities </h3>";
    $htmlentities = htmlentities($original);
    echo "$htmlentities";
    echo "<hr size=\"20\" color=\"#ffcc00\">";

    echo "
    <form method=\"POST\" >
    <input type=\"hidden\" name=\"original\" value=\"$original\";>
    <br>
    <input type=\"submit\" value=\"View htmlentities_decode\" name=\"htmlentities_decode\">
    ";
}




if (!$_POST[theform] && !$_POST[htmlentities_decode]){
    echo "
    Use this form for html code.
    <br>
    <form method=\"POST\" >
    <textarea name=\"output\" style=\"width: 500px; height: 300px; background-color: #ffcc00;\"></textarea>
    <br>
    <input type=\"submit\" value=\"Submit form\" name=\"theform\">
    </form>
    ";
}
?>

html (4-Feb @ 13:55)

Syntax Highlighted Code

  1. <form method="post">
  2. <table width="100%">
  3.              <tr><td width="30%">ЯвлÑетÑÑ Ð¿Ð¾Ð´Ñ€Ð°Ð·Ð´ÐµÐ»Ð¾Ð¼ раздела:</td><td></td></tr>
  4.              <tr><td>Приоритет</td><td><input type="text" name="edit[PRIOR]" value="<? if(isset($edit['PRIOR'])) echo $edit['PRIOR'];?>"</td></tr>
  5. [6 more lines...]

Plain Code

<form method="post">
<table width="100%">
             <tr><td width="30%">ЯвлÑетÑÑ Ð¿Ð¾Ð´Ñ€Ð°Ð·Ð´ÐµÐ»Ð¾Ð¼ раздела:</td><td></td></tr>
             <tr><td>Приоритет</td><td><input type="text" name="edit[PRIOR]" value="<? if(isset($edit['PRIOR'])) echo $edit['PRIOR'];?>"</td></tr>
             <tr><td>Мета</td><td><input type="text" name="edit[META]" value="<?if(isset($edit['META'])) echo $edit['META'];?>"</td></tr>
             <tr><td>Ðазвание</td><td><input type="text" name="edit[NAME]" value="<?if(isset($edit['NAME'])) echo $edit['NAME'];?>"</td></tr>
             <tr><td>URL</td><td><input type="text" name="edit[URL]" value="<?if(isset($edit['URL'])) echo $edit['URL'];?>"</td></tr>
             <tr><td>Контент</td><td><?if(isset($edit['CONTENT'])) echo $edit['CONTENT']; else echo fcke('Данный раздел на Ñтадии заполнениÑ.', 'edit[CONTENT]')?></td></tr>
</table>
<input type="submit" name="btn" value="Сохранить">
</form>

Untitled PHP (3-Feb @ 20:41)

Syntax Highlighted Code

  1. <?php echo "Hello World!"; ?>
  2.  

Plain Code

<?php echo "Hello World!"; ?>

Untitled PHP (30-Jan @ 12:29)

Syntax Highlighted Code

  1. <?php
  2. echo 'bonjour'
  3. ?>

Plain Code

<?php
echo 'bonjour'
?>

Untitled PHP (29-Jan @ 05:53)

Syntax Highlighted Code

  1. <?php echo "test"; ?>

Plain Code

<?php echo "test"; ?>

Untitled PHP (28-Jan @ 16:08)

Syntax Highlighted Code

  1. function reoe($oer) {
  2.  

Plain Code

function reoe($oer) {

Zimplit Multi User v.1.2 (26-Jan @ 23:35)

desbest.myopenid.com

Syntax Highlighted Code

  1. <?php
  2.  
  3. /*
  4. Zimplit CMS version 1.2
  5. [1359 more lines...]

Plain Code

<?php

/*
Zimplit CMS version 1.2

Zimplit CMS is a Content Management System developed by
Welisa, Inc. Copyright (C) 2008 Welisa Inc zimplit@zimplit.org.

-- AVAILABLE LICENCE TYPES --

Zimplit CMS is available under three different licenses:

1) AGPL 3
You must keep a visible link to Zimplit Legal Notices, on every generated page. The required link to the Zimplit Legal Notices must be static, visible and readable, 
and the text in the Zimplit Legal Notices may not be altered.

2) Linkware / "Powered by Zimplit CMS" Link Requirement Licence
Same as AGPL, but instead of keeping a link to the Zimplit Legal Notices, you must place a static, visible and readable link to www.zimplit.org with the text or an
image stating "Powered by Zimplit CMS" on every generated page.

3) Commercial Licence
This license will allow you to remove the Zimplit Legal Notices/"Powered by Zimplit CMS" link at one specific domain. This license will also protect your modifications 
against the copyleft requirements in AGPL 3 and give access to registry in the user support forum.
Commercial licenses are available at www.zimplit.org/buy_commercial_license.html. 


You may change this LICENCE TYPES SECTION to relevant information, if you have purchased a commercial licence, 
but then the files may not be distributed to any other domain not covered by a commercial licence.

-- LICENCE TYPES SECTION END -

This copyright note must under no circumstances be removed from this file and any distribution of code covered by this licence.

For more information please visit http://www.zimplit.org

*/

header('Pragma: no-cache');
header('Cache-Control: no-store, no-cache, must-revalidate');
header('Cache-Control: post-check=0, pre-check=0', FALSE); 


/**
 * @param action: load - sends a html file content as response.
 * Use 'file' parameter to specify the HTML file.
 * 
 * Example: zimplit.php?action=load&file=page.html
 * 
 * 
 * @param action: save - saves a HTML source to a file.
 * Use 'file' parameter to specify the HTML file.
 * Use 'html' POST variable, to pass HTML source.
 * 
 * Example: zimplit.php?action=save&file=page.html;
 *             html="<html>....</html>"
 * 
 * 
 * @param action: new - creates a new empty html file.
 * Use 'file' parameter to specify the HTML file.
 * 
 * Example: zimplit.php?action=new&file=page.html
 * 
 * 
 * @param action: delete - deletes a file.
 * Use 'file' parameter to specify the file.
 * Note: if the file is not in the webroot directory, the folder must be specified
 * 
 * Example: zimplit.php?action=delete&file=page.html
 * Example: zimplit.php?action=delete&file=Z-files/page.html
 * 
 * 
 * @param action: upload - uploads a file to a server.
 * Use 'folder' parameter (optional) to specify the folder, where the uploaded file must be moved.
 * Use 'file' POST variable, to pass the file. input="file".
 * 
 * Example: zimplit.php?action=upload&folder=Z-pictures;
 *             file=[Binary stream].
 * 
 *
 * @param action: rename - renames a file.
 * Use 'oldname' parameter to specify the old name of the existing file.
 * Use 'newname' parameter to specify the new name of the file.
 * Note: if the file is not in the webroot directory, the folder must be specified
 * 
 * Example: zimplit.php?action=rename&oldname=oldpage.html&newname=newpage.html
 * 
 * 
 * @param action: changeuserpass - changes username & password data.
 * Use 'username' parameter to specify the new username of the existing file.
 * Use 'password' parameter to specify the new name of the file.
 * 
 * Example: zimplit.php?action=changeuserpass
 * Use 'username' POST variable, to pass the username.
 * Use 'password' POST variable, to pass the password.
 * 
 * 
 * @param action: generatenewpassword - generates a new password and sends it by email.
 * Use 'securitycode' parameter to pass a security code for email verification.
 * Example: zimplit.php?action=generatenewpassword
 * 
 * 
 * @param action: listfiles - returns a list of files in the webroot directory.
 * 
 * Example: zimplit.php?action=listfiles
 */

//GET data
$GDsupport = false; 
if (extension_loaded('gd') && function_exists('gd_info')) {
    $GDsupport = true; 
}
 
if (!isset($_GET['action'])){ $action = NULL; } else {$action = $_GET['action'];}
if (!isset($_GET['file'])){    $file = NULL;} else {$file = $_GET['file'];}
if (!isset($_GET['max_width'])){$max_width = NULL;} else {$max_width = $_GET['max_width'];}
if (!isset($_GET['max_height'])){$max_height = NULL;} else {$max_height = $_GET['max_height'];}
if (!isset($_GET['folder'])){$folder = NULL;} else {$folder = $_GET['folder'];}
if (!isset($_GET['oldname'])){$oldName = NULL;} else {$oldName = $_GET['oldname'];}
if (!isset($_GET['newname'])){$newName = NULL;} else {$newName = $_GET['newname'];}
if (!isset($_GET['title'])){$title = NULL;} else {$title = urldecode($_GET['title']);}
if (isset($_GET['securitycode'])){    $securityCode = $_GET['securitycode'];}
$indexFile = getIndexFile();


//POST data
if (!isset($_POST['html'])){$html = NULL;} else {$html = $_POST['html'];}
if (isset($_POST['username'])){$username = $_POST['username'];}
if (isset($_POST['password'])){$password = $_POST['password'];}
if (isset($_POST['password_again'])){$password_again = $_POST['password_again'];}
if (!isset($_POST['email'])){$email = NULL;} else {$email = $_POST['email'];}
if (!isset($_POST['remember'])){$remember = NULL;} else {$remember = $_POST['remember'];}

//Settings
$locationOfEditor = 'http://zimplit.org/editor/ver1_1/';
$settings['filesFolder'] = 'Z-files';
$settings['picturesFolder'] = 'Z-pictures';
$settings['scriptsFolder'] = 'Z-scripts';
$settings['loginHtmlFile'] = 'login.html';
$settings['registerHtmlFile'] = 'register.html';
$settings['passfile'] = 'security.php';
$settings['menufile'] = 'Zmenu.js';
$settings['reminderContent'] = "You have requested a new password for Your Zimplit web editor. \nUsername: [username]\nPassword: [password]";
$settings['confirmationContent'] = "To confirm password change of Your Zimplit editor visit link \n";
$settings['templates_remote_path_index'] = "http://zimplit.org/ztemplates/index.html";
$settings['templates_remote_path'] = "http://zimplit.org/ztemplates/";

//Local variables
$processRequest = false;

function writePassfileParam($parameter, $value) {
    global $settings;
    $content = file_get_contents($settings['passfile']);
    $fhandle = fopen($settings['passfile'], 'w');
    $matchNr = preg_match('/\$'.$parameter.'=\"([^\"]*)\"/', $content);
    if ($matchNr == 0) {
        $content = str_replace('?>', '$'.$parameter.'="'.$value.'"; ?>', $content);
    } else {
        $content = preg_replace('/\$'.$parameter.'=\"([^\"]*)\"/', '$'.$parameter.'="'.$value.'"', $content);
    }
    $r = fwrite($fhandle, $content);
    fclose($fhandle);
}

function readPassfileParam($parameter) {
    global $settings;
    $content = file_get_contents($settings['passfile']);
    preg_match('/\$'.$parameter.'=\"([^\"]*)\"/', $content, $matches);
    $result = $matches[1];
    return $result;
}

function writePassfile($username, $password, $email, $sessionId) {
    global  $settings;
    $fhandle = fopen($settings['passfile'], 'w');
    $content = '<?php $u="'.$username.'"; $p="'.md5($password).'"; $e="'.$email.'"; $s="'.$sessionId.'"; ?>';
    fwrite($fhandle, $content);
    fclose($fhandle);
}

//Register a new user and write the data to the file
function register($username, $password, $email) {

        //desbest edited here
        $myname = $username;
        require ("../config.php");
        $datenumber = date('Y-m-d');
        $version = "1.2";
        mysql_query("INSERT INTO sites 
        (username, sitename, email, datenumber,version) 
        VALUES('$myname', '$_POST[makethis]',
        '$email', '$datenumber', '$version' ) 
        ") or die(mysql_error()); 
        /**////////Email the user their account details /**/
        
        $makethis = $_POST[makethis];
        $message = "
        
        <html>
        <body>
        <table width=\"790\" height=\"122\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">
        
        <tr>
        <td background=\"http://hostingz.org/images/version2_01.png\"  width=\"790\" height=\"122\">
        <div class=\"menuhere\">  </div> 
        
        </td>
        
        </tr>
        <tr><td>
        <div style=\"margin-left: 8px; margin-right:8px; font-family: Tahoma; font-size: 16px;\">
        <br>You've successfully created a Hostingz Site Builder website
        <br>Below are your account details
        <br>
        <br><b>Username:</b> $myname
        <br><b>Password:</b> $password
        <br><b>Email:</b> $password
        <br><b>Website Address:</b> http://$makethis.hostingz.org
        
        <br><br><a href=\"http://hostingz.org\">Launch Hostingz</a>
        <br>
        <br><br><a href=\"http://$makethis.hostingz.org\">Launch your website</a>
        </div>
        </td></tr></table>
        </body>
        </html>
        
        ";
        $subject  = "$makethis Hostingz Site Builder Account Details";
        $headers  = 'MIME-Version: 1.0' . "\r\n";
        $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
        /**/
        /**/// Additional headers
        $to = "$email";
        $headers .= "To:<$to>" . "\r\n";
        $headers .= 'From: Hostingz <donotreply@hostingz.org>' . "\r\n";
        /**/// Mail it
        $task = mail($to, $subject, $message, $headers);
        ////////////////////////////////////////////////////////////////////////
        /**////////Email the user their account details




    global  $settings, $indexFile;
    $sessionId = generateRandomCode(20);
    setcookie("ZsessionId", $sessionId);
    writePassfile($username, $password, $email, $sessionId);

    if (!is_dir($settings['filesFolder']))
        {
            mkdir($settings['filesFolder'], 0777);
            chmod($settings['filesFolder'],0777);
        }
    if (!is_dir($settings['picturesFolder'])) {
        mkdir($settings['picturesFolder'], 0777);
        chmod($settings['picturesFolder'],0777);
        };
    if (!is_dir($settings['scriptsFolder'])){
        mkdir($settings['scriptsFolder'], 0777);
        chmod($settings['scriptsFolder'],0777);
    }
    
    
    if(checkFileExistance($settings['menufile'])=='0'){
        checkMenuFile();
    } else {
        if (is_file($settings['menufile'])) {
            if (is_readable($settings['menufile'])) {
                $Mcontent = file_get_contents($settings['menufile']);
                if($Mcontent == ''){
                    checkMenuFile();
                }
            }
        }
    } 
    
    echo '<html><head><script>document.location = "zimplit.php?action=load&file='.$indexFile.'";</script></head><body></body></html>';
    
}

function checkMenuFile(){
    global  $settings, $indexFile;
    
        $theIndFile = 'hasNone';
        if(checkFileExistance('index.html')=='0'){
            if(checkFileExistance('index.htm')=='0'){
            
            } else{
                $theIndFile = 'index.htm';
            }
        } else {
            $theIndFile = 'index.html';
        }
        
        
        
        if ($theIndFile != 'hasNone'){
            $fhandle = fopen($settings['menufile'], 'w');
            
                $contentMenu = 'var ZMenuArray = []; 
var GlobZIndexfile = "'.$theIndFile.'"; 
ZMenuArray["'.$theIndFile.'"] = [];
ZMenuArray["'.$theIndFile.'"]["name"] = "First Page";
ZMenuArray["'.$theIndFile.'"]["parent"] = "";
ZMenuArray["'.$theIndFile.'"]["self"] = "'.$theIndFile.'";
ZMenuArray["'.$theIndFile.'"]["index"] = "0";';

            fwrite($fhandle, $contentMenu);
            fclose($fhandle);
        } else {
            
        }
}


//Show login screen
function showLoginScreen() {
    global $settings, $locationOfEditor;
    $content = '
        <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
        <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="et" lang="et">
        <head>
            <title></title>
            <meta name="author" content="" />
            <meta name="keywords" content="" />
            <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
                
            <link rel="stylesheet" href="'.$locationOfEditor.'Zstyle.css" type="text/css" media="all" />
            <script src="'.$locationOfEditor.'jquery.js" type="text/javascript"></script>
            <script src="'.$locationOfEditor.'jquery-ui.js" type="text/javascript"></script>

            <script type="text/javascript">
                function InitRegister(){
                    $("#ZMainOverlay").height($(window).height());
                    $("#ZloginScreen").draggable();
                    $("#zimplitPage").height($(window).height());
                    
                }
            </script>
            
        </head>
        <body onload="InitRegister();" style="overflow:hidden;">
            <div id="ZMainOverlay"></div>
            <div style="width: 100%; top:0px; left:0px; display:block; position: absolute; z-index: 20;  text-align:center;margin:0; padding:100px 0 0 0;">
                <div id="ZloginScreen" class="ZpopupScreen" >
                    <div class="inner">
                        <div class="header">
                            <a href="'.getIndexFile().'"><img src="'.$locationOfEditor.'images/close.gif" class="closeBtn" alt="" /></a>
                            Log in
                        </div>
                        <form method="post" action="zimplit.php?action=login">
                        <div class="loginarea">
                            <a href="http://www.zimplit.org"><img src="'.$locationOfEditor.'images/logo1.gif" id="theZlogo" alt="" /></a>
                            <br/>
                            <span style="font-size:10px;line-height: 12px;">Username</span>
                            <input type="hidden" name="file" value="'.getFile().'"/>
                            <input type="text" class="txtbox" name="username" value="Username" onfocus="if(this.value==\'Username\'){this.value=\'\';}"/>
                            <span style="font-size:10px;line-height: 12px;">Password</span>
                            <input type="password" class="txtbox" name="password" value="password" onfocus="if(this.value==\'password\'){this.value=\'\';}" />
                            <input type="submit" name="submit" class="submitBtn" value="Start!" /> 
                            <input type="checkbox" name="remember" value="true" /> Remember Me<br/><br/>
                            <a href="zimplit.php?action=generatenewpassword" target="_top" style="color: #1e9d11;">Forgot password?</a>
                            
                        </div>
                        </form>
                    </div>
                </div>
            </div>
            
            <!-- the frame of page to be loaded into -->
            <iframe id="zimplitPage" width="100%" frameborder="0"  src="'.getFile().'"></iframe>
        </body>
        </html>    
    ';
    //desbest edited here            
    
    if ($_POST[makethis] != ""){
    echo $content;
    } else {
    echo "
    <h1>Error!</h1>
    <h2>You might have typed it into the address bar.</h2>
    <h3>This is not allowed. This empty website will be deleted within a week.</h3>
    <h4><a href=\"#\" onClick=\"history.go(-1)\">Go Back</a></h4>
    "; 
    }
    
    
}


//Show registration screen
function showRegistrationScreen() {
    global $settings, $locationOfEditor;
    
    $content = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
                <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="et" lang="et">
                <head>
                    <title></title>
                    <meta name="author" content="" />
                    <meta name="keywords" content="" />
                    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
                        
                    <link rel="stylesheet" href="'.$locationOfEditor.'Zstyle.css" type="text/css" media="all" />
                    <script src="'.$locationOfEditor.'jquery.js" type="text/javascript"></script>
                    <script src="'.$locationOfEditor.'jquery-ui.js" type="text/javascript"></script>

                    <script type="text/javascript">
                        function InitRegister(){
                            $("#ZMainOverlay").height($(window).height());
                            $("#ZloginScreen").draggable();
                            $("#zimplitPage").height($(window).height());
                            
                        }
                        
                        function CheckZForm(){
                            var theanswer = true;
                            var alerts = "Some fileds are not filled: \n";
                            if (($("#Zusername").val() == "")||($("#Zusername").val() == "Username")){
                                alerts += "Username not defined. \n";
                                theanswer = false;
                            }
                            if (($("#Zemail").val() == "")||($("#Zemail").val() == "Your email address")){
                                alerts += "Email not defined. \n";
                                theanswer = false;
                            }
                            if ($("#Zpassword").val() == ""){
                                alerts += "Password not defined. \n";
                                theanswer = false;
                            } else {
                                if (document.getElementById("Zpassword").value != document.getElementById("Zpasswordagain").value){
                                    alerts += "Password and retyped password do not match. \n";
                                    theanswer = false;
                                }
                            }
                            if (!theanswer){ alert(alerts);}
                            return theanswer;
                        }
                    </script>
                    
                </head>
                <body onload="InitRegister();">
                    <div id="ZMainOverlay"></div>
                    <div style="width: 100%; top:0px; left:0px; display:block; position: absolute; z-index: 20;  text-align:center;margin:0; padding:100px 0 0 0;">
                        <div id="ZloginScreen" class="ZpopupScreen" style="height:460px;">
                            <div class="inner" style="height:460px;">
                                <div class="header">
                                    <a href="'.getIndexFile().'"><img src="'.$locationOfEditor.'images/close.gif" class="closeBtn " alt="" /></a>
                                    Create your account!
                                </div>
                                <form method="post" action="zimplit.php?action=register" onsubmit="return CheckZForm();">
                                <div class="loginarea">
                                    <a href="#"><img src="'.$locationOfEditor.'images/logo1.gif" id="theZlogo" alt="" /></a><br/>
                                    <span style="font-size:10px;line-height: 12px;">Username</span>
                                    <input type="text" class="txtbox" id="Zusername" name="username" onclick="this.value=\'\';" value="Username"/>
                                    <span style="font-size:10px;line-height: 12px;">Password</span>
                                    <input type="password" class="txtbox" id="Zpassword" name="password" onclick="this.value=\'\';" value="" />
                                    <span style="font-size:10px;line-height: 12px;">Retype password</span>
                                    <input type="password" class="txtbox" id="Zpasswordagain" name="password_again" onclick="this.value=\'\';" value="" />
                                    <span style="font-size:10px;line-height: 12px;">Your email address</span>
                                    <input type="text" class="txtbox" id="Zemail" name="email" onclick="this.value=\'\';" value="Your email address"/>
                                    <br><br><span style="font-size:10px;line-height: 12px;">Your site identity and subdomain
                                                       <input type="text" readonly class="txtbox" name="makethis" value="'.$_POST[makethis].'"/>
                                                          <input type="submit" name="submit" class="submitBtn" value="Start!" />
                                    <br> <a href="#">Why is it necessary?</a>
                                    
                                </div>
                                </form>
                            </div>
                        </div>
                    </div>
                    <!-- the frame of page to be loaded into -->
                    <iframe id="zimplitPage" width="100%" frameborder="0" height="700px" src="'.getIndexFile().'"></iframe>
                </body>
                </html>';
    echo $content;
}


//Checking username and password
function login($username, $password, $remember) {
    global $settings;
    $content = file_get_contents($settings['passfile']);
    if (strpos($content, '$u="'.$username.'";') && strpos($content, '$p="'.md5($password).'";')) {
        $sessionId = generateRandomCode(20);
        $expire = 0;
        if ($remember == 'true') {
            $expire = time()+60*60*24*30;
        }
        setcookie("ZsessionId", $sessionId, $expire);
        writePassfileParam('s', $sessionId);
        writePassfileParam('r', $remember);
        header( 'Location: zimplit.php?action=load&file='.getFile());
    } else {
        logout();
    }
}

//Closing session
function logout() {
    $remember = readPassfileParam("r");
    if ($remember == 'true') {
        header( 'Location:'.getFile());
    } else {
        setcookie("ZsessionId", "",  time()-60*60*24*30);
        writePassfileParam('s', '');
        writePassfileParam('r', '');
        showLoginScreen();
    }
}


//Check, if the visitor is authorized to access the CMS
function isAutorized() {
    global $settings;
    $rv = false;
    $content = file_get_contents($settings['passfile']);
    if (strpos($content, '$s="";') === false && strlen ($_COOKIE['ZsessionId']) > 0 && strpos($content, '$s="'.$_COOKIE['ZsessionId'].'";')) {
        $rv = true;
    }
    return $rv;
}

//Change username and password
function changeUsernamePasword($username, $password) {
    if (isAutorized() &&  strlen ($username) > 0 &&  strlen ($password) > 0 ) {
        writePassfileParam('u', $username);
        writePassfileParam('p', md5($password));
    }
    //global $settings;
    //$content = str_replace('$u="'.$_COOKIE['Zuser'].'"; $p="'.$_COOKIE['Zpass'].'";',
    //                         '$u="'.$username.'"; $p="'.md5($password).'";', $content);
    //
    //$fhandle = fopen($settings['passfile'], 'w');
    //fwrite($fhandle, $content);
    //fclose($fhandle);
    //setcookie("Zuser", $username);
    //setcookie("Zpass", md5($password));
    return $content;
}

//Generate random code with given length
function generateRandomCode($length) {
    $chars = 'abcdefghijklmnopqrstuvwxyz1234567890';
    $result = '';
    for ($i = 0; $i < $length; $i++) {
    $char = $chars[rand(0, strlen($chars)-1)];
        $result .= $char;
    }
    return $result;
}

//Generate and send a new password
function generateNewPassword() {
    global $settings, $securityCode, $locationOfEditor;
    //$chars = 'abcdefghijklmnopqrstuvwxyz1234567890';
    
    $content = file_get_contents($settings['passfile']);
    preg_match('/\$e=\"([^\"]*)\"/', $content, $matches);
    $email = $matches[1];
    
    preg_match('/\$u=\"([^\"]*)\"/', $content, $matches);
    $username = $matches[1];
    
    $securityCode2 = md5(date("F d Y H:i:s.", filemtime($settings['passfile'])));
    
    if ($securityCode) {
        if ($securityCode == $securityCode2) {
            //for ($i = 0; $i < 8; $i++) {
            //    $char = $chars[rand(0, strlen($chars)-1)];
            //    $newpass .= $char;
            //}
            $newpass .= generateRandomCode(8);
            $fhandle = fopen($settings['passfile'], 'w');
            $content = preg_replace('/\$p=\"([^\"]*)\"/', '$p="'.md5($newpass).'"', $content);
            $r = fwrite($fhandle, $content);
            fclose($fhandle);
            
            $message = str_replace('[username]', $username, $settings['reminderContent']);
            $message = str_replace('[password]', $newpass, $message);
            mail($email, 'Your new Zimplit password', $message);
            
            /* the html displayed when passwd confirmation sent */
            $content = '
            <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
            <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="et" lang="et">
            <head>
                <title></title>
                <meta name="author" content="" />
                <meta name="keywords" content="" />
                <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
                    
                <link rel="stylesheet" href="'.$locationOfEditor.'Zstyle.css" type="text/css" media="all" />
                <script src="'.$locationOfEditor.'jquery.js" type="text/javascript"></script>
                <script src="'.$locationOfEditor.'jquery-ui.js" type="text/javascript"></script>

                <script type="text/javascript">
                    function InitRegister(){
                        $("#ZMainOverlay").height($(window).height());
                        $("#ZloginScreen").draggable();
                        $("#zimplitPage").height($(window).height());
                        
                    }
                </script>
                
            </head>
            <body onload="InitRegister();" style="overflow:hidden;">
                <div id="ZMainOverlay"></div>
                <div style="width: 100%; top:0px; left:0px; display:block; position: absolute; z-index: 20;  text-align:center;margin:0; padding:100px 0 0 0;">
                    <div id="ZloginScreen" class="ZpopupScreen"  >
                        <div class="inner">
                            <div class="header">
                                <a href="'.getIndexFile().'"><img src="'.$locationOfEditor.'images/close.gif" class="closeBtn" alt="" /></a>
                                Change password
                            </div>
                            <form method="post" action="zimplit.php?action=login">
                            <div class="loginarea" style="font-size: 11px;">
                                <a href="http://www.zimplit.org"><img src="'.$locationOfEditor.'images/logo1.gif" id="theZlogo" alt="" /></a>
                                <br/>
                                A new password was created and sent to Your e-mail.<br/><br/>Check your email.<br/> To continue loging in klick OK.<br/><br/><br/>
                                <a class="submitBtn" href="zimplit.php" style="display:block;text-align:center; line-height:30px;text-decoration: none; color: #333333;">OK!</a>
                            </div>
                            </form>
                        </div>
                    </div>
                </div>
                
                <!-- the frame of page to be loaded into -->
                <iframe id="zimplitPage" width="100%" frameborder="0"  src="'.getIndexFile().'"></iframe>
            </body>
            </html>    
        ';
            
            
            if ($r > 0) echo $content;
            else return false;
        } else {
            $content = '
            <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
            <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="et" lang="et">
            <head>
                <title></title>
                <meta name="author" content="" />
                <meta name="keywords" content="" />
                <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
                    
                <link rel="stylesheet" href="'.$locationOfEditor.'Zstyle.css" type="text/css" media="all" />
                <script src="'.$locationOfEditor.'jquery.js" type="text/javascript"></script>
                <script src="'.$locationOfEditor.'jquery-ui.js" type="text/javascript"></script>

                <script type="text/javascript">
                    function InitRegister(){
                        $("#ZMainOverlay").height($(window).height());
                        $("#ZloginScreen").draggable();
                        $("#zimplitPage").height($(window).height());
                        
                    }
                </script>
                
            </head>
            <body onload="InitRegister();" style="overflow:hidden;">
                <div id="ZMainOverlay"></div>
                <div style="width: 100%; top:0px; left:0px; display:block; position: absolute; z-index: 20;  text-align:center;margin:0; padding:100px 0 0 0;">
                    <div id="ZloginScreen" class="ZpopupScreen"  >
                        <div class="inner">
                            <div class="header">
                                <a href="'.getIndexFile().'"><img src="'.$locationOfEditor.'images/close.gif" class="closeBtn" alt="" /></a>
                                Change password
                            </div>
                            <form method="post" action="zimplit.php?action=login">
                            <div class="loginarea" style="font-size: 11px;">
                                <a href="http://www.zimplit.org"><img src="'.$locationOfEditor.'images/logo1.gif" id="theZlogo" alt="" /></a>
                                <br/>
                                Password confirmation failed!<br/><br/>This error can be because someone has already requested a new password change. <br/><br/><br/>
                                <a class="submitBtn" href="zimplit.php" style="display:block;text-align:center; line-height:30px;text-decoration: none; color: #333333;">OK!</a>
                            </div>
                            </form>
                        </div>
                    </div>
                </div>
                
                <!-- the frame of page to be loaded into -->
                <iframe id="zimplitPage" width="100%" frameborder="0"  src="'.getIndexFile().'"></iframe>
            </body>
            </html>    
        ';
        
        
            echo $content;
        }
    } else {
        $link = 'http://'.$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF'].'?action=generatenewpassword&securitycode='.$securityCode2.'';
        $message = $settings['confirmationContent'].$link;
        mail($email, 'A new password was requested from Zimplit editor', $message);
        
        /* the html displayed when passwd confirmation sent */
            $content = '
            <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
            <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="et" lang="et">
            <head>
                <title></title>
                <meta name="author" content="" />
                <meta name="keywords" content="" />
                <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
                    
                <link rel="stylesheet" href="'.$locationOfEditor.'Zstyle.css" type="text/css" media="all" />
                <script src="'.$locationOfEditor.'jquery.js" type="text/javascript"></script>
                <script src="'.$locationOfEditor.'jquery-ui.js" type="text/javascript"></script>

                <script type="text/javascript">
                    function InitRegister(){
                        $("#ZMainOverlay").height($(window).height());
                        $("#ZloginScreen").draggable();
                        $("#zimplitPage").height($(window).height());
                        
                    }
                </script>
                
            </head>
            <body onload="InitRegister();" style="overflow:hidden;">
                <div id="ZMainOverlay"></div>
                <div style="width: 100%; top:0px; left:0px; display:block; position: absolute; z-index: 20;  text-align:center;margin:0; padding:100px 0 0 0;">
                    <div id="ZloginScreen" class="ZpopupScreen"  >
                        <div class="inner">
                            <div class="header">
                                <a href="'.getIndexFile().'"><img src="'.$locationOfEditor.'images/close.gif" class="closeBtn" alt="" /></a>
                                Change password
                            </div>
                            <form method="post" action="zimplit.php?action=login">
                            <div class="loginarea" style="font-size: 11px;">
                                <a href="http://www.zimplit.org"><img src="'.$locationOfEditor.'images/logo1.gif" id="theZlogo" alt="" /></a>
                                <br/>
                                A mail with confirmation for a new password was sent to Your mail. <br/><br/> Check your mailbox to confirm <br/>password change!<br/><br/><br/>
                                <a class="submitBtn" href="zimplit.php" style="display:block;text-align:center; line-height:30px;text-decoration: none; color: #333333;">OK!</a>
                            </div>
                            </form>
                        </div>
                    </div>
                </div>
                
                <!-- the frame of page to be loaded into -->
                <iframe id="zimplitPage" width="100%" frameborder="0"  src="'.getIndexFile().'"></iframe>
            </body>
            </html>    
        ';
        echo $content;
    
    }
}

//Send reply mail 

function sendReply(){
    $message = '
User question from Zimplit editor

Name: '.$_POST['Name'].'
E-mail: '.$_POST['Email'].'

Location: '.$_POST['doclocation'].'

Problem:
'.utf8_decode($_POST['Text']).'
    ';
    mail('support@zimplit.org', 'User question from Zimplit editor', $message);
    return true;
}

// checck file existance
// returns 1 if file exists and 0 if does not
function checkFileExistance($file){
    if (is_file($file)) {
        if (is_readable($file)) {
            return '1';
        } else {
            return '0';
        }
    } else {
        return '0';
    }
}

function getFile(){
    $file = $_GET['file'];
    if ($file == '') {
        $file = $_POST['file'];
    }
    if ($file != '' && checkFileExistance($file)=='1'){
        return $file;
    }
    return getIndexFile();
}

function getIndexFile(){
    if(checkFileExistance('index.html')=='0'){
        return 'index.htm';
    } else {
        return 'index.html';
    }
}

// function to resize image via gd library

function createthumb($name,$filename,$new_w,$new_h){
    $system=explode('.',$name);
    if (preg_match('/jpg|jpeg|JPG|JPEG/',$system[1])){
        $src_img=imagecreatefromjpeg($name);
    }
    if (preg_match('/png|PNG/',$system[1])){
        $src_img=imagecreatefrompng($name);
    }
    $old_x=imageSX($src_img);
    $old_y=imageSY($src_img);
    if ($old_x > $old_y) {
        $thumb_w=$new_w;
        $thumb_h=$old_y*($new_h/$old_x);
    }
    if ($old_x < $old_y) {
        $thumb_w=$old_x*($new_w/$old_y);
        $thumb_h=$new_h;
    }
    if ($old_x == $old_y) {
        $thumb_w=$new_w;
        $thumb_h=$new_h;
    }
    $dst_img=ImageCreateTrueColor($thumb_w,$thumb_h);
    imagecopyresampled($dst_img,$src_img,0,0,0,0,$thumb_w,$thumb_h,$old_x,$old_y);
    if (preg_match("/png/",$system[1]))
    {
        imagepng($dst_img,$filename); 
    } else {
        imagejpeg($dst_img,$filename); 
    }
    imagedestroy($dst_img); 
    imagedestroy($src_img); 
}


//Get the HTML content from the file.
//Returns FALSE on falure, html content on success
function getHTML($file) {
    if (is_file($file)) {
        if (is_readable($file)) {
            
            $content = file_get_contents($file);
            if ($content === FALSE) {
                return 'Error: Cannot read from the file '.$file.'.';
            }
            
            return $content;
        } else {
            return 'Error: The file '.$file.' is not readable.';
        }
    } else {
        return 'Error: The file '.$file.' does not exist.';
    }
}

//Get the HTML content from the file with editor .
//Returns FALSE on falure, html content on success
function getHTML1($file) {
    global  $locationOfEditor,$GDsupport;
    if (is_file($file)) {
        if (is_readable($file)) {
            
            $content = file_get_contents($file);
            if ($content === FALSE) {
                return 'Cannot read from the file '.$file.'.';
            } else {
                $LoadingFrameHtmlTop = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
                    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="et" lang="et">
                    <head>
                        <title></title>
                        <meta name="author" content="" />
                        <meta name="keywords" content="" />
                        <meta http-equiv="Pragma" content="no-cache">
                        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
                        
                        <link rel="stylesheet" href="'.$locationOfEditor.'Zstyle.css" type="text/css" media="all" />
                        <script src="'.$locationOfEditor.'jquery.js" type="text/javascript"></script>
                        <script src="'.$locationOfEditor.'jquery-ui.js" type="text/javascript"></script>
                        <script src="'.$locationOfEditor.'jquery.form.js" type="text/javascript"></script>
                        <script type="text/javascript">
                            GlobZIndexfile = "'.getIndexFile().'";
                            GDsupport = "'.$GDsupport.'";
                            ZimplitEditorLocation = "'.$locationOfEditor.'";
                        </script>
                        <script src="'.$locationOfEditor.'zimplit.js" type="text/javascript"></script>
                        <script src="Zmenu.js?t='.time().'" type="text/javascript"></script>
                        
                    <style>
                        body,html { margin:0; padding:0; }
                        iframe { border:0; margin:0; padding:0; width: 100%; }
                        #zimplitMenu {background: #AAAAAA; } 
                    </style>
                        
                    </head>
                    <body onload="ready();" id="ZimplitRootBody">
                        <!-- the frame of page to be loaded into -->
                        <iframe id="zimplitPage" name="zimplitPage" onload="ZDoTheReload();" width="100%" frameborder="0" height="700px" src="';
                                         
                $LoadingFrameHtmlBottom ='"></iframe>
                    </body>
                    </html>';
                $content = $LoadingFrameHtmlTop . $file . $LoadingFrameHtmlBottom;
            }
            
            
            
            return $content;
        } else {
            return 'The file '.$file.' is not readable.';
        }
    } else {
        return 'The file '.$file.' does not exist.';
    }
}


//Writes the HTML content to the file.
//Returns FALSE on falure, TRUE on success
function saveHTML($file, $html) {
    if (is_file($file)) {
        if (is_writable($file)) {
            if (!$handle = fopen($file, 'w')) {
                return 'Cannot open file '.$file.'.';
            }
            if (fwrite($handle, $html) === FALSE) {
                return 'Cannot write to file '.$file.'.';
            }
            fclose($handle);
        } else {
            return 'The file '.$file.' is not writable.';
        }
    } else {
        return 'The file '.$file.' does not exist.';
    }
}

function checkFileIsWritable($file){
    if (is_writable($file)) {
        return 0;
    } else {
        return 1;
    }
}



//Writes the HTML content to the file.
//Returns FALSE on falure, TRUE on success
function saveHTML1($file, $html) {
    $html1 = preg_replace('/\\\"/', '"', urldecode($html));
    $html1 = preg_replace('/%27/', "'", $html1);
    
    if (is_file($file)) {
        if (is_writable($file)) {
            if (!$handle = fopen($file, 'w')) {
                return 'Cannot open file '.$file.'.';
            }
            if (fwrite($handle, $html1) === FALSE) {
                return 'Cannot write to file '.$file.'.';
            }
            fclose($handle);
        } else {
            return 'The file '.$file.' is not writable.';
        }
    } else {
        return 'The file '.$file.' does not exist.';
    }
}



//Create new html file
function newFile($file) {
    if (file_exists($file)) {
        return 'The file '.$file.' already exists.';
    }
    if (touch($file)) {
        chmod($file,0666); 
        return true;
    } else {
        return 'The file '.$file.' cannot be created.';
    }
}


//Delete the file
function deleteFile($file, $folder='') {
    if (!file_exists($file)) {
        return 'The file '.$file.' does not exist.';
    }
    if (@unlink($file)) {
        return true;
    } else {
        return 'The file '.$file.' cannot be deleted.';
    }
}


//Upload a file
function uploadFile($folder='') {
    global $_FILES, $max_width, $max_height,$GDsupport;
    
    $file = $_FILES['file']['name'];
    $tmpfile = $_FILES['file']['tmp_name'];
    
    if ($folder) {
        if (!is_dir($folder)) {
            return 'No such directory: '.$folder;
        } else if (!is_writable($folder)) {
            return 'Cannot write to directory: '.$folder;
        }
    }
    
    $error = $_FILES["file"]["error"];
    if ($error == UPLOAD_ERR_INI_SIZE) {
           return 'The uploaded file exceeds the upload_max_filesize directive in php.ini.';
       } else if ($error == UPLOAD_ERR_FORM_SIZE) {
           return 'The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form.';
       } else if ($error == UPLOAD_ERR_PARTIAL) {
           return 'The uploaded file was only partially uploaded.';
       } else if (!$error == UPLOAD_ERR_OK) {
           return 'Failed to upload the file.';
       }
    
    $ext = strchr($file, '.');

    //Check image size
    if (strpos('.jpg.jpeg.png.gif.', $ext.'.') !== false) {
        $info = getimagesize($tmpfile);
    
        if (($info[0] > $max_width) || ($info[1] > $max_height)) {
            return 'Image must be '.$max_width.'px X '.$max_height.'px or smaller. Please resize image and try again.';
        }
    }
    if ($folder) {
        $path = $folder.'/'.$file;
    } else {
        $path = $file;
    }
    if (!move_uploaded_file($tmpfile, $path)) {
        return 'Failed to move the file to the '.$folder.' directory.';
    } else {
        if($GDsupport){ // if gd library present do thumbnail
            if (strpos('.jpg.jpeg.png.JPG.JPEG.PNG.', $ext.'.') !== false) {
                $content = file_get_contents('Zsettings.js');
                preg_match('/ZmaxpicZoomW \= \"([^\"]+)\"/i', $content, $ZWmatch); 
                $ZoomThumbW =  $ZWmatch[1];
                preg_match('/ZmaxpicZoomH \= \"([^\"]+)\"/i', $content, $ZHmatch); 
                $ZoomThumbH =  $ZHmatch[1];
                $thenewname = preg_replace('/'.$ext.'/i', '_thumb'.$ext, $path);
                createthumb($path,$thenewname,$ZoomThumbW,$ZoomThumbH);
            } 
        }
        return true;
    }
}


//Rename a file
function renameFile($oldName, $newName) {
    if (file_exists($newName)) {
        return 'The file '.$newName.' already exists.';
    }
    if (!file_exists($oldName)) {
        return 'The file '.$oldName.' does not exist.';
    }
    if (rename($oldName, $newName)) {
        return true;
    } else {
        return 'Failed to rename a file '.$oldName.'.';
    }
}


//Copy a HTML file with a new title
function copyHtml($file, $newFile, $title) {
    $content = getHTML($file);
    if (strpos($content, 'Error: ') !== 0) {
        $content = preg_replace('/<title>[^<]+<\/title>/i', '<title>'.$title.'</title>', $content);
        $r = newFile($newFile);
        if (strpos($r, 'Error: ') !== 0) {
            return saveHTML($newFile, $content);
        } else return $r;
    } else return $content;
}

//Get a list of files in http directory
function listFiles() {
    if ($handle = opendir('.')) {
        while (false !== ($file = readdir($handle))) {
            if ($file != '.' && $file != '..' && is_file($file) && strpos($file, '.htm')) {
                $files[] = $file;
            }
        }
        closedir($handle);
        
        $fileAndTitle = array();
        
        foreach($files as $Thefile){
            $content = getHTML($Thefile);
            
            $matches = array();
            $pattern = '/<title>(.*)<\/title>/i';
            preg_match($pattern, $content, $matches);
            $pagetitle = $matches[1];
            $fileAndTitle[] = $Thefile.'|'.$pagetitle;
            
        }
    }
    return implode(';', $fileAndTitle);
}


//Download zip
function downloadZip($src) {
    global $settings;
    
    $file = basename($src);
    if(function_exists("curl_init")) {
        $ch = curl_init();
        $fp = fopen($file, 'w');
        curl_setopt($ch, CURLOPT_URL, $settings['templates_remote_path'].'/'.$src);
        curl_setopt($ch, CURLOPT_BINARYTRANSFER, true);        
        curl_setopt($ch, CURLOPT_FILE, $fp);
        $response = curl_exec($ch);
        curl_close($ch);
    } else {
        $data = file_get_contents($settings['templates_remote_path'].'/'.$src);
        file_put_contents($file, $data);
    }
}

function unzip($file, $path="") {
    global $settings;
    $filepath = getcwd().'/'.$file;
    if (file_exists($filepath)) {
        
        if (file_exists($settings['scriptsFolder'].'/pclzip.lib.php')) {
            require_once($settings['scriptsFolder'].'/pclzip.lib.php');
            $archive = new PclZip($file);
            if ($archive->extract() == 0) {
                return "Error : ".$archive->errorInfo(true);
            }
        } else {
            $phpversion = phpversion();
            $modules = get_loaded_extensions();
            if ($phpversion[0] == 4) {
                if (function_exists("zip_open")) {
                    $zip = zip_open($filepath);
                    if ($zip) {
                        while ($zip_entry = zip_read($zip)) {
                            if (zip_entry_filesize($zip_entry) > 0) {
                                $complete_path = $path.str_replace('/','\\',dirname(zip_entry_name($zip_entry)));
                                $complete_name = $path.str_replace ('/','\\',zip_entry_name($zip_entry));
                                if(!file_exists($complete_path)) { 
                                    $tmp = '';
                                    foreach(explode('\\',$complete_path) as $k) {
                                        $tmp .= $k.'\\';
                                        if(!file_exists($tmp)) {
                                            mkdir($tmp, 0777);
                                        }
                                    }
                                }
                                if (zip_entry_open($zip, $zip_entry, "r")) {
                                    $fd = fopen($complete_name, 'w');
                                    fwrite($fd, zip_entry_read($zip_entry, zip_entry_filesize($zip_entry)));
                                    fclose($fd);
                                    zip_entry_close($zip_entry);
                                }
                            }
                        }
                        zip_close($zip);
                        return true;
                    } else {
                        return 'Error: The zip file '.$file.' is damaged.';
                    }
                }            
                
            } else {
                if (in_array("zip", $modules)) {
                    $zip = new ZipArchive();
                    if ($zip->open($file)===true)
                    {
                        $zip->extractTo(".");
                        $zip->close();
                        return true;
                    }
                    return 'Error: The zip file '.$file.' is damaged.';
                } else {
                    return 'Error: Zip is not supported.';
                }
            }
        }
        
    } else {
        return 'Error: The file '.$file.' does not exist.';
    }
}

function downloadTemplate($file) {
    downloadZip($file);
    return unzip(basename($file),'');
}

function checkIfHasIndexFile(){
    if(checkFileExistance('index.html')=='0'){
        if(checkFileExistance('index.htm')=='0'){
            return false;
        } else { 
            return true;
        }
    } else {
        return true;
    }
}


function loadExternalTemplHtml($fileaddr){
    global  $locationOfEditor;
    header('Content-Type: text/html');
    
        $LoadingFrameHtmlTop = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
            <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="et" lang="et">
            <head>
                <title></title>
                <meta name="author" content="" />
                <meta name="keywords" content="" />
                <meta http-equiv="Pragma" content="no-cache">
                <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
                
                <link rel="stylesheet" href="'.$locationOfEditor.'Zstyle.css" type="text/css" media="all" />
                <script src="'.$locationOfEditor.'jquery.js" type="text/javascript"></script>
                <script src="'.$locationOfEditor.'jquery-ui.js" type="text/javascript"></script>
                <script src="'.$locationOfEditor.'jquery.form.js" type="text/javascript"></script>
                <script src="'.$locationOfEditor.'zimplitTemplate_new.js" type="text/javascript"></script>
            <style>
                body,html { margin:0; padding:0; }
                iframe { border:0; margin:0; padding:0; width: 100%; }
                #zimplitMenu {background: #AAAAAA; } 
            </style>
                 
            </head>
            <body onload="" id="ZimplitRootBody">
                <!-- the frame of page to be loaded into -->
                <div id="zimplitTempPage">';
                                 
        $LoadingFrameHtmlBottom ='</div>
            </body>
            </html>'; 
        $content = $LoadingFrameHtmlTop . file_get_contents($fileaddr) . $LoadingFrameHtmlBottom;
    echo $content;
}

function loadTemplPage($fileaddr){
    global $settings;
    loadExternalTemplHtml($settings['templates_remote_path'].$fileaddr);
}


/*unzip("template1.zip");*/

if (file_exists($settings['passfile'])) {
    if (isAutorized()) {
        
            if(checkFileExistance($settings['menufile'])=='0'){
            checkMenuFile();
        } else {
            if (is_file($settings['menufile'])) {
                if (is_readable($settings['menufile'])) {
                    //$Mcontent = file_get_contents($settings['menufile']);
                    
                    if(filesize($settings['menufile'])== 0){
                            echo '<script>alert("tyhi");</script>';
                        checkMenuFile();
                    }
                }
            }
        }
        
        if ($action == 'logout') {
            logout();
            //showLoginScreen();
        } else {
            if(checkIfHasIndexFile()){
                $processRequest = true;
            } else {
                if ($action == 'gettemplate') {
                    if(downloadTemplate($file) == ''){
                        echo '<html><head><script>document.location = "zimplit.php";</script></head<body></body></html>';
                    } else { 
                        echo 'Some bad, bad error occured! Unpacking failed.';
                    }
                } else if ($action == 'loadTemplPage'){
                    loadTemplPage($file);
                } else {
                    loadExternalTemplHtml($settings['templates_remote_path_index']);
                }
            }
        }        
    } else {
        if (($action == 'login') && $username && $password) {
            login($username, $password, $remember);
        } else if($action == 'generatenewpassword') {
            generateNewPassword();
        } else {
            showLoginScreen();
        }
    }
} else {
    if (($action == 'register') && $username && $password &&
            $password_again && $email && ($password == $password_again)) {
        register($username, $password, $email);
        $processRequest = true;
    } else {
        showRegistrationScreen();
    }
}

if ($processRequest) {
    if ($action == 'load') {
        echo getHTML1($file);
    } else if ($action == 'load1') {
        echo getHTML($file);    
    } else if ($action == '') {
        echo getHTML1($indexFile);
    } else if ($action == 'save') {
        echo saveHTML($file, $html);
    } else if ($action == 'saveE') {
        echo saveHTML1($file, $html);
    } else if ($action == 'new') {
        echo newFile($file);
    } else if ($action == 'delete') {
        echo deleteFile($file);
    } else if ($action == 'upload') {
        echo uploadFile($folder);
    } else if ($action == 'rename') {
        echo renameFile($oldName, $newName);
    } else if ($action == 'changeuserpass') {
        echo changeUsernamePasword($username, $password);
    } else if ($action == 'generatenewpassword') {
        echo generateNewPassword();
    } else if ($action == 'listfiles') {
        echo listFiles();
    } else if ($action == 'copyhtml') {
        echo copyHTML($file, $newName, $title);
    } else if ($action == 'checkFile') {
        echo checkFileExistance($file);
    } else if ($action == 'sendreply') {
        echo sendReply();
    } else if ($action == 'iswriteble') {
        echo checkFileIsWritable($file);
    } else if ($action == 'gettemplate') {
        echo downloadTemplate($file);
    } else if ($action== 'loadExternalHtml'){
        loadExternalTemplHtml($file);
    } else if ($action== 'loadTemplPage'){
        loadTemplPage($file);
    }
}

?>

Zimplit Multi User v.1.1 (26-Jan @ 20:28)

desbest.myopenid.com

Syntax Highlighted Code

  1. <?php
  2.  
  3. /*
  4. Zimplit CMS version 1.1
  5. [1303 more lines...]

Plain Code

<?php

/*
Zimplit CMS version 1.1

Zimplit CMS is a Content Management System developed by
Welisa, Inc. Copyright (C) 2008 Welisa Inc zimplit@zimplit.org.

-- AVAILABLE LICENCE TYPES --

Zimplit CMS is available under three different licenses:

1) AGPL 3
You must keep a visible link to Zimplit Legal Notices, on every generated page. The required link to the Zimplit Legal Notices must be static, visible and readable, 
and the text in the Zimplit Legal Notices may not be altered.

2) Linkware / "Powered by Zimplit CMS" Link Requirement Licence
Same as AGPL, but instead of keeping a link to the Zimplit Legal Notices, you must place a static, visible and readable link to www.zimplit.org with the text or an
image stating "Powered by Zimplit CMS" on every generated page.

3) Commercial Licence
This license will allow you to remove the Zimplit Legal Notices/"Powered by Zimplit CMS" link at one specific domain. This license will also protect your modifications 
against the copyleft requirements in AGPL 3 and give access to registry in the user support forum.
Commercial licenses are available at www.zimplit.org/buy_commercial_license.html. 


You may change this LICENCE TYPES SECTION to relevant information, if you have purchased a commercial licence, 
but then the files may not be distributed to any other domain not covered by a commercial licence.

-- LICENCE TYPES SECTION END -

This copyright note must under no circumstances be removed from this file and any distribution of code covered by this licence.

For more information please visit http://www.zimplit.org

*/
/*
//desbest edit
header('Pragma: no-cache');
header('Cache-Control: no-store, no-cache, must-revalidate');
header('Cache-Control: post-check=0, pre-check=0', FALSE); 
*/

/**
 * @param action: load - sends a html file content as response.
 * Use 'file' parameter to specify the HTML file.
 * 
 * Example: zimplit.php?action=load&file=page.html
 * 
 * 
 * @param action: save - saves a HTML source to a file.
 * Use 'file' parameter to specify the HTML file.
 * Use 'html' POST variable, to pass HTML source.
 * 
 * Example: zimplit.php?action=save&file=page.html;
 *             html="<html>....</html>"
 * 
 * 
 * @param action: new - creates a new empty html file.
 * Use 'file' parameter to specify the HTML file.
 * 
 * Example: zimplit.php?action=new&file=page.html
 * 
 * 
 * @param action: delete - deletes a file.
 * Use 'file' parameter to specify the file.
 * Note: if the file is not in the webroot directory, the folder must be specified
 * 
 * Example: zimplit.php?action=delete&file=page.html
 * Example: zimplit.php?action=delete&file=Z-files/page.html
 * 
 * 
 * @param action: upload - uploads a file to a server.
 * Use 'folder' parameter (optional) to specify the folder, where the uploaded file must be moved.
 * Use 'file' POST variable, to pass the file. input="file".
 * 
 * Example: zimplit.php?action=upload&folder=Z-pictures;
 *             file=[Binary stream].
 * 
 *
 * @param action: rename - renames a file.
 * Use 'oldname' parameter to specify the old name of the existing file.
 * Use 'newname' parameter to specify the new name of the file.
 * Note: if the file is not in the webroot directory, the folder must be specified
 * 
 * Example: zimplit.php?action=rename&oldname=oldpage.html&newname=newpage.html
 * 
 * 
 * @param action: changeuserpass - changes username & password data.
 * Use 'username' parameter to specify the new username of the existing file.
 * Use 'password' parameter to specify the new name of the file.
 * 
 * Example: zimplit.php?action=changeuserpass
 * Use 'username' POST variable, to pass the username.
 * Use 'password' POST variable, to pass the password.
 * 
 * 
 * @param action: generatenewpassword - generates a new password and sends it by email.
 * Use 'securitycode' parameter to pass a security code for email verification.
 * Example: zimplit.php?action=generatenewpassword
 * 
 * 
 * @param action: listfiles - returns a list of files in the webroot directory.
 * 
 * Example: zimplit.php?action=listfiles
 */



//GET data
$GDsupport = false; 
if (extension_loaded('gd') && function_exists('gd_info')) {
    $GDsupport = true; 
}
 
if (!isset($_GET['action'])){ $action = NULL; } else {$action = $_GET['action'];}
if (!isset($_GET['file'])){    $file = NULL;} else {$file = $_GET['file'];}
if (!isset($_GET['max_width'])){$max_width = NULL;} else {$max_width = $_GET['max_width'];}
if (!isset($_GET['max_height'])){$max_height = NULL;} else {$max_height = $_GET['max_height'];}
if (!isset($_GET['folder'])){$folder = NULL;} else {$folder = $_GET['folder'];}
if (!isset($_GET['oldname'])){$oldName = NULL;} else {$oldName = $_GET['oldname'];}
if (!isset($_GET['newname'])){$newName = NULL;} else {$newName = $_GET['newname'];}
if (!isset($_GET['title'])){$title = NULL;} else {$title = urldecode($_GET['title']);}
if (isset($_GET['securitycode'])){    $securityCode = $_GET['securitycode'];}
$indexFile = getIndexFile();


//POST data
if (!isset($_POST['html'])){$html = NULL;} else {$html = $_POST['html'];}
if (isset($_POST['username'])){$username = $_POST['username'];}
if (isset($_POST['password'])){$password = $_POST['password'];}
if (isset($_POST['password_again'])){$password_again = $_POST['password_again'];}
if (!isset($_POST['email'])){$email = NULL;} else {$email = $_POST['email'];} 

//Settings
$locationOfEditor = 'editor/';
$settings['filesFolder'] = 'Z-files';
$settings['picturesFolder'] = 'Z-pictures';
$settings['scriptsFolder'] = 'Z-scripts';
$settings['loginHtmlFile'] = 'login.html';
$settings['registerHtmlFile'] = 'register.html';
$settings['passfile'] = 'security.php';
$settings['menufile'] = 'Zmenu.js';
$settings['reminderContent'] = "You have requested a new password for Your Zimplit web editor. \nUsername: [username]\nPassword: [password]";
$settings['confirmationContent'] = "To confirm password change of Your Zimplit editor visit link \n";
//desbest edit 
//templates path
$settings['templates_remote_path'] = "../selectdesign/index.php";
$settings['templates_remote_dirpath'] = "../selectdesign/";

//Local variables
$processRequest = false;


//Register a new user and write the data to the file
function register($username, $password, $email) {
    global  $settings, $indexFile;

    $fhandle = fopen($settings['passfile'], 'w');
    $content = '<?php $u="'.$username.'"; $p="'.md5($password).'"; $e="'.$email.'"; ?>';
    //desbest edited here
    $myname = $username;
    require ("../config.php");
    $datenumber = date('Y-m-d');
    $version = "1.1";
    mysql_query("INSERT INTO sites 
    (username, sitename, email, datenumber,version) 
    VALUES('$myname', '$_POST[makethis]',
    '$email', '$datenumber', '$version' ) 
    ") or die(mysql_error()); 
    /**////////Email the user their account details
/**/

$makethis = $_POST[makethis];
$message = "

<html>
<body>
<table width=\"790\" height=\"122\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">

    <tr>
            <td background=\"http://hostingz.org/images/version2_01.png\"  width=\"790\" height=\"122\">
                          <div class=\"menuhere\">  </div> 
        
        </td>
        
    </tr>
    <tr><td>
    <div style=\"margin-left: 8px; margin-right:8px; font-family: Tahoma; font-size: 16px;\">
    <br>You've successfully created a Hostingz Site Builder website
    <br>Below are your account details
    <br>
    <br><b>Username:</b> $myname
    <br><b>Password:</b> $password
    <br><b>Email:</b> $password
    <br><b>Website Address:</b> http://$makethis.hostingz.org

    <br><br><a href=\"http://hostingz.org\">Launch Hostingz</a>
  <br>
    <br><br><a href=\"http://$makethis.hostingz.org\">Launch your website</a>
    </div>
    </td></tr></table>
</body>
</html>

";
/**/$subject  = "$makethis Hostingz Site Builder Account Details";
/**/$headers  = 'MIME-Version: 1.0' . "\r\n";
/**/$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
/**/
/**/// Additional headers
/**/$to = "$email";
/**/$headers .= "To:<$to>" . "\r\n";
/**/$headers .= 'From: Hostingz <donotreply@hostingz.org>' . "\r\n";
/**/// Mail it
/**///$task = mail($to, $subject, $message, $headers);
////////////////////////////////////////////////////////////////////////
/**////////Email the user their account details
 

    fwrite($fhandle, $content);
    fclose($fhandle);
    
    if (!is_dir($settings['filesFolder']))
        {
            mkdir($settings['filesFolder'], 0777);
            chmod($settings['filesFolder'],0777);
        }
    if (!is_dir($settings['picturesFolder'])) {
        mkdir($settings['picturesFolder'], 0777);
        chmod($settings['picturesFolder'],0777);
        };
    if (!is_dir($settings['scriptsFolder'])){
        mkdir($settings['scriptsFolder'], 0777);
        chmod($settings['scriptsFolder'],0777);
    }
    
    
    if(checkFileExistance($settings['menufile'])=='0'){
        checkMenuFile();
    } else {
        if (is_file($settings['menufile'])) {
            if (is_readable($settings['menufile'])) {
                $Mcontent = file_get_contents($settings['menufile']);
                if($Mcontent == ''){
                    checkMenuFile();
                }
            }
        }
    }
    
    
    
    //desbest edit remove
    //echo '<html><head><script>document.location = "zimplit.php?action=load&file='.$indexFile.'";</script></head<body></body></html>';
}

function checkMenuFile(){
    global  $settings, $indexFile;
    
        $theIndFile = 'hasNone';
        if(checkFileExistance('index.html')=='0'){
            if(checkFileExistance('index.htm')=='0'){
            
            } else{
                $theIndFile = 'index.htm';
            }
        } else {
            $theIndFile = 'index.html';
        }
        
        
        
        if ($theIndFile != 'hasNone'){
            $fhandle = fopen($settings['menufile'], 'w');
            
                $contentMenu = 'var ZMenuArray = []; 
var GlobZIndexfile = "'.$theIndFile.'"; 
ZMenuArray["'.$theIndFile.'"] = [];
ZMenuArray["'.$theIndFile.'"]["name"] = "First Page";
ZMenuArray["'.$theIndFile.'"]["parent"] = "";
ZMenuArray["'.$theIndFile.'"]["self"] = "'.$theIndFile.'";
ZMenuArray["'.$theIndFile.'"]["index"] = "0";';

            fwrite($fhandle, $contentMenu);
            fclose($fhandle);
        } else {
            
        }
}


//Show login screen
function showLoginScreen() {
    global $settings, $locationOfEditor;
    $content = '
        <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
        <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="et" lang="et">
        <head>
            <title></title>
            <meta name="author" content="" />
            <meta name="keywords" content="" />
            <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
                
            <link rel="stylesheet" href="'.$locationOfEditor.'Zstyle.css" type="text/css" media="all" />
            <script src="'.$locationOfEditor.'jquery.js" type="text/javascript"></script>
            <script src="'.$locationOfEditor.'jquery-ui.js" type="text/javascript"></script>

            <script type="text/javascript">
                function InitRegister(){
                    $("#ZMainOverlay").height($(window).height());
                    $("#ZloginScreen").draggable();
                    $("#zimplitPage").height($(window).height());
                    
                }
            </script>
            
        </head>
        <body onload="InitRegister();" style="overflow:hidden;">
            <div id="ZMainOverlay"></div>
            <div style="width: 100%; top:0px; left:0px; display:block; position: absolute; z-index: 20;  text-align:center;margin:0; padding:100px 0 0 0;">
                <div id="ZloginScreen" class="ZpopupScreen" >
                    <div class="inner">
                        <div class="header">
                            <a href="'.getIndexFile().'"><img src="'.$locationOfEditor.'images/close.gif" class="closeBtn" alt="" /></a>
                            Log in
                        </div>
                        <form method="post" action="zimplit.php?action=login">
                        <div class="loginarea">
                            <a href="http://www.zimplit.org"><img src="'.$locationOfEditor.'images/logo1.gif" id="theZlogo" alt="" /></a>
                            <br/>
                            <span style="font-size:10px;line-height: 12px;">Username</span>
                            <input type="text" class="txtbox" name="username" value="Username" onfocus="if(this.value==\'Username\'){this.value=\'\';}"/>
                            <span style="font-size:10px;line-height: 12px;">Password</span>
                            <input type="password" class="txtbox" name="password" value="password" onfocus="if(this.value==\'password\'){this.value=\'\';}" />
                            <input type="submit" name="submit" class="submitBtn" value="Start!" /> 
                            <!-- input type="checkbox" name="remember" /> Remember Me! --><br/><br/>
                            <a href="zimplit.php?action=generatenewpassword" target="_top" style="color: #1e9d11;">Forgot password?</a>
                            
                        </div>
                        </form>
                    </div>
                </div>
            </div>
            
            <!-- the frame of page to be loaded into -->
            <iframe id="zimplitPage" width="100%" frameborder="0"  src="'.getIndexFile().'"></iframe>
        </body>
        </html>    
    ';
    echo $content;
}


//Show registration screen
function showRegistrationScreen() {
    global $settings, $locationOfEditor;
    
    $content = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
                <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="et" lang="et">
                <head>
                    <title></title>
                    <meta name="author" content="" />
                    <meta name="keywords" content="" />
                    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
                        
                    <link rel="stylesheet" href="'.$locationOfEditor.'Zstyle.css" type="text/css" media="all" />
                    <script src="'.$locationOfEditor.'jquery.js" type="text/javascript"></script>
                    <script src="'.$locationOfEditor.'jquery-ui.js" type="text/javascript"></script>

                    <script type="text/javascript">
                        function InitRegister(){
                            $("#ZMainOverlay").height($(window).height());
                            $("#ZloginScreen").draggable();
                            $("#zimplitPage").height($(window).height());
                            
                        }
                        
                        function CheckZForm(){
                            var theanswer = true;
                            var alerts = "Some fileds are not filled: \n";
                            if (($("#Zusername").val() == "")||($("#Zusername").val() == "Username")){
                                alerts += "Username not defined. \n";
                                theanswer = false;
                            }
                            if (($("#Zemail").val() == "")||($("#Zemail").val() == "Your email address")){
                                alerts += "Email not defined. \n";
                                theanswer = false;
                            }
                            if ($("#Zpassword").val() == ""){
                                alerts += "Password not defined. \n";
                                theanswer = false;
                            } else {
                                if (document.getElementById("Zpassword").value != document.getElementById("Zpasswordagain").value){
                                    alerts += "Password and retyped password do not match. \n";
                                    theanswer = false;
                                }
                            }
                            if (!theanswer){ alert(alerts);}
                            return theanswer;
                        }
                    </script>
                    
                </head>
                <body onload="InitRegister();">
                    <div id="ZMainOverlay"></div>
                    <div style="width: 100%; top:0px; left:0px; display:block; position: absolute; z-index: 20;  text-align:center;margin:0; padding:100px 0 0 0;">
                        <div id="ZloginScreen" class="ZpopupScreen" style="height:350px;">
                            <div class="inner" style="height:346px;">
                                <div class="header">
                                    <a href="'.getIndexFile().'"><img src="'.$locationOfEditor.'images/close.gif" class="closeBtn " alt="" /></a>
                                    Create your account!
                                </div>
                                <form method="post" action="zimplit.php?action=register" onsubmit="return CheckZForm();">
                                <div class="loginarea">
                                    <!-- <a href="#"><img src="'.$locationOfEditor.'images/logo1.gif" id="theZlogo" alt="" /></a><br/>  -->
                                    <span style="font-size:10px;line-height: 12px;">Username</span>
                                    <input type="text" class="txtbox" id="Zusername" name="username" onclick="this.value=\'\';" value="Username"/>
                                    <br><br><span style="font-size:10px;line-height: 12px;">Password</span>
                                    <input type="password" class="txtbox" id="Zpassword" name="password" onclick="this.value=\'\';" value="" />
                                    
                                    <br><br><span style="font-size:10px;line-height: 12px;">Retype password</span>
                                    <input type="password" class="txtbox" id="Zpasswordagain" name="password_again" onclick="this.value=\'\';" value="" />
                                    <br><br><span style="font-size:10px;line-height: 12px;">Your email address</span>
                                    <input type="text" class="txtbox" id="Zemail" name="email" onclick="this.value=\'\';" value="Your email address"/>
                                    
                                    <br><br><span style="font-size:10px;line-height: 12px;">Your site identity and subdomain
                                    <input type="text" readonly class="txtbox" name="makethis" value="'.$_POST[makethis].'"/>
                                    <input type="submit" name="submit" class="submitBtn" value="Start!" />
                                    
                                </div>
                                </form>
                            </div>
                        </div>
                    </div>
                    <!-- the frame of page to be loaded into -->
                    <iframe id="zimplitPage" width="100%" frameborder="0" height="700px" src="'.getIndexFile().'"></iframe>
                </body>
                </html>';
    
    //desbest edited here            
    /*
    if ($_POST[makethis] != ""){
    echo $content;
    } else {
    echo "
    <h1>Error!</h1>
    <h2>You might have typed it into the address bar.</h2>
    <h3>This is not allowed. This empty website will be deleted within a week.</h3>
    <h4><a href=\"#\" onClick=\"history.go(-1)\">Go Back</a></h4>
    "; 
  }
  */ echo $content;

}


//Checking username and password
function login($username, $password) {
    global $settings;
    $content = file_get_contents($settings['passfile']);
    if (strpos($content, '$u="'.$username.'";') && strpos($content, '$p="'.md5($password).'";')) {
        setcookie("Zuser", $username);
        setcookie("Zpass", md5($password));
        $PageToLoad = "?action=load&file=";
        if ($file == ""){
            $PageToLoad .= getIndexFile();
        } else {
            $PageToLoad .= $file;
        }
        header( 'Location: zimplit.php'. $PageToLoad ) ;
    } else {
        logout();
    }
}

//Closing session
function logout() {
    setcookie("Zuser", "", time()-60*60*24*30);
    setcookie("Zpass", "", time()-60*60*24*30);
    showLoginScreen();
}


//Check, if the visitor is authorized to access the CMS
function isAutorized() {
    global $settings;
    $rv = false;
    $content = file_get_contents($settings['passfile']);
    if (strpos($content, '$u="'.$_COOKIE['Zuser'].'";') && strpos($content, '$p="'.$_COOKIE['Zpass'].'";')) {
        $rv = true;
    }
    // $rv = isset($_SESSION['username']) && isset($_SESSION['password']) && (strlen($_SESSION['username']) > 0) && (strlen($_SESSION['password']) > 0);
    return $rv;
}

//Change username and password
function changeUsernamePasword($username, $password) {
    global $settings;

    $content = str_replace('$u="'.$_COOKIE['Zuser'].'"; $p="'.$_COOKIE['Zpass'].'";',
                             '$u="'.$username.'"; $p="'.md5($password).'";', $content);
    
    $fhandle = fopen($settings['passfile'], 'w');
    fwrite($fhandle, $content);
    fclose($fhandle);
    setcookie("Zuser", $username);
    setcookie("Zpass", md5($password));
    
    return $content;
}


//Generate and send a new password
function generateNewPassword() {
    global $settings, $securityCode, $locationOfEditor;
    $chars = 'abcdefghijklmnopqrstuvwxyz1234567890';
    
    $content = file_get_contents($settings['passfile']);
    preg_match('/\$e=\"([^\"]*)\"/', $content, $matches);
    $email = $matches[1];
    
    preg_match('/\$u=\"([^\"]*)\"/', $content, $matches);
    $username = $matches[1];
    
    $securityCode2 = md5(date("F d Y H:i:s.", filemtime($settings['passfile'])));
    
    if ($securityCode) {
        if ($securityCode == $securityCode2) {
            for ($i = 0; $i < 8; $i++) {
                $char = $chars[rand(0, strlen($chars)-1)];
                $newpass .= $char;
            }
            
            $fhandle = fopen($settings['passfile'], 'w');
            $content = preg_replace('/\$p=\"([^\"]*)\"/', '$p="'.md5($newpass).'"', $content);
            $r = fwrite($fhandle, $content);
            fclose($fhandle);
            
            $message = str_replace('[username]', $username, $settings['reminderContent']);
            $message = str_replace('[password]', $newpass, $message);
            mail($email, 'Your new Zimplit password', $message);
            
            /* the html displayed when passwd confirmation sent */
            $content = '
            <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
            <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="et" lang="et">
            <head>
                <title></title>
                <meta name="author" content="" />
                <meta name="keywords" content="" />
                <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
                    
                <link rel="stylesheet" href="'.$locationOfEditor.'Zstyle.css" type="text/css" media="all" />
                <script src="'.$locationOfEditor.'jquery.js" type="text/javascript"></script>
                <script src="'.$locationOfEditor.'jquery-ui.js" type="text/javascript"></script>

                <script type="text/javascript">
                    function InitRegister(){
                        $("#ZMainOverlay").height($(window).height());
                        $("#ZloginScreen").draggable();
                        $("#zimplitPage").height($(window).height());
                        
                    }
                </script>
                
            </head>
            <body onload="InitRegister();" style="overflow:hidden;">
                <div id="ZMainOverlay"></div>
                <div style="width: 100%; top:0px; left:0px; display:block; position: absolute; z-index: 20;  text-align:center;margin:0; padding:100px 0 0 0;">
                    <div id="ZloginScreen" class="ZpopupScreen"  >
                        <div class="inner">
                            <div class="header">
                                <a href="'.getIndexFile().'"><img src="'.$locationOfEditor.'images/close.gif" class="closeBtn" alt="" /></a>
                                Change password
                            </div>
                            <form method="post" action="zimplit.php?action=login">
                            <div class="loginarea" style="font-size: 11px;">
                                <a href="http://www.zimplit.org"><img src="'.$locationOfEditor.'images/logo1.gif" id="theZlogo" alt="" /></a>
                                <br/>
                                A new password was created and sent to Your e-mail.<br/><br/>Check your email.<br/> To continue loging in klick OK.<br/><br/><br/>
                                <a class="submitBtn" href="zimplit.php" style="display:block;text-align:center; line-height:30px;text-decoration: none; color: #333333;">OK!</a>
                            </div>
                            </form>
                        </div>
                    </div>
                </div>
                
                <!-- the frame of page to be loaded into -->
                <iframe id="zimplitPage" width="100%" frameborder="0"  src="'.getIndexFile().'"></iframe>
            </body>
            </html>    
        ';
            
            
            if ($r > 0) echo $content;
            else return false;
        } else {
            $content = '
            <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
            <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="et" lang="et">
            <head>
                <title></title>
                <meta name="author" content="" />
                <meta name="keywords" content="" />
                <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
                    
                <link rel="stylesheet" href="'.$locationOfEditor.'Zstyle.css" type="text/css" media="all" />
                <script src="'.$locationOfEditor.'jquery.js" type="text/javascript"></script>
                <script src="'.$locationOfEditor.'jquery-ui.js" type="text/javascript"></script>

                <script type="text/javascript">
                    function InitRegister(){
                        $("#ZMainOverlay").height($(window).height());
                        $("#ZloginScreen").draggable();
                        $("#zimplitPage").height($(window).height());
                        
                    }
                </script>
                
            </head>
            <body onload="InitRegister();" style="overflow:hidden;">
                <div id="ZMainOverlay"></div>
                <div style="width: 100%; top:0px; left:0px; display:block; position: absolute; z-index: 20;  text-align:center;margin:0; padding:100px 0 0 0;">
                    <div id="ZloginScreen" class="ZpopupScreen"  >
                        <div class="inner">
                            <div class="header">
                                <a href="'.getIndexFile().'"><img src="'.$locationOfEditor.'images/close.gif" class="closeBtn" alt="" /></a>
                                Change password
                            </div>
                            <form method="post" action="zimplit.php?action=login">
                            <div class="loginarea" style="font-size: 11px;">
                                <a href="http://www.zimplit.org"><img src="'.$locationOfEditor.'images/logo1.gif" id="theZlogo" alt="" /></a>
                                <br/>
                                Password confirmation failed!<br/><br/>This error can be because someone has already requested a new password change. <br/><br/><br/>
                                <a class="submitBtn" href="zimplit.php" style="display:block;text-align:center; line-height:30px;text-decoration: none; color: #333333;">OK!</a>
                            </div>
                            </form>
                        </div>
                    </div>
                </div>
                
                <!-- the frame of page to be loaded into -->
                <iframe id="zimplitPage" width="100%" frameborder="0"  src="'.getIndexFile().'"></iframe>
            </body>
            </html>    
        ';
        
        
            echo $content;
        }
    } else {
        $link = 'http://'.$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF'].'?action=generatenewpassword&securitycode='.$securityCode2.'';
        $message = $settings['confirmationContent'].$link;
        mail($email, 'A new password was requested from Zimplit editor', $message);
        
        /* the html displayed when passwd confirmation sent */
            $content = '
            <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
            <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="et" lang="et">
            <head>
                <title></title>
                <meta name="author" content="" />
                <meta name="keywords" content="" />
                <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
                    
                <link rel="stylesheet" href="'.$locationOfEditor.'Zstyle.css" type="text/css" media="all" />
                <script src="'.$locationOfEditor.'jquery.js" type="text/javascript"></script>
                <script src="'.$locationOfEditor.'jquery-ui.js" type="text/javascript"></script>

                <script type="text/javascript">
                    function InitRegister(){
                        $("#ZMainOverlay").height($(window).height());
                        $("#ZloginScreen").draggable();
                        $("#zimplitPage").height($(window).height());
                        
                    }
                </script>
                
            </head>
            <body onload="InitRegister();" style="overflow:hidden;">
                <div id="ZMainOverlay"></div>
                <div style="width: 100%; top:0px; left:0px; display:block; position: absolute; z-index: 20;  text-align:center;margin:0; padding:100px 0 0 0;">
                    <div id="ZloginScreen" class="ZpopupScreen"  >
                        <div class="inner">
                            <div class="header">
                                <a href="'.getIndexFile().'"><img src="'.$locationOfEditor.'images/close.gif" class="closeBtn" alt="" /></a>
                                Change password
                            </div>
                            <form method="post" action="zimplit.php?action=login">
                            <div class="loginarea" style="font-size: 11px;">
                                <a href="http://www.zimplit.org"><img src="'.$locationOfEditor.'images/logo1.gif" id="theZlogo" alt="" /></a>
                                <br/>
                                A mail with confirmation for a new password was sent to Your mail. <br/><br/> Check your mailbox to confirm <br/>password change!<br/><br/><br/>
                                <a class="submitBtn" href="zimplit.php" style="display:block;text-align:center; line-height:30px;text-decoration: none; color: #333333;">OK!</a>
                            </div>
                            </form>
                        </div>
                    </div>
                </div>
                
                <!-- the frame of page to be loaded into -->
                <iframe id="zimplitPage" width="100%" frameborder="0"  src="'.getIndexFile().'"></iframe>
            </body>
            </html>    
        ';
        echo $content;
    
    }
}

//Send reply mail 

function sendReply(){
    $message = '
User question from Zimplit editor

Name: '.$_POST['Name'].'
E-mail: '.$_POST['Email'].'

Location: '.$_POST['doclocation'].'

Problem:
'.utf8_decode($_POST['Text']).'
    ';
    mail('support@zimplit.org', 'User question from Zimplit editor', $message);
    return true;
}

// checck file existance
// returns 1 if file exists and 0 if does not
function checkFileExistance($file){
    if (is_file($file)) {
        if (is_readable($file)) {
            return '1';
        } else {
            return '0';
        }
    } else {
        return '0';
    }
}

function getIndexFile(){
    if(checkFileExistance('index.html')=='0'){
        return 'index.htm';
    } else {
        return 'index.html';
    }
}

// function to resize image via gd library

function createthumb($name,$filename,$new_w,$new_h){
    $system=explode('.',$name);
    if (preg_match('/jpg|jpeg|JPG|JPEG/',$system[1])){
        $src_img=imagecreatefromjpeg($name);
    }
    if (preg_match('/png|PNG/',$system[1])){
        $src_img=imagecreatefrompng($name);
    }
    $old_x=imageSX($src_img);
    $old_y=imageSY($src_img);
    if ($old_x > $old_y) {
        $thumb_w=$new_w;
        $thumb_h=$old_y*($new_h/$old_x);
    }
    if ($old_x < $old_y) {
        $thumb_w=$old_x*($new_w/$old_y);
        $thumb_h=$new_h;
    }
    if ($old_x == $old_y) {
        $thumb_w=$new_w;
        $thumb_h=$new_h;
    }
    $dst_img=ImageCreateTrueColor($thumb_w,$thumb_h);
    imagecopyresampled($dst_img,$src_img,0,0,0,0,$thumb_w,$thumb_h,$old_x,$old_y);
    if (preg_match("/png/",$system[1]))
    {
        imagepng($dst_img,$filename); 
    } else {
        imagejpeg($dst_img,$filename); 
    }
    imagedestroy($dst_img); 
    imagedestroy($src_img); 
}


//Get the HTML content from the file.
//Returns FALSE on falure, html content on success
function getHTML($file) {
    if (is_file($file)) {
        if (is_readable($file)) {
            
            $content = file_get_contents($file);
            if ($content === FALSE) {
                return 'Error: Cannot read from the file '.$file.'.';
            }
            
            return $content;
        } else {
            return 'Error: The file '.$file.' is not readable.';
        }
    } else {
        return 'Error: The file '.$file.' does not exist.';
    }
}

//Get the HTML content from the file with editor .
//Returns FALSE on falure, html content on success
function getHTML1($file) {
    global  $locationOfEditor,$GDsupport;
    if (is_file($file)) {
        if (is_readable($file)) {
            
            $content = file_get_contents($file);
            if ($content === FALSE) {
                return 'Cannot read from the file '.$file.'.';
            } else {
                $LoadingFrameHtmlTop = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
                    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="et" lang="et">
                    <head>
                        <title></title>
                        <meta name="author" content="" />
                        <meta name="keywords" content="" />
                        <meta http-equiv="Pragma" content="no-cache">
                        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
                        
                        <link rel="stylesheet" href="'.$locationOfEditor.'Zstyle.css" type="text/css" media="all" />
                        <script src="'.$locationOfEditor.'jquery.js" type="text/javascript"></script>
                        <script src="'.$locationOfEditor.'jquery-ui.js" type="text/javascript"></script>
                        <script src="'.$locationOfEditor.'jquery.form.js" type="text/javascript"></script>
                        <script type="text/javascript">
                            GlobZIndexfile = "'.getIndexFile().'";
                            GDsupport = "'.$GDsupport.'";
                            ZimplitEditorLocation = "'.$locationOfEditor.'";
                        </script>
                        <script src="'.$locationOfEditor.'zimplit.js" type="text/javascript"></script>
                        <script src="Zmenu.js?t='.time().'" type="text/javascript"></script>
                        
                    <style>
                        body,html { margin:0; padding:0; }
                        iframe { border:0; margin:0; padding:0; width: 100%; }
                        #zimplitMenu {background: #AAAAAA; } 
                    </style>
                        
                    </head>
                    <body onload="ready();" id="ZimplitRootBody">
                        <!-- the frame of page to be loaded into -->
                        <iframe id="zimplitPage" name="zimplitPage" onload="ZDoTheReload();" width="100%" frameborder="0" height="700px" src="';
                                         
                $LoadingFrameHtmlBottom ='"></iframe>
                    </body>
                    </html>';
                $content = $LoadingFrameHtmlTop . $file . $LoadingFrameHtmlBottom;
            }
            
            
            
            return $content;
        } else {
            return 'The file '.$file.' is not readable.';
        }
    } else {
        return 'The file '.$file.' does not exist.';
    }
}


//Writes the HTML content to the file.
//Returns FALSE on falure, TRUE on success
function saveHTML($file, $html) {
    if (is_file($file)) {
        if (is_writable($file)) {
            if (!$handle = fopen($file, 'w')) {
                return 'Cannot open file '.$file.'.';
            }
            if (fwrite($handle, $html) === FALSE) {
                return 'Cannot write to file '.$file.'.';
            }
            fclose($handle);
        } else {
            return 'The file '.$file.' is not writable.';
        }
    } else {
        return 'The file '.$file.' does not exist.';
    }
}

function checkFileIsWritable($file){
    if (is_writable($file)) {
        return 0;
    } else {
        return 1;
    }
}



//Writes the HTML content to the file.
//Returns FALSE on falure, TRUE on success
function saveHTML1($file, $html) {
    $html1 = preg_replace('/\\\"/', '"', urldecode($html));
    $html1 = preg_replace('/%27/', "'", $html1);
    
    if (is_file($file)) {
        if (is_writable($file)) {
            if (!$handle = fopen($file, 'w')) {
                return 'Cannot open file '.$file.'.';
            }
            if (fwrite($handle, $html1) === FALSE) {
                return 'Cannot write to file '.$file.'.';
            }
            fclose($handle);
        } else {
            return 'The file '.$file.' is not writable.';
        }
    } else {
        return 'The file '.$file.' does not exist.';
    }
}



//Create new html file
function newFile($file) {
    if (file_exists($file)) {
        return 'The file '.$file.' already exists.';
    }
    if (touch($file)) {
        chmod($file,0666); 
        return true;
    } else {
        return 'The file '.$file.' cannot be created.';
    }
}


//Delete the file
function deleteFile($file, $folder='') {
    if (!file_exists($file)) {
        return 'The file '.$file.' does not exist.';
    }
    if (@unlink($file)) {
        return true;
    } else {
        return 'The file '.$file.' cannot be deleted.';
    }
}


//Upload a file
function uploadFile($folder='') {
    global $_FILES, $max_width, $max_height,$GDsupport;
    
    $file = $_FILES['file']['name'];
    $tmpfile = $_FILES['file']['tmp_name'];
    
    if ($folder) {
        if (!is_dir($folder)) {
            return 'No such directory: '.$folder;
        } else if (!is_writable($folder)) {
            return 'Cannot write to directory: '.$folder;
        }
    }
    
    $error = $_FILES["file"]["error"];
    if ($error == UPLOAD_ERR_INI_SIZE) {
           return 'The uploaded file exceeds the upload_max_filesize directive in php.ini.';
       } else if ($error == UPLOAD_ERR_FORM_SIZE) {
           return 'The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form.';
       } else if ($error == UPLOAD_ERR_PARTIAL) {
           return 'The uploaded file was only partially uploaded.';
       } else if (!$error == UPLOAD_ERR_OK) {
           return 'Failed to upload the file.';
       }
    
    $ext = strchr($file, '.');

    //Check image size
    if (strpos('.jpg.jpeg.png.gif.', $ext.'.') !== false) {
        $info = getimagesize($tmpfile);
    
        if (($info[0] > $max_width) || ($info[1] > $max_height)) {
            return 'Image must be '.$max_width.'px X '.$max_height.'px or smaller. Please resize image and try again.';
        }
    }
    if ($folder) {
        $path = $folder.'/'.$file;
    } else {
        $path = $file;
    }
    if (!move_uploaded_file($tmpfile, $path)) {
        return 'Failed to move the file to the '.$folder.' directory.';
    } else {
        if($GDsupport){ // if gd library present do thumbnail
            if (strpos('.jpg.jpeg.png.JPG.JPEG.PNG.', $ext.'.') !== false) {
                $content = file_get_contents('Zsettings.js');
                preg_match('/ZmaxpicZoomW \= \"([^\"]+)\"/i', $content, $ZWmatch); 
                $ZoomThumbW =  $ZWmatch[1];
                preg_match('/ZmaxpicZoomH \= \"([^\"]+)\"/i', $content, $ZHmatch); 
                $ZoomThumbH =  $ZHmatch[1];
                $thenewname = preg_replace('/'.$ext.'/i', '_thumb'.$ext, $path);
                createthumb($path,$thenewname,$ZoomThumbW,$ZoomThumbH);
            } 
        }
        return true;
    }
}


//Rename a file
function renameFile($oldName, $newName) {
    if (file_exists($newName)) {
        return 'The file '.$newName.' already exists.';
    }
    if (!file_exists($oldName)) {
        return 'The file '.$oldName.' does not exist.';
    }
    if (rename($oldName, $newName)) {
        return true;
    } else {
        return 'Failed to rename a file '.$oldName.'.';
    }
}


//Copy a HTML file with a new title
function copyHtml($file, $newFile, $title) {
    $content = getHTML($file);
    if (strpos($content, 'Error: ') !== 0) {
        $content = preg_replace('/<title>[^<]+<\/title>/i', '<title>'.$title.'</title>', $content);
        $r = newFile($newFile);
        if (strpos($r, 'Error: ') !== 0) {
            return saveHTML($newFile, $content);
        } else return $r;
    } else return $content;
}

//Get a list of files in http directory
function listFiles() {
    if ($handle = opendir('.')) {
        while (false !== ($file = readdir($handle))) {
            if ($file != '.' && $file != '..' && is_file($file) && strpos($file, '.htm')) {
                $files[] = $file;
            }
        }
        closedir($handle);
        
        $fileAndTitle = array();
        
        foreach($files as $Thefile){
            $content = getHTML($Thefile);
            
            $matches = array();
            $pattern = '/<title>(.*)<\/title>/i';
            preg_match($pattern, $content, $matches);
            $pagetitle = $matches[1];
            $fileAndTitle[] = $Thefile.'|'.$pagetitle;
            
        }
    }
    return implode(';', $fileAndTitle);
}


//Download zip
function downloadZip($src) {
    global $settings;
    
    $file = basename($src);
    if(function_exists("curl_init")) {
        $ch = curl_init();
        $fp = fopen($file, 'w');
        //desbest edit
        curl_setopt($ch, CURLOPT_URL, $settings['templates_remote_dirpath'].'/'.$src);
        curl_setopt($ch, CURLOPT_BINARYTRANSFER, true);        
        curl_setopt($ch, CURLOPT_FILE, $fp);
        $response = curl_exec($ch);
        curl_close($ch);
    } else {
    //desbest edit
        $data = file_get_contents($settings['templates_remote_dirpath'].'/'.$src);
        file_put_contents($file, $data);
    }
}

function unzip($file, $path="") {
    global $settings;
    $filepath = getcwd().'/'.$file;
    if (file_exists($filepath)) {
        
        if (file_exists($settings['scriptsFolder'].'/pclzip.lib.php')) {
            require_once($settings['scriptsFolder'].'/pclzip.lib.php');
            $archive = new PclZip($file);
            if ($archive->extract() == 0) {
                return "Error : ".$archive->errorInfo(true);
            }
        } else {
            $phpversion = phpversion();
            $modules = get_loaded_extensions();
            if ($phpversion[0] == 4) {
                if (function_exists("zip_open")) {
                    $zip = zip_open($filepath);
                    if ($zip) {
                        while ($zip_entry = zip_read($zip)) {
                            if (zip_entry_filesize($zip_entry) > 0) {
                                $complete_path = $path.str_replace('/','\\',dirname(zip_entry_name($zip_entry)));
                                $complete_name = $path.str_replace ('/','\\',zip_entry_name($zip_entry));
                                if(!file_exists($complete_path)) { 
                                    $tmp = '';
                                    foreach(explode('\\',$complete_path) as $k) {
                                        $tmp .= $k.'\\';
                                        if(!file_exists($tmp)) {
                                            mkdir($tmp, 0777);
                                        }
                                    }
                                }
                                if (zip_entry_open($zip, $zip_entry, "r")) {
                                    $fd = fopen($complete_name, 'w');
                                    fwrite($fd, zip_entry_read($zip_entry, zip_entry_filesize($zip_entry)));
                                    fclose($fd);
                                    zip_entry_close($zip_entry);
                                }
                            }
                        }
                        zip_close($zip);
                        return true;
                    } else {
                        return 'Error: The zip file '.$file.' is damaged.';
                    }
                }            
                
            } else {
                if (in_array("zip", $modules)) {
                    $zip = new ZipArchive();
                    if ($zip->open($file)===true)
                    {
                        $zip->extractTo(".");
                        $zip->close();
                        return true;
                    }
                    return 'Error: The zip file '.$file.' is damaged.';
                } else {
                    return 'Error: Zip is not supported.';
                }
            }
        }
        
    } else {
        return 'Error: The file '.$file.' does not exist.';
    }
}

function downloadTemplate($file) {
    downloadZip($file);
    return unzip(basename($file),'');
}

function checkIfHasIndexFile(){
    if(checkFileExistance('index.html')=='0'){
        if(checkFileExistance('index.htm')=='0'){
            return false;
        } else { 
            return true;
        }
    } else {
        return true;
    }
}


function loadExternalTemplHtml($fileaddr){
    global  $locationOfEditor;
    header('Content-Type: text/html');
    
        $LoadingFrameHtmlTop = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
            <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="et" lang="et">
            <head>
                <title></title>
                <meta name="author" content="" />
                <meta name="keywords" content="" />
                <meta http-equiv="Pragma" content="no-cache">
                <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
                
                <link rel="stylesheet" href="'.$locationOfEditor.'Zstyle.css" type="text/css" media="all" />
                <script src="'.$locationOfEditor.'jquery.js" type="text/javascript"></script>
                <script src="'.$locationOfEditor.'jquery-ui.js" type="text/javascript"></script>
                <script src="'.$locationOfEditor.'jquery.form.js" type="text/javascript"></script>
                <script src="'.$locationOfEditor.'zimplitTemplate.js" type="text/javascript"></script>
            <style>
                body,html { margin:0; padding:0; }
                iframe { border:0; margin:0; padding:0; width: 100%; }
                #zimplitMenu {background: #AAAAAA; } 
            </style>
                
            </head>
            <body onload="ready();" id="ZimplitRootBody">
                <!-- the frame of page to be loaded into -->
                <div id="zimplitTempPage">';
                                 
        $LoadingFrameHtmlBottom ='</div>
            </body>
            </html>'; 
        $content = $LoadingFrameHtmlTop . file_get_contents($fileaddr) . $LoadingFrameHtmlBottom;
    echo $content;
}


/*unzip("template1.zip");*/

if (file_exists($settings['passfile'])) {
    if (isAutorized()) {
        
            if(checkFileExistance($settings['menufile'])=='0'){
            checkMenuFile();
        } else {
            if (is_file($settings['menufile'])) {
                if (is_readable($settings['menufile'])) {
                    //$Mcontent = file_get_contents($settings['menufile']);
                    
                    if(filesize($settings['menufile'])== 0){
                            echo '<script>alert("tyhi");</script>';
                        checkMenuFile();
                    }
                }
            }
        }
        
        if ($action == 'logout') {
            logout();
            //showLoginScreen();
        } else {
            if(checkIfHasIndexFile()){
                $processRequest = true;
            } else {
                if ($action == 'gettemplate') {
                    if(downloadTemplate($file) == ''){
                        echo '<html><head><script>document.location = "zimplit.php";</script></head<body></body></html>';
                    } else { 
                        echo 'Some bad, bad error occured! Unpacking failed.';
                    }
                } else {
          //desbest edit
                    loadExternalTemplHtml($settings['templates_remote_path']);
                }
            }
        }        
    } else {
        if (($action == 'login') && $username && $password) {
            login($username, $password);
        } else if($action == 'generatenewpassword') {
            generateNewPassword();
        } else {
            showLoginScreen();
        }
    }
} else {
    if (($action == 'register') && $username && $password &&
            $password_again && $email && ($password == $password_again)) {
        register($username, $password, $email);
        $processRequest = true;
    } else {
        showRegistrationScreen();
    }
}

if ($processRequest) {
    if ($action == 'load') {
        echo getHTML1($file);
    } else if ($action == 'load1') {
        echo getHTML($file);    
    } else if ($action == '') {
        echo getHTML1($indexFile);
    } else if ($action == 'save') {
        echo saveHTML($file, $html);
    } else if ($action == 'saveE') {
        echo saveHTML1($file, $html);
    } else if ($action == 'new') {
        echo newFile($file);
    } else if ($action == 'delete') {
        echo deleteFile($file);
    } else if ($action == 'upload') {
        echo uploadFile($folder);
    } else if ($action == 'rename') {
        echo renameFile($oldName, $newName);
    } else if ($action == 'changeuserpass') {
        echo changeUsernamePasword($username, $password);
    } else if ($action == 'generatenewpassword') {
        echo generateNewPassword();
    } else if ($action == 'listfiles') {
        echo listFiles();
    } else if ($action == 'copyhtml') {
        echo copyHTML($file, $newName, $title);
    } else if ($action == 'checkFile') {
        echo checkFileExistance($file);
    } else if ($action == 'sendreply') {
        echo sendReply();
    } else if ($action == 'iswriteble') {
        echo checkFileIsWritable($file);
    } else if ($action == 'gettemplate') {
        echo downloadTemplate($file);
    } else if ($action== 'loadExternalHtml'){
        echo loadExternalTemplHtml($file);
    }
}

?>

Untitled PHP (25-Jan @ 20:38)

Syntax Highlighted Code

  1. <?php
  2.  
  3.  
  4. [33 more lines...]

Plain Code

<?php

ob_start();

$w = 110;
$h = 18;

// Plot Random Data
for($i=0;$i<30;$i++)$d .= ($i!=0)?",".rand(1,250):rand(1,250);

$im = imagecreate($w,$h);

imageantialias($im,true);

$bg = imagecolorallocate($im,255,255,255);
$li = imagecolorallocate($im,180,180,180);

$p = explode(",",$d);
$c = count($p);
$m = max($p);
$s = $w/($c-1);

for($i=0;$i<$c-1;$i++) {
    $x1 = $i*$s;
    $y1 = ($h-1)-(($p[$i]/$m)*($h-1));
    $x2 = ($i+1)*$s;
    $y2 = ($h-1)-(($p[($i+1)]/$m)*($h-1));
    imageline($im,$x1,$y1,$x2,$y2,$li);
}

header("Content-type:image/gif");
imagegif($im);
imagedestroy($im);

// Size of file...
$size = ob_get_length(); 

?>

Untitled PHP (23-Jan @ 16:34)

Syntax Highlighted Code

  1. <?php
  2.  echo "test";
  3. ?>

Plain Code

<?php
 echo "test";
?>

Untitled PHP (23-Jan @ 15:04)

Syntax Highlighted Code

  1. <?php
  2.  
  3. echo 'hello world';
  4.  
  5. ?>

Plain Code

<?php

echo 'hello world';

?>

Untitled PHP (15-Jan @ 20:25)

Syntax Highlighted Code

  1. <!doctype html>
  2. <html>
  3. <head>
  4.     <title>Factorial</title>
  5. [40 more lines...]

Plain Code

<!doctype html>
<html>
<head>
    <title>Factorial</title>
    
    <script type="text/javascript" src="http://code.jquery.com/jquery-1.3.js"></script>
    <script type="text/javascript">
    $(document).ready(function() {
        $('form').bind('submit', function() {
            $(this).load(this.method + '?number=' + $('#number').val() + ' form > *');
            return false;
        });
    });
    </script>
</head>
<body>
<?php

$number    = !empty($_REQUEST['number']) ? $_REQUEST['number'] : 1;
$next      = $number + 1;
$factorial = factorial($number);

echo <<<EOT
<form method="factorial.php">
    <p>$number factorial is $factorial.</p>
    <input type="hidden" id="number" name="number" value="$next" />
    <input type="submit" value="get $next factorial" />
</form>
EOT;

function factorial($number)
{
    $factorial = 1;
    for ($i = $number; $i > 1; $i--) {
        $factorial *= $i;
    }
    
    return $factorial;
}

?>

</body>
</html>

Flickr API using Jquery JSON (14-Jan @ 21:27)

desbest.myopenid.com

Syntax Highlighted Code

  1. <!--
  2. With help from here.
  3. The api output uses the JSON format
  4.  
  5. [34 more lines...]

Plain Code

<!-- 
With help from here.
The api output uses the JSON format

_b is the big size (1024)
_t is the thumbnail
_s is the 75×75 pixels square
_m is the medium size
removing the _? extenstion means you choose the small size.
-->
<html>
<head>
  <script src="../jquery.js"></script>

  <script>
  $(document).ready(function(){
    $.getJSON("http://api.flickr.com/services/feeds/photos_public.gne?tags=light&tagmode=any&format=json&jsoncallback=?",
        function(data){
          $.each(data.items, function(i,item){
           
         $("<img/>").attr({ 
          src: item.media.m,
          href: "http://google.com",
          alt: item.title,
        }).appendTo("#images") .wrap("<a href=\""+item.link+"\"></a>")  ;

            if ( i == 4 ) return false;
          });
        });
        
        
  });
  </script>
  <style>img{ height: 100px; float: left; border: 0px; padding: 8px;}</style>
</head>
<body>
  <div id="images"></div>
</body>
</html>

Untitled PHP (12-Jan @ 18:43)

Syntax Highlighted Code

  1. <?php
  2. /*This page is solely for declaring functions.*/
  3.  
  4.  function set_error($err)
  5. [571 more lines...]

Plain Code

<?php
/*This page is solely for declaring functions.*/

 function set_error($err)
{
global $err_load;
$error_load = (!$error_load) ? $err : $error_load;
 return true;
}

function mysql_ver() {
   $output = shell_exec('mysql -V');
   preg_match('@[0-9]+\.[0-9]+\.[0-9]+@', $output, $version);
   return $version[0];
} 

class me {
 function add_new_campaign($name,$desc,$cat,$upg,$hl,$bld,$url,$user,$connection)
 {
 $key = strtoupper(md5(time().sha1(time())));
if(mysql_query("INSERT INTO `ads` (
`aId` ,
`aIdentifyKey` ,
`aCatagory` ,
`aName` ,
`aDesc` ,
`aMembers` ,
`aOutside` ,
`aUpgraded` ,
`aClicksLeft` ,
`aPaused` ,
`aApproved` ,
`aHighlight` ,
`aBold` ,
`aCountries` ,
`aURL` ,
`aUser`
)
VALUES (
NULL , '$key', '$cat', '$name', '$desc', '0', '0', '$upg', '0', '1', '0', '$hl', '$bld', 'ALL', '$url', '$user'
);",$connection))
{
 return true;
} else {
 return false;
}

 }
 function show_catagories()
 {
 if($_SESSION['cat']) 
 {
 return $_SESSION['cat'];
 } else {
 $q = mysql_query("SELECT * FROM ad_catagories WHERE ac_draft=0 ORDER BY ac_order ASC;");
while($r=mysql_fetch_array($q))
{
$tc .= "<option value='{$r['ac_id']}'>{$r['ac_name']}</option>";
}
 $_SESSION['cat'] = $tc;
 return $tc;
 }
 }
 function new_post($topic,$name,$body,$poster,$forum,$refs,$connection)
{
mysql_query("INSERT INTO `posts` (
`pid` ,
`pposter` ,
`pname` ,
`pbody` ,
`ptime` ,
`ptopic`
)
VALUES (
NULL , '{$poster}', '{$name}', '{$body}', unix_timestamp(), '$topic'
);
", $connection) or die(mysql_error());
$in_id = mysql_insert_id($connection);
mysql_query("UPDATE users SET posts=posts+'1' WHERE username='$poster' LIMIT 1;");
mysql_query("UPDATE forums SET ftopics=ftopics+'1', fposts=fposts+'1', flastpost='<a href=\'".$full_url.$refs."#post-{$in_id}\'><abbr>{$name}</abbr></a> By ".addslashes($poster)."' WHERE fname='$forum' LIMIT 1;");
mysql_query("UPDATE topics SET tposts=tposts+'1' WHERE tid='$topic' LIMIT 1;");
return $in_id;
}
 function new_topic($topicname,$topicbody,$topiclock,$topicstick,$starter,$forum,$connection)
{
$myfile = explode('/', $_SERVER['SCRIPT_NAME']);
foreach($myfile as $mstr)
{
if(eregi('.', $mstr)) { $page_url = $mstr; }
}
$https = ($_SERVER['HTTPS'] == "on") ? "s" : "";
$folder = str_replace($page_url,"", $_SERVER['SCRIPT_NAME']);
$full_url = "http".$https."://".$_SERVER['HTTP_HOST'].$folder;

if(mysql_query("INSERT INTO `topics` (
`tid` ,
`tname` ,
`tlocked` ,
`tsticky` ,
`tposts` ,
`tviews` ,
`tstarter` ,
`lastposter` ,
`tforum`
)
VALUES (
NULL , '$topicname', '$topiclock', '$topicstick', '0', '0', '{$starter}', '{$starter}', '{$forum}'
);", $connection))
{
$mhd = mysql_insert_id($connection);
mysql_query("INSERT INTO `posts` (
`pid` ,
`pposter` ,
`pname` ,
`pbody` ,
`ptime` ,
`ptopic`
)
VALUES (
NULL , '{$starter}', '{$topicname}', '{$topicbody}', unix_timestamp(), '$mhd'
);
", $connection);
mysql_query("UPDATE users SET posts=posts+'1' WHERE username='$starter' LIMIT 1;");
mysql_query("UPDATE forums SET ftopics=ftopics+'1', fposts=fposts+'1', flastpost='<a href=\'".$full_url."post.php/{$mhd}.html\'><abbr>{$topicname}</abbr></a> By ".addslashes($starter)."' WHERE fname='$forum' LIMIT 1;");
return $mhd;
} else {
return false;
}
}
 function get_loc()
 {
 
$myfile = explode('/', $_SERVER['SCRIPT_NAME']);
foreach($myfile as $mstr)
{
if(eregi('.', $mstr)) { $page_url = $mstr; }
}
$https = ($_SERVER['HTTPS'] == "on") ? "s" : "";
$folder = str_replace($page_url,"", $_SERVER['SCRIPT_NAME']);
$full_url = "http".$https."://".$_SERVER['HTTP_HOST'].$folder;
return $full_url;
 }
 function redirect($url)
 {
 print "<meta http-equiv='refresh' content='0; url=$url'>";
 }
 function login_user($user,$pass)
 {
 $_SESSION['account_username'] = $user;
 $_SESSION['account_password'] = $pass;
 $_SESSION['account_token'] = session_id();
 mysql_query("UPDATE users SET lastaction=unix_timestamp(),lastip='{$_SERVER['REMOTE_ADDR']}' WHERE username='$user' AND password='$pass' LIMIT 1;");
 return $_SESSION;
 }
 function is_curl_installed()
 {
 if(function_exists("curl_init"))
 {
 return true;
 } else {
 return false;
 }
 }
 function login_return()
 {
 $url = "login.php?return=".urlencode($_SERVER['PHP_SELF']);
  print "<meta http-equiv='refresh' content='0; url=$url'>";
 }
 function signup_today($date)
 {
 if(date("d", $date) == date("d") && date("m", $date) == date("m") && date("y", $date) == date("y"))
{
 return true; 
} else { return false; }
} 
 function logout($vbsr)
 {
 unset($vbsr);
 session_destroy();
 return true;
 }
 function refresh_sess($vb='none')
 {
 if($vb == "none")
{ 
 $_SESSION['me'] = false;
 $_SESSION['setting'] = false;
 } else {
 $_SESSION[$vb] = false;
} 
 return true;
 }
 function send_email($email,$subj,$message)
 {
 $message = stripslashes(stripslashes($message));
 $subj = stripslashes(stripslashes($message));
 $uri = str_replace("www.", "", $_SERVER['HTTP_HOST']);
 $re_email = "webmaster@".($uri);
 if(mail($re_email, $subj, $message, "From: Gen2 <$re_email>\r\nX-Mailer: Gen2\r\nService-IP: ".$_SERVER['REMOTE_ADDR']."\r\n"))
 {
 return true;
} else {
 return false;
}
 }
 function start_request_control($cdn)
 {
 $_SESSION['last_request'][$cdn] = time();
 return true;
 }
 function request_exceed($cdn)
 {
 if($_SESSION['last_request'][$cdn] > time()-30)
{
 return true;
} else {
 return false;
}
 }
 function show_request_left($cdn)
 {
$now = time()-$_SESSION['last_request'][$cdn];
$now = 30-$now;
 return $now;
 }
 function new_user($uname,$pword,$email,$uline=false,$country,$connection)
{
$uline = ($uline) ? $uline : "";
if(mysql_query("INSERT INTO `users` (
`userid` ,
`username` ,
`password` ,
`email` ,
`paypal_email` ,
`alertpay_email` ,
`signupdate` ,
`signupip` ,
`upgraded` ,
`country` ,
`balance` ,
`withdrew` ,
`ads_clicked` ,
`upline` ,
`referrals` ,
`posts` ,
`lastaction` ,
`lastip` ,
`advertiser_balance` ,
`suspended`
)
VALUES (
NULL , '{$uname}', '{$pword}', '{$email}', '{$email}', '{$email}', unix_timestamp(), '{$_SERVER['REMOTE_ADDR']}', '0', '$country', '0.00', '0.00', '', '$uline', '0', '0', unix_timestamp(), '{$_SERVER['REMOTE_ADDR']}', '0.00', '0'
);",$connection))
{
if($uline)
{
 mysql_query("UPDATE users SET referrals=referrals+1 WHERE username='$uline' LIMIT 1;",$connection);
mysql_query("UPDATE users SET uplinetype='1' WHERE username='$uname' LIMIT 1;",$connection);
}
 return true;
} else {
 return false;
}
}
 function cleanup($str)
 {
 $str = str_replace("//", "/", $str);
 return $str;
 }
 function get_file_url()
 {
$myfile = explode('/', $_SERVER['SCRIPT_NAME']);
foreach($myfile as $mstr)
{
if(eregi('.', $mstr)) { $page_url = $mstr; }
}
 return $page_url;
 }
 function get_r_file_url()
 {
$myfile = explode('/', $_SERVER['PHP_SELF']);
foreach($myfile as $mstr)
{
if(eregi('.', $mstr)) { $page_url = $mstr; }
}
 return $page_url;
 }
 function finish_script_executions()
 {
 mysql_close();
 exit();
 }
 function filter($str)
 {
 $str = addslashes($str);
 $str = htmlentities($str);
 return $str;
 }
 function get_country_list($id,$class,$id_class,$onchng='javascript:void(0);')
 {
return <<<EOF

<select name='{$id}' class='{$class}' id='{$id_class}' onchange='$onchng'>
<option value='-'>---Select One---</option>
<option>Afghanistan</option>
<option>&Aring;land Islands</option>
<option>Albania</option>
<option>Algeria</option>
<option>American Samoa</option>

<option>Andorra</option>
<option>Angola</option>
<option>Anguilla</option>
<option>Antarctica</option>
<option>Antigua and Barbuda</option>
<option>Argentina</option>
<option>Armenia</option>
<option>Aruba</option>
<option>Australia</option>

<option>Austria</option>
<option>Azerbaijan</option>
<option>Bahamas</option>
<option>Bahrain</option>
<option>Bangladesh</option>
<option>Barbados</option>
<option>Belarus</option>
<option>Belgium</option>
<option>Belize</option>

<option>Benin</option>
<option>Bermuda</option>
<option>Bhutan</option>
<option>Bolivia</option>
<option>Bosnia and Herzegovina</option>
<option>Botswana</option>
<option>Bouvet Island</option>
<option>Brazil</option>
<option>British Indian Ocean territory</option>

<option>Brunei Darussalam</option>
<option>Bulgaria</option>
<option>Burkina Aso</option>
<option>Burundi</option>
<option>Cambodia</option>
<option>Cameroon</option>
<option>Canada</option>
<option>Cape Verde</option>
<option>Cayman Islands</option>

<option>Central African Republic</option>
<option>Chad</option>
<option>Chile</option>
<option>China</option>
<option>Christmas Island</option>
<option>Cocos (Keeling) Islands</option>
<option>Colombia</option>
<option>Comoros</option>
<option>Congo</option>

<option>Congo, Democratic Republic</option>
<option>Cook Islands</option>
<option>Costa Rica</option>
<option>C&ocirc;te d'Ivoire (Ivory Coast)</option>
<option>Croatia (Hrvatska)</option>
<option>Cuba</option>
<option>Cyprus</option>
<option>Czech Republic</option>

<option>Denmark</option>
<option>Djibouti</option>
<option>Dominica</option>
<option>Dominican Republic</option>
<option>East Timor</option>
<option>Ecuador</option>
<option>Egypt</option>
<option>El Salvador</option>
<option>Equatorial Guinea</option>

<option>Eritrea</option>
<option>Estonia</option>
<option>Ethiopia</option>
<option>Falkland Islands</option>
<option>Faroe Islands</option>
<option>Fiji</option>
<option>Finland</option>
<option>France</option>
<option>French Guiana</option>

<option>French Polynesia</option>
<option>French Southern Territories</option>
<option>Gabon</option>
<option>Gambia</option>
<option>Georgia</option>
<option>Germany</option>
<option>Ghana</option>
<option>Gibraltar</option>
<option>Greece</option>

<option>Greenland</option>
<option>Grenada</option>
<option>Guadeloupe</option>
<option>Guam</option>
<option>Guatemala</option>
<option>Guinea</option>
<option>Guinea-Bissau</option>
<option>Guyana</option>
<option>Haiti</option>

<option>Heard and McDonald Islands</option>
<option>Honduras</option>
<option>Hong Kong</option>
<option>Hungary</option>
<option>Iceland</option>
<option>India</option>
<option>Indonesia</option>
<option>Iran</option>
<option>Iraq</option>

<option>Ireland</option>
<option>Israel</option>
<option>Italy</option>
<option>Jamaica</option>
<option>Japan</option>
<option>Jordan</option>
<option>Kazakhstan</option>
<option>Kenya</option>
<option>Kiribati</option>

<option>Korea (north)</option>
<option>Korea (south)</option>
<option>Kuwait</option>
<option>Kyrgyzstan</option>
<option>Lao People's Democratic Republic</option>
<option>Latvia</option>
<option>Lebanon</option>
<option>Lesotho</option>
<option>Liberia</option>

<option>Libyan Arab Jamahiriya</option>
<option>Liechtenstein</option>
<option>Lithuania</option>
<option>Luxembourg</option>
<option>Macao</option>
<option>Macedonia (FYROM)</option>
<option>Madagascar</option>
<option>Malawi</option>
<option>Malaysia</option>

<option>Maldives</option>
<option>Mali</option>
<option>Malta</option>
<option>Marshall Islands</option>
<option>Martinique</option>
<option>Mauritania</option>
<option>Mauritius</option>
<option>Mayotte</option>
<option>Mexico</option>

<option>Micronesia</option>
<option>Moldova</option>
<option>Monaco</option>
<option>Mongolia</option>
<option>Montserrat</option>
<option>Morocco</option>
<option>Mozambique</option>
<option>Myanmar</option>
<option>Namibia</option>

<option>Nauru</option>
<option>Nepal</option>
<option>Netherlands</option>
<option>Netherlands Antilles</option>
<option>New Caledonia</option>
<option>New Zealand</option>
<option>Nicaragua</option>
<option>Niger</option>
<option>Nigeria</option>

<option>Niue</option>
<option>Norfolk Island</option>
<option>Northern Mariana Islands</option>
<option>Norway</option>
<option>Oman</option>
<option>Pakistan</option>
<option>Palau</option>
<option>Palestinian Territories</option>
<option>Panama</option>

<option>Papua New Guinea</option>
<option>Paraguay</option>
<option>Peru</option>
<option>Philippines</option>
<option>Pitcairn</option>
<option>Poland</option>
<option>Portugal</option>
<option>Puerto Rico</option>
<option>Qatar</option>

<option>R&eacute;union</option>
<option>Romania</option>
<option>Russian Federation</option>
<option>Rwanda</option>
<option>Saint Helena</option>
<option>Saint Kitts and Nevis</option>
<option>Saint Lucia</option>
<option>Saint Pierre and Miquelon</option>

<option>Saint Vincent and the Grenadines</option>
<option>Samoa</option>
<option>San Marino</option>
<option>Sao Tome and Principe</option>
<option>Saudi Arabia</option>
<option>Senegal</option>
<option>Serbia and Montenegro</option>
<option>Seychelles</option>
<option>Sierra Leone</option>

<option>Singapore</option>
<option>Slovakia</option>
<option>Slovenia</option>
<option>Solomon Islands</option>
<option>Somalia</option>
<option>South Africa</option>
<option>South Georgia and the South Sandwich Islands</option>
<option>Spain</option>
<option>Sri Lanka</option>

<option>Sudan</option>
<option>Suriname</option>
<option>Svalbard and Jan Mayen Islands</option>
<option>Swaziland</option>
<option>Sweden</option>
<option>Switzerland</option>
<option>Syria</option>
<option>Taiwan</option>
<option>Tajikistan</option>

<option>Tanzania</option>
<option>Thailand</option>
<option>Togo</option>
<option>Tokelau</option>
<option>Tonga</option>
<option>Trinidad and Tobago</option>
<option>Tunisia</option>
<option>Turkey</option>
<option>Turkmenistan</option>

<option>Turks and Caicos Islands</option>
<option>Tuvalu</option>
<option>Uganda</option>
<option>Ukraine</option>
<option>United Arab Emirates</option>
<option>United Kingdom</option>
<option selected>United States of America</option>
<option>Uruguay</option>
<option>Uzbekistan</option>

<option>Vanuatu</option>
<option>Vatican City</option>
<option>Venezuela</option>
<option>Vietnam</option>
<option>Virgin Islands (British)</option>
<option>Virgin Islands (US)</option>
<option>Wallis and Futuna Islands</option>
<option>Western Sahara</option>
<option>Yemen</option>

<option>Zaire</option>
<option>Zambia</option>
<option>Zimbabwe</option></select>
EOF;
 }
}
$do = new me();
?>

Untitled PHP (7-Jan @ 09:06)

Syntax Highlighted Code

  1.  
  2. <?php
  3. include "../connect.php";
  4. include "classes/job.php";
  5. [32 more lines...]

Plain Code


<?php
include "../connect.php";
include "classes/job.php";
echo "<span id=\"tab_job\">";
echo "<table style=\"border:none\">";
    echo "<tr>";
        echo "<td class=\"menu_orange\">Nom</td>";
        echo "<td class=\"menu_orange\">Serveur</td>";
        echo "<td class=\"menu_orange\">Fr&eacute;quence</td>";
        echo "<td class=\"menu_orange\">Horaire</td>";
        echo "<td class=\"menu_orange\">Type</td>";
        echo "<td class=\"menu_orange\">Nbr serveur(s)</td>";
    echo "</tr>";
    $sql="SELECT * FROM job where job_actif=\"o\"";
    $query=mysql_query($sql);
    while($row=mysql_fetch_array($query))
    {
    $job=new job();
    $job->job_id=$row["job_id"];
    $job->get_job();    
        echo "<tr>";
            echo "<td>$job->job_nom</td>";
            echo "<td>$job->job_serv_sauv</td>";
            echo "<td>".$job->get_frequence()."</td>";
            echo "<td>".$job->get_horaire()."</td>";
            echo "<td>".$job->get_type_sauvegarde()."</td>";
            echo "<td>".$job->nbr_serveur_job()."</td>";
            $js=" onchange='valid_job(\"$job->job_id\",1,this.value,false)'";
            echo "<td>".$job->select_statut($job->job_id,$js)."</td>";
            echo "</tr>";
    unset($job);
    }
echo "</table>";
echo "</span>";

?>

Request (2-Jan @ 17:09)

Syntax Highlighted Code

  1. <?php
  2.  
  3.  class Request{
  4.        
  5. [105 more lines...]

Plain Code

<?php

 class Request{
        
        protected $aParams = array();
        protected $oUrl = null;
        protected $sRequest = null;
        
        
        protected $sDefaultModuleName = 'default';
        protected $sDefaultControllerName = 'index';
        protected $sDefaultActionName = 'index';
        
        public function __construct(){
            $this->oUrl = WebContent_Url::getInstance();
        }
        
        public function getRequest(){
            if(null === $this->sRequest)
                 $this->sRequest = $this->oUrl->Request();
        
            return $this->sRequest;
        }
        
        public function getParams($mKey = null, $mDefault = null){
            if($mKey === null){
                return $this->aParams;
            }
            
            return isset($this->aParams[$mKey]) ? $this->aParams[$mKey] : null;
        }
    
    public function setParams($mParams){
        $this->aParams = (array) $mParams;
    }
    
    
    public function getModuleName(){
        return isset($this->aParams['module']) ? $this->aParams['module'] : null;
    }
    public function setModuleName($sName){
        $this->aParams['module'] = $sName;
    }
    public function getDefaultModuleName(){return $this->sDefaultModuleName;}
    
    public function getControllerName(){
        return isset($this->aParams['controller']) ? $this->aParams['controller'] : null;
    }
    public function getDefaultControllerName(){return $this->sDefaultControllerName;}
    
    
    public function getActionName(){
        return isset($this->aParams['action']) ? $this->aParams['action'] : null;
    }
    
    public function setActionName($sName){
        $this->aParams['action'] = $sName;    
    }
    public function getDefaultActionName(){return $this->sDefaultActionName;}
    
    
    public function getPost($mKey = null, $mDefault = null){
        if($mKey === null){
            return $_POST;
        }
        
        return isset($_POST[$mKey]) ? $_POST[$mKey] : null;
    }
    
    public function getGet($mKey = null, $mDefault = null){
        if($mKey === null){
            return $_GET;
        }
        
        return isset($_GET[$mKey]) ? $_GET[$mKey] : $mDefault;
    }
    
     public function getServer($mKey = null, $mDefault = null){
        if($mKey === null){
            return $_SERVER;
        }

        return (isset($_SERVER[$mKey])) ? $_SERVER[$mKey] : $mDefault;
    }
    
    public function getHeader($sHeader){
    
        $sHttpHeader = 'HTTP_'.strtoupper($sHeader);
        if(isset($_SERVER[$sHttpHeader])){
            return $_SERVER[$sHttpHeader];
        }
        
        $aHeaders = apache_request_headers();
        
        if(!empty($aHeaders[$sHeader])){
            return $aHeaders[$sHeader];
        }
        
        return false;
    }
    
    public function isXmlHttpRequest(){
        return ($this->getHeader('X_REQUESTED_WITH') == 'XMLHttpRequest');
    }
    
    public function isPost(){
        return('POST' == $this->getServer('REQUEST_METHOD')) ? true : false;
    }
}
?>

Template Monster index.php bug fixed (15-Dec @ 10:26)

desbest.myopenid.com

Syntax Highlighted Code

  1. <?php
  2. include 'header.php';
  3. ?>
  4.  
  5. [97 more lines...]

Plain Code

<?php
include 'header.php';
?>

<br />
<h2><a href="#"><?php echo $category_title; ?> Templates</a></h2>
<br />

<?php

$cat_url = 'http://www.templatemonster.com/webapi/templates_screenshots4.php?linebreak=;&delim=,&list_delim=|&sort_by=price&order=asc&full_path=true&category='.$cat.'&'.$your_security_code.'';
  $cats = URLopen($cat_url);
  $lists = explode(";", $cats);

  // control page count
  $count = count($lists);
  $per_page = 36;
  $page_count = ceil($count/$per_page);

  if(!isset($_GET['pg'])) {
      $page = 1;
      $start = 0;
  } else {
      $page = $_GET['pg'];
      $start = ($page-1)*$per_page;
  }

  $stop = $start + ($per_page-1);


  echo '<div id="tb">';

// loop the current page records only!!
for($i=$start; $i<($stop+1); $i++) {
    if(!isset($lists[$i])) { continue; }
    $spl = explode(",", $lists[$i]);

    $id = $spl[0]; // temp ID
    if(!isset($id) || $id == "") { continue; }
    $price = $spl[1]; // price
    $exclusive = $spl[2]; // exclusive price
    $date = $spl[3]; // exclusive price
    $downloads = $spl[4];// downloads
    $is_hosting = $spl[5]; // is hosting ?
    $is_flash = $spl[6]; // is flash ?
    $is_adult = $spl[7]; // is adult ?
    $is_unique_log = $spl[8]; // is unique logo temp?
    $is_nunique_log = $spl[9]; // is non unique logo temp?
    $is_unique_corp = $spl[10]; // is unique corporate identity?
    $is_nunique_corp = $spl[11]; // is non unique corporate identity?
    $author_id = $spl[12]; // Authours ID
    $is_full = $spl[13]; // is full site ?
    $all_pages = $spl[14]; // is full site ?
    $screens = $spl[15]; // list of screenshots { list }

    $images = str_replace("{", "", $screens);
    $images = str_replace("}", "", $images);
    $images = str_replace(",", "", $images);
    $images = explode("|", $images);

    $t=1;
    foreach ($images as $im) {
        if (ereg("\-m\.", $im)) {
            $thumb = $im;
        }
        if (ereg("\-b\.", $im)) {
            $prev = $im;
        }
        
        $t++;
    }

if(isset($thumb)) { 
?>
<div class="float">
<a href="#" onClick="preview('<?php echo $aff; ?>','<?php echo $id; ?>');void(true)"><img width=147 height=156 src="<?php echo $thumb; ?>" border="0" alt="image <?php echo $id; ?>" onMouseover="showPreview('<?php echo $prev; ?>')" onMouseout="hidePreview()"/></a><br />
<p><b>$<?php echo $price; ?></b>   <a href="#" onClick="preview('<?php echo $aff; ?>','<?php echo $id; ?>');void(true)">More Details</a></p>
</div>

<?php
  }
}
?>
<div style="clear:both"></div>
</div>
<br />
<?php
echo "<br /><b>Page: </b>";
for($r=1; $r<$page_count+1; $r++) {
  if($r == $page) {
    echo "$page ·";
  } else {
    echo '<a href='.$path_to_dir.'/'.$thispage2.''.$cat.'/'.$category.'/'.$r.'.htm>'.$r.'</a>·';
  }
}

if($page_count > $page) {
  echo "<a href=$path_to_dir/$thispage2".$cat."/".$category."/".($page+1).".htm>Next</a>";
}

include 'footer.php';
?>

Untitled PHP (4-Dec @ 21:19)

Syntax Highlighted Code

  1. <?php
  2. ?>

Plain Code

<?php
phpinfo();
?>

Untitled PHP (30-Nov @ 07:27)

Syntax Highlighted Code

  1. <?php
  2. echo "yasser";
  3. ?>

Plain Code

<?php
echo "yasser";
?>

Untitled PHP (27-Nov @ 03:30)

Syntax Highlighted Code

  1. <?php
  2. echo 'hello';
  3. ?>

Plain Code

<?php
echo 'hello';
?>

Untitled PHP (20-Nov @ 04:17)

Syntax Highlighted Code

  1. <?='Hello World.'?>

Plain Code

<?='Hello World.'?>

Untitled PHP (14-Nov @ 09:25)

Syntax Highlighted Code

  1. echo '<a href="'. $item['link'] .'" title="'. $item['title'] .'">'. $item['title'] .'</a><br />\n';
  2.  
  3.  
  4.  

Plain Code

echo '<a href="'. $item['link'] .'" title="'. $item['title'] .'">'. $item['title'] .'</a><br />\n';


Untitled PHP (14-Nov @ 08:52)

Syntax Highlighted Code

  1. $url = 'http://www.abc.net.au/news/indexes/business/rss.xml';
  2. $rss = fetch_rss($url);
  3. foreach ($rss->items as $item ) {
  4.  
  5. [6 more lines...]

Plain Code

$url = 'http://www.abc.net.au/news/indexes/business/rss.xml';
$rss = fetch_rss($url);
foreach ($rss->items as $item ) {

    if($item['category'] == 'industry'){
        
        echo "<a href=\""+$item['link']+"\" title=\""+$item['title']+"\">"+$item['title']+"</a><br />\n";
      
    }
        
}

Untitled PHP (14-Nov @ 08:50)

Syntax Highlighted Code

  1. $url = 'http://www.abc.net.au/news/indexes/business/rss.xml';
  2. $rss = fetch_rss($url);
  3. foreach ($rss->items as $item ) {
  4.  
  5. [6 more lines...]

Plain Code

$url = 'http://www.abc.net.au/news/indexes/business/rss.xml';
$rss = fetch_rss($url);
foreach ($rss->items as $item ) {

    if($item['category'] == 'industry'){
        
        echo "<a href="$item['link']" title="$item['title']">$item['title']</a><br />\n";
      
    }
        
}

Untitled PHP (14-Nov @ 08:49)

Syntax Highlighted Code

  1. $url = 'http://www.upcoming.org/syndicate/my_events/349';
  2. $rss = fetch_rss($url);
  3. foreach ($rss->items as $item ) {
  4.  
  5. [6 more lines...]

Plain Code

$url = 'http://www.upcoming.org/syndicate/my_events/349';
$rss = fetch_rss($url);
foreach ($rss->items as $item ) {

    if($item['category'] == 'industry'){
        
        echo "<a href="$item['link']" title="$item['title']">$item['title']</a><br />\n";
      
    }
        
}

Untitled PHP (1-Nov @ 03:49)

Syntax Highlighted Code

  1. <?php
  2. class model extends Model{
  3.  
  4.     function model(){
  5. [4 more lines...]

Plain Code

<?php
class model extends Model{

    function model(){
        parent::Model();
    }

}
?>

Untitled PHP (30-Oct @ 21:26)

Syntax Highlighted Code

  1. <?php
  2.  
  3. if(machten('17', $sessie) == TRUE){
  4.     if($_GET['site'] == 'gewicht'){
  5. [76 more lines...]

Plain Code

<?php

if(machten('17', $sessie) == TRUE){
    if($_GET['site'] == 'gewicht'){
        $lidquery = mysql_query('SELECT * FROM leden WHERE sessie="' . $sessie . '"');
        $lidinfo = mysql_fetch_array($lidquery);

        if(isset($_GET['vak']) == FALSE){
            echo '
            <b>U heeft nog niet het vak geselecteerd waarin u de gewichten wilt aanpassen.</b><br />
            <b>U heeft nog niet de klas geselecteerd waarin u de gewichten wilt aanpassen.</b>
            <form method="GET" action="./index.php?site=gewicht">
                <select name="vak">
            ';
            $vakquery = mysql_query('SELECT * FROM vakken WHERE lid_id=' . $lidinfo['id']);
            while($vakinfos = mysql_fetch_array($vakquery)){
                echo '<option ';
                echo 'value="' . $vakinfos['vakid'] . '" ';
                echo '>';
                echo $vakinfos['vak'];
                echo '</option>';
            }
            
            echo '
                </select>
                <input type="submit" value="OK" />
            </form>
            
            ';

        if(isset($_GET['vak']) == TRUE){
            if(isset($_GET['klas']) == FALSE){
            if(is_numeric($_GET['vak']) == TRUE){ $vakid = $_GET['vak']; }
            elseif(is_numeric($_GET['vak']) == FALSE){ $vakid = 0; }
            $vakquery = mysql_query('SELECT * FROM vakken WHERE vakid=' . $vakid);
            $vakinfo = mysql_fetch_array($vakquery);
            echo '
            <b>U heeft ' . $vakinfo['vak'] . ' als vak geselecteerd.</b><br />
            <b>U heeft nog niet de klas geselecteerd waarin u de gewichten wilt aanpassen.</b>
            <form method="GET" action="./index.php?site=gewicht">
                <select name="klas">
            ';
            $klasquery = mysql_query('SELECT * FROM klas');
            while($klasinfo = mysql_fetch_array($klasquery)){
                echo '<option ';
                echo 'value="' . $klasinfo['id'] . '" ';
                echo '>';
                echo $klasinfo['klas'];
                echo '</option>';
            }
            
            echo '
                </select>
                <input type="submit" value="OK" />
            </form>
            
            ';
            }
            if(isset($_GET['klas']) == TRUE){

                if(is_numeric($_GET['vak']) == TRUE){ $vakid = $_GET['vak']; }
                elseif(is_numeric($_GET['vak']) == FALSE){ $vakid = 0; }
                $vakquery = mysql_query('SELECT * FROM vakken WHERE vakid=' . $vakid);
                $vakinfo = mysql_fetch_array($vakquery);
                if(is_numeric($_GET['klas']) == TRUE){ $klasid = $_GET['klas']; }
                elseif(is_numeric($_GET['klas']) == FALSE){ $klasid = 0; }
                $klasquery = mysql_query('SELECT * FROM klassen WHERE id=' . $klasid);
                $klasinfo = mysql_fetch_array($klasquery);
                echo '
                <b>U heeft ' . $vakinfo['vak'] . ' als vak geselecteerd.</b><br />
                <b>U heeft ' .  $klasinfo['klas'] . 'als klas geselecteerd waarin u de gewichten wilt aanpassen.</b>
                ';
            }
        }
    }
}
elseif(machten('17', $sessie) == FALSE){
    
}

?>

Untitled PHP (27-Oct @ 13:10)

Syntax Highlighted Code

  1. <?php phpinfo(); ?>

Plain Code

<?php phpinfo(); ?>

Untitled PHP (10-Oct @ 20:52)