[PHP] Wordpress Theme Switcher plugin redirect modification

2007-07-30 Thread Erik Gyepes

Hello,

I would like to modify the Theme Switcher Plugin for Wordpress 
(http://dev.wp-plugins.org/wiki/ThemeSwitcher). When I currently request 
the page to switch the theme (for example: 
mydomain.com/?wptheme=My+Theme) I'm redirected to the index.php, but 
instead I would like to redirect back to the page where I was before 
(for example: mydomain.com/?p=15)


Here is the code which is redirecting the page:

function ts_set_theme_cookie() { $expire = time 
http://www.php.net/time() + 3000; if (!empty 
http://www.php.net/empty($_GET[wptheme])) { setcookie 
http://www.php.net/setcookie(wptheme . COOKIEHASH,   
 stripslashes 
http://www.php.net/stripslashes($_GET[wptheme]), 
   $expire, COOKIEPATH 
   ); $redirect = get_settings('home').'/'; if 
(function_exists http://www.php.net/function_exists('wp_redirect'))   
 wp_redirect($redirect); else header 
http://www.php.net/header(Location: . $redirect); exit 
http://www.php.net/exit; } }



I've tried to change the $redirect variable to $_SERVER['REQUEST_URI'] 
but it doesn't worked. Then I realized that I should save the current 
page URL in the cookies, so I've set a cookie and then I tried redirect 
the page to the URL in that cookie. It worked, but not as intended, 
there are some situations when it is redirecting in a loop.


Any recommendations how to do it properly?

Thanks,
Erik

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



[PHP] How to check value in multidimensional array

2006-11-18 Thread Erik Gyepes

Hi guys,

I have an array with navigation items like that:

$navigationItemArr = array(Home=home,
 Profile=profile,
 Photogallery=photogallery,
 Contact=array(contact,subsection)
 );

How can I check for a value in this array?
I tried something like this:


.
.
..for $i++.. { // there is a normal for cycle, this is just an 
illustration

.
.

   if(in_array($bodyVariablePiece[$i], $navigationItemArr)) {
   echo $bodyVariablePiece[$i] [$i] - okbr /;
   }
   else {
   echo $bodyVariablePiece[$i] [$i] - errorbr /;
   }
.
.
}
.
.


* in $bodyVariablePiece are values extracted from URL like - home, 
profile, photogallery, contact
Everything works except contact - there it show error. So what is the 
correct way to check values in multidimensional arrays? Is it possible 
with in_array() function?


Thanks,
Erik

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



Re: [PHP] How to check value in multidimensional array

2006-11-18 Thread Erik Gyepes

Oliver Block wrote:

Am Samstag, 18. November 2006 19:46 schrieb Erik Gyepes:
  
What exactly do you need to do? You should read the manual too, at 

  
I would like to check if the value is really in the array, if it is not 
then I would like do some other things. (so not check if it is an array 
or not, as in your example) But my iteration not worked in 
multidimensional arrays.


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



[PHP] How to work with virtual (seo) URLs?

2006-11-18 Thread Erik Gyepes

Hi folks,
my another question is how to work with URLs like below in PHP:

http://www.example.com/section/
http://www.example.com/section/subsection/
http://www.example.com/section/subsection/subsubsection/
http://www.example.com/section/subsection/subsubsection/ 

These URLs works very well with this mod_rewrite rules:


RewriteEngine On

#check if file or directory real exists:
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

#do the rule only if the address has no extension:
RewriteCond %{REQUEST_URI} !\.[[:alnum:]]+$
#replace /whatever to /whatever/, not apply to whatever/!
RewriteRule ^(.+[^/])$ /$1/ [R]

#do the rule only if the address ends with trailing slash:
RewriteCond %{REQUEST_URI} ^.*/$
#if the rule ends with trailing slash then redirect to index.php..
RewriteRule ^(.*)/$ /index.php?p=$1 [L]


So Apache stage is solved, but how about the PHP stage?
The problem is that there can be many of subsections and how I can know 
that for example /animals/ is a subsection of /photogallery/ and not 
/profile/ ???


[url]http://www.example.com/photogallery/animals/[/url] - GOOD
[url]http://www.example.com/profile/animals/[/url] - BAD

How do you solve these things?

One idea which I had is to store sections in array an then compare them 
with the section's name in URL, but I can't get it work for more nested 
URL's.


Any ideas or web resources are appreciated!
Cheers.

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



[PHP] PDO and PGSQL: ERROR: syntax error at or near SET

2006-08-07 Thread Erik Gyepes

Hi all!

I'm trying to learn using PDO and PostgreSQL together a little bit and I 
have some problems with (I thinks, auto incrementing fields)

I have the following sample DB:

CREATE TABLE users (
uid SERIAL UNIQUE NOT NULL,
login TEXT NOT NULL,
password TEXT NOT NULL,
PRIMARY KEY (uid)
);

and the following PHP code:

?php
try {
  $db = new PDO('pgsql:host=localhost;dbname=testing', '', 'Z');
  $db-setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);

  $query = INSERT INTO users SET uid = :uid, login = :login, password 
= :password;

  $stmt = $db-prepare($query);

  $uid = ;
  $login = erik;
  $password = erikSecretPass;
 
  $stmt-bindParam(':uid', $uid);

  $stmt-bindParam(':login', $login);
  $stmt-bindParam(':password', $password);
 
  $stmt-execute();
 
  $db = null;

} catch (PDOException $e) {
  print Error!:  . $e-getMessage() . br/;
  die();
}
?

When running the script I get the following error message: Error!: 
SQLSTATE[42601]: Syntax error: 7 ERROR: syntax error at or near SET at 
character 19


I know that I doing something bad, maybe with the udi column, how to use 
auto incrementing columns with PDO?


Thanks very much for your time.

Erik Gyepes

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



[PHP] PHP5 + Mysql5 + Apache 2.0.55

2006-01-14 Thread Erik Gyepes

Hi all.

I'm trying to set up mysql 5 with php 5 on my windows machine, but I 
can't get work it. Also I can't see any loaded extensions with 
phpinfo(). I have set extensions directory in php.ini, PATH dir in 
windows, what else I may to do? I used linux a lot of time and now I 
cant remember how to set up these things on windows :)


