[PHP] php 5 and register_globals=off gives lotsa errors

2006-12-30 Thread Wikus Moller

Hi to all.

I am having huge problems running my script, which worked fine on a
server with php 4 and register_globals turned on, on a server with php
5 and register_globals turned off.

I get errors around the area in my script where I use $_GET (not the
only error). For example the following code on my index.php file which
like many other sites I know, handles quite a large amount
if(action=="main"); etc etc. :



When I go to http://chillinglounge.net (where the error is located) I
get the following error message(s):

Notice: Undefined index: action in
C:\websites\chillinglounge.net\public_html\index.php on line 55

Notice: Undefined index: sid in
C:\websites\chillinglounge.net\public_html\index.php on line 56

Notice: Undefined index: page in
C:\websites\chillinglounge.net\public_html\index.php on line 57

Notice: Undefined index: who in
C:\websites\chillinglounge.net\public_html\index.php on line 58

Now if you would look at exactly the same script at
http://ranterswap.net you'd see absolutely no errors.

That's where I need your help. I know what is causing this error. I
believe it's the fact that register_globals is turned off.

But what I really want to know is: How do I fix it without trying to
turn register_globals on via .htaccess (because it doesn't work)?

Is there a function or some magic script that would to the trick?
Or do I have to recode my entire script and how?

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Search script problem

2007-01-06 Thread Wikus Moller

Hi.

I am having problems with a script I wrote which searches keywords
from a field in a mysql db table.

It is a very simple,  one-page script. My site is a toplist, very
basic, still in it's infancy. When I go to the page, key in the
keywords and press submit, the head, body etc. part of the result
script is shown, but no results.
, although there are rows in my database containing the `keyword` field data.

Below is the script, please see if you find any errors, it could be
that I just made a stupid mistake.

";
echo "http://www.wapforum.org/DTD/xhtml-mobile10.dtd\";>";
echo "http://www.w3.org/1999/xhtml\";>";

error_reporting(E_ALL ^ E_NOTICE);

$pwd = $_GET["pwd"];
$uid = $_GET["uid"];
$action = $_GET["action"];
$cid = $_GET["cid"];
$sid = $_GET["sid"];
$var = $_GET["q"];

include ("function.php");
include ("config.php");
connect($dbserver,$dbname,$dbuser,$dbpass);



/Search main page
if(!isset($var)){
echo "";
echo "Search Engine";
echo "
.m3 {background-color: #291C6F;}
.n1 {background-color: #A0A0A0;}
.n2 {background-color: #88;}
.c2 {color: #00;}
.m2 {color: #91D0FF;}
body   {font-family: Arial, sans-serif;
font-size: 12px;
color: #ff;
background-color: #33;
margin-left: 0px;
margin-right: 0px;
margin-top: 0px;}
.ct1 {font-family: Arial, sans-serif;
font-size: 12px;
color: #800080;}
.cre {background-color: #1300A4;
padding: 2px 2px 2px 2px;
margin: 3px 0 0;
font-size: 12px;
color:#00;
text-align: center;
border-width:1px 0;
border-style:solid;
border-color:#00;}
";
echo "";
echo "";
echo "";
echo "";
echo "Search Engine";
echo ""; ///the uid and pwd is
nessecary cause my member features are very basic and the urls is used
to keep the user 'logged in'
echo "Keywords: ";
echo "";
echo "";
echo "";
echo "Home";
echo "";
echo "";
}

///Display Results

if(isset($var)){
$var = $_GET["q"];
$trimmed = trim($var); //trim whitespace from the stored variable
echo "";
echo "Search Results";
echo "
.m3 {background-color: #291C6F;}
.n1 {background-color: #A0A0A0;}
.n2 {background-color: #88;}
.c2 {color: #00;}
.m2 {color: #91D0FF;}
body   {font-family: Arial, sans-serif;
font-size: 12px;
color: #ff;
background-color: #33;
margin-left: 0px;
margin-right: 0px;
margin-top: 0px;}
.ct1 {font-family: Arial, sans-serif;
font-size: 12px;
color: #800080;}
.cre {background-color: #1300A4;
padding: 2px 2px 2px 2px;
margin: 3px 0 0;
font-size: 12px;
color:#00;
text-align: center;
border-width:1px 0;
border-style:solid;
border-color:#00;}
";
echo "";
echo "";
echo "";
echo "Search Results";
echo "";
// Get the search variable from URL



// check for an empty string and display a message.
if ($trimmed == "")
 {
 echo "Please enter a search...";
 exit;
 }



if($pg==0)$pg=1;
 $pg--;
 $lmt = $pg*20;
 $pg++;
 $cou =$lmt+1;
 $scount = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM table
WHERE keywords like \"%$trimmed%\" AND banned='0' AND hitsin >=
'2'"));
 $pgs = ceil($scount[0]/20);
 // Build SQL Query
 $sql = "SELECT * FROM table WHERE keywords like \"%$trimmed%\" AND
banned='0' and hits_in >='2' ORDER by hin DESC LIMIT ".$lmt.", 20;";
// EDIT HERE and specify your table and field names for the SQL query
 $sites=mysql_query($sql);


while ($site = mysql_fetch_array($sites))
{
   $dscr =htmlspecialchars($site[11]);
   $snm=htmlspecialchars($site[1]);
   echo "$snm";
   echo "$dscr";
   $cou++;
}
$npage = $pg+1;
$ppage = $pg-1;
if($pg<$pgs)
//this is just for clicking on the site's name when the results are displayed
{

   $nlink = "Next";

}
if($pg >1)
{
   $plink = "Prev";
}


echo "$nlink";
echo "$plink";

echo "";
echo "Home";
echo "";
echo "";
}
?>

Like I said, very basic. I know there must be a screw-up somewhere but
I can't seem to find it.

Thanks
Wikus

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: Search script problem

2007-01-06 Thread Wikus Moller

And the hits_in of the mysql query are the same, I just made a typing mistake.

On 1/7/07, Wikus Moller <[EMAIL PROTECTED]> wrote:

Hi.

I am having problems with a script I wrote which searches keywords
from a field in a mysql db table.

It is a very simple,  one-page script. My site is a toplist, very
basic, still in it's infancy. When I go to the page, key in the
keywords and press submit, the head, body etc. part of the result
script is shown, but no results.
, although there are rows in my database containing the `keyword` field
data.

Below is the script, please see if you find any errors, it could be
that I just made a stupid mistake.

";
echo "http://www.wapforum.org/DTD/xhtml-mobile10.dtd\";>";
echo "http://www.w3.org/1999/xhtml\";>";

error_reporting(E_ALL ^ E_NOTICE);

$pwd = $_GET["pwd"];
$uid = $_GET["uid"];
$action = $_GET["action"];
$cid = $_GET["cid"];
$sid = $_GET["sid"];
$var = $_GET["q"];

include ("function.php");
include ("config.php");
connect($dbserver,$dbname,$dbuser,$dbpass);



/Search main page
if(!isset($var)){
echo "";
echo "Search Engine";
echo "
.m3 {background-color: #291C6F;}
.n1 {background-color: #A0A0A0;}
.n2 {background-color: #88;}
.c2 {color: #00;}
.m2 {color: #91D0FF;}
body   {font-family: Arial, sans-serif;
font-size: 12px;
color: #ff;
background-color: #33;
margin-left: 0px;
margin-right: 0px;
margin-top: 0px;}
.ct1 {font-family: Arial, sans-serif;
font-size: 12px;
color: #800080;}
.cre {background-color: #1300A4;
padding: 2px 2px 2px 2px;
margin: 3px 0 0;
font-size: 12px;
color:#00;
text-align: center;
border-width:1px 0;
border-style:solid;
border-color:#00;}
";
echo "";
echo "";
echo "";
echo "";
echo "Search Engine";
echo ""; ///the uid and pwd is
nessecary cause my member features are very basic and the urls is used
to keep the user 'logged in'
echo "Keywords: ";
echo "";
echo "";
echo "";
echo "Home";
echo "";
echo "";
}

///Display Results

if(isset($var)){
$var = $_GET["q"];
$trimmed = trim($var); //trim whitespace from the stored variable
echo "";
echo "Search Results";
echo "
.m3 {background-color: #291C6F;}
.n1 {background-color: #A0A0A0;}
.n2 {background-color: #88;}
.c2 {color: #00;}
.m2 {color: #91D0FF;}
body   {font-family: Arial, sans-serif;
font-size: 12px;
color: #ff;
background-color: #33;
margin-left: 0px;
margin-right: 0px;
margin-top: 0px;}
.ct1 {font-family: Arial, sans-serif;
font-size: 12px;
color: #800080;}
.cre {background-color: #1300A4;
padding: 2px 2px 2px 2px;
margin: 3px 0 0;
font-size: 12px;
color:#00;
text-align: center;
border-width:1px 0;
border-style:solid;
border-color:#00;}
";
echo "";
echo "";
echo "";
echo "Search Results";
echo "";
 // Get the search variable from URL



// check for an empty string and display a message.
if ($trimmed == "")
  {
  echo "Please enter a search...";
  exit;
  }



if($pg==0)$pg=1;
  $pg--;
  $lmt = $pg*20;
  $pg++;
  $cou =$lmt+1;
  $scount = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM table
WHERE keywords like \"%$trimmed%\" AND banned='0' AND hitsin >=
'2'"));
  $pgs = ceil($scount[0]/20);
  // Build SQL Query
  $sql = "SELECT * FROM table WHERE keywords like \"%$trimmed%\" AND
banned='0' and hits_in >='2' ORDER by hin DESC LIMIT ".$lmt.", 20;";
// EDIT HERE and specify your table and field names for the SQL query
  $sites=mysql_query($sql);


while ($site = mysql_fetch_array($sites))
{
$dscr =htmlspecialchars($site[11]);
$snm=htmlspecialchars($site[1

[PHP] Re: Search script problem

2007-01-06 Thread Wikus Moller

So it should be like this (it still doesn't show the results):

";
echo "http://www.wapforum.org/DTD/xhtml-mobile10.dtd\";>";
echo "http://www.w3.org/1999/xhtml\";>";

error_reporting(E_ALL ^ E_NOTICE);

$pwd = $_GET["pwd"];
$uid = $_GET["uid"];
$action = $_GET["action"];
$cid = $_GET["cid"];
$sid = $_GET["sid"];
$var = $_GET["q"];

include ("function.php");
include ("config.php");
connect($dbserver,$dbname,$dbuser,$dbpass);



/Search main page
if(!isset($var)){
echo "";
echo "Search Engine";
echo "
  .m3 {background-color: #291C6F;}
  .n1 {background-color: #A0A0A0;}
  .n2 {background-color: #88;}
  .c2 {color: #00;}
  .m2 {color: #91D0FF;}
  body   {font-family: Arial, sans-serif;
  font-size: 12px;
  color: #ff;
  background-color: #33;
  margin-left: 0px;
  margin-right: 0px;
  margin-top: 0px;}
  .ct1 {font-family: Arial, sans-serif;
  font-size: 12px;
  color: #800080;}
  .cre {background-color: #1300A4;
  padding: 2px 2px 2px 2px;
  margin: 3px 0 0;
  font-size: 12px;
  color:#00;
  text-align: center;
  border-width:1px 0;
  border-style:solid;
  border-color:#00;}
";
echo "";
echo "";
echo "";
echo "";
echo "Search Engine";
echo ""; ///the uid and pwd is
nessecary cause my member features are very basic and the urls is used
to keep the user 'logged in'
echo "Keywords: ";
echo "";
echo "";
echo "";
echo "Home";
echo "";
echo "";
}

///Display Results

if(isset($var)){
$var = $_GET["q"];
$trimmed = trim($var); //trim whitespace from the stored variable
echo "";
echo "Search Results";
echo "
  .m3 {background-color: #291C6F;}
  .n1 {background-color: #A0A0A0;}
  .n2 {background-color: #88;}
  .c2 {color: #00;}
  .m2 {color: #91D0FF;}
  body   {font-family: Arial, sans-serif;
  font-size: 12px;
  color: #ff;
  background-color: #33;
  margin-left: 0px;
  margin-right: 0px;
  margin-top: 0px;}
  .ct1 {font-family: Arial, sans-serif;
  font-size: 12px;
  color: #800080;}
  .cre {background-color: #1300A4;
  padding: 2px 2px 2px 2px;
  margin: 3px 0 0;
  font-size: 12px;
  color:#00;
  text-align: center;
  border-width:1px 0;
  border-style:solid;
  border-color:#00;}
";
echo "";
echo "";
echo "";
echo "Search Results";
echo "";
// Get the search variable from URL



// check for an empty string and display a message.
if ($trimmed == "")
{
echo "Please enter a search...";
exit;
}



if($pg==0)$pg=1;
$pg--;
$lmt = $pg*20;
$pg++;
$cou =$lmt+1;
$scount = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM table
WHERE keywords like \"%$trimmed%\" AND banned='0' AND hits_in >=
'2'"));
$pgs = ceil($scount[0]/20);
// Build SQL Query
$sql = "SELECT * FROM table WHERE keywords like \"%$trimmed%\" AND
banned='0' and hits_in >='2' ORDER by hits_in DESC LIMIT ".$lmt.", 20;";
// EDIT HERE and specify your table and field names for the SQL query
$sites=mysql_query($sql);


while ($site = mysql_fetch_array($sites))
{
  $dscr =htmlspecialchars($site[11]);
  $snm=htmlspecialchars($site[1]);
  echo "$snm";
  echo "$dscr";
  $cou++;
}
$npage = $pg+1;
$ppage = $pg-1;
if($pg<$pgs)
//this is just for clicking on the site's name when the results are displayed
{

  $nlink = "Next";

}
if($pg >1)
{
  $plink = "Prev";
}


echo "$nlink";
echo "$plink";

echo "";
echo "Home";
echo "";
echo "";
}
?>



On 1/7/07, Wikus Moller <[EMAIL PROTECTED]> wrote:

And the hits_in of the mysql query are the same, I just made a typing
mistake.

On 1/7/07, Wikus Moller <[EMAIL PROTECTED]> wrote:
> Hi.
>
> I am having problems with a script I wrote which searches keywords
> from a 

[PHP] Table contents not updated

2007-01-08 Thread Wikus Moller

Hi.

I am new to uising html forms with php and I am having a problem with
database contents not being updated although it seems my coding is
correct.

It's a xhtml formatted site with html forms:

Here are my functions:



Everything seems to be correct, but the table isn't updated...

";
 echo "*Site Name: ";
 echo "*Wap Link: ";
 echo "Web Link: ";
 echo "Logo URL: ";
 echo "*Description: ";
 echo "*Category:";
 echo "";
 echo "Entertainment";
 echo "Portal - Search";
 echo "Messaging - Chat";
 echo "Ringtones - Logos";
 echo "Fun - Games";
 echo "Hobbies - Interests";
 echo "Services";
 echo "Personal";
 echo "Others";
 echo "";
 echo "*Keywords: (separate by spaces)";
 echo "* = Denotes a required field.";
 echo "";
 echo "";
?>

Theres my form, also everything seems to be correct... The correct
values are displayed when the form is loaded.

";
metatags();
echo "Chilling Lounge.net";
echo "";
echo "";
echo "";
echo "";
echo "";
echo "$snm Updated Successfully";
?>

And theres my site finished page (editsitefin.php), I can't find any
errors, but I am not that clued up with html forms. Does anyone notice
any errors? It displays a success message yet when I look at the
database or when I browse again to the site, the info isn't updated.
Please check if you find any errors that could cause the database
fields not to be updated or suggest a possible fix


Thanks

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: Table contents not updated

2007-01-08 Thread Wikus Moller

The function page IS included on every page so that wouldn't be what
is causing the errors.

On 1/8/07, Wikus Moller <[EMAIL PROTECTED]> wrote:

Hi.

I am new to uising html forms with php and I am having a problem with
database contents not being updated although it seems my coding is
correct.

It's a xhtml formatted site with html forms:

Here are my functions:



Everything seems to be correct, but the table isn't updated...

";
  echo "*Site Name: ";
  echo "*Wap Link: ";
  echo "Web Link: ";
  echo "Logo URL: ";
  echo "*Description: ";
  echo "*Category:";
  echo "";
  echo "Entertainment";
  echo "Portal - Search";
  echo "Messaging - Chat";
  echo "Ringtones - Logos";
  echo "Fun - Games";
  echo "Hobbies - Interests";
  echo "Services";
  echo "Personal";
  echo "Others";
  echo "";
  echo "*Keywords: (separate by spaces)";
  echo "* = Denotes a required field.";
  echo "";
  echo "";
?>

Theres my form, also everything seems to be correct... The correct
values are displayed when the form is loaded.

";
metatags();
echo "Chilling Lounge.net";
echo "";
echo "";
echo "";
echo "";
echo "";
echo "$snm Updated Successfully";
?>

And theres my site finished page (editsitefin.php), I can't find any
errors, but I am not that clued up with html forms. Does anyone notice
any errors? It displays a success message yet when I look at the
database or when I browse again to the site, the info isn't updated.
Please check if you find any errors that could cause the database
fields not to be updated or suggest a possible fix


Thanks



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Include files beneath pointed directory

2007-01-18 Thread Wikus Moller

Hi.

I have a windows server and I know this issue has been dealt with
before but I can't find it, I want to include a file from a directory
beneath or aside my home directory.

Can I use the C:\directory\anotherdirectory\file.php in the include
function like include "C:\directory\anotherdirectory\file.php"; or do
I need more code to make it work? I am sure I do. The directory would
be aside my home directory.

Thanks

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Get the shortened browser / HTTP_USER_AGENT

2007-01-19 Thread Wikus Moller

Hi.

I want to strip everything after a / in the HTTP_USER_AGENT for
example: Opera 9.10/blah/blah would become only Opera 9.10

Lets say
$user = $_SERVER["HTTP_USER_AGENT"];
$browser = ("/", $user);

Is this correct?
Isn't something needed in the browser variable?

Thanks
Wikus

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Request for...

2007-01-20 Thread Wikus Moller

Hi.

Since this is a mailing list for web developers, I thought I might as
well post an o f f  t o p i c request.
Does anyone know of any website where I can get a exe or jar sitemap
generating software? Particularly not GsiteCrawler as it uses too much
system resources. A java applet would be nice. And, if possible, free
of charge ^.^

And does anyone know how and if a j a v a applet can be extracted from
a webpage?(also a class)

Thanks
Wikus

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Matching numbers 1-100

2007-02-03 Thread Wikus Moller

Hi.

I want to know if anyone can help me with my code which matches a
number to a range e.g. 1-15 and echoes an image if the number is in
the range.

The code would use the if statement and check if a variable for
example 5  matches the range like 4-10 and if it does it echoes a
certain image.

Anyone know which function I should use and what regex I should use?

Thanks

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Matching numbers 1-100

2007-02-03 Thread Wikus Moller

Hi.

I want to know if anyone can help me with my code which matches a
number to a range e.g. 1-15 and echoes an image if the number is in
the range.

The code would use the if statement and check if a variable for
example 5  matches the range like 4-10 and if it does it echoes a
certain image.

Anyone know which function I should use and what regex I should use?

Thanks

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php