[PHP] External Function
Is it possible to put all of my functions in a text file and just call it and use the functions in it? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] External Function
Is there anyway that I can have a file (ex: functions.txt) that has all of my functions in it. And I can call that file and use the functions that are in it. If it is possible, than that would save me a load of time, thanks Cory -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Safety File
I want a file that has all of my important, global variables (like database info). I want this to be encoded by a PHP script and written. Is there any way, that I can import the file, while decoding it, so that the info is given as just lines of PHP. How can I do this? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] can't change upload_tmp_dir--not sure what's up
I am having some serious troubles uploading files to my server. The ISP cannot provide me with the tmp directory where files are stored so I am trying to change that directory to a specified one. I am editing the php.ini file to read as follows: ; File Uploads ; ; Whether to allow HTTP file uploads. file_uploads = On ; Temporary directory for HTTP uploaded files (will use system default if not ; specified). upload_tmp_dir = ./var/www/html/tmp/ ; Maximum allowed size for uploaded files. upload_max_filesize = 2M alas, when i upload a file, nothing arrives in the specified folder. All permissions are set to full access. below is the php code: Handling File Uploads \n"); print ("File size: $File_size\n"); if (copy ($File, "users/$File_name")) { print ("Your file was successfully uploaded!\n"); } else { print ("Your file could not be copied.\n"); } unlink ($File); } print ("Upload a file to the server:\n"); print ("\n"); print ("File \n"); print ("\n"); ?> any help would be immensely appreciated Thanks in advance -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] UPLOAD scripts refuse to function
ok, someone please lend me some advice here. I am trying create a upload form for my site. Sure that sounds easy right? well I have tried at least 10 different php scripts as well as a handful of cgi. Same resuls with everyone of them...nothing in my specified tmp folder. After contactig my host so many times, they know my name by voice, I have made no progress and here I sit without a very neccessary aspect of our website. Anyone have any idea on this...is there something server side that would prohibit me from executing my upload scripts? (yes chmod the folder...done) I have no problem with ANY other cgi or php script that I have used. Thanks in advance for any insight... -Cory -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] number of records
Diana, This is how I typically do this with mysql_num_rows: $sql = "SELECT * FROM sometable WHERE field LIKE '%$field%' LIMIT 0, 30 "; $result = mysql_query($sql) or die ("Error In Query:".mysql_error()); $num_results = mysql_num_rows($result); HTH! Cory On Tue, 2002-12-10 at 09:54, Diana Castillo wrote: > After I run a query lik this, > $db->query($sql); > > what is the quickest way to find out how many records result? Without having > to loop through them all? > > Thank you , > Diana > -- Cory Hicks <[EMAIL PROTECTED]> TRI-International -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] OO newb question....query results from a class
Hello! I am just getting going with OO stuff and I am stumped at how to pull out query results once it is part of a class. I am also using PEAR. Here is my code: class user { var $retval; function get_signin() { global $db_obj; $DateView = date("Y-m-d"); $sql = "SELECT date_format(sys_time_sign_in, '%h:%i %p') as sign_in FROM system_log WHERE sys_time_user_id='$_SESSION[valid_user]' AND sys_time_date='$DateView' AND sys_time_flag='ON'"; $result = $db_obj->query($sql); if (DB::isError($result)) die($result->getMessage()); while($rows = $db_obj->fetchRow($result, DB_FETCHMODE_ASSOC)) { $retval[] = $rows; } $retval = Array(); $retval['signin'] = $signin; return $retval; } } /* now to try to get at the var $retval */ $userinfo = new user(); echo $userinfo->get_signin(); It just returns "Array"? How do I, for lack of a better wordget to this array? Outside of a class it works great, I echo $rows['sign_in'] and it works. But this! Help! Many many thanks! Cory -- Cory Hicks <[EMAIL PROTECTED]> TRI-International -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] form within form
Can we see some code? Maybe we could help.. Cory On Thu, 2003-02-13 at 12:26, [EMAIL PROTECTED] wrote: > ALso, global variables are off... > > -Original Message- > From: Edward Peloke [mailto:[EMAIL PROTECTED]] > Sent: Thursday, February 13, 2003 1:22 PM > To: Php-General@Lists. Php. Net > Subject: [PHP] form within form > > > I am creating a form to allow the user to change his/her password. After > the user enters their username and old password, I need to verify that info > before they can change their user name and password. So I tried using a > form within a form but am having some problems with passing the parameters > back and forth...any new ideas would be greatly appreciated. I will fill in > all the db stuff later. > > Thanks, > Eddie > > > > > > > > > > UserName: > > > > '> > > > > > > > Password: > > > > > > > > > > > > > > > > > > New Password: > > > > > > > > > > > > Verify Password: > > > > > > > > > > > > > > > > > name=reset> > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php -- Cory Hicks <[EMAIL PROTECTED]> TRI-International -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] form within form
My bad...I see your code now. On Thu, 2003-02-13 at 12:22, [EMAIL PROTECTED] wrote: > I am creating a form to allow the user to change his/her password. After > the user enters their username and old password, I need to verify that info > before they can change their user name and password. So I tried using a > form within a form but am having some problems with passing the parameters > back and forth...any new ideas would be greatly appreciated. I will fill in > all the db stuff later. > > Thanks, > Eddie > > > > > > > > > > UserName: > > > > '> > > > > > > > Password: > > > > > > > > > > > > > > > > > > New Password: > > > > > > > > > > > > Verify Password: > > > > > > > > > > > > > > > > > name=reset> > -- Cory Hicks <[EMAIL PROTECTED]> TRI-International -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Admin Login
Ben, How about some session vars that denote you being an admin? This way you could show these options if $_SESSION[user_info] == 'Admin' is true. If you need more, let me know. Cory On Tue, 2003-06-10 at 22:12, Ben Houlton wrote: > How do I make it so when I log in the options such as delete message, edit message, > are viewable, but when someone else logs in they can't view it. Could someone guide > me to a tutorial or alike? > Thanks. -- Cory Hicks <[EMAIL PROTECTED]> TRI International -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] getting data from inside a class
Hey folks! I just posted this over on the PEAR list, but thought someone here might have some input. Can someone point me in the right direction with this little piece of code. This all works fine to get $num_rows or a single element in an array, but I need to get at all the actual elements in the arraylike $rows["sys_id"] ...how would I do this? Do I return $results[] or $rows? It seems when I have tried this, all I get returned is "Array"... Any help would be great! Thanks, Cory class user_info { var $num_rows; var $results; function get_user_info() { global $db_obj; $sql = "SELECT sys_id, sys_time_user_id, sys_time_flag, sys_time_sign_in, sys_remote_add, sys_user_agent FROM system_log WHERE sys_time_flag = 'On' ORDER BY sys_time_sign_in DESC"; $result=$db_obj->query($sql); if (DB::isError($result)) die($result->getMessage()); /* //works to return num_rows while ($rows = $result->fetchRow(DB_FETCHMODE_ASSOC)) { $this->results[] = $rows; } //$num_rows = $result->numRows(); return $num_rows; */ //works to return 1 value $rows = $result->fetchRow(DB_FETCHMODE_ASSOC); $this->results = $rows[sys_time_user_id]; return $this->results; } } -- Cory Hicks <[EMAIL PROTECTED]> TRI International -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Text from web form
Rick, Someone had mentioned doing the following: << $name = $_POST['name']; $message = $_POST['message']; at the top of your script to enable the variables. >> Or, you could try this at the top of every page: global $HTTP_POST_VARS; global $HTTP_GET_VARS; and then use: $_POST["field_name"] hth!~ Cory >>> "Rick King" <[EMAIL PROTECTED]> 09/11/02 16:29 PM >>> Apache: 1.3.26 PHP: 4.2.3 OS: HPUX-11 Hello PHP Guru's! After successfully installing PHP and viewing the phpinfo page, I decided to create a simple web-form. Just a basic "Name" "Message" web-form, when the form is complete it is emailed to an account. Everything works, except I don't see the filled in contents in the email message. I don't see the what the person filled out. But I see "Name:" ane "Message:" Any ideas? Here's my config line for installing PHP: CC=gcc ./configure --prefix=/opt/php \ --without-mysql \ (didn't have MySQL installed) --with-apxs=/opt/apache/bin/apxs Here's my config line for installing Apache: CC=gcc ./configure --prefix=/opt/apache \ --enable-module=most \ --enable-shared=max Any help would be greatly appreciated! Rick -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Who can tell me where I can get the cracked ZendEncoder3.0 ?
Be gone already! On Thu, 2002-10-31 at 09:00, jianking wrote: > Who can tell me where I can get the cracked Zend Encoder 3.0 ? > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] pear upgrade
Contents are Direct Alliance Corporation CONFIDENTIAL - PROBLEM: - I'm trying to run a pear upgrade on a sever that does not have access to the internet. - I have also tried $pear .tgz, however I don't have zlib, and I really can't bring down the server. OPTIONS: - I may have access to a proxy server. Is their a way to connect pear to a proxy, or another way to retrieve the files? - Can I just copy the pear packages (Mail, and Mime_Mail) to /usr/local/lib/php/Mail? Would this allow for the pear -l info to be undated? And could I do this to all pear packages? This message is for the designated recipient(s) only and contains Direct Alliance Corporation privileged and confidential information. If you have received it in error, please notify the sender immediately and delete the original. Any other use of this email is prohibited.
[PHP] PHP LDAP attributes question
Hello, I am having trouble returning attributes from an LDAP dir and was curious if anyone had experienced similar issues. I am able to retrieve the attributes in the $nds_stuff fine. However, once I add an attribute to the array, I can get the last attribute in the array, but not the one that comes before. For example, this returns usertier2, but not usertier. If I switch the order, I can get the last one, but not the one that comes before? Here is my code: $filter="(|(cn=" . $login_name . "*))"; //Attributes to get from NDS $nds_stuff = array("cn", "sn", "fullname", "usertier"); //doesn't work as expected //returns usertier2, but usertier is empty //$nds_stuff = array("cn", "sn", "fullname", "usertier","usertier2"); //Search for a specified filter on the directory with the scope of LDAP_SCOPE_SUBTREE $results=ldap_search($ldap, $dn, $filter, $nds_stuff); $info = ldap_get_entries($ldap, $results); //This loops Through the array for ($i=0; $i < $info["count"]; $i++) { //Declare the LDAP results as session variables $valid_user = strtolower($info[$i]["cn"][0]); $user_tier = $info[$i]["usertier"][0]; $user_tier2 = $info[$i]["usertier2"][0]; $user_fullname = $info[$i]["fullname"][0]; } //Close LDAP login array loop ldap_close($ldap); Any suggestions? Cory -- Cory Hicks <[EMAIL PROTECTED]> TRI International -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] re-creating a variable name
Hello, I'm having difficulty dynamically creating a variable name for mysql_query. I've tried using variable variables. I tried to re-create the sql string by $a = "update table set startdate='$startdate" $a .= $i ." ' where id=$i"); but that didn't work. I'm dynamically creating each name of the input tag. My input tag is: name=startdate but when I use $query = mysql_query("select * from table"); $num_rows = mysql_num_rows($query); for($i=1;$i<=$num_rows;$i++){ $updatesql = mysql_query("update table set startdate='$startdate.=$i' where id=$i"); } It doesn't execute. Can someone tell me what I'm doing wrong. Any help would be greatly appreciated. Thanks Cory -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] re-creating a variable name
I could try and explain my problem again but it would be easier if I just include the code. Because $FormStartDate1 is the name of the variable, I'm trying to recreate the name of the variable with the for loop after "edit" is submitted. Thanks again. Cory "Chris W. Parker" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] Cory Berry <mailto:[EMAIL PROTECTED]> on Friday, March 05, 2004 11:29 AM said: > Hello, I'm having difficulty dynamically creating a variable name for > mysql_query. [snip] > It doesn't execute. > Can someone tell me what I'm doing wrong. Any help would be greatly > appreciated. ?? i have no idea what you are saying. care to reword your post? chris. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Possibly undocumented operators.
The PHP manual does not document the operators () -> What is the relative precedence and associativity of each? I've looked in the archives, and I've found some butter, more complete precedence tables, but they appear to be outdated. Where can I find a complete and accurate operator precedence table? CW -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] ftp functions not working
I am writing some backup scripts that will ftp my *.gz files to my ftp server. Unfortunately I didn't originally install php with ftp support (oversight on my part). I reconfigured/installed PHP with --enable-ftp and restarted everything, but the functions still don't work. #!/usr/local/bin/php output when ran: 'Damn' During the make I didn't see any errors. When I ran phpinfo() [http://www.randomthoughtprocess.com/info.php] it shows that I have FTP support. Is there something that I am missing? -- Cory Wiles Systems Engineer ePerformax - Memphis, TN 901.751.4902 http://www.eperformax.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] ftp functions not working
Marek Kilimajer wrote: Cory D. Wiles wrote: I am writing some backup scripts that will ftp my *.gz files to my ftp server. Unfortunately I didn't originally install php with ftp support (oversight on my part). I reconfigured/installed PHP with --enable-ftp and restarted everything, but the functions still don't work. #!/usr/local/bin/php output when ran: 'Damn' During the make I didn't see any errors. When I ran phpinfo() [http://www.randomthoughtprocess.com/info.php] it shows that I have FTP support. Is there something that I am missing? Did you install php cli binary? Is it installed in /usr/local/bin? Check the build date (/usr/local/bin/php -i | grep "Build Date"). I did install the php cli binary. It is in /usr/local/bin. Build Date => Jun 30 2004 22:27:26 -- Cory Wiles Systems Engineer ePerformax - Memphis, TN 901.751.4902 http://www.eperformax.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] ftp functions not working
Michal Migurski wrote: #!/usr/local/bin/php output when ran: 'Damn' During the make I didn't see any errors. When I ran phpinfo() [http://www.randomthoughtprocess.com/info.php] it shows that I have FTP support. Is there something that I am missing? The version of PHP you're running on the command-line may or may not be the same installation as the one used by Apache. Use the following to see what your CLI installation does or does not have enabled: php -r "phpinfo();" shell>$php -r "phpinfo();" | grep ftp Registered PHP Streams => php, http, ftp, compress.zlib shell>$ I looked at the complete output and did not see that anything else for FTP. What do I need to do add FTP support for the CLI? michal migurski- contact info and pgp key: sf/ca http://mike.teczno.com/contact.html -- Cory Wiles Systems Engineer ePerformax - Memphis, TN 901.751.4902 http://www.eperformax.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] ftp functions not working
I figured out why that it wasn't working. My prefix isn't the standard default prefix. I put php in /usr/local/apache/php. Though my script calls for /usr/local/bin/php...that php binary was copied there from the previous installation. Therefore, when I recompiled it was still using the 'old' binary. I should have created a symbolic link to the /usr/local/apache/php/bin/php file and this wouldn't have happened. Thanks for the quick repsonse. Marek Kilimajer wrote: Cory D. Wiles wrote: I am writing some backup scripts that will ftp my *.gz files to my ftp server. Unfortunately I didn't originally install php with ftp support (oversight on my part). I reconfigured/installed PHP with --enable-ftp and restarted everything, but the functions still don't work. #!/usr/local/bin/php output when ran: 'Damn' During the make I didn't see any errors. When I ran phpinfo() [http://www.randomthoughtprocess.com/info.php] it shows that I have FTP support. Is there something that I am missing? Did you install php cli binary? Is it installed in /usr/local/bin? Check the build date (/usr/local/bin/php -i | grep "Build Date"). -- Cory Wiles Systems Engineer ePerformax - Memphis, TN 901.751.4902 http://www.eperformax.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: [PHP-WIN] i need help
Assuming you are doing just one string at a time: $regex = "/(\[i:)(\w+)(\])/i"; preg_match($regex, $str, $matches); print $str;//original string print substr($matches[2], 1, 3);//trimmed string ?> Gryffyn, Trevor wrote: If the format is consistantly the same, try this: $somedata = "[i:aslkdfj]"; $insidedata = substr($somedata,3,strlen($somedata)-4); -TG -Original Message- From: Student [mailto:[EMAIL PROTECTED] Sent: Monday, May 17, 2004 11:42 PM To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: [PHP-WIN] i need help Hi i was hoping if someone can help; I want to trim the following text [i:abcdef] but the inside text is different at time eg abcdef, bcdefg, etc etc how can i trim [i:(some text here)] so that i can replace them with nothing. eg these are to be trimmed. [i:abcdef] [i:bcdefg] [i:xyzab] [i:priftds] how can i trim them.. thanks -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php