cereal 1,524 Nearly a Senior Poster Featured Poster

You can type python inside the terminal to get the interpreter, if you want a GUI version then install idle3 by typing:

sudo apt-get install idle3

After that just run idle3 to load the GUI.

cereal 1,524 Nearly a Senior Poster Featured Poster

Read this: https://help.ubuntu.com/community/Grub2
Grub2 is a bit complex. At the end of the linked page there are some links that explain how to edit the config files.

cereal 1,524 Nearly a Senior Poster Featured Poster

@Tony I can understand, it happens also to me! ;)

cereal 1,524 Nearly a Senior Poster Featured Poster

It doesn't work because mysql_query() cannot handle more then a query:

mysql_query() sends a unique query (multiple queries are not supported)

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

To do that use mysqli: http://www.php.net/manual/en/mysqli.multi-query.php

cereal 1,524 Nearly a Senior Poster Featured Poster

You don't find ekhtml inside pecl because it isn't a PHP extension.

In order to remove it run sudo make uninstall in the source directory of ekhtml. If you deleted that, download it again and compile it with the same parameters and then run the uninstall command. That should remove everything related to ekhtml. By the way: to get more information about parameters run ./configure --help (for parameters strictly related to the program to compile) and make --help to get more information about the compiling process.

But I did not learn how to create those steps by thinking.

Sorry for that, sometimes I just write too much.. :D

cereal 1,524 Nearly a Senior Poster Featured Poster

With mysqli you can perform multiple queries in a single call: http://www.php.net/manual/en/mysqli.multi-query.php check the examples and the comments in the manual to get an idea of the method to apply. If you still have doubts post an example of data you want to submit and the table structure. Bye!

cereal 1,524 Nearly a Senior Poster Featured Poster

@vizz if you are referring only to a local script to run, then yes it can be done:

<?php
    $ref_url = 'http://google.com/'; # this is the Referer
    $url = 'http://your_website.tld/target.php';

    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_REFERER, $ref_url);
    echo curl_exec ($ch);
    curl_close ($ch);
?>

But it works only if the request starts from a script (the above) asking for a page. Not sure if this is helpful for you, bye!

cereal 1,524 Nearly a Senior Poster Featured Poster

Unfortunately I cannot access to a Windows box to try WAMP by myself, however the suggested configuration is working well for me on linux. Just try to test the config removing all the comments, or test thinklocal.dev alone:

NameVirtualHost *:80
Listen 80

<VirtualHost *:80>
    ServerAdmin webmaster@localhost
    DocumentRoot "C:/wamp/www"
    ServerName localhost
    ServerAlias localhost
</VirtualHost>

<VirtualHost *:80>
    ServerAdmin admin@ruthrudincom.dev
    DocumentRoot c:/wamp/www/ruthrudincom
    ServerName ruthrudincom.dev
    ErrorLog "logs/ruthrudincom.dev-error.log"
    CustomLog "logs/ruthrudincom.dev-access.log" common
</VirtualHost>

<VirtualHost *:80>
    ServerAdmin admin@thinklocal.dev
    DocumentRoot c:/wamp/www/thinklocal
    ServerName thinklocal.dev
    ErrorLog "logs/thinklocal.dev-error.log"
    CustomLog "logs/thinklocal.dev-access.log" common
    <Directory />
        Options Indexes FollowSymLinks MultiViews
        AllowOverride All
        Order allow,deny
        Allow from all
    </Directory>

    <FilesMatch "^.ht">
        order allow,deny
        deny from all
    </FilesMatch>
</VirtualHost>

Make sure that logs directory exists under the declared ServerRoot and has write permissions.

So, while waiting for help by others members, all I can do is to suggest you to post the complete httpd_vhosts and troublueshooting to get some output from Apache, you can try to run Apache manually, by opening the command prompt (Start > Run > cmd.exe) as Administrator and running httpd.exe:

httpd.exe -S
httpd.exe -t -D DUMP_VHOSTS

