0

The name is well defined, otherwise you would get an exception:

Route [navcolor] not defined.

The error message says Call to undefined function routes(), which in other words means that the function you are trying to call does not exists. Have you read the documentation? I posted the link for you in my previous message. You already have the solution, you could have solved this hours ago.

0

Hi,

supposing you are not trying to load a user defined function named routes(), have you read the documentation? https://laravel.com/docs/5.5/routing#named-routes and the source in which this function should be defined? Does exists?

Use an editor that can autocomplete the code, in SublimeText for example, when you hover a method/function it shows you in which files this is defined and you can click it to see the code. Also add a linter plugin to enlight obvious mistypes and forgotten operators.

1

Hi!

I remember reading that there was a failure point on SSL as antiviruses were performing a MITM against browsers to verify the contents of connected pages. In practice they used to replace certificates in the client machine. Is this still an issue? See: http://ieeexplore.ieee.org/document/6956558/

Anyway, just a drop in the ocean.

Votes + Comments
AV vendors installing their own root certificates was always a recipe for disaster. I don't use AV products so I'm not really up to date on this
2

This board has been most helpful to me! I learned that the term "serial numbers", although not a big deal to me, can be taken very seriously by scammers and I need to simply change serial numbers to first and last names when asking for help, to weed out any potential scammers asking why, why, why, why and hiding behind XY problem. Of course they are going to ask why, they want to know if I am stupid enough to give out "real serial numbers".

uh :o are you sure it was not just too young and eager to help? A part Skype & co. I had few questions too about your task, because, for example, for me it was not clear enough how input was structured (basically type and size: alphanumeric, integer, with spaces, splitted in multiple files and to be considered as a whole or repetitions and uniqueness for each file...) and how to output. For example, depending on method awk, from command line could work fine to identify repetitions. Along with rproffitt's suggest about uniq.

0

It's a shared hosting, , so I don't have access to a server config file

Okay, then you may want to ask to their support. The AllowOverride property is not always enabled for security and performance purposes, as Apache needs to scan the contents of each .htaccess along the folder tree and reset the rules accordingly.

virtualhost then got the <Directory>

oh my «got» o_o

0

Hi!

If you have access to the configuration file for the virtualhost then got the <Directory> and set AllowOverride to All:

<Directory /path/to/www/public>
    Options Indexes FollowSymLinks MultiViews
    AllowOverride All
    Require all granted
</Directory>

Remember to adjust the options to your needs, the above example will show directory contents and so on... If you can choose the web server, then try Caddy, the community version is free and works good. It supports HTTP/2 and LetsEncrypt by default: https://caddyserver.com/

0

Whoops, now I see , sorry I was distracted by the null values. The redirect does not solve the problem, it just overrides. The warning happens because in your view the loop starts anyway and you are suppling a string when instead it expects an array or an object:

foreach ($result as $record):

Instead of $query->result() from the model return the object:

function read($where, $length, $start) {
    $this->db->limit($length, $start);
    return $this->db->get_where('myguestbook', $where);
}

this way you can cache it, use the custom result object and, in your controller, use the attached methods like num_rows():

$li = [];
$int = 0;
$template = '<li>user: %s<br>email: %s<hr></li>';

if(0 < $result->num_rows())
{
    foreach ($result as $record)
    {
        $li[$int++] = sprintf($template, $record->user, $record->email);
    }
}

$data['result'] = $li;
$data['result_count'] = $result->num_rows();

And in the view just run:

if(0 < $result_count)
{
    echo implode(PHP_EOL, $result);
}

else
{
    echo '<p>No record exists</p>';
}

Thanks to you for your reply, bye!

0

Hi Andris,

you may want to use SELECT ... INTO OUTFILE 'file_name_here' and perhaps use CONCAT() to create the query, if you do:

set @file = concat('/tmp/file_', UNIX_TIMESTAMP(), '.log');
select 'hello' into outfile @file;

It will not work, so you have to do:

set @file := concat("/tmp/file_", UNIX_TIMESTAMP(), ".log");
set @query := concat("select 'hello' into outfile '", @file, "'");
prepare stmt from @query;
execute stmt;
deallocate prepare stmt;

As suggested here:

But it's mandatory that the destination file does not exists, otherwise the query will fail, this is done to avoid overwriting files with random content. The alternative, if you want to append results, for example, is to use mysqldump or something like this:

mysql -uVAR -pVAR -e "SELECT 'hello';" > /tmp/random.log

To execute, if using PHP, from exec().

// Edit
But looking at previous answers, now I'm not sure is this you where searching for.

0

Hi,

according to the source of the get_where() method in system/database/DB_query_builder.php, sending NULL is acceptable as it would skip to set the WHERE conditions. So looking at your code:

$data['result'] = $this->myguestbook_model->read(null, null, null);

It seems it should work fine. So, in order to debug, change the configuration so that it returns to you the last performed query: in application/config/database.php set save_queries to boolean TRUE, then go back to your model and right after line 3, i.e. where you perform the $query, write:

print $this->db->last_query();
die;

And see what you get. Then try to run the query into a MySQL client and see if you get results. Once you end the debugging process set save_queries to FALSE again, as it slows down the execution of the code. Also, for a better debug process I suggest you to add Kint:

Can I ask why you are using CodeIgniter? It's for a new project or just maintaining legacy?

0

It happens because the POST request write is executed at the end of the script, in practice your write block (file_put_contents()) is placed after the reading block (file_get_contents()), so when a POST request is performed the script:

  1. reads the contents of the file which has not still been modified
  2. it prints the contents to the textarea
  3. and then it saves the input to the file

