Jump to content

gizmola

Administrators
  • Posts

    5,945
  • Joined

  • Last visited

  • Days Won

    145

Everything posted by gizmola

  1. What would the point of that be? If the $department has no value you will not find any rows, so there is no point in doing the query. You should simply check for that and bypass the query altogether. If you really want to search for NULL (which should be avoided in my opinion) then the clause required is WHERE column IS NULL, so at minimum the string passed would probably need to be 'department IS NULL' rather than your array with bind variable.
  2. You can use ssh to connect to the remote machine and execute a command. For example: ssh david@myhost.com 'ls -lath' You can call this command using the PHP backtick techniqe to exec it in a shell and capture the output into a variable, assuming that is necessary, or you can simply exec() it. Some details you will probably need to figure out -- what windows compatible ssh will you utilize? Putty is frequently used. It will need to be in the path possibly. You wlll have to setup key files on the hosts so that you can authenticate without having to utilize a password.
  3. Look into m3u files if you want to offer streaming of the mp3 files. You need to configure your webserver to provide the correct mime type for files of that extension. There's some nice nuts and bolts information on a variety of formats here: http://www.spartanicus.utvinternet.ie/streaming.htm
  4. Did you read my post carefully? I outlined the technique you need. Read this page carefully ---- http://us.php.net/manual/en/function.readfile.php
  5. I gave you the answer already. Why are you arguing with people when you should be reading up on amfphp and how to use it.
  6. You might check that your version of the framework is current and not mixed. There was some additions made to that area of the framework after version 1.85 or so.
  7. Wilburt, I wrote a summary of what I consider the top 3 PHP based frameworks by popularity: http://www.phpfreaks.com/forums/index.php/topic,239122.msg1114857.html#msg1114857 From the way you've described your needs, my gut instinct is that you will find the Zend framework to be the easiest to get into, and the most like a library that you can pick and choose from. It does have a full MVC, and all the components you're used to using, only in the PHP style. You also might take a look at using phpEclipse, which is a nice free PHP Ide built on top of eclipse. If you already know eclipse to a degree, you can hit the ground running with that.
  8. franklos, First off, of course you can continue to ask questions, that's the reason phpFreaks exists! In looking at your delete code, it is basic, but looks about right to me. I'm not 100% sure what's in your connections.php at this point, but it needs to make a mysql connection, and it looks to me like that connection may not be available when you actually do the query. You should check the result of the mysql_query() function and if it fails, you should return the mysql_error() so you can see what's going on.
  9. They are two entirely different things. ACL is designed to restrict access to areas by group permission level. Session is a generic facility. In Zend's case it's a fairly minimal wrapper around the basic PHP session capability. Of course sessions are designed for you to persist information about a user across HTTP requests. In other words, the ACL is specifically designed for you to secure your site, whereas session is a generic facility for storing session state - which typically includes a lot more data than what is needed for authentication and security.
  10. I should probably add this to my signature http://www.gizmola.com/blog/archives/51-Exploring-Mysql-CURDATE-and-NOW.-The-same-but-different..html
  11. Having libraries installed in PEAR is fine, but the Pear library must be in the php include path. Only you can determine if the include path has been set so that the scripts can be found. You can set the include path in the php.ini file, or if you don't have access to that on your server, you can set it programatically using ini_set(). In the php.ini -> check include_path= In a script set it with -> ini_set('include_path', '.: etc');
  12. The simplest tool to do stress testing is apache bench which comes with apache. You can set it to call a url using any number of times with any number of seperate processes. For something more complicated, I have seen people develope automated web test scripts using Ruby Watir and Selenium. There are sophisticated automated testing products out there, but of course many of them cost big bucks.
  13. First off PHP has page scope. That is to say that scripts run, variables are created and when the script finishes everything is disposed of. Inside a script you can have functions and classes defined. All variables inside a function or class have local scope. Additionally variables declared in page scope (globally) are not visible inside class methods or functions. To use a global you would have to actually declare it as such inside a function, which would then allow the function to access the global variable's value.
  14. Set up the path in a string first, then pass the string to the include statement.
  15. There are several settings that limit this, in the php.ini and the apache server itself. These are covered here: http://us3.php.net/manual/en/features.file-upload.common-pitfalls.php. One or both may be limiting your file size.
  16. So to interpret what you mean, you are using built-in HTTP or "realms" authentication. This page should help you: http://us.php.net/features.http-auth One issue with this form of authentication is that there is essentially no way to log out a user once they are authenticated. The user literally needs to close the browser to clear the credentials. They are sent in the HTTP header with every request, so they also aren't the best, since anyone sniffing even one HTTP request will see the credentials.
  17. The best way is to write a delivery script in php. All the .pdf files should be stored outside of the webroot. Your delivery script should accept a variable like the filename to download. It will then get the script from it's directory using one of the file opening techniques and return the contents. You do need the script to return the proper mime header for a .pdf using the Header() function. Because this is a script opening the file and returning it, the script can do a check first to insure the user has logged in. I won't cover that, but typically it is handled through the use of php sessions. You can set a session variable that the delivery script checks at the top, and it will give the user an error if they're not logged in, or redirect them to the login page.
  18. Certainly it can, but your question doesn't really have enough details. First off, flash runs in the browser, so any php script has completed running by the time flash starts working. If you want to have flash communicate with a php script and do something with that back on the server, you can certainly accomplish this. One of the most utilized methods these days is to use amfphp. http://www.amfphp.org/
  19. FYI if you want the answer, for what was going on, your test script worked exactly as expected. PHP is somewhat odd, in that what the global keyword does is say -- reference the "global variable of this name" in the function rather than make a new local variable. So you set the variable in the global scope at the top, in in the one function you declare the global and echo it. It displays of course. In the other you don't and you get no echo. This is exactly what global does, and why it's a bad idea and a mess that produces spaghetti. Once you start using it, you might as well have one big gigantic script with no functions at all.
  20. I'm with Thorpe. I was referring to the version you posted where you used the Constants for the connection details, and defined the two functions. Please go back to that, as it is the most sensible code you've posted, and very close to working. Globals aren't going to make things better at this point.
  21. Actually, that would not be needed, because the property of a mysql timestamp column is that when the row is created, mysql sets the value to be the same as the server time ie. the unix time. So you don't need to write a single line of code --- mysql will do this for you. You can think if it as a built in insert/update trigger that runs inside mysql.
  22. This is the 2nd time today I've posted this link, but I think you'll find it very relevant: http://www.gizmola.com/blog/archives/51-Exploring-Mysql-CURDATE-and-NOW.-The-same-but-different..html
  23. The last version of your code was close but missing a key detail: Function dbConnect() you make a variable $connection but you never pass this variable back using: return $connection; In the viewSpecialsUi function you need to call the function like so: $connection = dbConnect(); Try this. If it does not work, then in the dbConnect() function do the return like this: return &$connection;
  24. allworknoplay's answer is correct if we assume that phpBB gives us all the tables needed. I don't have a version of phpbb3 to look at at the moment, but in phpbb2, there's a key ingredient missing. phpbb2 does have a table that could be joined to _users called _user_group that has a row created whenever a user is added to a group, however it does not have a datetime column. You could probably safely modify this table to add a timestamp column (this assumes you're using mysql database). In mysql when you have a timestamp column, it will be set to the current date/time when that row is created. Theoretically adding a column called "created" of type "timestamp" using the Alter table syntax will not have any effect on the functionality of phpbb, and would then give you what you needed. Your SQL statement would then need to join the two tables together, but everything else will work. Of course since none of your existing members will have those rows, you will need to fill those with a value to start with, however new people that are added to the group should automagically get the timestamp value set when the row is added.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.