The command httpd.exe can be found somewhere under the installation "Wamp directory\...\bin", but you can also use dir to get the correct path: dir /s httpd.exe

The first command will:

Show the settings as parsed from the config file (currently only shows the virtualhost settings).

The second instead:

Run syntax tests for configuration files only. The program immediately exits after these syntax parsing tests with either a return code …

cereal 1,524 Nearly a Senior Poster Featured Poster

If I understood your request, I think it cannot be done.
Since Google Analytics runs into an external javascript file, which is located in:

http://www.google-analytics.com/ga.js

Or for SSL:

https://ssl.google-analytics.com/ga.js

The referer cannot be changed by your server, but only by a client browser. This happens because when a page is opened, the browser sends the headers to all the resources requested by the page, including all the external files. So Google Analytics is creating a direct connection [browser] -> [google-analytics] without including your server, i.e. nothing like this: [browser] -> [your_server] -> [google-analytics]. The association with your website is done by the tracker ID code.

cereal 1,524 Nearly a Senior Poster Featured Poster

As suggested before you have to enable the reading of .htaccess, so inside Thinklocal add:

#Think local
<VirtualHost *:80>
    ServerAdmin admin@thinklocal.dev
    DocumentRoot c:/wamp/www/thinklocal
    ServerName thinklocal.dev
    ErrorLog "logs/thinklocal.dev-error.log"
    CustomLog "logs/thinklocal.dev-access.log" common

    <Directory /> # relation with DocumentRoot
        Options Indexes FollowSymLinks MultiViews
        AllowOverride All # allow .htaccess
        Order allow,deny
        Allow from all
    </Directory>

    # prevent remote access to .htaccess and .htpasswd
    <FilesMatch "^.ht">
        order allow,deny
        deny from all
    </FilesMatch>

</VirtualHost>

You can do the same with ruthrudincom.dev, once edited reload the server and it should work. Bye!

cereal 1,524 Nearly a Senior Poster Featured Poster

This is part of Gnome and it's used by the system when you connect to a remote server (ftp, webdav, ssh):

userspace virtual filesystem - server
gvfs is a userspace virtual filesystem where mount runs as a separate processes which you talk to via D-Bus. It also contains a gio module that seamlessly adds gvfs support to all applications using the gio API. It also supports exposing the gvfs mounts to non-gio applications using fuse.
This package contains the gvfs server that provides gvfs mounts to all gio applications, and the minimal set of backends.

http://packages.ubuntu.com/lucid/gvfs

If you run "Connect to server" and then browse inside .gvfs through the terminal, you will find the map tree of the remote resource.

cereal 1,524 Nearly a Senior Poster Featured Poster

Something like this will work:

<?php
    $path = '/vault/';
    $f = $_GET['file'];
    $f = pathinfo($f);

    if(file_exists($f['basename']) && strtolower($f['extension']) == 'pdf')
    {
        $file = file_get_contents($path.$f['basename']);
        header("Content-Type: application/pdf");
        echo $file;
    }
?>

Just create a directory pdf, put a file index.php as above and build links like this:

http://localhost/pdf/?file=thecbook.pdf

The access to the direct path containing the files, then can be limited by .htaccess:

Order deny,allow
Deny from all

So, no one can directly access to:

http://localhost/vault/thecbook.pdf

Anyway, to make the resources available only to registered users you have to add sessions, so the above script becomes something like:

<?php

    session_start();

    if(isset($_SESSION['logged']) && $_SESSION['logged'] === true)
    {
        $path = '/pdf/vault/';
        $f = $_GET['file'];
        $f = pathinfo($f);

        if(file_exists($f['basename']) && strtolower($f['extension']) == 'pdf')
        {
            $file = file_get_contents($path.$f['basename']);
            header("Content-Type: application/pdf");
            echo $file;
        }
    }

    else
    {
        header('HTTP/1.0 401 Unauthorized');
        echo '401 Unauthorized Access! Please login first.';
    }