Move all the PHP logic in top of the file and set only print variables inside the HTML:

<?php

// Initialize
$alert = '';

// Write
if(isset($_POST['submit']))
{
    $newtext = $_POST['PHP_testing']; // <- Sanitize! See filter_input()
    file_put_contents('filltext.txt', $newtext);
    $alert = '<p>The modified text has been saved.</p>';
}

// Read
$oldtext = file_get_contents('filltext.txt');

?>
<!DOCTYPE html>
<html>
<head>
    <title>Test</title>
</head>
<body>

<form name="for PHP" method="POST">
    <textarea name="PHP_testing" cols="60" rows="10" id="testing">
    <?php

    echo $oldtext;

    ?>
    </textarea>
    <input type="submit" name="submit" value="Save Text">
</form>

<?php

echo $alert;

?>

</body>
</html>
1

@RJ

most is still true, I read the same on forums for years, about people changing system every month like scarves, but I suspect it comes only from those which have time to waste. I have never had to put my hands on kernel, to be honest I don't even know from where to start. I use Ubuntu because it's different from other distros, which I agree are not friendly with new users, but Ubuntu is easy to install and configure, it's all graphical and supports a lot of hardware.

You can always open the terminal and compile a source if needed, most of the time it's easy, but not always because it happens that you have to find which library satisfies an obscure dependency but it's rare that an average user will ever need that software. I bought the laptop from which I'm writing in 2008, installed and never formatted. I do upgrades to follow the LTS (Long Time Support) versions which are supported for 5 years, now I'm on 16.04. Yes, I don't get the edgy versions of softwares but I gain in stability. I do reboots only because systemd, the new process manager, in practice an equivalent of your svchost.exe, sometimes requires to reboot the machine after an update (sigh), but otherwise I don't even need to do it for weeks.

1

It may be true that Linux offers a smaller surface attack with the default configuration, but as RJ states, it depends a lot more on how you use the system. Lately I read about a user hit by a ransomware on Linux, he was running Mozilla Firefox as root, who knows why, and got infected through an extension of the browser (seemingly Adobe Flash).

Disclaimer: I use Linux since 2001 and abandoned Microsoft OS since 2004.

0

The code seems to be okay, are you sure opcache is disabled? If you are using PHP 7.0 then it's enabled by default, so if you ran the delete.php script and this was cached by the engine, then even after changing the code you still hit the cached version, until expiration, so while developing you can get an unexpected result. If this is the case you should disable it.

Run:

print var_dump(opcache_get_status());
die;

To see the current status, it does not matter from which script you run it, if enabled, it will return the list of cached scripts

2

You can use varbinary(16) to store IPV4 (4bytes) and IPV6 (16bytes), MySQL has some functions to convert the IP from a string representation to a blob and reverse, see for INET6_ATON() and INET6_NTOA(), which deals with both IP types:

Note, the HEX() function in the documentation example is used only to show the hexadecimal value of the blob. When you want to store the IP just do, something like this:

INSERT INTO `log_table` (`ip_address`, `created_at`) VALUES(INET6_ATON(?), NOW());

Where ? is the IP to save.
When you want to search do:

SELECT INET6_NTOA(`ip_address`) AS `ip` FROM `log_table` WHERE `ip_address` = INET6_ATON(?);

This allows you to create an index on the ip_address column, which means fast access. So it's important, in the WHERE statement, to convert the IP to the binary representation, not reverse:

SELECT INET6_NTOA(`ip_address`) AS `ip` FROM `log_table` WHERE INET6_ATON(`ip_address`) = ?;

This would be very slow because it would convert each row into a string representation.

In the result set you could also return as blob, so:

SELECT `ip_address` FROM `log_table` WHERE `ip_address` = INET6_ATON(?);

and convert in PHP through inet_ntop():

But this requires to compile PHP with IPV6 support, otherwise it will fail. I use the same storing method with file paths:

SELECT UNHEX(MD5(TRIM(TRAILING '/' FROM '/path/to/file')));

It's working fine with +2M rows. Right now I would focus much on the storage size issue.

1

The above would not be an inline code, which is defined by backticks. Here you should use a code block, when you want to do such and you have other text above, then hit Return two times, so that you go to a new line and set a line of space between the text and the code. Hit TAB (or hit 4 spaces) and paste the code. If you are copying from your editor, then you can tab there, just make sure it equals at least at 4 spaces.

This textarea does not act like you would expect, so using the TAB key here does not focus on the next form element.

When the code is under 4 spaces then it's parsed as simple text.

At the end of the code block, if you want to insert other text, then again hit Return two times, otherwise there could be a parsing issue with the following text.

In alternative use the CODE button above, it will open a modal to paste the code.

For the XAMPP issue, see if the Apache error log gives information. Also, make sure the file has the .php extension.

0

You can add parameters to the selectCommand property, see these examples:

In your case, in pseudo code, try something like:

sqlCommand.CommandText = "select StudentID from student  where print like '%' + @template + '%'"
sqlCommand.Parameters.Add("@template", SqlDbType.NVarChar, 40, "Value Here")

Follow the examples in the documentation.

2

Hi,

in addition, have you tried with SplFixedArray? It should be faster than standard arrays. Also if you want to open files from the script, than use fopen() instead of file_get_contents(), because the latter will load the entire file in memory before starting processing, while the former will read in chunks and start the execution immediately.

See: http://php.net/manual/en/class.splfixedarray.php