Search Results

Search found 42698 results on 1708 pages for 'php in array'.

Page 110/1708 | < Previous Page | 106 107 108 109 110 111 112 113 114 115 116 117  | Next Page >

  • PHP Redirect location with htaccess

    - by Wayne
    In one of the page I have is where administrators are allowed, however, I use if the session isn't set, the header will redirect them to index.php and that method works. If I replace index.php with home which is for the htaccess which changes it to index.php but it gives an error in the browser This works: if(!isset($_SESSION['MEMBER'])){ header("Location: index.php"); } This does not work: if(!isset($_SESSION['MEMBER'])){ header("Location: home"); } htaccess: RewriteRule ^home$ index.php The error in Firefox: The page isn't redirecting properly Firefox has detected that the server is redirecting the request for this address in a way that will never complete. This problem can sometimes be caused by disabling or refusing to accept cookies. What's wrong with it? How do I get this method to work?

    Read the article

  • PHP: include inside include

    - by Karem
    In dbc.php I have where the connection to the mysql db gets made, and all my functions is there. dbc.php is included on all my files. Now all functions are in dbc.php and i would like to sort out alittle. I was thinking about putting all form_*() functions to form_api.php, and then include it in dbc.php. But will this work? Can i just include inside a file i included? Or should i use require/include_once ? help me out thank you

    Read the article

  • php variable persistance

    - by Illes Peter
    I have two files: index.php /lib/user.php Index contains the form: <div class="<? echo $msgclass; ?>"> <? echo $msg; ?> </div> <form id="signin" action="/lib/user.php" method="post"> ... </form> User.php makes all the processing. It sets $msg to 'some error message' and $msgalert to 'error' in case of any error. At the end of processing it uses header() to redirect to index.php But after redirection $msg and $msgalert no longer persist and index only gets empty vars. How can i fix this?

    Read the article

  • (PHP)how to hold javascript alertbox on screen

    - by Piyush
    when user changes password I want to show message "Successfully changed!" and when user clicks on OK button of alert box I call logout.php and force user to login with new password.But the problem is PHP header() is not waiting for alertbox and directly goes to logout.php. my code- if($count==1) { $sqlchange="UPDATE $tbl_name SET password='$newpassword' WHERE userId='$myusername'"; unset($result); $result=mysql_query($sqlchange,$link); if($result>0) { ?> <script type="text/javascript"> alert("Your Password has been changed successfully.Please login again."); </script> <?php header("location:logout.php"); exit; } else {....

    Read the article

  • Calling C/C++ library function from PHP

    - by Anon. BlackBerry Developer
    We have a PHP web app running on a customer's machine. For an update, we have a bit of code in C that we'd like to include as a native opaque library along with the PHP web app. How does one go about calling a C/C++ lib. function from PHP? It cannot be assumed that the PHP app, called by the web server, has any sort of permission to call an exec(), eval(), or system() type of function to execute a C wrapper driver which in turn uses the C/C++ library, so it would need to be a direct C library use from within the PHP code.

    Read the article

  • Apache/PHP is determined to serve the wrong file

    - by Lucas
    I have a page that is called with a url like http://testserver/path/to/foo/bar/ but apache is serving the wrong file altogether. /path/to/ is a real directory where all the code and .htaccess file is. foo/bar/ is supposed to redirect to foo_bar.php with a RewriteRule, but it never gets there. It's not a mod_rewrite issue as I have commented out all the rules that could be interfering, which should give me 404s for that request, but the same problem occurs: the file that is served is /path/to/foo.php, so in it I var_dump $_SERVER and get: REQUEST_URI = /path/to/foo/bar/ SCRIPT_NAME = /path/to/foo.php SCRIPT_FILENAME = /real/path/to/foo.php PATH_INFO = /bar/ PATH_TRANSLATED = /real/bar/ PHP_SELF = /path/to/foo.php/bar/ Why is this request being routed to this file at all?

    Read the article

  • Easy way to combine php code (lame question)

    - by alekseygr
    Hi, I have vary easy and LAME question. I have code: <?php if (function_exists("insert_audio_player")) {insert_audio_player("[audio:|titles=]"} ?> This code outputs audio player to my page in wordpress. I need to call custom field inside this code. My custom field code is: <?php print_custom_field('tc_filename'); ?> Something like: <?php if (function_exists("insert_audio_player")) {insert_audio_player("[audio:<?php print_custom_field('tc_filename'); ?>|titles=<?php print_custom_field('tc_title'); ?>]"} ?> How can I call for second code inside first? Thx.

    Read the article

  • Does FastCGI support PHP 5.3.2 centOS?

    - by bn
    I just upgrade the PHP version in my VPS to 5.3.2 I used FastCGI and worker MPM in php 5.1.2 or 5.2.1 I forgot, it worked fine, and it was so fast, I like it. After I upgrade the PHP version, it gives me Internal Server Error 500 on all .php pages. What is wrong? does FCGI support php 5.3.2? If yes, there should be some differences in setting it up? what should I change to get it back working? Thank You

    Read the article

  • Pass value to an include file in php.

    - by Muhammad Sajid
    Hi, How do you pass a parameter into an include file? I tried the following but it doesn't work. include "myfile.php?var=123"; and in myfile.php, I try to retrieve the parameter using $_GET["var"]. include "myfile.php?var=123"; will not work. PHP searches for a file with this exact name and does not parse the parameter for that I also did this: include "http://MyGreatSite.com/myfile.php?var=123";but it does not also work. Any hints? Thanks.

    Read the article

  • Passing PHP session variable to AJAX URL

    - by user547794
    Hello, I am trying to pass a session variable into an AJAX loaded page. Here is the code I am using: jQuery(document).ready(function(){ $("#userdetail").click(function() { $.ajax({ url: "userdetail.php?id=<?php $_SESSION['uid']?>", success: function(msg){ $("#results").html(msg); } }); }); }); This is the HTML URL I had working, not sure how to get this into the AJAX call: userdetail.php?id=<?php $_SESSION['uid']?> I should also mention that if I manually pass in the userID it works fine url: "userdetail.php?id=1",

    Read the article

  • PHP and Java interoperablity

    - by Jack
    I am working on windows using tomcat 6 and PHP/Java Bridge. I know how to access a Java file from PHP but how do we do it the other way i.e accessing PHP from Java <?php require_once("java\Java.inc"); $systemInfo = new Java("java.lang.System"); print "Total seconds since January 1, 1970: ".$systemInfo->currentTimeMillis(); ?> Also how do I access Java classes that are created by me. Do I write a CLASSPATH env variable or change the php.ini config file?

    Read the article

  • php include file issue using document root

    - by nithi
    I have used the following code to get the document root. $path = get_file_dir(); function get_file_dir() { global $argv; return realpath($argv[0]); } Below code includes config.php and config.php has the $setuprun variable with a value. if((file_exists("$path/admin/config.php"))) { include_once "$path/admin/config.php"; } if($setuprun=="true") { //do some code } In my system, it takes the document root like /home/myname/myfolder and the variable $setuprun has the value and the code works perfectly. But in another user's system, it shows the following error. Notice: Undefined variable: setuprun in /usr/local/www/chat/setup.php on line 22. He is using FreeBSD 8.2 Stable with MySQL 5, PHP5 and Apache 2.2. Can anyone please help me to solve this error?

    Read the article

  • How do I loop through a SimpleXML object in PHP

    - by Aditya
    I have a simpleXml object and want to read the data from the object , I am new to PHP and dont quite know how to do this. The object details are as follows. I need to read [description] and [hours]. Thankyou. SimpleXMLElement Object ( [@attributes] = Array ( [type] = array ) [time-entry] = Array ( [0] = SimpleXMLElement Object ( [date] = 2010-01-26 [description] = TCDM1 data management: sort & upload NFP SubProducers list [hours] = 1.0 [id] = 21753865 [person-id] = 350501 [project-id] = 4287373 [todo-item-id] = SimpleXMLElement Object ( [@attributes] = Array ( [type] = integer [nil] = true ) ) ) [1] = SimpleXMLElement Object ( [date] = 2010-01-27 [description] = PDCH1: HTML [hours] = 0.25 [id] = 21782012 [person-id] = 1828493 [project-id] = 4249185 [todo-item-id] = SimpleXMLElement Object ( [@attributes] = Array ( [type] = integer [nil] = true ) ) ). Please help me. I tries a lot of stuff , but not getting the syntax right.

    Read the article

  • generate php classes in bash

    - by Derek
    i have this script: #!/bin/bash if [[ -z "$1" ]] ; then echo "Class is required" exit 1; fi if [[ -z "$2" ]] ; then package="Default" else package=$2; fi echo "<?php /** * $1.class.php * * Vcard class file. * @name Project * @author Author * @link http://www.domain.com * @copyright Copyright © 2011 * @package $package * @version 1.0 */ /** * The main $1 class * @package $package */ class $1 { /** * Constructor setup. */ public function __construct() { } /** * Destructor setup. */ public function __destruct() { } } " > $1.class.php php -l $1.class.php echo "Done"; if i do: ./generate.sh my_class it creates everything with my_class. how can i modify this to: MyClass? i need to use MyClass for the filename, and the class name etc... later in the code i use the argument (in this case my_class) for some other purposes. thanks

    Read the article

  • PHP 5.3 Namespaces should i use every PHP function with backslash?

    - by lhwparis
    Hi, im now using namespaces in PHP 5.3 now there is a fallback mechanism for functions which dont exist in the namespace. so php every time checks if the function exists in namespace and then tries to load it from global space. So what about all php internal functions? strstr for example? Should i now use every php internal function with a \ ? to avoid php first checking the namespace? is this fallback a huge performance drop? what do you think?

    Read the article

  • Format MySQL code inside PHP string

    - by JohnA
    Is there any program IDE or not that can format MySQL code inside PHP string e.g. I use PHPStorm IDE and it cannot do it. It does that for PHP and MYSQL but not for MYSQL inside php string. I am ready to use new IDE because now i have to manually format hundreds of database requests that are one line and not readable. Only criteria for my choice is that ide can do that automatically. <?php ... $request1 = "select * from tbl_admin where admin_id= {$_SESSION['admin_id']} and active= 1 order By admin_id Asc"; ... ?> should become <?php ... $request1 = "SELECT * FROM tbl_admin WHERE admin_id = {$_SESSION['admin_id']} AND active = 1 ORDER BY admin_id ASC"; ... ?>

    Read the article

  • PHP Mail Function

    - by vgathan
    Is it possible to send a mail in PHP without any external packages or tools? If so, is there any requirement to configure the php.ini file? Its as follows: $to = $row-EMail_ID; $subject = "Reset your password"; $body = "Hi ".$row->Username.", \n\t\t\tA request to reset your password was received from you. \n\n\n"; $headers = "From: [email protected]\r\n"."X-Mailer: php/"; mail($to, $subject, $body, $headers); The error i get: Warning: mail() [function.mail]: Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in F:\wamp\www\pwd.php on line 20

    Read the article

  • Using Classes / OOP in PHP

    - by Alex Demchak
    I'm pretty proficient with PHP, outside of OOP - which I am just now starting to jump in to. I've been watching videos and reading tutorials, but they are all still pretty confusing... If I have FILE 1 (class.time.php) class Time { function GetTime(){ $time = date('H:i:s'); printf($time); } } and then in a nother php page I've got FILE 2 (page.php) I can do include('class.time.php'); and then anywhere in this page I can then do $time = new Time; //Calling the class and setting the class to a variable $time->GetTime(); //This is BASICALLY saying (run the 'GetTime' function in the 'Time Class' My main question is, is the comment above (This is BASICALLY saying.....) correct? or is there a better way to think of it?

    Read the article

  • PHP Guideline required

    - by user160820
    I am interested in learning PHP, but the books that I read are in procedural style and the source code that I try to reay are also mixtures of SQL,PHP and HTML. My Background is from Java. What I want to learn is PHP really with seprate Layers. Database Layer, Controller and View but I don't want to use any Framework. I also have fried some OOP PHP books, but they not what I am lloking for. What I need is a book or any Document that develops a sample website in pure PHP but in OOP style. Any Help. Thanks a lot in advance.

    Read the article

  • Sometimes when visiting a php page, the browser asks me to download the .php file with nothing in it

    - by John
    I've noticed an unusual problem with some of my php programs. Sometimes when visiting a page like profile.edit.php, the browser throws a dialogue box asking to download profile.edit.php page. When I download it, there's nothing in the file. profile.edit.php is supposed to be a web form that edits user information. I've noticed this on some of my other php pages as well. I look in my apache error logs, but don't see any errors. How do i figure out why this is happening?

    Read the article

  • Why does this PHP program not work?

    - by oncode
    I'm new to PHP and was learning about PHP functions from w3schools. It said PHP allows a function call to be made when the function name is in a variable: This program worked <?php $v = "var_dump"; $v('foo'); ?> But this program did not work: <?php $v = "echo"; $v('foo'); ?> But if I do echo('foo'); it works. What am I doing wrong?

    Read the article

  • I want to prevent people from accessing my php pages directly using .htaccess

    - by asdasdasd
    I have a site that is made up of php pages, but they are served to the user through includes based on what I think they need. if they can guess the name of a php file, they can access those pages. while this is not a security risk at all, i would rather have a way to catch this and redirect them to somewhere else. i really want everything to go through the index page unless it is a file that exists (exeption being for any file ending with .php). I tried this, didnt work: RewriteEngine on RewriteCond %{REQUEST_URI} !(.*\.php$) [NC] RewriteCond %{REQUEST_FILENAME} !-f [NC] RewriteRule .* /n/index.php [NC]

    Read the article

  • SQL SERVER – PHP on Windows and SQL Server Training Kit

    - by pinaldave
    The PHP on Windows and SQL Server Training Kit includes a comprehensive set of technical content including demos and hands-on labs to help you understand how to build PHP applications using Windows, IIS 7.5 and SQL Server 2008 R2. This release includes the following: PHP & SQL Server Demos Integrating SQL Server Geo-Spatial with PHP SQL Server Reporting Services and PHP PHP & SQL Server Hands On Labs Introduction to Using SQL Server with PHP Using SQL Server Full-Text Search and FILESTREAM Storage with PHP New: Getting Started with SQL Server Migration Assistant for MySQL Download SQL Server PHP on Windows and SQL Server Training Kit Reference: Pinal Dave (http://blog.SQLAuthority.com) Filed under: PostADay, SQL, SQL Authority, SQL Documentation, SQL Download, SQL Query, SQL Server, SQL Tips and Tricks, T SQL, Technology

    Read the article

  • Unable to install PHP-FPM on Apache (Failed to connect to FastCGI server)

    - by Nyxynyx
    I have been having problem installing php-fpm for use with apache2-mpm-worker. This is the guide that I am following. According to the guide's Step 5, Alias /php5-fcgi /usr/lib/cgi-bin/php5-fcgi FastCgiExternalServer /usr/lib/cgi-bin/php5-fcgi -host 127.0.0.1:9000 -pass-header Authorization However I cannot find php5-fcgi at /usr/lib, but only /usr/bin/php5-cgi and /usr/bin/php-cgi, which I am not sure if they are the same. So I changed the lines in Step 5 to: Alias /php5-fcgi /usr/bin/php5-fcgi FastCgiExternalServer /usr/bin/php5-fcgi -host 127.0.0.1:9000 -pass-header On restarting Apache, it's logs gave the errors: [notice] caught SIGTERM, shutting down [alert] (4)Interrupted system call: FastCGI: read() from pipe failed (0) [alert] (4)Interrupted system call: FastCGI: the PM is shutting down, Apache seems to have disappeared - bye [notice] Apache/2.2.22 (Ubuntu) mod_fastcgi/mod_fastcgi-SNAP-0910052141 configured -- resuming normal operations [notice] FastCGI: process manager initialized (pid 16348) And on loading the index page [error] [client 10.0.2.2] (111)Connection refused: FastCGI: failed to connect to server "/usr/bin/php5-cgi": connect() failed [error] [client 10.0.2.2] FastCGI: incomplete headers (0 bytes) received from server "/usr/bin/php5-cgi" [error] [client 10.0.2.2] File does not exist: /var/www/mydomain/public/favicon.ico Question: Any idea why php5-fcgi is missing, and how should this problem be fixed? Thank you!! :)

    Read the article

  • PHP on Server 2003: Enabling PHP_APC.DLL creates Error

    - by james.527.
    When trying to enable PHP_APC.DLL, PHP crashes returning invalid access to memory location. Any ideas? I am running 5.2.12 in ISAPI mode. Here is what I have enabled extension wise: ;extension=php_bz2.dll ;extension=php_curl.dll ;extension=php_dba.dll ;extension=php_dbase.dll ;extension=php_exif.dll ;extension=php_fdf.dll extension=php_gd2.dll ;extension=php_gettext.dll ;extension=php_gmp.dll ;extension=php_ifx.dll ;extension=php_imap.dll ;extension=php_interbase.dll extension=php_ldap.dll ;extension=php_mbstring.dll extension=php_mcrypt.dll ;extension=php_mhash.dll ;extension=php_mime_magic.dll ;extension=php_ming.dll ;extension=php_msql.dll ;extension=php_mssql.dll extension=php_mysql.dll extension=php_mysqli.dll ;extension=php_oci8.dll ;extension=php_openssl.dll extension=php_pdo.dll ;extension=php_pdo_firebird.dll ;extension=php_pdo_mssql.dll extension=php_pdo_mysql.dll ;extension=php_pdo_oci.dll ;extension=php_pdo_oci8.dll ;extension=php_pdo_odbc.dll ;extension=php_pdo_pgsql.dll extension=php_pdo_sqlite.dll ;extension=php_pgsql.dll ;extension=php_pspell.dll ;extension=php_shmop.dll ;extension=php_snmp.dll ;extension=php_soap.dll ;extension=php_sockets.dll extension=php_sqlite.dll ;extension=php_sybase_ct.dll ;extension=php_tidy.dll ;extension=php_xmlrpc.dll ;extension=php_xsl.dll extension=php_zip.dll extension=php_win32service.dll ultimately i'm trying to create a PHP based uploader with a progress bar. From what I understand PHP_APC is the only way to do this. If anyone could help me stabilize PHP_APC or know of another UL with progress bar method, it would be appreciated.

    Read the article

< Previous Page | 106 107 108 109 110 111 112 113 114 115 116 117  | Next Page >