?>

Hope is useful, bye!

cereal 1,524 Nearly a Senior Poster Featured Poster

It seems there's a bug related to your problem, for more information check:

Is this happening only with html_parse package?

Anyway try by adding sudo:

sudo pecl install html_parse

Otherwise write the specific package version:

sudo pecl install channel://pecl.php.net/html_parse-1.0.0

And if it doesn't work, download it and run pecl with the local file:

wget http://pecl.php.net/get/html_parse-1.0.0.tgz
sudo pecl install ./html_parse-1.0.0.tgz

If still you have problems you can compile it. Since html_parse depends from ekhtml you have to install it:

wget http://sourceforge.net/projects/ekhtml/files/latest/download
tar xvf download
cd ekhtml-0.3.2
./configure
make
sudo make install

And then do the same with html_parse:

tar xvf html_parse-1.0.0.tgz
cd html_parse-1.0.0
phpize
./configure
make
sudo make install

And it should work.

cereal 1,524 Nearly a Senior Poster Featured Poster

You can start by checking the MySQL error log: http://dev.mysql.com/doc/refman/5.0/en/windows-troubleshooting.html

The error log is located in the data directory specified in your my.ini file. The default data directory location is C:\Program Files\MySQL\MySQL Server 5.0\data.

Once you have the error.log, if you still need help paste here the content. Bye.

cereal 1,524 Nearly a Senior Poster Featured Poster

Try mysql-server and mysql-client, these are metapackages that redirect to the latest version available in repositories. If it doesn't match try dpkg -l mysql-* it will list all the packages related to mysql. And to remove them all, you can run dpkg -r mysql-*

EDIT
You can use --purge to remove also the config files: dpkg --purge mysql-*

cereal 1,524 Nearly a Senior Poster Featured Poster

I tried the form from the pastebin and it seems to work fine for me, I get:

Array
(
    [name] => Anonymous
    [email] => 
    [title] => 
    [contents] => 
    [id] => 30
    [pid] => 21
    [cid] => 1
)

I just hardcoded $this->id and $this->pid, so check if there is something wrong in the generated source of page.html, which should be page.php, unless your server is handling .html as .php

cereal 1,524 Nearly a Senior Poster Featured Poster

757 will allow everyone to write, this is not good. The directories hosting the website needs to be owned by the same user running Apache, so set:

  • 644 for directories
  • 755 for files

If it doesn't work check your configuration.

cereal 1,524 Nearly a Senior Poster Featured Poster

The problem could be also MySQL, if the bind-address is not on 127.0.0.1 or the firewall is not setted properly, then an attacker can perform a bruteforce, gain access and use mysql shell to read and write files to the system, something like for example:

select "<?php echo 'hello'; ?>" INTO OUTFILE "/var/www/test/hack.php"

This works even as SQL Injection, this is why I asked you to post your code..

cereal 1,524 Nearly a Senior Poster Featured Poster

Remove all the break from the switch statment, actually when it resolves a condition it doesn't go further to check the others, read this:

It is important to understand how the switch statement is executed in order to avoid mistakes. The switch statement executes line by line (actually, statement by statement). In the beginning, no code is executed. Only when a case statement is found with a value that matches the value of the switch expression does PHP begin to execute the statements. PHP continues to execute the statements until the end of the switch block, or the first time it sees a break statement. If you don't write a break statement at the end of a case's statement list, PHP will go on executing the statements of the following case.

http://php.net/manual/it/control-structures.switch.php

A simple example:

<?php
    $a = array(
        'alpha',
        'bravo',
        'gamma'
    );

    switch($a)
    {
        case $a[0] == 'alpha' && $a[1] == 'bravo':
            echo 'first step';
        case $a[0] == 'alpha' && $a[2] == 'gamma':
            echo 'second step';
        case $a[0] == 'alpha' && $a[1] == 'bravo' && $a[2] == 'gamma':
            echo 'third step';
    }
?>

Bye!

