Posts: 13
Threads: 3
Joined: Jan 2012
Not sure if there is a way or not, is there something I can do, once I have all my dynamic id's pages setup to disable automatic creation of new pages with false id's. Kind of like a toggle on/off switch until I add new pages.
If someone enters lets say
www.mysite.com/file.php?Name=somebogusname it creates this as a new page.
What I have been doing is deleting the false pages in the backend, but its becoming a chore and they are incrementing my Id numbers.
Thanks for any help.
Posts: 2,895
Threads: 59
Joined: Jun 2010
Hi,
I assume you're using the "cmtx_url" keyword?
The issue as you know is that it's creating a new page because it failed to match the supplied ID,
http://www.mysite.com/file.php?Name=somebogusname, with the actual ID, which for argument's sake might be
http://www.mysite.com/file.php. But if you removed the ability to create a new page then there would still be no match *and* no page would be created. The script then wouldn't have an ID with which to work with. The only real solution is to try to match the supplied ID with the actual ID. I think the best way would be to use the $parameters option in your integration code. You would list your important parameters that should be there, or leave empty if you don't have any, and then it would ignore unnecessary ones like "name" etc. More info
here.
With Commentics.org, the demo uses a non-dynamic ID, simply $page_id = "1". So it doesn't matter what parameters are in the URL. This solution is the best but of course it's not ideal if you have lots of pages. It's possible for you to switch to this method by entering the same ID in the integration code as the ones that the database issued when automatically creating the pages. This might be a last resort for you.
Have
you completed
the interview?
Posts: 13
Threads: 3
Joined: Jan 2012
Hi Steven
I'm using this in my php file:
$page_id = $_GET['propertyName'];
$reference = $_GET['propertyName'];
$path_to_comments_folder = "comments/";
define ('IN_COMMENTICS', 'true'); //no need to edit this line
require $path_to_comments_folder . "includes/commentics.php"; //no need to edit this line
My webpage is a template where the data is dynamic. I tried the parameter but didn't work. Probably because I don't know what I'm doing. Is it possible to lock the pages table in mysql? And then release the lock when I add new pages? Did you use to have it in prior versions where we could manually create the pages?
Thanks for your time.
Posts: 2,895
Threads: 59
Joined: Jun 2010
Ok let's say you disable the new page creation and someone views the page
http://www.mysite.com/file.php?Name=somebogusname
There won't be a match because "somebogusname" doesn't exist and it won't create a new page because that's disabled so there will be no ID for the script to use and there will be lots of errors.
The only solution would be to escape away from the script. In comments/includes/functions/page.php, instead of lines 180 to 182, you could use something like the die(); function.
So instead of this:
PHP Code:
<?php
} else { //create page
mysql_query("INSERT INTO `".$mysql_table_prefix."pages` (custom_id, reference, url, is_form_enabled, dated) VALUES ('$page_id', '$reference', '$url', 1, NOW())");
return mysql_insert_id();
}
It would be:
PHP Code:
<?php
} else { //create page
die();
}
Or you could return an existing page ID:
PHP Code:
<?php
} else { //create page
return "1";
}