jaymc
-
Posts
1,521 -
Joined
-
Last visited
Never
Posts posted by jaymc
-
-
Im creating a CMS system to run multiple websites.
The content and templates are all stored in a mysql database and the only use of files is for the php code/classes that generates the pages.
The problem I have is some of the pages generated from the CMS must allow for dynamic output hence I will need the use of PHP.
I know eval() can execute data e.g straight from a mysql database but that would pretty much allow a user to have some serious access to the system.
Can anyone think of a better solution? It would be good if I could use eval() alongside some good security limitations that stopped them from using certain functions related to reading files / delete functions.
-
Does anyone know of a free API to lookup a UK postcode and return street, city, town etc..
-
I have wrote quite a lot of user login applications however I would like to double check something with some of the great minds
to validate whether a member is logged in (hence has access to membership pages) I have always used the below code
if (!isset($_SESSION['memberID'])) { die('Please login'); }
That seems good to me based on the only way $_SESSION['memberID'] can be set is by going through the login process which of course requires valid username/password
Is that how you guys do it? Is my way safe?
-
Yes similar, but more aimed at sitting over the top of a textarea which contains html
-
Im building a CMS (content management system) for my customers to manage their website
I use http://ckeditor.com/demo to control the page content which for me is great, but then again i 9 times out of 10 go into raw source code view and make the changes that way.
However, the type of people that will be using it to edit and add content/pages are not web designers. Their experience in this type of thing starts and ends with the likes of Microsoft Word / Publisher. Mainly click and drag type approach
In other words, very simple things like aligning elements left and right with maybe something in the centre to, with text wrapped around it is not so easy even with a wysiwyg
Is there any other framework out there that can be plugged into a textarea and give them easy and flexiable control of content and designing pages.
Microsoft publisher is as close as I can give as an example. You literally just drag and drop elements which allows you pin point precision on how your page will look, even if your a novice.
-
I usually rewrite none www. urls using this method
rewritecond %{http_host} ^website.co.uk [nc]
rewriterule ^(.*)$ http://www.website.co.uk/$1 [r=301,nc]
Although that works, I need a way to do it where I do not need to statically set the domain name as the same vhost will be used for multiple deomains, hence I cant statically set the domain name as its dynamic
e.g something like this (obviously not correct syntax)
rewritecond %{http_host} ^{$DOMAIN} [nc]
rewriterule ^(.*)$ http://www.{$DOMAIN}/$1 [r=301,nc]
Any ideas how to elimate the need to statically assign url?
-
Yeh index.php but because of the dynamic vhost it needs rewritebase
-
I have the following
<VirtualHost 87.117.x.x> UseCanonicalName Off DocumentRoot /mnt/codebase/monthly VirtualDocumentRoot /mnt/codebase/monthly/%-2/ RewriteEngine on RewriteBase / RewriteRule ^([^/\.]+)/?$ ?pageName=$1 [QSA] </VirtualHost>
Because Im using dynamic vhost the rewrite rule will not work without RewriteBase /
if I put this in .htaccess it works fine
RewriteEngine on RewriteBase / RewriteRule ^([^/\.]+)/?$ ?pageName=$1 [QSA]
But when I take it out of .htaccess and put into the vhost so it applies to all websites I get this error rewritebase: only valid in per-directory config files
Im a bit stuck? Any ideas?
-
You would want to use the dynamic approach anyway otherwise you need to restart Apache for every new client, this quickly becomes a pita.
I maintain much the same setup with a server hosting 900+ sites this way. We started with all clients in one vhost, ran into problems pretty quickly (we had one rogue client getting DOS'd). moved to each client having there own vhost, then moved again to the dynamic setup when we got to around 300 clients.
Yeh it does sound like you have pretty much what I am trying to do.
Do you have rules in the list so that root file requests such as sitemap.xml automatically forward to something like /home/$1/sitemap.xml
Can you advise of any limitations you have run into using the dynamic approach? The last thing I want to do is set this all up running smooth then have to revert back due to silly issue that cant be resolved.
-
If you have the access you would be much better off making each website its own virtualhost (and thus, each site will have its own document root). This will give you allot more control over each clients site.
I have full access yes, just didnt want to end up with a vhost file with 100s of vhosts if there was a way to do it dynamically
e.g this potentually looks ok http://httpd.apache.org/docs/2.0/vhosts/mass.html
What are your thoughts?
-
I am creating a CMS which will allow people to create websites using a a global website script.
There content/pages etc are all stored in a mysql database, which is pulled out based on their website URL.
So basically all websites have the same docRoot
That works fine, however I need the ability to serve static files from the websites root directory, and of course, every website will have the same root directory! e.g www.site.com/sitemap.xml
Am I right in thinking the best solution to do this is by using VirtualHost and Alias e.g Alias /sitemap.xml /masterDIR/www.site.com/sitemap.xml
Is there a better way?
-
I was hoping someone could just say .. Are you running this function inside another function?
Isn't that pretty much a paraphrase of this post?
Didnt see that post! Cool so now I know
What a pain
What are the ways around it other than using register globals
Any other solutions
-
php_info();
register_globals Off Off
-
Edit: As to your latest post, you do realize that when you don't post your actual code that is exhibiting the symptoms, that NO ONE can help you with what your actual code is doing.
I was hoping someone could just say .. Are you running this function inside another function?
As no one knows any obvious causes I have stripped out my code to try and find the root culpret
Is that the reason then? Because I have functions nested in functions.
-
Hmm. I have an idea why it may be although no idea why it would
in my index file I have this
$html->body(cpanel_module_loader(file.php));
cpanel_module_loader("browser") is a function which will open file.php which is what contains all that code I gave you...
It will then echo it to screen
It seems that because its a case of a function running inside another function.. as obviously if I just call file.php direct it all works fine.
Is this a rule of php that global calls do not work if you are inside another function.
The function cpanel_module_loader uses globals... is this why?
function cpanel_module_loader($file) {
global $html, $my, $client, $user;
include($file); $file includes other files which have functions which do not appear to have working globals!
}
-
Why exactly is it you don't just pass variables by argument?
Because I dont want to screw with paypals API or attempt to rewrite it, especially as they update it
It should work, its tried and test.
It is just a case of something conflicting which i must find.
-
Are these variables available in $GLOBALS array?
print_r($GLOBALS);
gives me this
[API_UserName] =>
[API_Password] =>
Blank
-
A file called paypal.php
<? $API_UserName="seller_1256141718_biz_api1.hotmail.com"; $API_Password="1256141861"; function beees() { global $API_UserName, $API_Password; echo $API_UserName; echo $API_Password; echo "1234567<br><br>"; } ?>
a file called index.php
require_once("funcs/paypalfunctions.php"); echo "1 $API_UserName<br><br>"; beees(); echo "3 $API_UserName<br><br>"; die();
I get this
1 seller_1256141718_biz_api1.hotmail.com
1234567
3 seller_1256141718_biz_api1.hotmail.com
Hence, $API_UserName and $API_PassWord are not being echoed inside the function
-
So obviously something else where in my code is causing global to die... What are the possibilities? I don't even know where to begin
Which is precisely why it's bad practice. You have no real control over what writes to it when, and it's a pain to debug.
Its how paypal have written most of there API's
In fairness I can echo the variables immediately before the function call and immediately after the function call
Just not inside the function... so I don't think anything is overwriting there values?
-
It works for me. You're not calling the function in the code you posted though.
Yes it works for me.. I have a working version of the whole thing
But when I simply plug it into my website, the globals stop working
I havn't touched the code, simply copy and pasted
So obviously something else where in my code is causing global to die... What are the possibilities? I don't even know where to begin
-
<? $API_UserName="dummy@dummy.com"; $API_Password="12345"; $API_Signature="qwertyqwertyqwety"; // BN Code is only applicable for partners $sBNCode = "PP-ECWizard"; function hash_call($methodName,$nvpStr) { //declaring of global variables global $API_Endpoint, $version, $API_UserName, $API_Password, $API_Signature; echo $API_UserName; // DOES NOT WORK } echo $API_UserName; // DOES WORK ?>
Polluting global namespace? Hmm, how may I have done that?
Thats what I am looking for really, the reason that may cause global to lose functionality?
-
I am using a paypal API which I have tested and works fine
I am now integreating it into my website and it is no longer!
I have debugged as much as I can and what it has come down to is this
There is a function which has
function hash_call($methodName,$nvpStr) { //declaring of global variables global $API_Endpoint, $version, $API_UserName, $API_Password, $API_Signature;
None of those variables contain any data when echoed inside the function..
If I echo them outside the function, it works fine
So the conclusion but not the solution is that something somewhere is not allowing me to call a global.
Is there anything that would cause this? if so I can then check through all the layers of my code for the problem child.
-
Thanks
-
I have an array of numbers, which can change (generated by database).. so lets they they are
array(100,200,500,1000,5000,10000);
I want to pull out the cloest matching element in that array to a number I specify, but it must round down
So if I input the number 170 I want it to return 100
If I input the number 120 I want it to return 100
If I input the number 4500 I want it to return 1000
If I input the number 5200 I want it to return 5000
If I input the number 9000 I want it to return 5000
If I input the number 12000 I want it to return 10000
To help you understand if our customer spends £100+ they get a special discount, £500+ an even better discount, £1000+ even better discount and so on
So if they spend £900 they get the discount associated with spending £500+ even though £900 is closer to £1000
Hope you understand.
php cmyk image
in PHP Coding Help
Posted
To cut a long story short I need to display text as an image
Obviously this can be done using phps image library but the reason I need to do this is so I can display the text as CMYK, not RGB
So my question is, how can I accomplish creating the output image as CMYK?