Please login or register.

Login with username, password and session length
Advanced search  

News:

Latest sNews - sNews 1.7 - with its own forums - for discussion and user mods.

Pages: 1 [2]

Author Topic: change search page result in other page  (Read 1929 times)

Rui Mendes

  • Development,Testing, Support
  • Hero Member
  • *****
  • Karma: 195
  • Posts: 1009
  • sNews1.7
    • Comunidade Portuguesa
Re: change search page result in other page
« Reply #15 on: November 16, 2011, 01:25:19 PM »

I make some changes, download again.

This should work, on my localhost (OK) on my server also.

Maybe your mysql is old or something if not support. Download my snewsDoctor and tell what you got (only versions, not database settings)
Logged
Need a Job on Europe. Linkdin - Facebook / Group

adminphp

  • Full Member
  • ***
  • Karma: 4
  • Posts: 150
  • you must be a great snewser .
Re: change search page result in other page
« Reply #16 on: November 16, 2011, 07:39:27 PM »

after the changes you make i got the same problem;

Code: [Select]
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/aljazeer/public_html/search.php on line 147

i think the Problem with connecting to multiple databases

Code: [Select]
// CONNECT DATABASE
connect_to_db();
// CONNECT TO DATABASE
function connect_to_db() {
$db = mysql_connect(db('dbhost'), db('dbuname'), db('dbpass'));
mysql_select_db(db('dbname')) or die(l('dberror'));
    mysql_select_db(db('db name')) or die(l('dberror'));
if (mysql_num_rows(mysql_query("SHOW TABLES LIKE '"._PRE.'articles'."'")) != 1) {
       die(l('db_tables_error'));
}
}

just to know i run snews1.6 and my mysql is support the script search .  the problem as i think is in connecting to tables in DB.
did you made any changes in this file http://snews.engcivil.net/downloads/search.zip
« Last Edit: November 16, 2011, 08:31:30 PM by adminphp »
Logged
“Fifty years of programming language research, and we end up with C++?”

Rui Mendes

  • Development,Testing, Support
  • Hero Member
  • *****
  • Karma: 195
  • Posts: 1009
  • sNews1.7
    • Comunidade Portuguesa
Re: change search page result in other page
« Reply #17 on: November 16, 2011, 08:38:14 PM »

You should told me that you are using snews1.6.


Don't go away, I'll try make this fast
Logged
Need a Job on Europe. Linkdin - Facebook / Group

Rui Mendes

  • Development,Testing, Support
  • Hero Member
  • *****
  • Karma: 195
  • Posts: 1009
  • sNews1.7
    • Comunidade Portuguesa
Re: change search page result in other page
« Reply #18 on: November 16, 2011, 09:10:38 PM »

Here is the version for snews 1.6 search_snews16.zip.

I found 2 bugs on official version.
Quote
// FIND CATEGORY'S SEF TITLE THROUGH ARTICLE'S CATEGORY ID - 1.6.0 - revised.
function find_cat_sef($categoryid) {
    if ($categoryid==0) {return l('home_sef');}
   $SEF = retrieve('seftitle','categories','id', $categoryid);
   $cat_sef_title = isset($SEF) ? $SEF : l('home_sef');
   return $cat_sef_title;
}

