cereal 1,524 Nearly a Senior Poster Featured Poster

Hi!

Notice: Undefined index: engraving in /path/httpdocs/store/cart.php on line 13 error

This usually happens when you try to access an array index key that does not exists, for example:

$a = array(
    'apple'  => 'fuji',
    'orange' => 'vanilla'
);

echo $a['apple'];
echo $a['coconut']; # will emit a notice because 'coconut' index does not exists

Now, it seems that your issue is in this line:

$engraving = $_POST['engraving'];

But I see in section 5 you print the $engraving variable apparently without defining it anywhere. It is defined only when a POST request is executed, but if you access the cart with a GET request then you should get a notice for undefined variable: engraving. So check if this is related to the cart saved in the session array. Do:

<?php

    echo "<pre>" . print_r($_SESSION['cart'], true) . "</pre>";

To get the contents, then if it does not help print the results and the code in which you define the variable.

cereal 1,524 Nearly a Senior Poster Featured Poster

Hi, Slim Framework supports composer so you can get a pagination library from packagist.org or you write it by your self.

cereal 1,524 Nearly a Senior Poster Featured Poster

Don't know your current code but, you're using procedural style, so the first argument for mysqli_query() is the connection link, which is missing from your last pasted code. It was set in the first line of your original script but not at line 42. I forgot to point that particular. Try to add that and it should work fine:

$query = mysqli_query($db, $select . $Order);
cereal 1,524 Nearly a Senior Poster Featured Poster

Hi,

use DateTime and DateInterval, like this:

<?php

    $time = '05:00 PM';
    $dt = (new Datetime($time))->add(new DateInterval('PT5H'))->format('g:i A');

    echo $dt; # outputs 10:00 PM

For more information check the documentation.

Docs about DateTime:

Docs about DateInterval:

@jkon sorry, just saw your answer!

cereal 1,524 Nearly a Senior Poster Featured Poster

Just an update to my previous post (besides I think I got a downvote for this typo haha): I wrote about Google Picasa but I intended Google Photos, which has two storage types: High Quality and Original, the first type will reduce the size of images bigger than 16MP (mega pixels):

If the camera takes photos with a resolution higher than 16 MP, then photos will be downsized to 16 MP.

the second won't reduce the images, but free storage is limited. Source:

Sorry for that, bye! :)

cereal 1,524 Nearly a Senior Poster Featured Poster

Ok, a part those exit; at lines 25 and 32 I don't see anything wrong, those will stop the execution of the script, in one of the cases it setting $Filter and $Order and then stopping, the query will not be executed.

Also, you wrote you have tested the query on PHPMyAdmin and that works, I'm in doubt if you have tested the one generated by the script or the intended query. Could you paste what was generated? In practice instead of:

$query = mysqli_query($select . $Order);

do:

$query = $select . $Order;
echo $query;

And return it or simply test it. You could also add error checking to see if the database returns an error code.

cereal 1,524 Nearly a Senior Poster Featured Poster

Hi, yes you can:

the above link refers to the Classic API, for the REST API check the Sale Transactions and the Refunds sections at:

cereal 1,524 Nearly a Senior Poster Featured Poster

At line 1 instead of:

$select =mysqli_query($db,"SELECT created, views_count, message, category_id from table AS M ");

write:

$select = "SELECT created, views_count, message, category_id from table AS M ";

So at line 42 you can execute it correctly.

cereal 1,524 Nearly a Senior Poster Featured Poster

Hi,

you have to perform a select query inside the methods isUserExistscustomer() and $this->isUserExistsmobile() and return boolean TRUE or FALSE.

For example:

public function isUserExistsmobile($mobile_no)
{
    $stmt = $this->conn->prepare("SELECT id FROM np_system_users WHERE customer_mobileno = ?");
    $stmt->bind_param('s', $mobile_no);
    $stmt->execute();
    $stmt->store_result();

    return $stmt->num_rows > 0 ? TRUE : FALSE;
}

Do the same for the email. The mobile number should be trimmed, to avoid leading and trailing spaces that could trick the system and allow duplicates:

$mobile_no = trim($mobile_no);

You should also remove spaces, dashes, dots inside the string, i.e. convert 555-123 231 to 555123231 and you should match prefixes which can be expressed in two ways, for example the international prefix for USA is 001 which can be shorted to +1.

