cereal 1,524 Nearly a Senior Poster Featured Poster

That path seems an intranet resource (UNC) rather then a web server. Can you confirm that? In this case I cannot help, I don't have much experience on Windows systems, so wait for help from Windows users.

I think that the resolution of the UNC link depends on the client, so if it cannot see the segment of lan with that resource, it will not be able to access to the file.

If the files, instead, are served by a webserver then you need to change the path \\srv01\ to http://srv01/ and convert the backslashes to slashes, so \ to /

cereal 1,524 Nearly a Senior Poster Featured Poster

Not sure what you asking for, provide your code. Anyway you could use mod_alias module in Apache:

That way you can return data from from server2 without actually seeing it, for example set this in server1 config file:

Alias /remotefiles http://server2.tld/files
<Location /remotefiles>
    Order allow,deny
    Deny from all
    Allow from 192.168.0.10
</Location>

Where the 192.168.0.10 is server1 IP. That way your scripts can access to those resources just by using:

$_SERVER['DOCUMENT_ROOT'] . "/remotefiles/some.doc"

You should put a similary rule in server2 to allow access only from server1:

<Directory /files>
    Order allow,deny
    Deny from all
    Allow from 192.168.0.10
</Directory>

If instead you want to enable public access then change the above rule to:

<Location /remotefiles>
    Order allow,deny
    Allow from all
</Location>

But I think this is the reverse of what you want. So explain better or provide some code. Bye.

cereal 1,524 Nearly a Senior Poster Featured Poster

Shikha_1 you're continuing to ignore forum rules:

Create a meaningful thread title. So you've searched and haven't found anything that fits your problem? Great! We can help, but you need to peak our interest with a thread title that briefly describes your problem. Many members browse the topic list and choose which threads to post in only by the title. Oh, and for future reference, "PHP Help", "PHP Question", or any variation thereof does not describe your problem. We're well aware that this forum is about PHP and the majority of threads are asking questions or need help.

Please stop starting threads with not useful titles.

cereal 1,524 Nearly a Senior Poster Featured Poster

Try to add the extension to the command, so: php.exe

If it does not work, it means that XAAMP didn't defined the system environment path, so the command line does not know where php.exe is located. At this point you can try to execute the command by adding the path, for example:

> c:\php\php.exe artisan key:generate

Or add the path to the system. I cannot test, back in Windows XP you had to do this procedure:

I don't know if this is current also for the latest versions of Windows, you may want to read this:

Otherwise wait for more appropriate help, bye!

cereal 1,524 Nearly a Senior Poster Featured Poster

Go to: https://github.com/laravel/laravel

Click on download in the right side of the page, unzip the file and move everything to the folder that will run the website. Use the installation notes to be sure to create a public_html directory, this is where you have to publish css and javascript files.

Another method consists into the installation of Composer:

And then run this command from the prompt of commands (cmd.exe):

composer create-project laravel/laravel --prefer-dist .

Where the dot is the path in which you want to install the framework.

cereal 1,524 Nearly a Senior Poster Featured Poster

As the others I've some difficult to understand the result you want to get, to me it seems a compare between A/B arrays, when the values of the correspondent keys are the same, then return 000000, in the other cases return the value of A, unless A is 000000 itself, in that case return the value of B, am I right?

If yes try:

<?php

$a = array(0 => array(0 => '000000', 1 => '000400', 2 => '000450'), 1 => array(0 => '000350', 1 => '000400'));
$b = array(0 => '000350', 1 => '000400', 2 => '000450');

foreach($a as $k => $v)
{
    $i = 0;
    foreach($v as $k2 => $v2)
    {
        if($v2 == $b[$i]) $a[$k][$i] = '000000';
        if($v2 == '000000') $a[$k][$i] = $b[$i];
        $i++;
    }
}

print_r($a);

Outputs:

Array
(
    [0] => Array
        (
            [0] => 000350
            [1] => 000000
            [2] => 000000
        )

    [1] => Array
        (
            [0] => 000000
            [1] => 000000
        )

)

Removing the second IF statement, will return 000000 also for $a[0][0], because it will keep the value of the array A.