thanks,
depi

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



[PHP] ftp_nlist dont work for me :(

2005-08-29 Thread Erik Gyepes

Hi folks!

I have compiled PHP 5.0.4 at my Slackware machine at home, I have the 
FTP support enable and I trying connect to the FTP with this little scritp:


?php
$connect = ftp_connect(ftp.slackware.at) or die(Couldn't connect to ftp 
server);
$login = ftp_login($connect,anonymous,[EMAIL PROTECTED]) or die(Couldn't login 
to ftp server);

$ftp_dir = ftp_pwd($connect) or die(error ftp dir);
$fileArray = ftp_nlist($connect,$ftp_dir) or die(error file array);

echo var_dump($fileArray);
?

And I always get: error file array, so there is problem with the ftp_nlist I think. 
But the sripts work well at my webhosting, but It dont get work it at home at my machine.

May I enable something in PHP? Some settings, or what?

Thanks very much.

Erik Gyepes

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



Re: [PHP] LAN IP address

2005-08-29 Thread Erik Gyepes

Hi.

I think you want to get the internal IP adress which computer uses? Am I 
right?
If yes, that is not possible with PHP directly, but it is possible with 
Java and PHP.


Erik

Philippe Reynolds wrote:


Hi all,

I would like to find a way to get my computers LAN IP address through 
PHP.  I tried using the gethostbyname(HOSTNAME) function, however I 
only got back the 127.0.0.1 address.


Any help is always appreciated
Cheers
Phil



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



Re: [PHP] LAN IP address

2005-08-29 Thread Erik Gyepes

Okay.

There I have script for you: http://pokusy.depi.sk/internalip.zip. Just 
download it and see the source.

You can see how it works here: http://pokusy.depi.sk/inernalip/ip.php.

Hope that helps you.

Erik

Philippe Reynolds wrote:

Yes, I would hard code my IP address but when the computer crashs the 
server assigns it a different IP address, so I have to make my code a 
tad more dynamic...


I havn't touched Java in a while, would you know the function for that?

Thanks again

I think you want to get the internal IP adress which computer uses? 
Am I right?
If yes, that is not possible with PHP directly, but it is possible 
with Java and PHP





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



Re: [PHP] Looking for CMS advice

2005-08-22 Thread Erik Gyepes

Zachary Kessin wrote:

I am about to start on a project that seems like it would be right for 
a CMS system. It will be about 80% rather boring stuff with about 20% 
custom database work. I have looked at XOOPS and a few others. However 
I can not seem to find one rather important thing about XOOPS. I 
understand how to use a module that someone else wrote, but I have not 
found any documentation on how to build my own blocks or application 
components.


I am not yet committed to XOOPS, so if there is different system that 
would be better that could work as well


--Zach


Nucleus seems to be good CMS too, see the: http://nucleuscms.org/.

Erik

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



Re: [PHP] Looking for CMS advice

2005-08-22 Thread Erik Gyepes

Zachary Kessin wrote:

I am about to start on a project that seems like it would be right for 
a CMS system. It will be about 80% rather boring stuff with about 20% 
custom database work. I have looked at XOOPS and a few others. However 
I can not seem to find one rather important thing about XOOPS. I 
understand how to use a module that someone else wrote, but I have not 
found any documentation on how to build my own blocks or application 
components.


I am not yet committed to XOOPS, so if there is different system that 
would be better that could work as well


--Zach


Nucleus seems to be good CMS too, see the: http://nucleuscms.org/.

Erik

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