Search Results

Search found 31819 results on 1273 pages for 'sphinx php'.

Page 124/1273 | < Previous Page | 120 121 122 123 124 125 126 127 128 129 130 131  | Next Page >

  • Hide header if node body is empty - Drupal php snippet help

    - by Toxid
    Hello! I've made a content type for links, I'm trying to make a link directory. People only have to submit the link, description is voluntary. If no description is entered, I want the header that says "description" to disappear. The description field is the node body. Right now my snippet looks like this <?php if (!empty($node->body)) {?> <div class="field field-type-link field-field-link-archive"> <h3>Description</h3> <?php print $node->content['body']['#value'] ?></div> <?php }?> I expect this to check if node body is not empty, and if it isn't it'll print what's there. The problem is that the Description header is still printed out even if the node body is empty. Can anyone see what's wrong?

    Read the article

  • Accessing a variable passed by jquery using php

    - by celenius
    How does php access a variable passed by JQuery? I have the following code: $.post("getLatLong.php", { latitude: 500000}, function(data){ alert("Data Loaded: " + data); }); but I don't understand how to access this value using php. I've tried $userLat=$_GET["latitude"]; and $userLat=$_GET[latitude]; and then I try to print out the value (to check that it worked) using: echo $userLat; but it does not return anything. I can't figure out how to access what is being passed to it.

    Read the article

  • Stopping and Starting Apache Using PHP (!)

    - by Abs
    Hello all, I have two problems which are related. 1) I have a batch file that contains this: net stop wampapache net start wampapache Which tries to stop and start my wamp server. When I double click the stop.bat file with the above it works successfully. When I try to run that from my PHP script, it stops the server but doesn't start it fully which I am guessing is because Apache is waiting for that PHP process to exit? function php_kill(){ exec('stop.bat', $output = array(), $return); return $return; } 2) Is there a way to restart my webserver (apache) whilst keeping session variables that PHP needs available? Thanks all

    Read the article

  • php session_start() warning

    - by Eniasharmila Karunakaran
    I'm new to php.. Im trying to get value from session. Below is my code. Set session in login page session_start(); $_SESSION["username"] = $username ; $_SESSION["password"] = $password ; $_SESSION["companycode"] = $companycode; Get the session if(! isset($_SESSION)) session_start(); $a=$_SESSION["companycode"]; echo $a; But i got the warning in my page: Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at C:\xampp\htdocs\lucent\clientlogin.php:216) in C:\xampp\htdocs\lucent\clientlogin.php on line 219 Please help. Thanks

    Read the article

  • PHP: form input field names containing square brackets like field[index]

    - by gidireich
    Hi, I've seen lot of code that handle forms, which creates input fields with names containing square brackets. I understand that this is being somehow converted to PHP arrays when a PHP script examines the $_POST variable. My questions about this: What is the mechanism behind? At which point this names that merely contain brackets are converted to arrays? Is this a feature of the HTPP protocol? Of web servers? Of the PHP language? Continuing the previous question, is this a commonly used hack or a normal programming tool? What are (all) the rules of using brackets in input field names? Can multidimensional arrays be created this way? Thanks, Gidi

    Read the article

  • Determining Terminal lines/cols via PHP CLI

    - by eFrane
    I know that it is quite easy to figure out a terminal's size parameters via the stty -a command. When using local CLI PHP scripts, there is no problem at all on grabbing that output via system() or so. But I am trying the same thing via a php script started from an ssh command. Sadly, all that stty ever returns is: stty: standard input: Invalid argument. The calling code is: exec('stty -a | head -n 1', $query); echo $query[0]; So the question is: If I can output to the terminal and read input from it (e.g. can fread() from STDIN and fwrite() to STDOUT in PHP, shouldn't stty also have valid STDIN and STDOUT?

    Read the article

  • PHP exec() hangs, Error 500

    - by MRX_II
    So, my plan is to make small thumbnails of URL's with PHP and IECapt. IECapt works well, a nice command line tool, gets the full sized image of specified URL in 1 to 4 seconds. But my problem is to execute it trough PHP. This is the code I've trying to get working: exec('IECapt.exe ' . escapeshellarg($URL) . ' ' . escapeshellarg($Filename)) $URL is of course the URL, and $filename is a simplified version of the URL. Sometimes I get the IECapt to snap the image(trough PHP), but it takes awfully long (30-60s), and in the end I always get a 500-error, with no error messages to tell me what's wrong. Both variables are fine, they work manually with commandline: IECapt http://google.com Google.png My server set-up is IIS7 and PHP5.2.9, if relevant. (Windows Vista, all on my personal computer, so full access.) Any ideas?

    Read the article

  • Twitter oauth php problems

    - by Patrick Gates
    I'm writing some backend script for a twitter app and heres how it's going On the app you click a button that sends you to login.php on my server which logs into my database connects to twitter with my consumer key and secret: $to = new TwitterOAuth($consumer_key, $consumer_secret); $tok = $to->getRequestToken(); $request_link = $to->getAuthorizeURL($tok); and then writes the token and secret to the database, sets a session equal to the id in the database of the token and secret and then redirects to the "$request_link" You then go through the process of logging in and such on twitter and it redirects you to callback.php on my server Callback.php consists of logging into the database again, getting the new token and secret, and then writing the new token and secret to the database and then prompts you to go back to the app Then on the app, all I'm trying to do is access the basic credentials$to->get('account/verify_credentials') and it keeps coming back "could not authenticate you" What am I doing wrong?? Thank you for all the help :)

    Read the article

  • php cURL POST how to follow location

    - by One Stuck Pixel
    I am in a bit of a rut with a cURL issue. The post works greate, the data is POSTED just fine and received ok, but the url of the posted page never appears in the browser after the cURL session is executed, for example look at the following code: $ch = curl_init("http://localhost/eterniti/cart-step-1.php"); curl_setopt($ch, CURLOPT_HEADER, false); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, "error=1&em=$em&fname=$fname&lname=$lname&email1=$email1&email2=$email2&code=$code&area=$area&number=$num&mobile=$mobile&address1=$address1&address2=$address2&address3=$address3&suburb=$suburb&postcode=$postcode&country=$country"); curl_exec($ch); curl_close($ch); The post works fine and I am taken to the cart-step-1.php where I can process the posted data, HOWEVER the location in the URL address bar of the browser remains that of the script page, in this case proc_xxxxxx.php Any ideas how to get the URL address to reflect the page I am actually POSTED to? Thanks a mill

    Read the article

  • Securely using exec with PHP to run ffmpeg

    - by Venkat D.
    I would like to run ffmpeg from PHP for video encoding purposes. I was thinking of using the exec or passthru commands. However, I have been warned that enabling these functions is a security risk. In the words of my support staff: The directive 'disable_functions' is used to disable any functions that allow the execution of system commands. This is for more security of the server. These PHP functions can be used to crack the server if not used properly. I'm guessing that if exec is enabled, then someone could (possibly) execute an arbitrary unix command. Does anyone know of a secure way to run ffmpeg from PHP? By the way, I'm on a dedicated server. Thanks ahead of time!

    Read the article

  • PHP pass variable after form is submitted

    - by user342391
    I have a form that posts to process.php. Process.php send all the data to mysql then returns back to the page using: <?php header("Location: /campaigns"); ?> On the page it returns to I want to display a message saying form submitted. Can I post a variable to the Location: /campaigns. And use the variable to display the message (or modal box)? and if so what would be the best way to do it?

    Read the article

  • convert Bash command to php

    - by Keverw
    This is the bash command echo -n x && (echo 618cf954-6576-491d-8ac6-a1b888c4705d |xxd -r -p |openssl base64|tr '/+' '_-') This is my php <? $uuid = "618cf954-6576-491d-8ac6-a1b888c4705d"; $voiceid = "x" . $uuid; $voiceid = base64_encode($voiceid); $voiceid = str_replace("+", "-", $voiceid); $voiceid = str_replace("/", "_", $voiceid); echo $voiceid; ?> The bash gives the right output, the php one isn't. I'm not sure what i need to do deferent in php.

    Read the article

  • How to debug PHP with netbeans and Xdebug

    - by Jon Winstanley
    I have recently tried to get going with Netbeans 6.5 after it rated so highly in the IDE review by Smashing magazine. http://www.smashingmagazine.com/2009/02/11/the-big-php-ides-test-why-use-oneand-which-to-choose/ My main reason for switching from Notepad++ is that I'd like to be able to debug my code and set through it. I have followed the instructions about how to install xdebug from both the vendor http://xdebug.org/ and the netbeans web site. http://www.netbeans.org/kb/docs/php/debugging.html#gettingReady but to no avail. How is it done, has anyone else got debugging working in netbeans? (My setup is: Windows XP, Wamp server 2.0, PHP 5, Netbeans 6.5.1)

    Read the article

  • how to get key value of array with curl (php)

    - by Vierri
    Hello I want to make use of an API but it print alot of info and i don't know how i can get a few key values of the array. <?php $query = "SELECT * FROM kvk WHERE adres='Wit-geellaan 158'"; $host = "http://api.openkvk.nl/php/"; $url = $host ."/". rawurlencode($query); $curl = curl_init(); curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($curl, CURLOPT_URL, $url); curl_setopt($curl, CURLOPT_HEADER, 0); curl_exec($curl); curl_close($curl); ?> Is my php script and it shows array(array("RESULT"=>array("TYPES"=>array("int","bigint","varchar","varchar","varchar","varchar","varchar","int","int","smallint","smallint","int"),"HEADER"=>array("id","kvk","bedrijfsnaam","adres","postcode","plaats","type","kvks","sub","bedrijfsnaam_size","adres_size","verhuisd"),"ROWS"=>array(array("1303095","271242250000","Schoonmaakbedrijf Regio","Wit-geellaan 158","2718CK","Zoetermeer","Hoofdvestiging","27124225","0","23","16","0"))))) Thanks in advance Greetings, Vierri

    Read the article

  • PHP include(): File size & performance

    - by Tom
    An inexperienced PHP question: I've got a PHP script file that I need to include on different pages lots of times in lots of places. I have the option of either breaking the included file down into several smaller files and include these on a as-needed basis... OR ... I could just keep it all together in a single PHP file. I'm wondering if there's any performance impact of using a larger vs. smaller file for include() in this context? For example, is there any performance difference between a 200KB file and a 20KB file? Thank you.

    Read the article

  • How to learn web-programming (Javascript, PHP)?

    - by metal-gear-solid
    If I'm going to learn programming first time, How i should start? I don't know programming yet but I'm good at XHTML and CSS. my main aim is to learn first Javascript than second PHP. after having good command in Javascript I'll move to PHP. all these i want to learn to get good command in all areas of Wordpress design and Development. Although i can use basic javascript, jquery, PHP scripts in my projects but know i want to learn programming concept and want to get good knowledge.

    Read the article

  • PHP PDO Username Availability Checker

    - by John Bernal
    I'm building a registration page that uses JQuery's validator plugin to validate the form. For the username, i used the remote method. So here's my jquery+html code: fiddle And here's Available.php: <?php $usr = $_POST["username"]; $link = new PDO('mysql:***;dbname=***;charset=UTF-8','***','***'); $usr_check = $link->prepare("SELECT * FROM Conference WHERE Username = :usr"); $link->bindParam(':usr', $usr); $usr_check->execute(); if($usr_check->rowCount()>0) echo "false"; else echo "true"; ?> So I have a test account in my database with the username: user. When I tried to submit my form with the same username, it didn't display the error saying "username taken" which means the php isn't correct. Any ideas where I went wrong? Thanks

    Read the article

  • PHP-friendly NoSQL solutions

    - by mattbasta
    I'm looking to use a NoSQL solution for my next project, which will be written in PHP. What choices do I have in terms of NoSQL solutions that can easily interfaced via PHP? I haven't done much thinking about the architecture yet, so I'm not sure what my needs will be; I'd simply like to know what my choices are so I don't build something I can't reasonably implement. For instance, I know Cassandra has Pandra, but that's just a PHP library. MongoDB has a native PECL extension.

    Read the article

  • Wordpress SQL_CALC fix causes PHP error

    - by ok1ha
    I'm looking for some followup on an older topic for Wordpress where SQL_CALC was found to slow things down when you have a large DB in Wordpress. I have been using the code, at the bottom of this post, to get around it but it does generate an error in my error log. How would I prevent this error? PHP Warning: Division by zero in /var/www/vhosts/domain.com/httpdocs/wp-content/themes/greatTheme/functions.php on line 19 The original thread: http://wordpress.org/support/topic/slow-queries-sql_calc_found_rows-bringing-down-site?replies=25 The code in my functions.php: add_filter('pre_get_posts', 'optimized_get_posts', 100); function optimized_get_posts() { global $wp_query, $wpdb; $wp_query->query_vars['no_found_rows'] = 1; $wp_query->found_posts = $wpdb->get_var( "SELECT COUNT(*) FROM wp_posts WHERE 1=1 AND wp_posts.post_type = 'post' AND (wp_posts.post_status = 'publish' OR wp_posts.post_status = 'private')" ); $wp_query->found_posts = apply_filters_ref_array( 'found_posts', array( $wp_query->found_posts, &$wp_query ) ); $wp_query->max_num_pages = ceil($wp_query->found_posts / $wp_query->query_vars['posts_per_page']); return $wp_query; }

    Read the article

  • php explode() delimiter issue

    - by mumis2012
    I am new to php so this may be a simple fix. I have a text file named 'textt.txt' that looks like this: South East asia,2222,code1 winter break,3333,code2 my php code looks like this: <?php $x = file_get_contents('textt.txt'); $y = explode("\r\n", $x); $z = $y[0]; echo $z; ?> the outcome of this is: South East asia,2222,code1 I would like it to return only: South East Asia. How can I make this happen? Thanks!

    Read the article

  • I have some basic questions setting up a PHP daemon

    - by mike
    I will be writing my first daemon in php and I have a couple really basic questions that I need help with. 1) What packages need to be installed on my linux server and Does anything in PHP need to be enabled? So far I have gotten this - http://pear.php.net/package/System_Daemon/download 2) Where on server do I save my daemon files? 3) I have a number of files that need to be included within the daemon that contain classes and functions for gathering emails and attachments through IMAP. All of these files are currently in my web public directory, how do I include these files within my daemon? I think that is everything I need to get started. Thanks so much!

    Read the article

  • Declaring static arrays in php

    - by user220201
    Hi, I am new to php. I was wondering how I could declare a static array in php. Here is what I would do in C. How is the corresponding php code for it? char a[][] = { (1,1), (1,2), (1,3), (2,1), (2,2), (2,3), (3,1), (3,2), (3,3) }; From what I read it has to be something like this - $a = array( 1 = array(1,1), 2 = array(1,2), ... ); Is this correct? If so it sucks :) I hope I am wrong. Thanks, - Pav

    Read the article

  • What is "with" used for in PHP?

    - by Jason
    I have come across this line in the eloquent ORM library: return with(new static)->newQuery(); I've never seen "with" used before, and cannot find it in the PHP documentation. I'm guessing "with" is a stop-word in most searches, so I am not even getting close. Never having encountered "with" in many years of programming PHP, I feel like I'm missing out. What does it do? I did come across one passing comment regarding the ORM, that mentioned "with" is no longer needed in PHP-5.4, but that was as much as was said.

    Read the article

  • Php security question

    - by Camran
    I have a linux server, and I am about to upload a classifieds website to it. The website is php based. That means php code adds/removes classifieds, with the help of the users offcourse. The php-code then adds/removes a classified to a database index called Solr (like MySql). Problem is that anybody can currently access the database, but I only want the website to access the database (solr). Solr is on port 8983 as standard btw. My Q is, if I add a rule in my firewall (iptables), to only allow connections coming from the servers IP to the Solr port nr, would this solve my issue? Thanks

    Read the article

  • php/mySQL error: mysql_num_rows(): supplied argument is not a valid MySQL result

    - by Michael Robinson
    I'm trying to INSERT INTO a mySQL database and I'm getting this error on: if (mysql_num_rows($login) == 1){ Here is the php, The php does add the user to the database. I can't figure it out. <? session_start(); require("config.php"); $u = $_GET['username']; $pw = $_GET['password']; $pwh = $_GET['passwordhint']; $em = $_GET['email']; $zc = $_GET['zipcode']; $check = "INSERT INTO family (loginName, email, password, passwordhint, location) VALUES ('$u', '$pw', '$pwh', '$em', '$zc')"; $login = mysql_query($check, $link) or die(mysql_error()); if (mysql_num_rows($login) == 1) { $row = mysql_fetch_assoc($login); echo 'Yes';exit; } else { echo 'No';exit; } mysql_close($link); ?> Thanks,

    Read the article

< Previous Page | 120 121 122 123 124 125 126 127 128 129 130 131  | Next Page >