Hello, need assistence (new) with basic answers script issue

Discussions of secure PHP coding. Security in software is important, so don't be afraid to ask. And when answering: be anal. Nitpick. No security vulnerability is too small.

Moderator: General Moderators

Post Reply
biddersspot
Forum Newbie
Posts: 6
Joined: Thu Apr 24, 2008 4:29 am

Hello, need assistence (new) with basic answers script issue

Post by biddersspot »

Hello,

I purchased an off the shelf answers script, the script is based upon career related questions and answers using yahoo api.

My issue is this, for the last 3 months the site has run well, however,the script has and area where I can add swear words which will block any user, who use's bad words.What has been happening is that the swear words seem to increase in the database and it appears that the negitive words are creating more questions and answers.

My thoughts:
I belive a backdoor has been created in the script,in order to allow a person to build the database for thier own ends.

Help

As this is a career site, for people seeking career guidence,i would like to close the back door that prevents words like *hit,*uck being included in my site.

Any thoughts, advice or requests to view snippets of the script

Thank you in advance
matthijs
DevNet Master
Posts: 3360
Joined: Thu Oct 06, 2005 3:57 pm

Re: Hello, need assistence (new) with basic answers script issue

Post by matthijs »

biddersspot wrote:.What has been happening is that the swear words seem to increase in the database and it appears that the negitive words are creating more questions and answers.
What exactly is happening? Could you explain some more? Are there appearing more words in the database? Are things changing on your site without you doing it?

It could as well be just a problem in the script which is being exploited by a hacker. Maybe an sql injection or something. But without seeing any code people here cannot help I'm afraid. is it a lot of code to post?
biddersspot
Forum Newbie
Posts: 6
Joined: Thu Apr 24, 2008 4:29 am

Re: Hello, need assistence (new) with basic answers script issue

Post by biddersspot »

Thank you for your quick response,

Exactly that, on the home page,i list the 30 most popular searchs,these generally have search words that should be blocked.

The script below is the adult.php script

Code: Select all

//
<?php
session_start();
define("ADDITIONAL_PATH","../");
include_once(ADDITIONAL_PATH."config/config.php");
require_once(ADDITIONAL_PATH."lib/application/kernel/first.controller.class.php");
require_once(ADDITIONAL_PATH."lib/database/mysql.class.php");
 
 
$firstController = new FirstController();
$firstController->run();
?>
do you see a problem? what I have noticed, is that questions with one keyword generally include a lot of question mark i.e ????sex?????

the code is not that heavy, what advice do you offear, upload or display code in my questions?
Last edited by biddersspot on Thu Apr 24, 2008 7:18 am, edited 1 time in total.
biddersspot
Forum Newbie
Posts: 6
Joined: Thu Apr 24, 2008 4:29 am

Re: Hello, need assistence (new) with basic answers script issue

Post by biddersspot »