Note: I converted the values of the arrays to strings, because as integer will not keep the padding zeros.

cereal 1,524 Nearly a Senior Poster Featured Poster

Start by removing this at line 26 remove:

$data = fgetcsv($getfile, 1000, ",");

You don't need it because the same runs on line 27, in the while statement. Remove also line 42, since the previous query is already using mysql_query().

Two suggestions:

  1. avoid using MySQL library, and move to MySQLi or PDO, the former is going to be removed from PHP
  2. when you insert, consider to pack multiple values('a','b','c'), ('d','e','f'), ('g', 'h', 'i'), ... statements in order to reduce the amount of write queries to your database, because if you're going to import large numbers of csv lines, you will generate a lot of traffic and locks.
cereal 1,524 Nearly a Senior Poster Featured Poster

Your intent is to separate the groups by an <hr> tag?

Basing on my example, loop it this way:

foreach($new as $key => $value)
{
  foreach($value as $list => $article)
  {
    echo $article['title'] . PHP_EOL;
  }
  echo '<hr />'.PHP_EOL;
}

It will output:

News
<hr />
Services we offer
<hr />
Our location
Contact Details
Bikes for sale
How to find us...
<hr />
Boats for sale
Cars for sale
<hr />
History
Legends
<hr />
cereal 1,524 Nearly a Senior Poster Featured Poster

This can happen when the keys are considered strings instead of integers. After generating the list try this:

$result = array_values($result);

And submit this to dataTable.

cereal 1,524 Nearly a Senior Poster Featured Poster

You're welcome! :)

cereal 1,524 Nearly a Senior Poster Featured Poster

Not that I'm aware of. END is part of a compound statement:

So, unless you're using something previous of MySQL 5.* I don't have any other ideas. I can only suggest you to run the code from a script, as PHP:

<?php

$dns = 'mysql:dbname=TEST;host=127.0.0.1';
$username = '';
$password = '';

$conn = new PDO($dns, $username, $password);

$conn->exec('CREATE PROCEDURE mytest(IN name VARCHAR (200)) BEGIN SELECT * FROM Results WHERE candidate = name; END;');

print_r($conn->errorInfo());

In this case you can avoid the delimiter, but it is not the correct syntax to use inside a MySQL client or from PHPMyAdmin (at least in the latest versions).

cereal 1,524 Nearly a Senior Poster Featured Poster

Remove the first line, that select cannot be there, since this part:

CREATE PROCEDURE mytest(IN name VARCHAR (200))
BEGIN
SELECT * FROM Resultsets WHERE candidate = name
END

is used only to create the procedure. But even removing that line, it will not work. You have to set a delimiter different from the one used to define the query inside the procedure, usually you end the queries by adding a semicolon ;, so, in order to create the statement you have to change it:

delimiter //

Then you create the procedure:

CREATE PROCEDURE mytest(IN name VARCHAR (200))
BEGIN
SELECT * FROM Resultsets WHERE candidate = name;
END//

Note ; at the end of the query and // at the end of the procedure statement, after this you have to pull back the default delimiter:

delimiter ;

After this you can use call mytest('Sarah Smith'). If you need to set an output variable you need to change the procedure to something like this:

CREATE PROCEDURE mytest(IN name VARCHAR(200), OUT cname VARCHAR(200), OUT quiz VARCHAR(200), OUT score DECIMAL(5,2), OUT fail INT(3))
    BEGIN
    select Candidate INTO cname, QuizName INTO quiz, PercentageScore INTO score, PassFail INTO fail FROM Results WHERE Candidate = name limit 1;
    END//

So when you execute the procedure you write:

CALL mytest('Sarah Smith', @cname, @quiz, @score, @fail);

And then you can use the variables:

SELECT @cname, @quiz, @score, @fail;

Note:

  • when using the OUT variables, you …
cereal 1,524 Nearly a Senior Poster Featured Poster

Hi,

This should do what you want:

<?php