cereal 1,524 Nearly a Senior Poster Featured Poster

As suggested by pritaeas:

Are you sure your upload script was the way the script got onto your server in the first place?

For example from ftp? Have you tried to change user and password? Do you know if PUT is enabled? Can you show your code? Also since they don't want to enable .htaccess support I would consider to change the hosting service.

cereal 1,524 Nearly a Senior Poster Featured Poster

In addition to previous suggestions, you can mitigate the problem by adding an .htaccess file to the directory in which are hosted the images and specify to treat them with the default handler for static files:

SetHandler default-handler

If you upload a php file to this directory and try to open it, this will not be executed but downloaded as a simple file. Another measure is to add this line to the .htaccess file:

php_flag engine off
cereal 1,524 Nearly a Senior Poster Featured Poster

Congrats!

cereal 1,524 Nearly a Senior Poster Featured Poster

If you click on the links you will get error 404, I've seen this error when trying to download from a local mirror but in your case the fetch is done from the main server... so try to download directly from the repositories:

http://packages.ubuntu.com/quantal/mysql-server-5.5
http://packages.ubuntu.com/quantal/mysql-client-5.5

...and so on for the other dependencies. By the way, have you tried to run apt-get update ?

cereal 1,524 Nearly a Senior Poster Featured Poster

Many, from surgical sutures to my fingers to a spinal disc herniation which is so painful sometimes that I remain breathless. But the one I remember worst, it happened while I was doing snorkeling and was caused by a sea urchin spine between the thumb and the nail of my hand, the sting broken in many pieces and so I had to wait weeks to get it out.

cereal 1,524 Nearly a Senior Poster Featured Poster

Configuring a firewall for example, or using a version control system as git or subversion, ssh, PECL and PEAR if you are using PHP, building and using a chroot, dealing with compilation of a program: it's not true that if not compiled is not stable, imagemagick for example is available by apt but you must compile it from source to tune or just to match your server and application features, same story for nginx, apache, gearman, php and mysql. But there is a lot more to take in consideration, it depends on your role (configuring everything or just the httpd server?) and in the application you want to develop.

cereal 1,524 Nearly a Senior Poster Featured Poster

If Italy beats England next weekend

Maybe at soccer... but sure not at a rugby game in this decade ;D

cereal 1,524 Nearly a Senior Poster Featured Poster

This is my little list of test tools:

Consider also to use BackTrack or Samurai, a live distro focused only in web sites testings. Bye!

broj1 commented: This is very useful info, thnx. +8
cereal 1,524 Nearly a Senior Poster Featured Poster

While waiting for more appropriate support, try to load randomize. This seems to work fine for me:

Program Test;

var
  num:longint;

begin
  randomize;
  num:=random(1000000);
  write(num, '');
  writeln;
end.

Source: http://www.freepascal.org/docs-html/rtl/system/randomize.html

cereal 1,524 Nearly a Senior Poster Featured Poster

Change both or die("error") with:

or die(error_log(mysql_error(),0));

Add one also to the query, if the id is something like int(9) not null auto_increment primary key then you don't need to declare with NULL value, otherwise it will return a boolean FALSE. After these changes check /var/log/php_errors.log or the specified file inside /etc/php5/cli/php.ini. Bye!

cereal 1,524 Nearly a Senior Poster Featured Poster

Check the config file of the website, maybe the problem is given by these directives:

<Directory /var/www/website/>
    Options Indexes FollowSymLinks MultiViews
    AllowOverride All
    Order allow,deny
    allow from all
</Directory>

Now, if MultiViews is enabled (i.e. without the minus) if you digit /page the server will attemp to find a file page.html or a directory /page/ inside the server root and this is probably the reason why your rewrite rule seems to work properly with html files.

Secondly, usually in fresh installs AllowOverride is set to None, in these cases the server will ignore the .htaccess file, so try to change it as the above, to do that disable the website:

sudo a2dissite website

browse to /etc/apache2/sites-available/ and modify the file, then reanable and reload the server:

