Jump to content

roopurt18

Staff Alumni
  • Posts

    3,746
  • Joined

  • Last visited

    Never

Everything posted by roopurt18

  1. There was another thread in which someone wanted help with a login page where I had a few replies that seemed to help them, which you can read here: http://www.phpfreaks.com/forums/index.php/topic,114046.0.html You might be able to pull some useful information out of that for your own login mechanism. As for the session trouble, session_start() needs to be the first line of your script, immediately after the <?php.  In addition, there can't be any text, including white space, before the < in <?php. I can't help you with your ODBC problem, no experience there.
  2. I was able to infer the following from your SQL query about your table structure: [b]Participants[/b] Participant_ID First_Name Last_Name [b]Event_Log[/b] Participant_ID Date Signin_Time Why don't you give the basic format of the other two tables you're talking about and then we might be able to give you a better answer.
  3. Are you positive you are using PHP 1.4.3?  Just about every distribution / installation comes with at least version 4 these days.
  4. There is support for dbase, but it's not recommended to use dbase for a production environment.  The support is there to import data from dbase into a better database engine, such as MySQL, which is what my project at work does.
  5. SELECT m.GANG, CASE WHEN SUM(b.DEPOSIT) IS NULL THEN SUM(m.CASH) ELSE ( SUM(m.CASH) + SUM(b.DEPOSIT) ) END AS total FROM USERS m LEFT JOIN BANK b ON m.USERNAME = b.USERNAME LEFT JOIN table3 t3 ON tX.field = t3.field WHERE m.LIFESTATUS='Alive' AND m.GANG!='None' AND m.GANG!='The Staff' GROUP BY m.GANG ORDER BY total DESC, m.CASH DESC I'm assuming that you want another left join.  You may very well want a cross or inner join instead depending on your needs.
  6. In Apache's httpd.conf file there is a setting for User and Group, usually those are set to nobody.  Change them to what you want them to run as and restart the server.
  7. Thanks for the response wildteen.  That was done and it was during that process that the [i]/usr/local/lib/php/extensions/no-debug-non-zts-20020429/[/i] directory was created. However I still had to go in and edit php.ini to include the DSO as an extension.  Everything works just fine now except when calling [b]finfo_open[/b] I have to pass the magic file to use, whereas on the old server I didn't.  That was the last thing I was trying to fix and I finally gave up and said, "Screw it."  I don't call it very often and I'm passing the path to the magic file as a constant defined in a central location so if I ever have to move hosts or change it, it will be a quick process.
  8. It's a regular expression.  I'm not going to pick it apart, but basically it's a pattern matching mechanism that breaks $string apart based off of what the regexp represents. Try googling for any of these: regexp regexps regular expression regular expressions
  9. As cheesier said, you're better off just storing minimal information (username or user_id) in the session and querying for it on every page.  If you don't do that, you have to remember to update variables in $_SESSION every time you allow the user to update their personal information which can become a PITA.
  10. Here's a good thread all about that: http://www.phpfreaks.com/forums/index.php/topic,114046.0.html
  11. That's because it's enclosed in single quotes. The escape characters only work inside double quotes.
  12. You can stop users from browsing directories on the site by turning off automatic indexing for that directory, either by editing httpd.conf and restarting the apache server or by putting a .htaccess file in the directory. That will only stop people from browsing directories AFAIK however, I don't believe it will stop them from accessing a document if they have the direct URL (AKA path AND filename). To do that you might have to configure, either through httpd.conf or an .htaccess file, the webserver to not serve those types of files at all.  Instead you'd need to write a script that takes some identifier unique to a file, which then opens the file, sets header information, and directly passes through the contents of the file.  I believe that would be the only way to truly secure files but still have them be servable. This is an area not well known to me, so this information is in the general ballpark at best.  Perhaps someone with more experience will post eventually!
  13. If I call finfo_open like so:   $fi = finfo_open(FILEINFO_MIME, "/usr/share/file/magic"); I receive no error.  If I leave off the second argument, I get the errors in the above post. Now, looking at http://www.php.net/finfo_open, the following applies to the second argument: [i]Name of a magic database file, usually something like /path/to/magic.mime. If not specified, MAGIC environment variable is used. If this variable is not set neither, /usr/share/misc/magic is used. .mime and/or .mgc is added if appropriate.[/i] Now I've edited .bash_profile as both root and the regular user to have the lines: [code]MAGIC=/usr/share/file/magic export MAGIC[/code] Logged everything out, went back in, and restarted the apache server.  Checking env at the command prompt reveals that MAGIC=/usr/share/file/magic.  The apache server is not running as nobody, but as the user whose .bash_profile I modified. For the life of me I can't figure out why it's not using the default value I've specified in the MAGIC environment variable. Any help?
  14. I swear I did this once before, but perhaps it was in the wrong php.ini file; mental note: make sure you edit php.ini that is displayed in phpinfo(). I added: [code]; Directory in which the loadable extensions (modules) reside. extension_dir = "/usr/local/lib/php/extensions/no-debug-non-zts-20020429/" ;[/code] Restarted the server and now phpinfo() is reporting fileinfo support. However, now I get the errors: [b]Warning: finfo_open() [function.finfo-open]: Failed to load magic database at '/usr/share/misc/magic'. in /home/webview/public_html/test/fileinfo_test.php on line 3 Warning: finfo_file(): supplied argument is not a valid file_info resource in /home/webview/public_html/test/fileinfo_test.php on line 4 Warning: finfo_close(): supplied argument is not a valid file_info resource in /home/webview/public_html/test/fileinfo_test.php on line 5[/b] Anyways, I'm sure I'll figure it out shortly, just posting in case anyone runs into the same problem in the future.
  15. I'm having a bear of a time installing the Fileinfo module. Here is my test script: [code] <?php   // fileinfo_test.php   $fi = finfo_open(FILEINFO_MIME);   echo (($out = finfo_file($fi, 'package.xml')) === false ? 'false' : $out) . "\n";   finfo_close($fi); ?> [/code] Here is the error I get: [b]Fatal error: Call to undefined function: finfo_open() in /home/webview/public_html/test/fileinfo_test.php on line 3[/b] As root: [code] > find / -name "fileinfo.so" /usr/local/lib/php/extensions/no-debug-non-zts-20020429/fileinfo.so > find / -name "php.ini" /scripts/php.ini /usr/lib/php.ini /usr/local/Zend/etc/php.ini /usr/local/cpanel/3rdparty/etc/php.ini /usr/local/cpanel/3rdparty/lib/php.ini /usr/local/lib/php.ini [/code] Now I have added into every single php.ini the following: [code] ; If you wish to have an extension loaded automatically, use the following ; syntax: ; ;  extension=modulename.extension ; ; For example, on Windows: ; ;  extension=msql.dll ; ; ... or under UNIX: ; ;  extension=msql.so ; ; Note that it should be the name of the module only; no directory information ; needs to go here.  Specify the location of the extension with the ; extension_dir directive above. mime_magic.magicfile = "/usr/share/file/magic.mime" extension=fileinfo.so [/code] I then restart the apache server and my script still fails. Any ideas?
  16. Ok, so I'm able to compile and install a new libphp4.so.  For thoroughness and anyone else in this situation in the future, here's what I did. From /usr/local/src: [code] > bash install_php.sh > cd php-4.4.4 > make > cp /usr/local/src/php-4.4.4/libs/libphp4.so /usr/local/apache/libexec/libphp4.so > /usr/sbin/apachectl restart [/code] Now loading a phpinfo() page displays the new command line options I specified.  However, it doesn't solve the original problem I had set out to solve. One of my scripts was using memory_get_usage() which is disabled if PHP is not built with the --enable-memory-limit option.  I suppose this particular installation doesn't allow that flag to be set, so I'll have to use a workaround function. I'll probably just adapt this code, posted by [i]e dot a dot schultz at gmail dot com[/i] at http://php.net/memory_get_usage: [code] <?php if( !function_exists('memory_get_usage') ) {   function memory_get_usage()   {       //If its Windows       //Tested on Win XP Pro SP2. Should work on Win 2003 Server too       //Doesn't work for 2000       //If you need it to work for 2000 look at http://us2.php.net/manual/en/function.memory-get-usage.php#54642       if ( substr(PHP_OS,0,3) == 'WIN')       {               if ( substr( PHP_OS, 0, 3 ) == 'WIN' ):               $output = array();               exec( 'tasklist /FI "PID eq ' . getmypid() . '" /FO LIST', $output );                     return preg_replace( '/[\D]/', '', $output[5] ) * 1024;                  }else       {           //We now assume the OS is UNIX           //Tested on Mac OS X 10.4.6 and Linux Red Hat Enterprise 4           //This should work on most UNIX systems           $pid = getmypid();           exec("ps -eo%mem,rss,pid | grep $pid", $output);           $output = explode("  ", $output[0]);           //rss is given in 1024 byte units           return $output[1] * 1024;       }   } } ?> [/code]
  17. I just did a search for libphp4.so and came up with: [code]/usr/local/apache/libexec/libphp4.so /usr/local/src/php-4.4.4/.libs/libphp4.so /usr/local/src/php-4.4.4/libs/libphp4.so[/code] Am I right to assume that when I do recompile PHP it will create a new libphp4.so in the /usr/local/src/php-4.4.4 area that I will need to copy over to /usr/local/apache/libexec ?
  18. I am needing to recompile PHP on my webhost, which happens to be Server Powered.  They can do it for me, but I'd rather not have to always bother them to enable a new option when compiling the PHP binary.  I have root access to my account so I can do this myself; however I only know enough about the linux OS to be dangerous but not efficient. After logging in, I change to dir / and issue the commands: [code] > find . -name "*php*.tar*" ./usr/local/cpanel/src/3rdparty/gpl/phpPgAdmin-4.0.1.tar.gz ./usr/local/cpanel/src/3rdparty/other/php-4.4.2.tar.gz ./usr/local/src/php-4.4.4.tar.gz > cd /usr/local/src > ls -l total 5456 drwxr-xr-x   3 root root    4096 Nov 19 17:12 ./ drwxr-xr-x  22 root root    4096 Oct  8 09:47 ../ -rwxr-xr-x   1 root root     885 Nov 19 17:12 install_php.sh* drwxr-xr-x  18 1000 1000    4096 Nov 19 17:17 php-4.4.4/ -rw-r--r--   1 root root 5555168 Aug 15 07:32 php-4.4.4.tar.gz > more install_php.sh cd php-4.4.4 ./configure \ --with-apxs=/usr/local/apache/bin/apxs \ --prefix=/usr/local \ --with-xml \ --with-mm \ --enable-bcmath \ --enable-calendar \ --with-curl \ --with-dom \ --with-dom-xslt \ --with-dom-exslt \ --enable-exif \ --enable-ftp \ --with-gd \ --with-jpeg-dir=/usr/local \ --with-png-dir=/usr \ --with-xpm-dir=/usr/X11R6 \ --with-gettext \ --with-imap \ --with-imap-ssl \ --with-kerberos \ --enable-mbstring \ --enable-mbstr-enc-trans \ --enable-mbregex \ --with-mcrypt \ --with-mhash \ --enable-magic-quotes \ --with-mm \ --with-mysqli \ --with-mysql=/usr \ --with-openssl \ --enable-discard-path \ --with-pear \ --with-pspell \ --enable-xslt \ --with-xslt-sablot \ --enable-sockets \ --enable-track-vars \ --with-ttf \ --with-freetype-dir=/usr \ --enable-gd-native-ttf \ --enable-versioning \ --enable-wddx \ --with-xmlrpc \ --with-zip \ --with-zlib \ --enable-dbase [/code] From this I'm gathering that if I need to edit install_php.sh to enable or disable my PHP installation.  If i then run install_php.sh, I assume it changes me into the php-4.4.4 directory and runs the configure program. From then, what do I need to do to compile and install PHP?  There already is apache (1.3 I believe) and PHP set up and running.  I'd like to just recompile PHP and stick it in the same place where it currently resides.  Can I keep my old php.ini or will a new one be created?  The webhost installed a PEAR module for me, will that still be available? I have a pretty good sense of what I'm doing up until the actual point of compiling PHP, replacing the old one, and making sure I don't lose any of the old settings. If it helps, inside my httpd.conf for the Apache server is the following: [code] LoadModule php4_module        libexec/libphp4.so AddModule mod_php4.c [/code] Thanks for any help!
  19. Why on earth did you separate it into 3 tables?
  20. You can jump in and out of HTML with <? and ?> [code] <html>   <head>   </head>   <body>     <? echo $_GET['id']; ?>   </body> </html> [/code]
  21. [code]<?php   $arr = Array();   echo $arr; ?>[/code] Will output something like: array The same thing is happening with your query.  You can't just give it an array, you have to give it the values inside the array.
  22. That reply was meant for Nicklas.  I was only saying sometimes you don't want to keep the old file hanging around, such as when you're allowing a user to edit something and replace a current image with a new one.
  23. Here's a hint on the terminology to get you started.  You're talking about creating an HTML form with check boxes for input.  I'd start here: http://www.echoecho.com/htmlforms.htm Forget about the database stuff for now, just work on creating and displaying a form with checkboxes.  Then try and set it up so you can submit it and echo the output. When you get that far, or get stuck in the process, come back to this thread and I'm sure you'll get more help. (EDIT) When I say create a form with check boxes, just disregard whats in your database or what you think the end form will look like.  Keep it simple and focus on the single task at hand: Creating an HTML form and successfully getting data from it. (EDIT #2) This might give you head start: http://www.phpfreaks.com/forums/index.php/topic,115088.msg468702.html#msg468702 Don't just copy and paste that.  Dissect it and figure out why it does what it does.
  24. It's not always possible or desirable to leave the old file intact.  Let's say you were writing an edit feature and allowing the user to replace an image, you certainly wouldn't want an old file hanging around on your webserver if it's not linked to anything in the DB.
  25. If you haven't yet got a working apache / php / mysql installation, I'd start by installing XAMPP. After ensuring the installation is working correctly, the first thing I'd try and do is create a simple HTML form.  One that has a few fields (not necessarily checkboxes) that you can enter information into.  For the form handler, just try and output what was submitted. That's the first thing I'd do in your shoes.
×
×
  • 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.