$a = array(
    0 => array(
        'question_title' => 'Question 8',
        'question_description' => '',
        'type_id' => 1,
        'type_title' => 'Yes/No',
        'question_number' => 8
    ),

    1 => array(
        'question_title' => 'Question 9',
        'question_description' => '',
        'type_id' => 1,
        'type_title' => 'Yes/No',
        'question_number' => 9,
    ),

    2 => array(
        'question_title' => 'Question 10',
        'question_description' => '',
        'type_id' => 1,
        'type_title' => 'Yes/No',
        'question_number' => 10,
    ),

    3 => array(
        'question_title' => 'Question 11',
        'question_description' => '',
        'type_id' => 1,
        'type_title' => 'Yes/No',
        'question_number' => 11,
    ),

    4 => array(
        'question_title' => 'Question 7',
        'question_description' => '',
        'type_id' => 1,
        'type_title' => 'Yes/No',
        'question_number' => 7
    )
);

$qnumbers = array();
$result = array();

foreach($a as $key => $value)
{
    $qnumbers[$key] = $value['question_number'];
    asort($qnumbers, SORT_NUMERIC);
}


foreach($qnumbers as $key => $value)
{
    $result[] = $a[$key];
}

print_r($result);

The output is:

Array
(
    [0] => Array
        (
            [question_title] => Question 7
            [question_description] => 
            [type_id] => 1
            [type_title] => Yes/No
            [question_number] => 7
        )

    [1] => Array
        (
            [question_title] => Question 8
            [question_description] => 
            [type_id] => 1
            [type_title] => Yes/No
            [question_number] => 8
        )

    [2] => Array
        (
            [question_title] => Question 9
            [question_description] => 
            [type_id] => 1
            [type_title] => Yes/No
            [question_number] => 9
        )

    [3] => Array
        (
            [question_title] => Question 10
            [question_description] => 
            [type_id] => 1
            [type_title] => Yes/No
            [question_number] => 10
        )

    [4] => Array
        (
            [question_title] => Question 11
            [question_description] => 
            [type_id] => 1
            [type_title] => Yes/No
            [question_number] => 11
        )

)

Bye …

cereal 1,524 Nearly a Senior Poster Featured Poster

Yup, try with a loop and ksort, an example:

<?php

$weightings = array(7 => 1,3 => 2,1 => 10,2 => 10,10 => 10,6 => 10,4 => 15,5 => 15,8 => 20,9 => 20);
$revised_date = array(1 => 1378652385,2 => 1378654024,3 => 1378654113,4 => 1378654151,5 => 1378654201,6 => 1378654239,7 => 1378654273,8 => 1378841224,9 => 1378842139,10 => 1378842189);
$titles = array(1=>"Our location",2=>"Contact Details",3=>"Services we offer",4=>"Boats for sale",5=>"Cars for sale",6=>"Bikes for sale",7=>"News",8=>"History",9=>"Legends",10=>"How to find us...",);

$new = array();

foreach($weightings as $key => $value)
{
    $new[$weightings[$key]][$revised_date[$key]] = array(
        'id'     => $key,
        'title'  => $titles[$key]
    );

    ksort($new[$weightings[$key]], SORT_NUMERIC);
}

# uncomment below to order weightings in decrescent order
# asort($new, SORT_NUMERIC);

print_r($new);

It outputs:

Array
(
    [1] => Array
        (
            [1378654273] => Array
                (
                    [id] => 7
                    [title] => News
                )

        )

    [2] => Array
        (
            [1378654113] => Array
                (
                    [id] => 3
                    [title] => Services we offer
                )

        )

    [10] => Array
        (
            [1378652385] => Array
                (
                    [id] => 1
                    [title] => Our location
                )

            [1378654024] => Array
                (
                    [id] => 2
                    [title] => Contact Details
                )

            [1378654239] => Array
                (
                    [id] => 6
                    [title] => Bikes for sale
                )

            [1378842189] => Array
                (
                    [id] => 10
                    [title] => How to find us...
                )

        )

    [15] => Array
        (
            [1378654151] => Array
                (
                    [id] => 4
                    [title] => Boats for sale
                )

            [1378654201] => Array
                (
                    [id] => 5
                    [title] => Cars for sale
                )

        )

    [20] => Array
        (
            [1378841224] => Array
                (
                    [id] => 8
                    [title] => History
                )

            [1378842139] => …
cereal 1,524 Nearly a Senior Poster Featured Poster

Use trim to remove empty spaces:

$cls=trim($_GET['class']);

If you see, there is an empty space in your link between class= and the value, the spaces are encoded with %20.

Ref: http://php.net/manual/en/function.trim.php

Note next time follow the rules of the forum, use a more appropriated title. Bye.

cereal 1,524 Nearly a Senior Poster Featured Poster

Ok, it seems related to permissions. You should check the user running Apache (usually www-data) and switch the ownership of the files and subdirectories of /var/www/code to it, run this:

ps -aux |grep apache2

to see the user, the parent is root, all the child processes should be owned by www-data or another defined user in /etc/apache2/apache2.conf, and then change the ownership:

sudo chown www-data:www-data -R /var/www/code

If this still does not work, then change the write permissions:

sudo chmod 755 -R /var/www/code

Note that 755 works if the owner of the files is the same user used by Apache, otherwise you need to use 777, which can be fine in a development box, but it is not good in a production server. Hope this helps to solve the problem.

iamthwee commented: Excellent +14
cereal 1,524 Nearly a Senior Poster Featured Poster

Try with error.log and access.log, the others with the numbers are old logs.

Run:

tail -n 20 error.log

This will display the last 20 lines of that file, if you don't see anything particular, reload the page in the browser. If you need to all the file type:

less error.log

If needed do the same with access.log. Then if you don't find anything browse to /etc/apache2/sites-available/ and open the file configuration of your virtual host, from there you can see if your configuration is saving the errors into another path, the line should look like:

ErrorLog ${APACHE_LOG_DIR}/error.log

You can also try to find if CodeIgniter is generating an error log.

cereal 1,524 Nearly a Senior Poster Featured Poster

near 'and then it lists all of the code' at line 1.

Right now it seems there's a problem inside the WHERE statements. If you show us your query it will probably be easier to help you.

cereal 1,524 Nearly a Senior Poster Featured Poster

I'm sorry, I'm afraid I cannot answer that, you're asking how to develop your project, that requires a good knowledge of your application requirements and about the technologies to use. I can only suggest you to try to break everything in many little problems, that way you can focus better on the single aspects of the application.

Note - in my last reply I posted a wrong link, the correct one was this: http://cassandra.apache.org/doc/cql3/CQL.html#createTableStmt

cereal 1,524 Nearly a Senior Poster Featured Poster

Hi, check the Apache log files, 5xx errors are related to the server, so it can be a misconfiguration of .htaccess or something related to write permissions.

cereal 1,524 Nearly a Senior Poster Featured Poster

If you still have problems it may be related to this query:

$query_result1 = Yii::app()->cassandra->cql3_query("CREATE TABLE users (user_name varchar,password varchar,gender varchar,session_token varchar,state varchar)");

This will try to create the table each time you run the code, if this is required by your application, change the query so it runs only if the table does not exists, so:

$query_result1 = Yii::app()->cassandra->cql3_query("CREATE TABLE IF NOT EXISTS users (user_name varchar,password varchar,gender varchar,session_token varchar,state varchar)");

Documentation: http://dev.mysql.com/doc/refman/5.5/en/create-table.html

cereal 1,524 Nearly a Senior Poster Featured Poster

Ok, with PHPMyAdmin it should work fine by injecting the code inside the SQL box. Try by running:

SHOW PROCEDURE STATUS;

It will list all your procedures. The error you are reporting referes to the SQL syntax, and there should be more information about the exact point in which the error occurs. For example if I miss the P of the previous command:

SHOW ROCEDURE STATUS;

I get the following:

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'ROCEDURE STATUS' at line 1

If you still have doubts post your precise code and also the exact error, not only the number, post all the line.

cereal 1,524 Nearly a Senior Poster Featured Poster

Hello,

I've tested my solution before posting, it works fine or at least, in reference to your example query, it worked fine for me. I used a command line mysql client, in connection with MySQL server 5.5 a part this the code to execute is just that, as explained in my previous answer.

From this:

I originally tried saving your code as a 'Routine' but got an error message along the lines of 'You cant run a procedure inside a routine'.

I suppose you're using a third party software: is this correct? Can you tell us which one? From the error it seems a conflict between a dedicated form and the above code. Can you report exactly each error?

cereal 1,524 Nearly a Senior Poster Featured Poster

Apache is running as root or as www-data user? It should be www-data, verify the output of:

ps -aux |grep apache

You should see the main process owned by root, the childs owned by www-data user. So, in order to work correctly, you have to change the ownership of the directory and of the files under the DocumentRoot of your website, try this:

sudo chown www-data:www-data -R /var/www/ET

With -R flag we recursively change the owners and the group of all the files inside ET directory. That should fix the problem.

cereal 1,524 Nearly a Senior Poster Featured Poster

Hello,

If I understood your problem you want to know how to connect your PHP script to Cassandra, correct? Check these links:

If you still have doubts, please post your code or at least add some details about your issue.

cereal 1,524 Nearly a Senior Poster Featured Poster

Check if the file and also the directory containing the database, have read and write permissions.

cereal 1,524 Nearly a Senior Poster Featured Poster

Which OS are you using? Ubuntu, Fedora, Slackware...? Also, which error you get? At the moment is not possible to help you because you are not describing the problem. Give us details and maybe we can help.

cereal 1,524 Nearly a Senior Poster Featured Poster

Hi,
please be more specific about your issue, currently I don't see any attachment to your post.

cereal 1,524 Nearly a Senior Poster Featured Poster

I would choose Laravel, I actually switched my new projects to that in April. I was going to start a new one and I was thinking to go back to Ruby on Rails, but then I decided to try Laravel and I like it, very much. I've been using CodeIgniter a lot in the last five years, for little to medium projects, it's easy to use and relatively easy to modify. But lately Ellislab dropped CodeIgniter development, they are seeking for a group interested in continuing the project:

From this point of view it's not a great news because there is no certainity of the future developments, and if it will ever support last versions of PHP.

My PROS list about Laravel 4:

  • good ORM library (Eloquent) which reminds me a lot Ruby on Rails, it's really easy to create relationships between tables, it supports soft deleting and you can use multiple databases concurrently
  • good command utility artisan which helps writing CLI scripts or asynchronous jobs, migrations scripts and resources
  • it's easy to create APIs, you can use HTTP verbs to interact with resources, it supports Auth Basic and you can also build your own mechanins by creating your filters
  • good template system: Blade
  • you can group and prefix routes, and also you can create named routes, I find this powerful because it gives you the ability to switch languages really easy
  • it's binded to Composer project which gives the ability to easily include third party …
cereal 1,524 Nearly a Senior Poster Featured Poster

@toldav the main problem is that this directive cannot be used inside the .htaccess file, you have to place it in the configuration file, check this for more information:

http://httpd.apache.org/docs/2.2/mod/mod_alias.html#alias

cereal 1,524 Nearly a Senior Poster Featured Poster

As Pritaeas asked, did you got errors?

Maybe I'm missing a point, but I'm taking some samples from here and it seems I can convert swf files without any problems, both with ffmpeg and avconv:

ffmpeg -i source.swf out.mp4
avconv -i source.swf -b 128k output.mp4

Also you can list supported formats and codecs by using -formats and -codecs:

ffmpeg -formats |grep -i swf
 DE swf             Flash format

ffmpeg -codecs | grep -i swf
 DEA D  adpcm_swf       ADPCM Shockwave Flash

Below each command there is the expected output. Are you using Windows?

cereal 1,524 Nearly a Senior Poster Featured Poster

Also, try to trim $email_address value, if there is a space at the beginning or at the end you get an empty result set:

$email_address = trim($_POST['email_address']);
cereal 1,524 Nearly a Senior Poster Featured Poster

Also, while trying your download link, I got this:

[1] 27470
HTTP/1.1 200 OK
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Content-Encoding: gzip
Content-Length: 254
Content-Type: text/html
Date: Wed, 04 Sep 2013 21:57:30 GMT
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Pragma: no-cache
Server: Apache/2
Set-Cookie: PHPSESSID=[REMOVED]; path=/
Set-Cookie: =1; expires=Wed, 04-Sep-2013 22:57:30 GMT
Vary: Accept-Encoding,User-Agent
X-Powered-By: PHP/5.2.17

<font color="#000000"><b>1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'ORDER BY products_order ASC' at line 1<br><br>select * from dss_products where products_id = ORDER BY products_order ASC <br><br><small><font color="#ff0000">
                [ S T O P ]</font></small><br><br></b></font>

The header is different from a valid one, because there is no reference to the file to download and that's correct, but note that the query is revealed because it occurs even if the captcha is not submitted, and since the $id is not set, it generates that output. In other words, make sure to stop the execution before running that query.

cereal 1,524 Nearly a Senior Poster Featured Poster

Yes if you extend those controllers with Page, something like:

class Connection extends Page
{
    public function __construct()
    {
        parent::__construct();
    }
}

Recalling the construct of Page (parent::__construct()) you can access to the public and protected properties.

In CodeIgniter this can work if you place Page controller inside the System/Core or if you include it when the controller loads:

<?php

include 'page.php';

class Connection extends Page
{
    public function __construct()
    {
        parent::__construct();
    }

    public function index()
    {
        $this->load->view('connection/someindex', $this->data);
    }
}

Read this for more information: http://philsturgeon.co.uk/blog/2010/02/CodeIgniter-Base-Classes-Keeping-it-DRY

cereal 1,524 Nearly a Senior Poster Featured Poster

You can change $data to a property of the class, so you can do:

class Page extends CI_Controller {

    // declare property
    protected $data;

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

        // define the property
        $this->data['assets'] = array(
                'style' => base_url().'assets/css/style.css',
                'connection' => base_url().'assets/images/connection.jpg',
                'collaboration' => base_url().'assets/images/collaboration.jpg',
                'solution' => base_url().'assets/images/solution.jpg',
                'connectionUrl' => base_url().'index.php/connection/',
                'collaborationUrl' => base_url().'index.php/collaboration/',
                'solutionUrl' => base_url().'index.php/solution/'
        );

        $this->data['navigation'] = array(
               'nav' => base_url().'assets/css/nav.css',
               'logo2' => base_url().'assets/images/logo2.png', 
               'index' => base_url(),
               'connectionUrl' => base_url().'index.php/connection/',
               'collaborationUrl' => base_url().'index.php/collaboration/',
               'solutionUrl' => base_url().'index.php/solution/',
               'foUrl' => base_url().'index.php/connection/fo',
               'wirelessUrl' => base_url().'index.php/connection/wireless',
               'cloudUrl' => base_url().'index.php/collaboration/cloud',
               'emailUrl' => base_url().'index.php/collaboration/email',
               'vconUrl' => base_url().'index.php/collaboration/vcon',
               'sharepointUrl' => base_url().'index.php/collaboration/sharepoint',
               'crmUrl' => base_url().'index.php/collaboration/crm',
               'voiceUrl' => base_url().'index.php/collaboration/voice',
               'networkUrl' => base_url().'index.php/solution/network',
               'systemUrl' => base_url().'index.php/solution/system',
               'surveillanceUrl' => base_url().'index.php/solution/surveillance',
               'searchbutton' => base_url().'assets/images/search button.jpg'
        );

    }

    public function index()
    {
        $this->data['title'] = 'title of this page';
        $this->load->view('templates/navigation', $this->data['navigation']);
        $this->load->view('homepage', $this->data['assets']); 
    }

    public function another_page()
    {
        $this->data['title'] = 'Another title';
        $this->load->view('templates/navigation', $this->data['navigation']);
        $this->load->view('anotherpage', $this->data['assets']); 
    }

}

Reference: http://www.php.net/manual/en/language.oop5.properties.php

cereal 1,524 Nearly a Senior Poster Featured Poster

Yes you can, as sample:

DELIMITER //

CREATE PROCEDURE mytest(IN name VARCHAR(200))
    BEGIN
    select * from results where candidate = name;
    END//

DELIMITER ;

Then you just need to pass the parameter name:

call mytest('Sarah Smith');

Reference: http://dev.mysql.com/doc/refman/5.5/en/create-procedure.html

cereal 1,524 Nearly a Senior Poster Featured Poster

Does the table comment exists? The complete error should be something like:

mysql_fetch_array() expects parameter 1 to be resource, boolean given

Which means the query on line 19 returned false. In addition from line 12 to 14 you're not executing any query. So if the table does not exists the other queries will generate errors.

Also:

The query string should not end with a semicolon.

Reference: http://php.net/manual/en/function.mysql-query.php

cereal 1,524 Nearly a Senior Poster Featured Poster

If I understand you want to get data by changing this link parameters:

http://finance.yahoo.com/d/quotes.csv?s=GOOG&f=snd1l1yr

I'm not sure you can manipulate it, because you will need an API specification in order to know which parameters you can use. The Yahoo Finance API from what I'm seeing right now, does not provide this kind of feature, but only RSS feeds, which are actually those you're already accessing from:

http://finance.yahoo.com/q?s=GOOG

Maybe you want to consider the Finance Badges: http://finance.yahoo.com/badges/

cereal 1,524 Nearly a Senior Poster Featured Poster

I see you can get data also as xml or as json, this last seems to be malformed, so here's an example based on xml output:

<?php
    $url = 'http://chartapi.finance.yahoo.com/instrument/1.0/GOOG/chartdata;type=quote;range=5d/xml/';

    $f = file_get_contents($url);
    $xml = simplexml_load_string($f);

    # print everything
    print_r($xml);

Since you get an object array you can print a specific node by adding the node name:

print_r($xml->series);

From here it should be easy to collect data and create a chart.

cereal 1,524 Nearly a Senior Poster Featured Poster

Looking at your first example the increments should be by five, not by one, this is my test:

<?php

$key = 'never_before_used_key';
$cache = new Memcached;
$cache->addServer('127.0.0.1', 11211);
$cache->setOption(Memcached::OPT_BINARY_PROTOCOL, TRUE);
$cache->set($key,0,5);

$limit = 1000;
$i = 0;

while (true)
{
    $current = $cache->get($key);
    echo $cache->increment($key, 5). PHP_EOL;

    $i++;
    if($i > $limit || $key > $current) break;
}

I get this output:

5
10
15
20
25
30
35
40
45
50
55
60
65
70
75
...

What version are you using? Mine is:

STAT version 1.4.13
STAT libevent 2.0.16-stable

You can see that by typing echo stats | nc -v 127.0.0.1 11211 | head

Not sure if this can be useful: https://code.google.com/p/memcached/issues/detail?id=320

cereal 1,524 Nearly a Senior Poster Featured Poster

If you're using Google Chrome, open the page of your script, then open the Javascript Console (CTRL+Shift+J), open the Network tab and try select an option from the form, if the AJAX works fine you will see a POST request, by clicking on the Name (probably the url of the AJAX call), you can see what was sent.

Verify it is not empty and let us know, we will try to help, bye!

cereal 1,524 Nearly a Senior Poster Featured Poster

Consider that this can happen also with unknown keys, could this be an attempt to find your encryption key?

No, no. I know what serialized data looks like :) This was not serialized data. This looked like a binary string of some sort where every character was a weird symbol.