sudo a2ensite webiste
sudo service apache2 reload

if reload doesn't work use restart and it should work fine. Here you can find more info: http://httpd.apache.org/docs/current/mod/core.html

cereal 1,524 Nearly a Senior Poster Featured Poster

Italy 9 - 26 Wales
Was it over before the half?

No, it was 6 - 9 at the end of the first, then Italy made one error after another...

cereal 1,524 Nearly a Senior Poster Featured Poster

Italy 9 - 26 Wales (terrible game, not worth watching, other than for Leigh Halfpenny's kicking)

I agree! The first half wasn't to terrible, but then Italy surrendered o_o

cereal 1,524 Nearly a Senior Poster Featured Poster

It's probably cached by the browser, try by adding a random value to the requested url:

http://localhost/page?1234

During the test, on each request, change the numbers (i.e. this ?1234) so you will be sure to get new content. Also the rules suggested by Squidge are working fine for me. Bye!

cereal 1,524 Nearly a Senior Poster Featured Poster

What happens inside GraViewImg.php? And do you get correct access to this url?

http://'+hpath+'/dms/user/Gravity/GraViewImg.php

From the errors it seems the applet is receiving NULL.

cereal 1,524 Nearly a Senior Poster Featured Poster

welcome back!

cereal 1,524 Nearly a Senior Poster Featured Poster

That's the Unix time format, which is the number of seconds since 1970-01-01 00:00:00: http://en.wikipedia.org/wiki/Unix_time

cereal 1,524 Nearly a Senior Poster Featured Poster

The problem is here:

//fetching each row as an array and placing it into a holder array ($aData)
while($row=mysql_fetch_assoc($Result)){
$aData[] = $row;
}
//feed the final array to our formatting function...
$contents=getExcelData($aData);

Since you are not declaring $aData before the while loop, if the result set is empty then $aData doesn't exist. To solve add $aData = array(); before the loop and check also if you get something from the query, so you can stop the process, for example:

$aData = array();

if(mysql_num_rows($Result) > 0)
{
    //fetching each row as an array and placing it into a holder array ($aData)
    while($row=mysql_fetch_assoc($Result)){
    $aData[] = $row;
    }
}
else
{
    die('no data');
}

//feed the final array to our formatting function...
$contents=getExcelData($aData);
cereal 1,524 Nearly a Senior Poster Featured Poster

Probably yes, use curly brackets to delimit the statements:

Do it like this:

echo "<td width=\"104\" class=";

if(!isset($_GET['section']) || $_GET['section'] == "newsletter")
{
    echo "tabactive";
}
else
{
    echo "tabinactive";
}
echo ">";

or simply:

echo '<td width="104" class="'.(!isset(GET_['section']) || $_GET['section'] == 'newsletter' ? 'tabactive':'tabinactive').'">;

The same goes for the other block of code:

echo "<div align=\"center\"><a href=\"index.php?section=newsletter\" class=";

if($_GET['section'] == "newsletter")
{
    echo "tabactive";
}
else
{
    echo "tabinactive";
}
echo ">";

echo "Newsletter</a></div></td>";

That becomes:

echo '<div align="center"><a href="index.php?section=newsletter" class="'.($_GET['section'] == "newsletter" ? 'tabactive':'tabinactive').'">Newsletter</a></div></td>';

EDIT
glad to see that you solved by yourself, bye! ;D

cereal 1,524 Nearly a Senior Poster Featured Poster

The expected value for $staff['isadmin'] is a boolean true/false or a string? If it's a boolean then change it to:

if($staff['isadmin'] === 1)

If you have doubts use var_dump($staff['isadmin']); to get the type of value.

cereal 1,524 Nearly a Senior Poster Featured Poster

Not completely, they posted an update few days later: http://www.php.net/archive/2012.php#id2012-05-06-1

The rewrite rule to test is this:

RewriteCond %{QUERY_STRING} ^[^=]*$
RewriteCond %{QUERY_STRING} %2d|\- [NC]
RewriteRule .? - [F,L]

basically try something like this:

If you don't get the source of the page then it's reasonably safe. But it is always better to upgrade at least to 5.3.13 or 5.4.3 as suggested by PHP.net advisory. You can find more information and few patch suggestions here:

http://eindbazen.net/2012/05/php-cgi-advisory-cve-2012-1823/

Or search for CVE-2012-2311 on google. Anyway, remember this is related only to mod_cgi.

LastMitch commented: Thanks for Sharing! +0
cereal 1,524 Nearly a Senior Poster Featured Poster

Thank you for the suggestions, I'm still learning js :)
Now it's perfect, many thanks!

cereal 1,524 Nearly a Senior Poster Featured Poster

Hello,

I'm trying to display a message depending on the value of an input field. But it stops working when going back to default. Here's the JQuery code:

$(document).ready(function(){
    test();
});

function test()
{
    $('#quantity').keyup(function(){
        var quantity = $('input:text#quantity').val();
        if(isInteger(quantity))
        {
            var msg = false;
            if(quantity > 1)
            {
                msg = true;
            }

            // more code . . .

            if(msg === true)
            {
                 $('#result').html(quantity+' items');   
            }
            else
            {
                $('#result').hide();
            }
        }
    });
}

// same result by disabling this function
function isInteger(value)
{
    return /^[0-9]+$/.test(value);
}

This is the form:

<form>
    <input type="text" name="quantity" id="quantity" value="1" />
</form>

<div id="result"></div>

And here's a live example: http://jsfiddle.net/2vF3a/

To see the effect set 2, then 1 and then 2, expected result msg === true and message displayed.

The default value is 1 and to display the message it's enough to set 2 or an higher number, it seems to work fine until I go back to 1. In my intentions when going back to 1, the message has to disappear and, until this point, it's ok.

But when I type 2 or an higher number, the message doesn't appear anymore and I cannot understand why. I'm trying to achieve this effect by setting a variable msg at the top of the function var msg = false; and then switching to true when the value is higher than 1...

Any idea?
Thank you for your time!

cereal 1,524 Nearly a Senior Poster Featured Poster

You can do that, but first you need to download the files from repositories and make sure you are satisfying all the dependencies, once you have all the files you can use dpkg for example:

dpkg -i package_name.deb

For more info type man dpkg or dpkg --help.

cereal 1,524 Nearly a Senior Poster Featured Poster

Yes, AND is defined by the standard ANSI/SQL.

cereal 1,524 Nearly a Senior Poster Featured Poster

There is also the strong tag inside the href attribute:

http://www.famaspain.com/<strong>dogfactstemplate.php</strong>?name=$name

Remove it:

http://www.famaspain.com/dogfactstemplate.php?name=$name
cereal 1,524 Nearly a Senior Poster Featured Poster

Use AND OR not comma. The logical operators available for MySQL are these: http://dev.mysql.com/doc/refman/5.0/en/logical-operators.html

So your query becomes:

$query = "SELECT * FROM customers WHERE firstname = '$firstname' AND lastname = '$lastname'";
cereal 1,524 Nearly a Senior Poster Featured Poster

Get Mint and then use debootstrap to chroot debian, so you can have both without rebooting: https://help.ubuntu.com/community/DebootstrapChroot

cereal 1,524 Nearly a Senior Poster Featured Poster

Change line 5 and 6:

$query = "SELECT * FROM customers WHERE firstname = '$firstname'";
$result = mysql_query($query);
cereal 1,524 Nearly a Senior Poster Featured Poster

In case you want to use a different name, it can also be used an alias:

$this->load->model('Model_name', 'admin_user');
$this->admin_user->something();

http://ellislab.com/codeigniter/user-guide/general/models.html#anatomy

cereal 1,524 Nearly a Senior Poster Featured Poster

There is also the zip command:

zip my_archive -r directory_to_zip/

will create my_archive.zip