When creating the database, I,m requested to import the contents you see below, do you see any faults in the script.
I would like not to include the questions listed below,as they are not relevant to my subject.
[code-txt]
CREATE TABLE `adult_search_terms` (
`id` int(11) unsigned NOT NULL auto_increment,
`term` varchar(255) default NULL,
UNIQUE KEY `u` (`term`),
KEY `id` (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=8 ;

--
-- Dumping data for table `adult_search_terms`
--

INSERT INTO `adult_search_terms` VALUES(1, 'sex');
INSERT INTO `adult_search_terms` VALUES(2, 'porn');
INSERT INTO `adult_search_terms` VALUES(3, '<span style='color:blue' title='I&#39;m naughty, are you naughty?'>smurf</span>');
INSERT INTO `adult_search_terms` VALUES(4, 'wank');
INSERT INTO `adult_search_terms` VALUES(5, '<span style='color:blue' title='I&#39;m naughty, are you naughty?'>smurf</span>');
INSERT INTO `adult_search_terms` VALUES(6, 'twat');
INSERT INTO `adult_search_terms` VALUES(7, 'porno');

CREATE TABLE `questions` (
`id` varchar(50) NOT NULL default '',
`subject` varchar(250) NOT NULL default '',
`last_date` int(11) unsigned default NULL,
`number` int(11) unsigned default '1',
KEY `id` (`id`),
KEY `date` (`last_date`),
KEY `number` (`number`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

--
-- Dumping data for table `questions`
--

INSERT INTO `questions` VALUES('20070330194847AAHJLku', 'cars.....?', 1194799231, 59);
INSERT INTO `questions` VALUES('20060831172131AA79phW', 'which are the 6 world powers?', 1194763776, 20);
INSERT INTO `questions` VALUES('20060709165114AAxfwzK', 'I want a decent Career in Retail or Shopping TV what can you suggest?', 1194779827, 27);
INSERT INTO `questions` VALUES('20070901141815AAkVlnJ', 'Lawyer Jokes?', 1194776404, 25);
INSERT INTO `questions` VALUES('20070625191450AAoOzBZ', 'Laptops????', 1194776073, 44);
INSERT INTO `questions` VALUES('1006030401584', 'software??', 1194779825, 32);
INSERT INTO `questions` VALUES('20061123145602AAVSOJC', 'What do you think of TV shopping channels?', 1194454101, 2);
INSERT INTO `questions` VALUES('1006052908353', 'World powers?', 1194454355, 2);
INSERT INTO `questions` VALUES('20070312182218AAcmVmo', 'hosting...?', 1194454439, 2);
INSERT INTO `questions` VALUES('20070213180533AA7CHz9', 'Website hosting for Porn?', 1194454445, 2);
INSERT INTO `questions` VALUES('20070304180749AAX07MO', 'Domain Hosting?', 1194769385, 22);
INSERT INTO `questions` VALUES('20061104202300AAkGwr4', 'Blue fire = gas fire?', 1194782073, 35);
INSERT INTO `questions` VALUES('20061113115059AACB5cB', 'Logo Design?', 1194541773, 1);
INSERT INTO `questions` VALUES('20070619042905AAOs6s3', 'if i am running win xp. is there any way i can take something off win start-up without going to system setting', 1194544828, 1);
INSERT INTO `questions` VALUES('20060714150938AAFVvLc', 'windows server?', 1194545144, 2);
INSERT INTO `questions` VALUES('20070208161047AAYQcS5', 'Windows Server?', 1194544889, 2);
INSERT INTO `questions` VALUES('20061005013604AANVuu9', 'Windows server 2003 giving strange problems?', 1194545003, 2);
INSERT INTO `questions` VALUES('20071107124651AATJ9t0', 'Do I need Windows Server?', 1194544862, 1);
INSERT INTO `questions` VALUES('20071105091422AAg1S8p', 'Can SQL Server 2005 be installed on Windows Vista?', 1194544936, 2);
INSERT INTO `questions` VALUES('20070827105213AAmo7M7', 'Apply CSS across domains?', 1194544879, 1);
INSERT INTO `questions` VALUES('20070913180522AAxR1fP', 'domains????', 1194544880, 1);
INSERT INTO `questions` VALUES('20070528175919AAnMN0A', 'Yahoo! Domains?!?', 1194764017, 16);
INSERT INTO `questions` VALUES('20061004073604AAdeWYf', 'Yahoo domains or yahoo business email screenshot AWARD.?', 1194544898, 1);
INSERT INTO `questions` VALUES('20061102023313AAh5rPj', 'online payment processor and postal mail,?', 1194803170, 16);
INSERT INTO `questions` VALUES('20071107080011AAxeBEW', 'TV Shopping, Help?', 1194564394, 1);
INSERT INTO `questions` VALUES('20070730092511AAtC9dO', 'How to take care of skin FAST?', 1194565918, 1);
INSERT INTO `questions` VALUES('20070430070216AAM47En', 'Hairstyle?', 1194566209, 1);
INSERT INTO `questions` VALUES('20061017085455AAKHhLt', 'I wanna travel round NZ, any good companys or info I should know?', 1194567306, 1);
INSERT INTO `questions` VALUES('20071101152116AAwP6Qt', 'Harley Davidson owners...any problems with your bike?', 1194572277, 1);
INSERT INTO `questions` VALUES('20061226210759AAMmNAm', 'MS Streets and Trips 2007 vs. Copilot Navigator 9?', 1194572495, 1);
INSERT INTO `questions` VALUES('20070228213731AAE5S9f', '3.4L camero engine leaking under pressure?', 1194574635, 2);
INSERT INTO `questions` VALUES('20071020140645AAxC8Hy', 'which is easier to create, a real time strategy game or browser based text rpg?', 1194574669, 2);
INSERT INTO `questions` VALUES('20070620220944AAq0s2r', 'MySpace layouts?', 1194574764, 2);
INSERT INTO `questions` VALUES('20070617105653AAEiqYj', 'myspace layouts?', 1194574786, 2);
INSERT INTO `questions` VALUES('20070119211014AAaWFCH', '?????Ufo??', 1194575001, 2);
INSERT INTO `questions` VALUES('20070803081950AAwHCFg', 'Different Pork Recipes?', 1194579879, 2);
INSERT INTO `questions` VALUES('20071024113215AABEq31', 'Why do so many people believe the sky is blue because of the ocean?', 1194579949, 3);
INSERT INTO `questions` VALUES('20070609180854AA6Wc4K', '********GirlS*******?', 1194586936, 2);
INSERT INTO `questions` VALUES('20070911105646AArvFA8', 'Where in Ankara (Turkey) is good for shopping good sport captions (for winter)?', 1194594565, 2);
INSERT INTO `questions` VALUES('20060913185258AAwVvrt', 'Ankara is the capital of what country?', 1194594609, 3);
INSERT INTO `questions` VALUES('20070713043010AAgWaYM', 'why is Ankara so cold in the winter?', 1194594627, 2);
INSERT INTO `questions` VALUES('20060815005244AAer9qA', 'Women Over 50?', 1194595641, 2);
INSERT INTO `questions` VALUES('20061010163135AAx7Xxr', 'dog...????', 1194604944, 2);
INSERT INTO `questions` VALUES('20071104183019AAdKkm1', 'jokes????????????????', 1194610499, 3);
INSERT INTO `questions` VALUES('20070507061743AALu3Uk', 'lawyer jokes?', 1194633430, 3);
INSERT INTO `questions` VALUES('20070410223022AAkBFFz', 'concept camero or mustang?', 1194634442, 2);
INSERT INTO `questions` VALUES('20070419100431AAsMWBZ', 'Mustange Vs. Camero?', 1194633561, 1);
INSERT INTO `questions` VALUES('20071018061307AA8w7Jn', 'Banks????????/?', 1194634822, 2);
INSERT INTO `questions` VALUES('20061122063033AAs7IdK', 'About banks problem...?', 1194634856, 2);
INSERT INTO `questions` VALUES('20070518061619AAwxHu0', 'Loans?????', 1194633602, 1);
INSERT INTO `questions` VALUES('20060613140435AAApMZB', 'Student loans, grants, etc. Please help!?', 1194634815, 4);
INSERT INTO `questions` VALUES('20070411152223AA2NTPM', 'Personal Flexible Loans and Personal Revolving Loans?', 1194634470, 2);
INSERT INTO `questions` VALUES('1006060308857', 'where to get free articles without copyright protection?', 1194715932, 1);
INSERT INTO `questions` VALUES('20070505215731AAzTRdk', 'india................?', 1194715988, 1);
INSERT INTO `questions` VALUES('20070721161517AAozjb2', 'website????', 1194716019, 1);
INSERT INTO `questions` VALUES('20070831194108AATbV2n', 'help with php and this part of the code...?', 1194718163, 1);
INSERT INTO `questions` VALUES('20061116212225AAqDQqA', 'What does the word ''ajedrez" mean? (spanish)?', 1194720713, 2);
INSERT INTO `questions` VALUES('20070718082156AALsHLO', 'Dye-penetrant testing, detecting cracks in metals, non-destructive test material/DP test?', 1194720564, 2);
INSERT INTO `questions` VALUES('20070413185758AAiH3ni', 'taxes?????', 1194721658, 2);
INSERT INTO `questions` VALUES('20070619184554AASNzLk', 'tampon????', 1194720772, 2);
INSERT INTO `questions` VALUES('20061107180251AA7ihq7', 'tampon users only- how often do u change them ?', 1194721456, 2);
INSERT INTO `questions` VALUES('20070728144246AAusrNq', '.....Tampon?', 1194721252, 2);
INSERT INTO `questions` VALUES('20070801105359AAtbPRn', 'Problem setting up Win XP?', 1194725349, 2);
INSERT INTO `questions` VALUES('20070525171425AABy2hf', 'Advertising?', 1194733099, 1);
INSERT INTO `questions` VALUES('1006021707685', 'first part of this week there was mention of a appraisal site that started with a Z in a featured artical.?', 1194746048, 2);
INSERT INTO `questions` VALUES('20070606092738AATkZBl', 'Is Host Monster the best host?', 1194753451, 2);
INSERT INTO `questions` VALUES('20070207175929AAYwzV0', 'Condom..........?', 1194757475, 1);
INSERT INTO `questions` VALUES('20070821105853AAnQgx9', 'ThumbSucking?', 1194763380, 2);
INSERT INTO `questions` VALUES('20070326064718AAUPWqQ', 'Love......!!!?', 1194773275, 2);
INSERT INTO `questions` VALUES('20060709100357AAiKDOw', 'Domain name?', 1194773237, 1);
INSERT INTO `questions` VALUES('20070222075946AAjv4V7', 'Is New York pizza better than Chicago style pizza?', 1194773325, 1);

CREATE TABLE `search_terms` (
`id` int(11) unsigned NOT NULL auto_increment,
`query` varchar(200) default NULL,
`last_date` int(11) unsigned default NULL,
`number` int(11) unsigned default '1',
KEY `id` (`id`),
KEY `date` (`last_date`),
KEY `number` (`number`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=93 ;

--
-- Dumping data for table `search_terms`
--

INSERT INTO `search_terms` VALUES(1, 'mens skin care', 1194733571, 3);
INSERT INTO `search_terms` VALUES(2, 'skin', 1194277330, 1);
INSERT INTO `search_terms` VALUES(3, 'uk hotels', 1194277799, 2);
INSERT INTO `search_terms` VALUES(4, 'cars', 1194794235, 7);
INSERT INTO `search_terms` VALUES(5, 'world powers', 1194454343, 3);
INSERT INTO `search_terms` VALUES(6, 'shopping on tv', 1194802323, 6);
INSERT INTO `search_terms` VALUES(7, 'layers', 1194758753, 3);
INSERT INTO `search_terms` VALUES(8, 'lawyer', 1194632660, 6);
INSERT INTO `search_terms` VALUES(9, 'laptops', 1194758125, 2);
INSERT INTO `search_terms` VALUES(10, 'LAPTOP', 1194786473, 2);
INSERT INTO `search_terms` VALUES(11, 'mesothelioma', 1194769624, 2);
INSERT INTO `search_terms` VALUES(12, 'software', 1194769554, 2);
INSERT INTO `search_terms` VALUES(13, 'hosting', 1194769774, 2);
INSERT INTO `search_terms` VALUES(14, 'Websites', 1194786562, 3);
INSERT INTO `search_terms` VALUES(15, 'Owning A Website', 1194716008, 2);
INSERT INTO `search_terms` VALUES(16, 'Health Care', 1194475047, 1);
INSERT INTO `search_terms` VALUES(17, 'Insurance', 1194758667, 2);
INSERT INTO `search_terms` VALUES(18, 'DIY', 1194475109, 1);
INSERT INTO `search_terms` VALUES(19, 'Gas Fire', 1194816556, 4);
INSERT INTO `search_terms` VALUES(20, 'Forums', 1194758244, 2);
INSERT INTO `search_terms` VALUES(21, 'auction', 1194475823, 1);
INSERT INTO `search_terms` VALUES(22, 'Logo Design', 1194541769, 1);
INSERT INTO `search_terms` VALUES(23, 'Setting Up Win XP', 1194724140, 3);
INSERT INTO `search_terms` VALUES(24, 'windows server', 1194786264, 2);
INSERT INTO `search_terms` VALUES(25, 'domains', 1194564254, 2);
INSERT INTO `search_terms` VALUES(26, 'yahoo domains', 1194758388, 2);
INSERT INTO `search_terms` VALUES(27, 'payment processor', 1194545073, 1);
INSERT INTO `search_terms` VALUES(28, 'male grooming', 1194758852, 2);
INSERT INTO `search_terms` VALUES(29, 'hair styling', 1194564220, 1);
INSERT INTO `search_terms` VALUES(30, 'mens hair styles', 1194769266, 2);
INSERT INTO `search_terms` VALUES(31, 'hair styles', 1194564232, 1);
INSERT INTO `search_terms` VALUES(32, 'charity', 1194564237, 1);
INSERT INTO `search_terms` VALUES(33, 'server', 1194564246, 1);
INSERT INTO `search_terms` VALUES(34, 'jeans style', 1194786745, 2);
INSERT INTO `search_terms` VALUES(35, 'new zealand', 1194631418, 2);
INSERT INTO `search_terms` VALUES(36, 'how to get a fast care', 1194595676, 4);
INSERT INTO `search_terms` VALUES(37, 'hairstyle', 1194802366, 2);
INSERT INTO `search_terms` VALUES(38, 'myspace layouts', 1194574755, 3);
INSERT INTO `search_terms` VALUES(39, 'travel nz', 1194567298, 1);
INSERT INTO `search_terms` VALUES(40, 'pizza new york', 1194773319, 5);
INSERT INTO `search_terms` VALUES(41, 'HARLEY', 1194758452, 2);
INSERT INTO `search_terms` VALUES(42, 'Copilot', 1194786386, 2);
INSERT INTO `search_terms` VALUES(43, 'camero', 1194816679, 4);
INSERT INTO `search_terms` VALUES(44, 'chevy truck', 1194592317, 3);
INSERT INTO `search_terms` VALUES(45, 'browser based rpg', 1194574656, 1);
INSERT INTO `search_terms` VALUES(46, 'ufo', 1194574984, 1);
INSERT INTO `search_terms` VALUES(47, 'diabetes', 1194577577, 1);
INSERT INTO `search_terms` VALUES(48, 'pork', 1194579862, 1);
INSERT INTO `search_terms` VALUES(49, 'rainbows', 1194579897, 1);
INSERT INTO `search_terms` VALUES(50, 'universal studios orlando?', 1194816652, 2);
INSERT INTO `search_terms` VALUES(51, 'why is the sky blue?', 1194758634, 2);
INSERT INTO `search_terms` VALUES(52, 'computers', 1194586908, 1);
INSERT INTO `search_terms` VALUES(53, 'girls', 1194586927, 1);
INSERT INTO `search_terms` VALUES(54, 'football', 1194758322, 2);
INSERT INTO `search_terms` VALUES(55, 'how to dance', 1194593191, 1);
INSERT INTO `search_terms` VALUES(56, 'ankara', 1194816625, 2);
INSERT INTO `search_terms` VALUES(57, '50', 1194595659, 2);
INSERT INTO `search_terms` VALUES(58, 'dog', 1194604933, 1);
INSERT INTO `search_terms` VALUES(59, 'jokes', 1194610481, 1);
INSERT INTO `search_terms` VALUES(60, 'google', 1194715329, 2);
INSERT INTO `search_terms` VALUES(61, 'real estate', 1194628851, 1);
INSERT INTO `search_terms` VALUES(62, 'adsense script', 1194628896, 1);
INSERT INTO `search_terms` VALUES(63, 'crappy', 1194628914, 1);
INSERT INTO `search_terms` VALUES(64, 'lawyer jokes', 1194786631, 2);
INSERT INTO `search_terms` VALUES(65, 'banks', 1194633573, 1);
INSERT INTO `search_terms` VALUES(66, 'loans', 1194802239, 2);
INSERT INTO `search_terms` VALUES(67, 'credit cards', 1194786685, 3);
INSERT INTO `search_terms` VALUES(68, 'finance', 1194786802, 2);
INSERT INTO `search_terms` VALUES(69, 'free bingo', 1194637362, 1);
INSERT INTO `search_terms` VALUES(70, 'free articles', 1194816591, 2);
INSERT INTO `search_terms` VALUES(71, 'india', 1194715981, 1);
INSERT INTO `search_terms` VALUES(72, 'Php', 1194718028, 1);
INSERT INTO `search_terms` VALUES(73, 'ajedrez', 1194719602, 1);
INSERT INTO `search_terms` VALUES(74, 'test', 1194748136, 2);
INSERT INTO `search_terms` VALUES(75, 'taxes', 1194769724, 2);
INSERT INTO `search_terms` VALUES(76, 'tampon', 1194720352, 1);
INSERT INTO `search_terms` VALUES(77, 'advertising', 1194733096, 1);
INSERT INTO `search_terms` VALUES(78, 'wallet', 1194816512, 2);
INSERT INTO `search_terms` VALUES(79, 'condom', 1194757462, 2);
INSERT INTO `search_terms` VALUES(80, 'college degree', 1194743340, 1);
INSERT INTO `search_terms` VALUES(81, 'redemption', 1194743377, 1);
INSERT INTO `search_terms` VALUES(82, 'jewish singles', 1194744829, 1);
INSERT INTO `search_terms` VALUES(83, 'part time appraisal', 1194769675, 2);
INSERT INTO `search_terms` VALUES(84, 'what is hemp', 1194769395, 2);
INSERT INTO `search_terms` VALUES(85, 'best host', 1194753348, 1);
INSERT INTO `search_terms` VALUES(86, 'ok', 1194757730, 1);
INSERT INTO `search_terms` VALUES(87, '''', 1194757761, 1);
INSERT INTO `search_terms` VALUES(88, 'fever', 1194802403, 2);
INSERT INTO `search_terms` VALUES(89, 'tawnee stone', 1194762807, 1);
INSERT INTO `search_terms` VALUES(90, 'thumbsucking', 1194763360, 1);
INSERT INTO `search_terms` VALUES(91, 'love', 1194802436, 2);
INSERT INTO `search_terms` VALUES(92, 'domain name', 1194773226, 1);

CREATE TABLE `_config` (
`name` varchar(50) default '0',
`value` varchar(255) default NULL,
UNIQUE KEY `name` (`name`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

--
-- Dumping data for table `_config`
--
Last edited by biddersspot on Thu Apr 24, 2008 7:20 am, edited 2 times in total.
matthijs
DevNet Master
Posts: 3360
Joined: Thu Oct 06, 2005 3:57 pm

Re: Hello, need assistence (new) with basic answers script issue

Post by matthijs »

I'm afraid I still don't understand the problem.
Exactly that, on the home page,i list the 30 most popular searchs,these generally have search words that should be blocked.
What do you mean with this?

If I guess correct,
- people do searches on your site using some form
- the most used or most recent searches are shown in a list somewhere
- to prevent "bad" words from showing up in that list there is a black list filter in the script
So what is the problem? What is happening which should not happen?

The code you showed is only the database dump. If there is a problem, it should be in the php code somewhere.
biddersspot
Forum Newbie
Posts: 6
Joined: Thu Apr 24, 2008 4:29 am

Re: Hello, need assistence (new) with basic answers script issue

Post by biddersspot »

sorry for being vague,

The script creates a google like search box, when a question is asked the script use's yahoo answers api to respond.The question is answered by yahoo and stored in my databse.

The bad word filter instead of preventing bad words are generating new questions and answers, this is highlighted on the home page which displays the top 30 most searched keywords.The number of negitive keywords are showing up in the top 30 on nearly every refreash(By refreashing this should diplayed varied results

What Im seeing in the databse and home page are variations of the bad words,both in questions and keywords.

Below is the generate php file,

Code: Select all

//<?
function sentence($keyword){
$a = array("looking", "searching", "checking", "looking hard", "searching hard", "checking hard");
$b = array("online", "on the internet", "on the interweb", "in a shop", "in an online shop", "on a search engine");
$c = array("important", "crucial", "essential", "imperative", "paramount", "significant");
$d = array("you look out for", "you are aware of", "you take note of", "you take notice of", "he takes notice of");
$e = array("effects", "influences", "changes", "differences", "ammendments", "modifications");
$f = array("cheap", "expensive", "cheaper", "lower priced", "higher priced");
 
$sentences = array(
"When you are *a* for *keyword* *b* it is *c* that *d* any *e* which can change it, especially if it is an *f* *keyword*.",
"When *a* for a *keyword* *b* you must be aware that it is *c* that *d* all *e* that can cause differences, especially so if its a *f* *keyword*.",
"If you are *a* for *keyword* *b* you should note that its *c* that *d* any *e* that may change it, even if it is a *f* *keyword*.",
"He was *a* for *keyword* *b* and knew it was *c* that *d* all *e* that could effect it, even more so if its *f* *keyword*.",
"She was *a* for *keyword* *b* and realised it was *c* that *d* many *e* which could cause any differences, obviously of importance if it is *f* *keyword*.",
"They were *a* for *keyword* *b* but were told it is *c* that *d* any *e* which may cause changes, very noticable importance if it is *f* *keyword*.",
"They started *a* for *keyword* *b* while remembering how *c* that *d* all *e* which could possible cause a change, more important so if *f* *keyword*.",
"They decided to *a* for *keyword* *b* but knew it was *c* that *d* any *e* which may result in a modification, more noticable because if it is a *f* *keyword*.",
);
 
 
//Grab template sentence
$sentence = $sentences[array_rand($sentences)];
 
$sentence = str_replace("*keyword*", $keyword, $sentence);
$sentence = str_replace("*a*", $a[array_rand($a)], $sentence);
$sentence = str_replace("*b*", $b[array_rand($b)], $sentence);
$sentence = str_replace("*c*", $c[array_rand($c)], $sentence);
$sentence = str_replace("*d*", $d[array_rand($d)], $sentence);
$sentence = str_replace("*e*", $e[array_rand($e)], $sentence);
$sentence = str_replace("*f*", $f[array_rand($f)], $sentence);
 
return($sentence);
}
 
function createfeed($words, $number, $urls){
shuffle($words);
 
//Grab our names list
$names = explode("\r\n", file_get_contents("firstnames.txt"));
 
if(count($words) <= $number){
$number = count($words);
}
 
 
//Create items
for($i=0;$i<$number;$i++){
$link = $urls[array_rand($urls)];
$title = htmlspecialchars($words[$i]);
$description = htmlspecialchars(sentence($words[$i]));
$items .= "<item><title>$title</title><link>$link</link>
<guid isPermaLink=\"false\">$link</guid><dc:creator>".$names[array_rand($names)]."</dc:creator><category><![CDATA[Uncategorized]]></category><description><![CDATA[$description]]></description></item>\r\n\r\n";
}
 
//Generate todays date
$dateuse = date("D, j F Y G:i:s O");
$xml = trim("<?xml version=\"1.0\" encoding=\"UTF-8\"?><!-- generator=\"wordpress/2.1.3\" --><rss version=\"2.0\"xmlns:content=\"http://purl.org/rss/1.0/modules/content/\"xmlns:wfw=\"http://wellformedweb.org/CommentAPI/\"xmlns:dc=\"http://purl.org/dc/elements/1.1/\">
 
<channel><title>".$names[array_rand($names)]."</title><link>".$urls[array_rand($urls)]."</link><description>Just another WordPress weblog</description><pubDate>".$dateuse."</pubDate><generator>http://wordpress.org/?v=2.1.3</generator><language>en</language>
 
$items
    
</channel></rss>");
 
return($xml);
}
 
?>
Last edited by biddersspot on Thu Apr 24, 2008 7:15 am, edited 3 times in total.
matthijs
DevNet Master
Posts: 3360
Joined: Thu Oct 06, 2005 3:57 pm

Re: Hello, need assistence (new) with basic answers script issue

Post by matthijs »

Could you edit your posts and wrap code tags around them?

Code: Select all

 

Code: Select all

// your code
 Makes reading the code a lot easier!
biddersspot
Forum Newbie
Posts: 6
Joined: Thu Apr 24, 2008 4:29 am

Re: Hello, need assistence (new) with basic answers script issue

Post by biddersspot »

Hopefully that should able better reading
dhiraj
Forum Newbie
Posts: 12
Joined: Wed Apr 23, 2008 12:23 am

Re: Hello, need assistence (new) with basic answers script issue

Post by dhiraj »

make the change in the admin area to trace the user first with the post and install the new data base on the user are i mean an user account panel
biddersspot
Forum Newbie
Posts: 6
Joined: Thu Apr 24, 2008 4:29 am

Re: Hello, need assistence (new) with basic answers script issue

Post by biddersspot »

dhiraj wrote:make the change in the admin area to trace the user first with the post and install the new data base on the user are i mean an user account panel
Sorry, I did not a understand what you where trying to say, would you clarify
thanks
Post Reply