Sorry, I wrote this because while testing I noted something similar to binary code, to get the array I had to use urldecode() and after the _unserialize() of the Session.php file. I will check better tomorrow :)

cereal 1,524 Nearly a Senior Poster Featured Poster

Dani, did you changed the encryption key lately? I can replicate the issue by trying to decode cookies encoded with a previous key.

By the way:

When I attempted to log the broken $session values, they were complete gibberish (tons of weird symbols and characters, etc). It looked like binary data.

this happens because you still need to pass the data through _unserialize().

cereal 1,524 Nearly a Senior Poster Featured Poster

Could a problem unserializing() be caused by a session cookie size that is too big (and therefore the serialized version wasn't fully writen)?

I think this could still be a valid reason, because in sess_read() there is:

// Decrypt the cookie data
if ($this->sess_encrypt_cookie == TRUE)
{
    $session = $this->CI->encrypt->decode($session);
}
else
{
    // encryption was not used, so we need to check the md5 hash

If you can log the broken $session values, then you can try to run the decode method manually and see if it fails.

cereal 1,524 Nearly a Senior Poster Featured Poster

Hello,

I'm wondering if I can get help to understand the behaviour of a PHP function: dns_get_record(). This returns an array with DNS records for the given domain name, here is an example of the output:

php > print_r(dns_get_record('php.net', DNS_TXT));
Array
(
    [0] => Array
        (
            [host] => php.net
            [type] => TXT
            [txt] => v=spf1 ptr ?all
            [entries] => Array
                (
                    [0] => v=spf1 ptr ?all
                )

            [class] => IN
            [ttl] => 272
        )

)

Now, if the DNS server returns multiple TXT records I get n keys ([0], [1], ...). What I'm not sure about is if the entries array will always return one entry. From the RFC 1035 I see the format of a TXT record is a text string.

But the PHP documentation does not mention the entries array nor it explains if it will always count one value. So I've searched the source file and this is the relevant part:

case DNS_T_TXT:
    {
        int ll = 0;
        zval *entries = NULL;

        add_assoc_string(*subarray, "type", "TXT", 1);
        tp = emalloc(dlen + 1);

        MAKE_STD_ZVAL(entries);
        array_init(entries);

        while (ll < dlen) {
            n = cp[ll];
            memcpy(tp + ll , cp + ll + 1, n);
            add_next_index_stringl(entries, cp + ll + 1, n, 1);
            ll = ll + n + 1;
        }
        tp[dlen] = '\0';
        cp += dlen;

        add_assoc_stringl(*subarray, "txt", tp, (dlen>0)?dlen - 1:0, 0);
        add_assoc_zval(*subarray, "entries", entries);
    }
    break;

I understand that add_assoc_* functions are adding the values to the subarray variable, that …

cereal 1,524 Nearly a Senior Poster Featured Poster

The problem in your script seems related with this $data['logo_image']->logo_image, the script tries to get an object from an array, you should get an error for this.

Anyway change this block:

if ($result) {
    if ($result['file_name']) {
        $data['logo_image'] = $result['file_name'];
        if ($data['logo_image']->logo_image)
          {
          unlink($data['logo_image']->logo_image);
          } 
          $data['user_id'] = $this->session->userdata('user_id');
         $this->user_admin_model->saveProfilelogo($data);  // saveProfilelogo = model fun name.
    } else {
        $errors = $result['error'];
    }
}

With:

if( ! empty($result['file_name']))
{
    if(file_exists($result['file_name']))
    {
        log_message('debug', 'file '. $result['file_name'] .' exists.');
        unlink($result['file_name']);
        log_message('debug', 'file '. $result['file_name'] .' deleted.');

        $data['user_id'] = $this->session->userdata('user_id');
        $data['logo_image'] = $result['file_name'];
        $this->user_admin_model->saveProfilelogo($data);
    }
    else
    {
        log_message('debug', 'file '. $result['file_name'] .' not found.');
        $errors = 'File '.$result['file_name'].' not found.';
    }
}
else
{
    log_message('debug', $result['error']);
    $errors = $result['error'];
}

It should work. Be sure to enable CodeIgniter logs, in order to see errors and other debugging information, it will be useful.

Reference: http://ellislab.com/codeigniter/user-guide/general/errors.html

cereal 1,524 Nearly a Senior Poster Featured Poster

Hey Dany the Bookmark Post feature is awesome, great add! :)

cereal 1,524 Nearly a Senior Poster Featured Poster

CI logs are enabled? In /application/config/config.php search and change log_threshold to 4:

$config['log_threshold'] = 4;

Then be sure that /application/logs/ is writable. After that just by reloading the page you should find a log file with information and, eventually, errors.

Also is assets directory outside of the application directory?

cereal 1,524 Nearly a Senior Poster Featured Poster

assets is outside the application directory? What do you get from CI logs?

cereal 1,524 Nearly a Senior Poster Featured Poster

but checking the database its just importing the filenames without the extension.

Are you sure the data is not inserted in the database table independently from this method? At this point it's hard to suggest the correct approach, can you show the part relative to the insert?

Also you can verify the values of DIR_IMAGE and $this->params['images_dir'] just by echoing them.