|
Zorilla posted:I've got a client we're doing a web page redesign for and it turns out he would like to be able to edit basically anything that might need changing on the site on his own. Normally, I would just set up some system like Website Baker or CMS Made Simple, but this site in particular has quite a bit of markup I don't want the client to disturb. Plus, the site has some dynamic content with a backend I wrote a month or so ago to edit its contents. I'm pretty sure cmsms has a user management system in it that you can use to prevent users from editing certain pages and content blocks. Actually I think most content management systems have that now. You could take a look at http://www.opensourcecms.com/ and look over some of the more popular ones.
|
# ? Apr 9, 2008 09:47 |
|
|
# ? May 16, 2024 19:04 |
|
the talent deficit posted:Is this the right place for Zend questions? I hope so. It's one of two things 1) mod_rewrite is not enabled 2) your htaccess file is messed up If it was setup correctly then all requests should be going to the index.php file in the webroot. The framework handles all requests form there.
|
# ? Apr 9, 2008 09:52 |
|
genericadmin posted:Or, if you want to be flexible... Don't you mean: preg_match_all("#<br(?: /)?>#", $string, $m) edit: can't quote your < admiraldennis fucked around with this message at 12:08 on Apr 9, 2008 |
# ? Apr 9, 2008 12:01 |
|
admiraldennis posted:Don't you mean: correct
|
# ? Apr 9, 2008 14:43 |
|
Zorilla posted:markup I don't want the client to disturb bt_escm posted:I'm pretty sure cmsms has a user management system in it that you can use to prevent users from editing certain pages and content blocks. Further, you can limit them through the WYSIWYG editor. Turn off the buttons for all but important formatting, or create classes that show up as styles for them to use when they want something formatted differently so it's consistent and controlled through CSS. For even more control, you can limit the types of HTML tags and attributes permitted in the content: if they're not on the approved list, they're filtered out.
|
# ? Apr 9, 2008 15:03 |
|
e: php4 I've got a $variable filled with a large amount of text separated by new lines (\n). I want to split the $variable into two giant chunks after a certain amount of lines, is that possible? I thought about using split() but that would just make a new array value for every sentence and that might not be an effective way of doing it. Thanks
|
# ? Apr 9, 2008 21:42 |
|
drcru posted:e: php4 You could use strpos to find the nth line break and then substr to grab the first and then second half of the string. I'm sure there's a way to do this with regular expressions too.
|
# ? Apr 9, 2008 22:18 |
|
I'm writing another small PHP script to amuse myself, and this time I'd like to move away from having SQL sitting in my code. Are there any articles on how to go about this? I'm not looking for a full blown framework as that's just overkill for this but a simple DB class or something would be nice. Frameworks are a few projects down the track...
|
# ? Apr 10, 2008 06:57 |
|
TheHeadSage posted:I'm writing another small PHP script to amuse myself, and this time I'd like to move away from having SQL sitting in my code. Are there any articles on how to go about this? I'm not looking for a full blown framework as that's just overkill for this but a simple DB class or something would be nice. Here's an ORM http://propel.phpdb.org/trac/ And here's a tutorial http://codepoets.co.uk/propel_php5_framework_quickstart_howto_guide
|
# ? Apr 10, 2008 07:28 |
bt_escm posted:Here's an ORM http://propel.phpdb.org/trac/ I don't really understand what that helps with. Isn't it more beneficial to just learn/practice SQL?
|
|
# ? Apr 10, 2008 07:42 |
|
fletcher posted:I don't really understand what that helps with. Isn't it more beneficial to just learn/practice SQL? I already know SQL. I'd like to move away from having SQL statements littered all throughout my projects where it's hard coded in. Which leads to maintaining multiple versions because my home system runs MySQL and my sever runs PostgreSQL and for added fun a friend uses my scripts and he's got Oracle. So, it's getting to the point where I need database abstraction. I'll have a look at this ORM stuff.
|
# ? Apr 10, 2008 07:49 |
|
Actually an ORM layer is far better suited to your needs. Inquisitus fucked around with this message at 09:51 on Apr 10, 2008 |
# ? Apr 10, 2008 09:46 |
|
fletcher posted:I don't really understand what that helps with. Isn't it more beneficial to just learn/practice SQL? They're not mutually exclusive. This explains it way better than I could http://en.wikipedia.org/wiki/Object-relational_mapping
|
# ? Apr 10, 2008 16:39 |
|
TheHeadSage posted:I already know SQL. I'd like to move away from having SQL statements littered all throughout my projects where it's hard coded in. Which leads to maintaining multiple versions because my home system runs MySQL and my sever runs PostgreSQL and for added fun a friend uses my scripts and he's got Oracle. What do you mean by hard coded? Technically if you have sql anywhere in your code it could be considered hard coded since sql is frequently tied to the specific database server you are using. If you just want to be able to execute sql statements using the same set of commands across multiple script regardless of the database then pear's mdb2 would be better suited for that. If you want code to dynamically know the structure of your tables and handle all of the basic manipulations for you then propel would be ideal for that.
|
# ? Apr 10, 2008 16:48 |
|
Is there a way to catch 'Ctrl-C' in a PHP CLI script running in Windows? PCNTL isn't available for Windows so I can't easily use it to catch the signal for it. Google only turns up one post on php.net where a guy made a custom build of PHP to include PCTNL and that won't work for my situation.
|
# ? Apr 10, 2008 20:40 |
|
bt_escm posted:Here's an ORM http://propel.phpdb.org/trac/ Is Propel better than Doctrine? (I'm currently shopping around for ORMs)
|
# ? Apr 11, 2008 04:15 |
|
fletcher posted:I don't really understand what that helps with. Isn't it more beneficial to just learn/practice SQL? If you use raw SQL then you will have to escape strings every time you input them and then remember to stripslashes every time you output them, you will have to build big rear end queries by concating strings and it eventually gets very ugly. If you use an ORM you can treat individual records as instances of an object and it's very pretty, all the escaping bullshit is managed for you (you will be much better protected from injection), and you can change the database schema with a migration and have all your code handle the change automatically (without having to do a big search replace of your entire codebase). , etc.
|
# ? Apr 11, 2008 04:21 |
Sewer Adventure posted:If you use raw SQL then you will have to escape strings every time you input them and then remember to stripslashes every time you output them, you will have to build big rear end queries by concating strings and it eventually gets very ugly. That's not true at all. I used PDO and didn't use a single string concatenation for SQL or have to worry about escaping ANY input throughout my entire application. Don't use addslashes, stripslashes, magic quotes, concatenation, or any of that other crap, that's the wrong way to do it.
|
|
# ? Apr 11, 2008 05:44 |
|
stack posted:Is there a way to catch 'Ctrl-C' in a PHP CLI script running in Windows? PCNTL isn't available for Windows so I can't easily use it to catch the signal for it. Google only turns up one post on php.net where a guy made a custom build of PHP to include PCTNL and that won't work for my situation.
|
# ? Apr 11, 2008 06:11 |
|
fletcher posted:That's not true at all. I used PDO and didn't use a single string concatenation for SQL or have to worry about escaping ANY input throughout my entire application. Don't use addslashes, stripslashes, magic quotes, concatenation, or any of that other crap, that's the wrong way to do it. Sewer Adventure posted:If you use raw SQL
|
# ? Apr 11, 2008 07:32 |
|
Either way, not using an ORM is just making more work for yourself.
|
# ? Apr 11, 2008 07:33 |
|
Sewer Adventure posted:Either way, not using an ORM is just making more work for yourself. I have tried plenty of ORM's, they often turn out to be more work. Its often much much easier to just use an SQL join instead of setting up a bunch of objects to do a join. It also makes it a lot easier to optimize SQL statements if they are staring right at you instead of trying to figure out what SQL statements the ORM is making up and how to make them run faster. A good bridge is something like PDO or Zend_DB with prepared statements. It is pretty close to database generic (although swapping out drivers would probably require a little bit of work) and will let you write SQL without having to escape everything. Zend_DB includes a lot of handy methods that help with simple queries. If the app is well written, and you have some wrappers so that your SQL ends up all in a clearly defined set of classes, then not using an ORM can be a very robust maintainable solution.
|
# ? Apr 11, 2008 13:25 |
I've been playing around with this s3 script and can't seem to figure out how to list more than 1,000 objects in a bucket. Amazon mentions this here as the expected behavior and what you need to do. In s3.php: php:<? public function getBucket($bucket, $prefix = null, $marker = null, $maxKeys = null) ?> edit: this seems to work php:<? $pictures = array(); $done = false; $marker = null; while (!$done) { $set = $s3->getBucket(S3_BUCKET_PICTURES, null, $marker, null); if (sizeof($set) > 0) { $pictures = array_merge($pictures, $set); $marker = end(array_keys($pictures)); } else $done = true; } ?> fletcher fucked around with this message at 23:06 on Apr 12, 2008 |
|
# ? Apr 12, 2008 21:53 |
|
Perhaps you guys can give me some advice on the following system I want to build. I'm not really looking for coding advice just your thoughts on what approach to take. I'm building everything on a PHP5 & MySQL5 platform. So sprocs are an option and I have experience with them. I want to make a small community website where each individual user can can have their own personal page. The users can edit their own personal page to their liking with some javascript colorpicking scripts. I figured I could do it in a few ways:
Options 1 and 2 create a heavier load in terms of disk i/o. Options 3 and 4 create more constant database queries (disk i/o and processing) Options 3 and 4 seem the most viable to me. I'm expecting around 250 concurrent users daily during normal business hours. When people navigate to eachothers pages the colorpicks of the page they are visiting need to be loaded not their own! So what method would you guys pick? Is there another way of going about this? Recommendations are very welcome!
|
# ? Apr 12, 2008 23:07 |
|
Jahuran posted:flat files Use a database, we just had this nonsense on the last page. Also use something like memcached to speed up the database stuff.
|
# ? Apr 13, 2008 00:13 |
|
Jahuran posted:I figured I could do it in a few ways: Standish fucked around with this message at 11:56 on Apr 13, 2008 |
# ? Apr 13, 2008 11:47 |
|
Standish posted:Stuff Sewer Adventure posted:Stuff Thanks guys
|
# ? Apr 13, 2008 14:30 |
|
Sewer Adventure posted:Either way, not using an ORM is just making more work for yourself. How do these ORMs work on master-slave setups? We need to get a new version of our site up quick, and ORMs enable us to do it.
|
# ? Apr 13, 2008 15:27 |
|
Does anyone here have have experience using jpGraph? I'm having trouble with a graph of mine. It seems whenever you try to display the values of an accumulated bar graph rotated at 90 degrees, the labels get printed a few pixels higher than they are supposed to be. here is an example: http://xs226.xs.to/xs226/08156/list_graph473.png Here is the code for that particular graph: code:
|
# ? Apr 13, 2008 19:32 |
|
I'm looking to stop image leeching on my server by using a fancypants URL hiding script. I have images on a few different image servers and I am looking to hide the URL of them by doing something like the SA's attachment.php image output script where showimage.php outputs the image data and showimage.php checks whether it's pulling the file from one of my scripts, if it's true - it outputs the image data. [index.php] <img src="showimage.php?server=2&filename=sweet.jpg"> [/index.php] Any help or pointer towards this would be appreciated.
|
# ? Apr 14, 2008 03:32 |
Safety Shaun posted:I'm looking to stop image leeching on my server by using a fancypants URL hiding script. You will need to know how to set the header of a document to let it know you will be outputting image data. You will need to pass something into the script, maybe a md5sum of a salted filename, like: http://domain.com?script.php?id=9e107d9d372bb6826bd81d3542a419d6 script.php gets that id input using $_GET['id']. Using that, do whatever you need to do in the script to get back to a filename. Set the header and output the appropriate file. fletcher fucked around with this message at 04:25 on Apr 14, 2008 |
|
# ? Apr 14, 2008 04:22 |
|
Safety Shaun posted:Any help or pointer towards this would be appreciated. Try using mod_rewrite instead. Much easier and less server load. http://isnoop.net/dev/mod_rewrite.php
|
# ? Apr 14, 2008 04:50 |
|
Safety Shaun posted:I'm looking to stop image leeching on my server by using a fancypants URL hiding script. The easiest is just to check the Referrer header with mod_rewrite and redirect the user to a 404 page if it's not your site. However some browsers/proxy servers don't send the Referrer header 100% of the time so its presence or absence alone is not enough - the best and easiest thing to do here is to only let the image be displayed if the Referrer header is present and points at your site, OR isn't present at all. I believe this is what Waffleimages does. A more accurate solution would be to set a cookie when someone visits your site, and then check for the presence of that cookie when serving the images. Anyone leeching won't have the cookie and thus won't get the image. This can probably be done with mod_rewrite (but I don't know for sure). If not then use a PHP script to check for it. If the cookie is present, then just do: php:<? header('Content-type: image/jpeg'); $path_to_file = $_GET['file_name']; ... //validate and sanitize $path_to_file here http_send_file($path_to_file); exit; ?>
|
# ? Apr 14, 2008 04:56 |
|
How do I get the data of say, http://55.55.55.55/image.jpg or http://myimageserver.com/image.jpg into $imagedata?php:<?php ob_start(); $imagedata = how_do_i_get_data("http://blah.com/image.jpg"); $length = strlen($imagedata); header('Last-Modified: '.date('r')); header('Accept-Ranges: bytes'); header('Content-Length: '.$length); header('Content-Type: image/jpeg'); print($imagedata); ob_end_flush(); ?>
|
# ? Apr 14, 2008 04:58 |
|
Safety Shaun posted:How do I get the data of say, http://55.55.55.55/image.jpg or http://myimageserver.com/image.jpg into $imagedata? php:<?php $ch = curl_init("http://myimageserver.com/image.jpg"); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $imagedata = curl_exec($ch); curl_close($ch); ?>
|
# ? Apr 14, 2008 09:27 |
|
Standish posted:Use the cURL http library: if cURL isn't enabled, use file_get_contents: php:<?php $file = file_get_contents( 'http://path/.jpg' ); header( 'Content-Type: image/jpeg' ); echo $file; ?>
|
# ? Apr 14, 2008 16:27 |
|
LOL AND OATES posted:if cURL isn't enabled, use file_get_contents: Thank you. For my purposes and level of PHP, this works perfect. I am now streaming images from my site from multiple servers seamlessly, whilst hiding the IP of the servers.
|
# ? Apr 14, 2008 21:59 |
|
LOL AND OATES posted:if cURL isn't enabled, use file_get_contents: Or just readfile it: code:
|
# ? Apr 14, 2008 22:27 |
|
Inquisitus posted:Or just readfile it: code:
|
# ? Apr 14, 2008 23:08 |
|
|
# ? May 16, 2024 19:04 |
|
gibbed posted:Edit: wait why the hell did you put a \r\n in the header() call? Looks like a force of habit from Perl
|
# ? Apr 15, 2008 00:06 |