Php Function Equivalent For UNIX 'pwd' Command
Is there a function, or any roundabout way to get the current directory
other than using an exec or system to just run pwd?
View Complete Forum Thread with Replies
Related Forum Messages:
Unix/Linux Command Question
I'm trying to incorporate the following UNIX (I think) command in a PHP script. unzip -P password /home/xxx/public_html/dir/file.zip -d /home/xxx/public_html/dir/targetdir What do I use to do that?
View Replies !
PHP Equivalent To The Asp Function GetClientUsername
I'm making a site running mainly on a intranet with all NT machines on it.. Every user has his own username of course, and i would like to make a poll system which only let persons vote once, just logging the IP or placing a cookie won't really work, because every computer keeps getting other users (still with the same ip though). Personally i think that getting the clientusername would be the easiest, but i just don't know how to do that in php.
View Replies !
PHP Equivalent Of TCL Command "subst"?
I need to find a PHP equivalent to a very familiar TCL command "subst" (see http://www.hume.com/html84/mann/subst.html ). This command will take a string and evaluate anything TCL inside of it and return values. for example, if this were my line: [TCL] set word {World} set line {Hello #word#} regsub -all {#([^#]+)#} $line {$$1} line return [subst $line] [/TCL] My return should be Hello World and not Hello #word# Nor Hello $word Because of a requirement for my app I am having to do the same kind of substitution variation, however, I am having to do it entirely in PHP. I don't know of any PHP manual operated command close to TCL's subst() but I'm open to the idea. Here is my class method that fails to do so: Code: ( php )
View Replies !
Replace Command/function
is there a code/command/function that can be used in a form scenario, for instance when the submit button is pressed it does the normal get the post and upload onto database but for a certain fieldname it checks it and turns al the spaces into something else? is this possible? if so what is the code for it?
View Replies !
Tracert :: Passing Command To Command Prompt Via Exec
I want to execute a "tracert" command in the command prompt via php (using windows) I've managed to use passthru() to open the command prompt (but it doesn't allow me to use it) and when I close it, it outputs the command prompt output in the browser. I don't mind whether the result is passed back to the browser to stays in the command prompt window (but that would use exec() I would think). So how can I tell the command prompt that launches to execute the line tracert 192.190.201.273 So far my experimental code is: <?php passthru("c:windowssystem32cmd.exe"); ?> EDIT: my backslashes have been stripped from the path, but you know what I mean!
View Replies !
Equivalent Of PS In PHP?
I am looking for classes/modules in PHP that can give me output similar to the output of unix command "ps". Additionally, are there classes/modules that can kill processes based on process IDs? Though I can execute a system command, I do not have a consistent method that will work across platforms like Linux, SunOS, AIX, HP-UX and Windows* and was hoping that PHP will help reduce complexity.
View Replies !
Clearerr() Equivalent In PHP?
Does PHP have a clearerr() equivalent for file streams ? It allows to do things such as "tail -f", by resetting the error status and dozing for few seconds. I didn't see any equivalents in the function list (www.php.net) void clearerr( FILE *stream); The function clearerr clears the end-of-file and error indicators for the stream pointed to by stream.
View Replies !
PHP Equivalent Of ASP Code
Im trying to duplicate this ASP code in PHP. Basically its a form of 10 records pulled from an MySQL table. The form lets the user update all 10 records at once if they want to. Each text box I name using the ID of the database record and the Database Field. Example: 3|Name (3 is the ID and Name is the database field) When the form is submitted this code is run: for x = 1 to request.form.count() if request.form.key(x) <> "Submit" then curFld = request.form.key(x) aryCats = split(curFld, "|") ID = aryCats(1) Field = aryCats(2) Data = request.form(curFld) strSQL = "UPDATE " & Table & " Set " & Field & "= '" & Data "' WHERE ID = " & ID 'response.write strSQL conn.execute strSQL end if next The code loops thru all the objects on the form. It takes each object name and splits it into an array using the | in the object name. Is there anything in PHP that will count the number of objects on a form and let you loop thu them like this script?
View Replies !
JSP Equivalent To PHP $_SERVER?
I looked up System.getProperties, but to be honest, I have no clue how to use it in light of what I can do in PHP, which is this: <?php echo $_SERVER['HTTP_USER_AGENT'] . ' ' . $_SERVER['SERVER_URI']; ?> it would be very nice to find the JSP equivalent of <? phpinfo(); ?> (anyone know who knows both PHP and JSP?) but until then, what on earth do I do?
View Replies !
PHP Equivalent To ASP Instr()
I've got a list of emails: doug@doug.com,mary@mary.com,rich@rich.com... I want to test if an email is already in the list, to prevent double entries. So I would like to test to see if doug@doug.com is already there. I have tried using the strstr function, but this just returns the position of the first needle.
View Replies !
[PHP 4.4.6] BerkeleyDB Or Equivalent?
If possible, I'd like to use a file-based, simpler alternative to MySQL such as BerkeleyDB to manage a two-column database (phone number -name), but I'm not sure my hoster supports this kind of thing: --------------- Configure Command ./configure --with-mysql=/usr/local/mysql --with-config-file-path=/opt3/local/apache/conf --with-gd --enable-gd-native-ttf --enable-gd-imgstrttf --with-jpeg-dir=/usr/local --with-ttf=/usr --with-freetype-dir=/usr/local --with-zlib-dir=/usr/local --with-zlib=/usr/local --with-imap=/usr/local/imap-2006g --with-imap-ssl=/usr/local/ssl --without-kerberos --with-dom=/usr/local --with-sablot=/usr/local --enable-xslt --with-xslt-sablot --with-png-dir=/usr/local --with-pdflib=/usr/local --with-curl=/usr/local/ --with-mcrypt=/usr/local --with-ming=/usr/local --with-gettext=/usr/local --with-apxs=/opt3/local/apache/bin/apxs --enable-track-vars --with-regex=system --with-pear --enable-ftp --enable-bcmath --enable-mbstring --enable-exif --enable-calendar --enable-memory-limit --enable-trans-sid --enable-libgcc --enable-inline-optimization --disable-debug Apache Loaded Modules mod_php4, mod_setenvif, mod_so, mod_headers, mod_expires, mod_proxy, mod_auth, mod_access, mod_rewrite, mod_alias, mod_speling, mod_actions, mod_imap, mod_asis, mod_cgi, mod_dir, mod_autoindex, mod_include, mod_info, mod_status, mod_negotiation, mod_mime, mod_mime_magic, mod_log_config, mod_env, http_core ---------------
View Replies !
Php Equivalent Of Global.asa?
In asp I used a global.asa file to open up database connections, record details about the number of people on the site, where they came from and some other stuff (affiliate ids etc). What is the closed thing to this in php?
View Replies !
Tuples Equivalent
What's the equivalent to Pythons Tuples in PHP? i.e Code: tuple = {'a': [Ƈ', ƈ', Ɖ'], 'b': [Ɗ', Ƌ', ƌ']}
View Replies !
PHP Equivalent Of Grep
I need to write a script that will parse through several non-static documents on my server and print out all of the URLs on those documents to a single page. Is there a PHP equivalent of *nix "grep" that I can use to locate lines with "http://" in them?
View Replies !
Equivalent For File_get_contents
I'm running the final tests on my script, and I ran an install on my older server(php 4.2.2), and where I'm checking a remote server for an update, it's failing: Quote: Fatal error: Call to undefined function: file_get_contents() in /path/to/automonial/admin/index.php on line 956 I would like to allow versions of php < 4.3.0 to be able to check for updates. Is it possible? If it's not possible, How could I get the script to detect that their php won't handle the request, and thus not perform it?
View Replies !
TIMESTAMP Equivalent
I need a timestamp equivalent of this: $result = mysql_query("SELECT COUNT(*) AS unique_members FROM users WHERE last_login > DATE_SUB(now(), interval 1 day)"); The last_login field IS in TIMESTAMP format. However, I want to use that for another field (signup_date) which is in DATETIME format. I can't convert the DATETIME field.
View Replies !
ASP AdRotator Equivalent
Is there a equivalent in PHP for the ASP AdRotator? Basically I want to be able to show 3 different includes at specific time percentages. For example, each of the 3 includes 33.33% of the time each.
View Replies !
Sendmail.asp Equivalent
I'm looking for a simple php code I can use for webforms to submit information submitted via email. I have usually used sendmail.asp in the past, keeping the script in one place and just calling on it on my server whenever I needed a form. Im hoping I can figure out something equivalent to that.
View Replies !
PHP Weather Equivalent
I would like to add weather information on a site. I do not want to use Weather Channel , Yahoo etc. but rather translate the metar reports. I would use PHP Weather that seems to do exactly what I need that is decoding metar ALSO for international cities. Apparently though the project has been abandoned and I tried to install the program with no success.
View Replies !
Equivalent To <jsp:param>
In JSP, I can pass parameter to an included page as follows: <jsp:include page="page_include.jsp" flush="true"> <jsp:param name="buttonClicked" value="<%=submitBtn%>" /> <jsp:param name="navigation" value="<%=nav%>" /> </jsp:include> Is there an equivalent in PHP? (I'm not talking about a simple include--require_once() and others--I mean, passing a param while including).
View Replies !
Is There A PHP Equivalent Of Server.Transfer (in ASP.NET)
I've only been at PHP for a couple of days, and I'm trying to get some stuff done as fast as possible. I'm an experienced ASP.NET programmer, and am trying to find some equivalent stuff in PHP. In ASP.NET there is a method called Server.Transfer which transfers the request to a different page from the one that the user requested, but without doing a redirect. The user gets sent headers as though they were seeing the page they requested. Does PHP have such a function? I have seen the function... header('Location: page.php'); ....but these seems to be a redirect, which is not the same thing. I don't want the headers altered as I want the search engines to see the page with the original URL.
View Replies !
Php Equivalent To Perl's || Behavior?
one feature of perl I'm desparately missing in php is using || to assign the first non-empty value in a list to a variable. For example, # perl example 1 $a = 1; $b = 2; $c = $a || $b; print $c; # displays 1 # perl example 2 $a = 1; $b = 2; $c = $d || $b; print $c; # displays 2, since $d is empty # perl example 3 $a = 'apple' $b = 'banana' $c = 'cherry' $d = $a || $b || $c; print $d; # displays 'apple' # perl example 4 $a = '' $b = '' $c = 'cherry' $d = $a || $b || $c; print $d; # displays 'cherry' This is such a handy language construct. Is there any such php equivalent that accomplishes this? I've already written a function to do it. (Like this: $d = value($a, $b, $c). But making value() visible everywhere is something I'd rather avoid if there's something built-in to php.)
View Replies !
PHP Equivalent Of MySQL STR_TO_DATE()?
I have an application where I would like to be able to allow the user to specify the date format used throughout the program (for internationalization). Then, on a date entry field, I can specify the date format on a MySQL SELECT to get the date in the proper format. The Javascript date selector I am using allows me to specify the format for selecting the date. Where I am having problems is posting the date back to MySQL. If I was using v4 of MySQL, I could use STR_TO_DATE(). However, I need to be able to support version 3 of MySQL, so I need a PHP equivalent to convert the date in the user-defined format to the MySQL date format. I can use date() to get a timestamp into the proper format, but how do I get the user-defined format into a timestamp? strtotime() was the closest I could find, but that doesn't look like it is going to work for any format.
View Replies !
Array_pop Equivalent For SESSION
I understand how array_push() and array_pop() work on simple arrays, but I need something like this to manage $_SESSION arrays. So far, the best I can come up with is using unset() unset($_SESSION[$key]); But, I would like to use the push/pop functionality for $_SESSION arrays. I guess it is as easy as writing my own function to simulate it, but it would be nice to harness this power if it already exists in a predefined function. I scoured the us.php.net website, and to no avail. Sessions don't seem to be equipped with this. Or, perhaps I am doing it wrong.
View Replies !
Equivalent Of Mysql Aes_decrypt
I am using AES_DECRYPT and AES_DECRYPT to store my datat in mysql databases. I want to be able to download these as csv files and have a php script decrypt them. I can use bin2hex to convert to text , but I cant figure out how to decrypt the hex to plaintext using php? I hv tried this without success, as AES is not recognized. $input = 'some encrypted data in hexadecimal' $len = strlen ( $input ); $input = pack("H" . $len, $input ); $td = mcrypt_module_open( 'AES' , '', 'ecb', ''); $iv = mcrypt_create_iv (mcrypt_enc_get_iv_size($td), MCRYPT_RAND ); mcrypt_generic_init($td, $key, $iv); $decrypted = mdecrypt_generic($td, $input );
View Replies !
PEAR DB Equivalent To Mysql_select_db()?
I'm connecting to a MySQL database via PEAR DB abstraction. Within the MySQL database there are multiple databases. I can connect and do everything I need to do to ONE database, but I need to grab some entries from another one. Is there a way to switch around databases with (like the function mysql_select_db())? If the above doesn't work, can I just create a second connection to the database? I tried this but couldn't get it to work for some reason.
View Replies !
Postgres Equivalent For Mysql_insert_id()
I have a database class that I use which encapsulates some database functions for mysql. I'm trying to make a new class that uses postgres and I'm having trouble understanding what to do about this line: Code: $this->insert_id = @mysql_insert_id($this->connection_id);.
View Replies !
Simple Mod_rewrite Equivalent
I've got a site which is visible with three different domain names that I'd like to consolidate into one. Unfortunately, I've got a bug with mod_rewrite on the server, so I'm looking for a way with PHP. I've done this, which appears to work, for the home page: <?php if ($_SERVER["HTTP_HOST"]!= "www.example.com") { header("HTTP/1.1 301 Moved Permanently"); header("Location: http://www.example.com/"); exit; } else {}; ?> That sorts it out for one page, but I'd like to extend it to be placed in an include on every page. Is there a way of doing that which would redirect automatically with a 301 to the same page name in each case.
View Replies !
Trying To Convert String To Decimal Equivalent
I am trying to convert a string of any given length (can include special characters such as :,/,-,.,etc...) into its decimal equivalent. I've tried all of the php functions I can find, but they all seem to deal with hex or binary. For example: h == 104 (it is ok if the function adds the html enties on h) (here is a table of the decimal equivalents http://www.neurophys.wisc.edu/www/comp/docs/ascii.html) I've tried: HexDec() bin2hex() BinDex() etc.... Can anyone tell me how to convert this value?
View Replies !
OO Java Main Method Equivalent???
So I was wondering if it is possible to have within a PHP script something equivalent to a main method as it is possible in JAVA.... For example: class myclass{ //my class's code } //Here is where I want to create a main method... or a function that gets automatically called when the script is executed... that way this "main" method would create instances of "myclass" and use them..
View Replies !
|