So here you should decide if the client can insert prefixes manually or by a dropdown menu (select tag), and if you want to reject the input which is not composed just by digits.

Regarding the trim() function the same applies to email addresses, where you should lower the case to avoid values like abc@some.tld and Abc@some.tld. You can use mb_strtolower() or the MySQL function LOWER(), however this depends also on the charset assigned to the table column:

cereal 1,524 Nearly a Senior Poster Featured Poster

Hi,

since you set $Filter on line 5 the condition on line 7 will never verify, so you could remove it. What you should do is to verify if the GET attribute is set and valid, do:

$url = filter_input(INPUT_GET, 'url', FILTER_VALIDATE_URL);

Then replace the IF condition at line 7 with:

if($url !== FALSE)

Docs:

cereal 1,524 Nearly a Senior Poster Featured Poster

Use your editor to find the string product_id. Looking at your pasted code I don't see it, but probably somewhere you have $_POST['product_id'] instead of $_POST['productid'], or set by another array.

To avoid these kind of problems use array_key_exists('key_to_verify', $array):

cereal 1,524 Nearly a Senior Poster Featured Poster

Hi,

data loss means a file corruption because the server misses some packets from the transmission (for example caused by a timeout), in this case the uploaded file will result corrupted and the server will return an error because the received length is not the same of what was declared by the Content-Length header. So in this case the API should return an error code.

This does not depend on JSON, depends on the HTTP protocol.

Or you mean that the service will reduce compress high-res files? I now that Picasa does something similar with free accounts.

cereal 1,524 Nearly a Senior Poster Featured Poster

Ok, at the moment I cannot test their API, but I see from your request that curl will set Expect: 100-continue, if their server does not reply HTTP/1.1 100 Continue then curl will not send the body.

You can try to fix it by adding Expect: (with a blank space after the colon character :) to the CURLOPT_HTTPHEADER array, this should unset the 100-continue.

cereal 1,524 Nearly a Senior Poster Featured Poster

Hi, instead of:

while($_SESSION['application']['food'])

which acts as an endless loop, because it's equal to while(TRUE), write:

foreach($_SESSION['application']['food'] as $food)
{
    mysql_query("INSERT INTO tbl_user_detail (food, user_id) VALUES ('".$food."', '".$user_id."')") or die(mysql_error());
}

Or better:

$sql = 'INSERT INTO tbl_user_detail (food, user_id) VALUES';

foreach($_SESSION['application']['food'] as $food)
{
    $values[] = "($food, $user_id)";
}

$sql .= implode(',', $values);

mysql_query($sql) or die(mysql_error());

This will execute a single query with multiple rows:

INSERT INTO tbl_name (a,b,c) VALUES(1,2,3),(4,5,6),(7,8,9);

As always: I suggest you to really stop using MySQL API, switch to MySQLi or PDO.

cereal 1,524 Nearly a Senior Poster Featured Poster

Hi!

It happens because you are not appending the file to the body of the request, if you open netcat on localhost:8005:

nc -l localhost 8005

And change the $url to:

$url = 'http://localhost:8005/';

You can see what is sent by curl. In your case this is what is sent:

POST / HTTP/1.1
Host: localhost:8005
Accept: */*
Content-Type: multipart/form-data; boundary=--myboundary-xxx
Content-Length: 184

----myboundary-xxx
Content-Disposition: form-data; name="chat_id"

17446522
----myboundary-xxx
Content-Disposition: form-data; name="photo"

/tmp/phplsaMUp
----myboundary-xxx--

As you see it's displaying the filename of the uploaded file, not the binary, use file_get_contents():

$filedata = file_get_contents($_FILES['file']['tmp_name']);

And then it should work fine.

By the way: it seems you're missing the closing curly bracket for this statement if ($filedata != ''), around line 33.

cereal 1,524 Nearly a Senior Poster Featured Poster

Add a javascript event listener, when the form changes submit the query through an AJAX request. To make it work correctly separate the query script so that it returns only the data you want to display in the page.

cereal 1,524 Nearly a Senior Poster Featured Poster

Hi,

I haven't used Rails for ages, but I think you probably need execute to run a raw query, for example:

def up
    execute <<-SQL
      CREATE VIEW rocket_current_activities AS
        SELECT rocket_activities.status  AS status from rocket_activities....
    SQL
end

Docs: http://edgeguides.rubyonrails.org/active_record_migrations.html#using-the-up-down-methods

cereal 1,524 Nearly a Senior Poster Featured Poster

You're looping the $_POST array, instead you have to loop the $_FILES array. Follow the documentation and the comments at this page:

If still in doubt create a dummy upload script and place this:

<?php

    echo "<p>$_POST array:</p>";
    echo "<pre>" . print_r($_POST) . "</pre>";

    echo "<p>$_FILES array:</p>";
    echo "<pre>" . print_r($_FILES) . "</pre>";

so you can see what is generated by your upload form.

cereal 1,524 Nearly a Senior Poster Featured Poster

Uh, sorry, due to chosen forum and title I thought it was related to the framework, not to the CSS rules.

It happens probably because of this rule:

.register form input {
    width: 95%;
    height: 30px;
    background: #fcfcfc;
    border: 1px solid #ddd;
    -moz-border-radius: 2px;
    -webkit-border-radius: 2px;
    border-radius: 2px;
    -moz-box-shadow: 0 1px 3px 0 rgba(0,0,0,.1) inset;
    -webkit-box-shadow: 0 1px 3px 0 rgba(0,0,0,.1) inset;
    box-shadow: 0 1px 3px 0 rgba(0,0,0,.1) inset;
    font-family: 'PT Sans', Helvetica, Arial, sans-serif;
    color: #888;
    font-size: 16px;
}

use input[type=text] to match only text inputs and occasionally add types like password, number, email. Otherwise use not(), for example to avoid only radio buttons do:

input:not([type=radio])

To include also checkboxes assign a class to these input fields and then use not on the class, for example:

<input type="radio" name="abc" value="1" class="input_check_radio">
<input type="radio" name="abc" value="2" class="input_check_radio">

<input type="checkbox" name="def" value="alpha" class="input_check_radio">

And for the rule:

input:not(.input_check_radio)

Live example: http://jsfiddle.net/ptu3wv3s/

cereal 1,524 Nearly a Senior Poster Featured Poster

Hi,

which version are you using? With version 3 you can use set_checkbox() instead of set_value(). In this case write something like:

<label for="sex_1">
    <?php echo form_radio('sex', 1, set_checkbox('sex', 1), "id='sex_1'"); ?> male
</label>

<label for="sex_2">
    <?php echo form_radio('sex', 2, set_checkbox('sex', 2), "id='sex_2'"); ?> female
</label>

Docs: http://www.codeigniter.com/user_guide/helpers/form_helper.html#set_checkbox

cereal 1,524 Nearly a Senior Poster Featured Poster

Just an add: maybe this is something you don't need at this stage, but regarding the database consider also PostgreSQL which has a really great support for geocoding & co.: http://postgis.net/

cereal 1,524 Nearly a Senior Poster Featured Poster

Hi,

you have to use the comparison operator ==, at the moment you are using the assignment operator =.

cereal 1,524 Nearly a Senior Poster Featured Poster

Ok, you have to fix two things here:

A) add publish_pages to the scope:

$permissions = ['publish_actions', 'manage_pages', 'email', 'publish_pages'];

B) the third argument for $fb->post() must be the page access token, not the user access token which is set previously. So:

$pageTokens = $fb->get('/me/accounts?fields=id,name,access_token')
                 ->getGraphEdge()
                 ->asArray();

foreach($pageTokens as $key => $value)
{
    # match page ID
    if($value['id'] == 357971644373038)
    {
        $pageToken = $value['access_token'];
        break;
    }

}

$response = $fb->post('/357971644373038/feed', $linkData, $pageToken);

The page access token expires after one hour. With these changes you should be able to write to a page.

cereal 1,524 Nearly a Senior Poster Featured Poster

Welcome!

cereal 1,524 Nearly a Senior Poster Featured Poster

You have to add the appropriate permission in order to post to the timeline, this is done by appending the scope parameter to the login link, in your case the value to use should be publish_actions, but check the documentation to apply the correct permissions:

Read it carefully, especially the reference / public_actions section at the end of the document.

cereal 1,524 Nearly a Senior Poster Featured Poster

so what am i to do to make this work hun

I'm afraid you cannot do much with it. Maybe by rewriting the urls through .htaccess. Not tested.

The problem is given by the plugin key which needs to be unique and registered to the Oxwall store. Otherwise you have to rewrite some of their core methods to skip the check, but I'm not sure this is allowed by their policy.

cereal 1,524 Nearly a Senior Poster Featured Poster

Hi, the first argument of set_message() must match the rule name, i.e. the callback, not the field name, so change it to:

$this->form_validation->set_message('check_captcha', 'Your code did not match!');

You can read more about this in the guide, after the note about sprintf:

cereal 1,524 Nearly a Senior Poster Featured Poster

Use the Form helper, read the documentation for more information:

If still in doubt, show the view code.

cereal 1,524 Nearly a Senior Poster Featured Poster

Hi, it does not work because of the exception at line 17 of your log:

OW Debug - Exception
Message:    There is no active plugin with key `meet`
File:   /home/jktempla/public_html/fabcouples/ow_core/plugin_manager.php
Line: 86

If you go to this specific file, you find:

public function getPlugin( $key )
{
    if ( !array_key_exists(mb_strtolower(trim($key)), $this->activePlugins) )
    {
        throw new InvalidArgumentException("There is no active plugin with key `" . $key . "`");
    }

    return $this->activePlugins[mb_strtolower(trim($key))];
}

The array $this->activePlugins is generated by an instance of the BOL_PluginService class which in practice query Oxwall's server in search of the plugins (for update operations). So when you rename a plugin, you get the above exception. Have you tried to apply the code without any changes / renames?

cereal 1,524 Nearly a Senior Poster Featured Poster

Try to add backticks to the ### column. MySQL for unquoted column names expects:

  1. basic Latin letters, digits 0-9, dollar, underscore
  2. Unicode Extended: U+0080 .. U+FFFF

The character # is U+0023 which falls in the quoted range:

So, write:

$sql = "INSERT INTO result_sec (exe, `###`, ca1, ca2, exam) VALUES ('$exe', '$asss[$key]', '$ca1s[$key]', '$ca2s[$key]', '$exams[$key]')";

Also, the $sql variable is rewritten after each loop, instead you have to append the queries, so make few small changes:

  1. Initialize $sql outsite the loop, otherwise you get a notice for undefined variable
  2. Add a dot in front of the assignment operator =
  3. add a semi-colon at the end of the query

So, write:

$sql = '';
foreach($exes as $key => $exe)
{
    $sql .= "INSERT INTO result_sec (exe, `###`, ca1, ca2, exam) VALUES ('$exe', '$asss[$key]', '$ca1s[$key]', '$ca2s[$key]', '$exams[$key]'); ";

Then it should work.

cereal 1,524 Nearly a Senior Poster Featured Poster

The model is returning an object, which is passed to $this->user_data array with the index key result so, in the view file write:

foreach($result as $row)
{
    echo $row->id . ' ' .  $row->names;
}
cereal 1,524 Nearly a Senior Poster Featured Poster

If you use AJAX yes, you can, because it would be managed by a remote PHP script and sessions. But to get more help explain better your goal.

cereal 1,524 Nearly a Senior Poster Featured Poster

Hi, maybe one of the hard drive sectors in which the file was registered got corrupted, you could try to fix the issues through scandisk.

cereal 1,524 Nearly a Senior Poster Featured Poster

Ok, thanks for the update. Bye!

cereal 1,524 Nearly a Senior Poster Featured Poster

Could you paste the full stylesheet?

cereal 1,524 Nearly a Senior Poster Featured Poster

Are you sure you're not missing some closing parentheses in the first block? I don't see how both rules could apply when the second range is not reached by your resolution.

By the way, is this portrait oriented?

cereal 1,524 Nearly a Senior Poster Featured Poster

In addition to previous suggestions, I also like Cheers theme song by Gary Portnoy and few that are more recent: 30 Rock by Jeff Richmond (extended version) and House of Cards by Jeff Beal.

Another one I really like, but about an Italian show is the theme song for Inspector Montalbano by Franco Piersanti.

cereal 1,524 Nearly a Senior Poster Featured Poster

Would setting the folder and file permission to 711 suffice?

Hmm, no this doesn't solve, because the request will be executed through the TCP/IP stack, so the owner of the process will be the web server or the PHP server (in case of PHP-FPM) and any client through a web request could start the backup procedure.

Usually a cron job should be set like this:

/usr/bin/php /var/www/path/to/testCronJobLIVE.php

Or by setting the shebang in the script to define the executable:

#!/usr/bin/env php

echo 'Hello';

And then simply pointing the script in the crontab interface:

/var/www/path/to/testCronJobLIVE.php

That way you can set the script outside the public_html directory. But if you still want to stick with TCP solution, then you could set an extra header with a string value to match, something like:

<?php

if( ! array_key_exists('HTTP_AUTHORIZATION', $_SERVER) || $_SERVER['HTTP_AUTHORIZATION'] != 'Donna')
{
    header("HTTP/1.1 403 Forbidden");
    die('Error: 403 Forbidden.');
}

# execute your code
print 'hello';
print PHP_EOL;

And at cron job level:

curl --header "Authorization: Donna" http://digitalmediasolutions.ie/course-updates/testCronJobLIVE.php

I'm not sure lynx can set custom headers as it is a browser. You could use curl as in my example or httpie:

http GET http://digitalmediasolutions.ie/course-updates/testCronJobLIVE.php "Authorization: Donna"

Is this secure? Not really, if the request is intercepted then the header could be read, unless you can send through https.

cereal 1,524 Nearly a Senior Poster Featured Poster

Uh, so how is this job executed?

Usually a cron job is listed into a crontab file and executed by the cron daemon running in the server, so it's an internal task. As explained here:

If you're using an external service to run the jobs or your hosting is practicing another method then just remove my code suggestion and leave the script in public_html, unless your hosting configuration does not suggest something different, if still in doubt ask to the support.

cereal 1,524 Nearly a Senior Poster Featured Poster

Here:

if(!is_null($contact))
{
    $contact->delete($path);
}

Place:

if(!is_null($contact))
{
    File::delete($path);
    $contact->delete($path);
}

Or Storage::delete() if using Laravel 5.

cereal 1,524 Nearly a Senior Poster Featured Poster

Ok, just add the method to delete the file: follow diafol's suggestion depending the Laravel version you're using.

cereal 1,524 Nearly a Senior Poster Featured Poster

Ok, the URI registered in your script and in your App defines the port number:

http://localhost:80/feedreader/fdposter.php

But in your browser (screenshot) the port number is missing:

http://localhost/feedreader/fdposter.php

If you're using port 80, then try to remove it from the App settings and from the script, as this is an implicit port number and could generate this kind of problems.

In other words, set the redirect URI in App settings and in your script to:

http://localhost/feedreader/fdposter.php
cereal 1,524 Nearly a Senior Poster Featured Poster

In Javascript this is never a simple task, at least for me, so I prefer to stick with libraries. While waiting for more appropriate suggestions, try with the difference() function in moments.js library:

Bye!

diafol commented: +rep for moment - brilliant I use it a lot +15
cereal 1,524 Nearly a Senior Poster Featured Poster

Hi!

If you can, place it outside the public_html directory, so it cannot be executed by requesting the file through the web.

Otherwise write this in top of the script:

<?php

    if(php_sapi_name() != 'cli')
    {
        header("HTTP/1.1 403 Forbidden");
        die('Error: 403 Forbidden.');
    }
cereal 1,524 Nearly a Senior Poster Featured Poster

Can you show your updated code? Do you got any errors? If in debug mode you should get the stack trace.

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

The path defined in File::delete($path) must include the filename:

$path = '../app/uploads/' . $contact->filename;

Also you should use the helper to set the correct path:

cereal 1,524 Nearly a Senior Poster Featured Poster

The error message suggests to enable the web OAuth login, so go to your Facebook App dashboard > Settings > Advanced, scroll to Client OAuth Settings and set Web OAuth Login to Yes, then it should work.

cereal 1,524 Nearly a Senior Poster Featured Poster

Also move the <script> block inside the body, place it just before the closing tag </body>. And the <script> cannot use self closing tag, add </script> to those loaded in the head section.

And at line 14 you're missing the closing parenthesis, so from:

$(document).ready(function(}{

To:

$(document).ready(function(){
diafol commented: Good spot. +0
cereal 1,524 Nearly a Senior Poster Featured Poster

It's not only the missing special characters, depending on the used collation the comparison can become case-sensitive:

The easy solution is to add an url slug column to the table, so you query directly the slug. Which should be UNIQUE:

ALTER TABLE `wp_feed` ADD `url_slug` VARCHAR(255) NOT NULL UNIQUE AFTER `feedTitulo`;