And the 2nd
Quote
// SEARCH ENGINE
function search() {
   $search_query = clean(cleanXSS($_POST['search_query']));
   echo '<h2>'.l('search_results').'</h2>';
Logged
Need a Job on Europe. Linkdin - Facebook / Group

adminphp

  • Full Member
  • ***
  • Karma: 4
  • Posts: 150
  • you must be a great snewser .
Re: change search page result in other page
« Reply #19 on: November 16, 2011, 10:07:46 PM »

other messeage after discovering the two bugs;
Code: [Select]
Warning: Unexpected character in input: ''' (ASCII=39) state=1 in /home/aljazeer/public_html/search.php on line 199
Parse error: syntax error, unexpected $end, expecting ')' in /home/aljazeer/public_html/search.php on line 199

did you fixed the bugs you discovered.
Logged
“Fifty years of programming language research, and we end up with C++?”

Rui Mendes

  • Development,Testing, Support
  • Hero Member
  • *****
  • Karma: 195
  • Posts: 1009
  • sNews1.7
    • Comunidade Portuguesa
Re: change search page result in other page
« Reply #20 on: November 16, 2011, 10:17:24 PM »

Yes I did.

In localhost snews1.6 with standard instalation works fine.
Did you change anything?

As I can see line 199 is
Quote
$pattern .= ')?';
« Last Edit: November 16, 2011, 10:19:49 PM by Rui Mendes »
Logged
Need a Job on Europe. Linkdin - Facebook / Group

adminphp

  • Full Member
  • ***
  • Karma: 4
  • Posts: 150
  • you must be a great snewser .
Re: change search page result in other page
« Reply #21 on: November 16, 2011, 11:04:33 PM »

Did you change anything?
No i didn't.

As I can see line 199 is
Quote
$pattern .= ')?';
i checked the file search.php after fix the bugs, i didn't found any line include    $pattern .= ')?'    but  i found it in snews.php
exactly in  // XSS CLEAN but in search file I didn't found nothing so i think you are making changes in some other file php than the file which you gave me above.
the solution for this thing in condition if your search.php file works fine, is to fix all bugs you mentioned and changes you made then upload them with an other path zip
« Last Edit: November 16, 2011, 11:09:17 PM by adminphp »
Logged
“Fifty years of programming language research, and we end up with C++?”

Rui Mendes

  • Development,Testing, Support
  • Hero Member
  • *****
  • Karma: 195
  • Posts: 1009
  • sNews1.7
    • Comunidade Portuguesa
Re: change search page result in other page
« Reply #22 on: November 17, 2011, 02:36:06 AM »

My mistake, sorry the filename was correct but I forget to change link for this file

search_snews16.zip
« Last Edit: November 17, 2011, 02:40:18 AM by Rui Mendes »
Logged
Need a Job on Europe. Linkdin - Facebook / Group

adminphp

  • Full Member
  • ***
  • Karma: 4
  • Posts: 150
  • you must be a great snewser .
Re: change search page result in other page
« Reply #23 on: November 17, 2011, 04:35:44 AM »

 ??? ???
« Last Edit: April 15, 2012, 05:12:50 PM by adminphp »
Logged
“Fifty years of programming language research, and we end up with C++?”

Rui Mendes

  • Development,Testing, Support
  • Hero Member
  • *****
  • Karma: 195
  • Posts: 1009
  • sNews1.7
    • Comunidade Portuguesa
Re: change search page result in other page
« Reply #24 on: November 17, 2011, 03:45:17 PM »

There are 2 ways:

First like you did with snews:
Quote
- In snews change to echo "index2.php";
- In your index2.php include search.php
- Remove line search(20); on search.php
- In index2.php you can use your center with <?php search(20); ?>

Another way is add all html staff structure on search.php
example:
Quote
echo '
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
   <base href="http://localhost/demo/" />
   <title>sNews 1.7</title>
   <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
   <meta name="description" content="sNews CMS" />
   <meta name="keywords" content="new, site, snews" />
   <meta name="robots" content="index,follow" />
   <meta name="author" content="Solucija.com" />
   <link rel="stylesheet" type="text/css" href="css/style.css" />
</head>
<body>';
search(20);
echo '</body></html>';
Logged
Need a Job on Europe. Linkdin - Facebook / Group

adminphp

  • Full Member
  • ***
  • Karma: 4
  • Posts: 150
  • you must be a great snewser .
Re: change search page result in other page
« Reply #25 on: November 17, 2011, 10:24:10 PM »

template completely works fine, thank you very much mr. Rui Mendes for your help,
karma for you +
« Last Edit: November 18, 2011, 12:10:48 AM by adminphp »
Logged
“Fifty years of programming language research, and we end up with C++?”
Pages: 1 [2]