Search Results

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

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

  • How do I generate an array from a string representation of that array?

    - by question_about_the_problem
    I want to generate the array $result_array. There is no error at the page, but not works! that not works ! //BOF: Result Array $result_array = ''; $result_array .= '"messages" => "' . $errors .'",'; $result_array .= '"this_addr_type" => "' . (int)$_REQUEST['edit'] .'",'; if (ACCOUNT_GENDER == 'true') { $result_array .= '"gender_male" => "' . $male .'",'; $result_array .= '"gender_female" => "' . $female .'",'; } $result_array .= '"firstname" => "' . $entry['entry_firstname'] .'",'; $result_array .= '"lastname" => "' . $entry['entry_lastname'] .'",'; if (ACCOUNT_COMPANY == 'true') { $result_array .= '"company" => "' . $entry['entry_company'] .'",'; } $result_array .= '"street_address" => "' . $entry['entry_street_address'] .'",'; if (ACCOUNT_SUBURB == 'true') { $result_array .= '"suburb" => "' . $entry['entry_suburb'] .'",'; } $result_array .= '"postcode" => "' . $entry['entry_postcode'] .'",'; $result_array .= '"city" => "' . $entry['entry_city'] .'",'; if (ACCOUNT_STATE == 'true') { $result_array .= '"state" => "' . $entry['entry_state'] .'",'; } $result_array .= '"country" => "' . $entry['entry_country_id'] .'"'; //EOF: Result Array $_RESULT = array($result_array); that works $_RESULT = array( "this_addr_type" => (int)$_REQUEST['edit'], "gender_male" => $male, "gender_female" => $female, "firstname" => $entry["entry_firstname"], "lastname" => $entry["entry_lastname"], "company" => $entry["entry_company"], "street_address" => $entry["entry_street_address"], "suburb" => $entry["entry_suburb"], "postcode" => $entry["entry_postcode"], "city" => $entry["entry_city"], "state" => $entry["entry_state"], "country" => $entry["entry_country_id"] );

    Read the article

  • Why the array not works ?

    - by question_about_the_problem
    I want to generate the array $result_array. There is no error at the page, but not works! that not works ! //BOF: Result Array $result_array = ''; $result_array .= '"messages" => "' . $errors .'",'; $result_array .= '"this_addr_type" => "' . (int)$_REQUEST['edit'] .'",'; if (ACCOUNT_GENDER == 'true') { $result_array .= '"gender_male" => "' . $male .'",'; $result_array .= '"gender_female" => "' . $female .'",'; } $result_array .= '"firstname" => "' . $entry['entry_firstname'] .'",'; $result_array .= '"lastname" => "' . $entry['entry_lastname'] .'",'; if (ACCOUNT_COMPANY == 'true') { $result_array .= '"company" => "' . $entry['entry_company'] .'",'; } $result_array .= '"street_address" => "' . $entry['entry_street_address'] .'",'; if (ACCOUNT_SUBURB == 'true') { $result_array .= '"suburb" => "' . $entry['entry_suburb'] .'",'; } $result_array .= '"postcode" => "' . $entry['entry_postcode'] .'",'; $result_array .= '"city" => "' . $entry['entry_city'] .'",'; if (ACCOUNT_STATE == 'true') { $result_array .= '"state" => "' . $entry['entry_state'] .'",'; } $result_array .= '"country" => "' . $entry['entry_country_id'] .'"'; //EOF: Result Array $_RESULT = array($result_array); that works $_RESULT = array( "this_addr_type" => (int)$_REQUEST['edit'], "gender_male" => $male, "gender_female" => $female, "firstname" => $entry["entry_firstname"], "lastname" => $entry["entry_lastname"], "company" => $entry["entry_company"], "street_address" => $entry["entry_street_address"], "suburb" => $entry["entry_suburb"], "postcode" => $entry["entry_postcode"], "city" => $entry["entry_city"], "state" => $entry["entry_state"], "country" => $entry["entry_country_id"] );

    Read the article

  • preg_replace replacing with array

    - by Scott
    What I want to do is replace the "[replace]" in input string with the corresponding vaule in the replace array. The total number of values will change but there will always be the same number in the replace array as in input string. I have tried doing this with preg_replace and preg_replace_callback but I can't get the pattern right for [replace], I also tried using vsprintf but the % in <table width="100%"> was messing it up. All help is greatly appreciated! Replace Array: $array = array('value 1','value 2','value 3'); Input String $string = ' <table width="100%"> <tr> <td>Name:</td> <td>[replace]</td> </tr> <tr> <td>Date:</td> <td>[replace]</td> </tr> <tr> <td>Info:</td> <td>[replace]</td> </tr> </table> '; Desired Result <table width="100%"> <tr> <td>Name:</td> <td>value 1</td> </tr> <tr> <td>Date:</td> <td>value 2</td> </tr> <tr> <td>Info:</td> <td>value 3</td> </tr> </table>

    Read the article

  • Weird "?>" being displayed

    - by Jaxkr
    I have the following navigation bar script: <?php session_start(); require('includepath.inc.php'); require($include_path.'loginsysfunc.inc.php'); $current_page = $_SERVER['REQUEST_URI']; ?> <div class="navbar"> <img class="navlogo" src="logo.png"> <div class="navbutton"><a href="index.php">Home</a></div> <div class="navbutton"><a href="about.php">About</a></div> <div class="navbutton"><a href="donate.php">Donate</a></div> <?php if (loggedIn()){ ?> <div class="navusername"><a href="profile.php?user=<?php echo $_SESSION['username'];?>"><?php echo $_SESSION['username']; ?></a></div> <div class="navtoolsettings"><a href="settings.php">Settings</a></div> <div class="navtoollogout"><a href="logout.php">Log out</a> <?php } elseif ($current_page == '/login.php') { ?> <div class="navregister"><a href="register.php">Register</a></div> <?php } else { ?> <div class="navusername"><a href="login.php">Log in</a></div> <?php } ?> </div> For some reason, a strange "?" is being displayed. I am super confused, so please help. Here is includepath.inc.php (the only I reason it's there is because I am on a shared host, and I don't want to type '/home/bigdumbhash/public_html/include' everytime. But, here it is: <?php $include_path = '/home/a6595899/public_html/include/'; ?> Here is loginsysfunc.inc.php. These are functions that go with my login system to save time: <?php function valUser() { session_regenerate_id(); $_SESSION['valid'] = true; $_SESSION['username'] = $userid; echo '<meta http-equiv="refresh" content="0;URL=\'index.php\'">'; } function loggedIn() { if($_SESSION['valid'] == true) { return true; } else { return false; } } function createSalt() { $string = $string = md5(uniqid(rand(), true)); return substr($string, 0, 3); } function logout() { $_SESSION = array(); session_destroy(); echo '<meta http-equiv="refresh" content="0;URL=\'index.php\'">'; } ?> Here is the actual HTML of the page: <!DOCTYPE html> <html> <head> <link href="style.css" rel="stylesheet" type="text/css"> <title> Log in </title> </head> <body> <div class="navbar"> <img class="navlogo" src="logo.png"> <div class="navbutton"><a href="index.php">Home</a></div> <div class="navbutton"><a href="about.php">About</a></div> <div class="navbutton"><a href="donate.php">Donate</a></div> <div class="navregister"><a href="register.php">Register</a></div> </div> ?> <div class="loginbox"> <h1>Log in</h1> <form action="logingo.php" method="POST"> <input class="userpass" type="text" name="username" value="Username" onFocus="this.value='';"> <br> <input class="userpass" type="password" name="password" value="Password" onFocus="this.value='';"> <br> <input class="loginbutton" type="submit" value="Log in!"> </form> </div> </body> </html>

    Read the article

  • How to simulate browser form POST method using PHP/cURL

    - by user283266
    I'm trying to simulate browser with POST method using PHP/cURL. When I looked at that live Http header it shows Content-Type: multipart/form-data. I checked on the internet where it was suggested that cURL will send multipart/form-data when a custom headers is specified to Content-Type: multipart/form-data. $headers = array( 'Content-Type' => 'multipart/form-data; boundary='.$boundary ); This didn't work for me either when I print_r(curl_getinfo()) it showed [content_type] => text/html; charset=UTF-8 Which means cURL sent a default headers I also read that sending/uploading a file with cURL will cause data to be send as multipart/form-data. I created a file which curl uploaded but again when I ran curl_getinfo I got [content_type] => text/html; charset=UTF-8 $data_array = array("field" => "@c:\file_location.txt"); I also tried to read a file content so that the only thing sent would be content NOT ATTACHED FILE but this didn't work for me curl_getinfo shows [content_type] => text/html; charset=UTF-8. $data_array = array("field" => "<c:\file_location.txt"); // note @ replaced with < Do I miss somthing here? This is the referer url POST somepath HTTP/1.1 Host: www(dot)domain(dot)com User-Agent: Mozilla/5.0 (Windows) Gecko/13081217 Firefox/3 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 Accept-Language: en-us,en;q=0.5 Accept-Encoding: gzip,deflate Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7 Keep-Alive: 300 Connection: keep-alive Referer: url/some-file.php Content-Type: multipart/form-data; boundary=--------------------------$boundary Content-Length: $some_number ----------------------------$boundary Content-Disposition: form-data; name="$some_Value1" $some_text1 ----------------------------$boundary Content-Disposition: form-data; name="$some_Value2" $some_text2 ----------------------------$boundary Content-Disposition: form-data; name="$some_Value3" $some_text3 ----------------------------$boundary Content-Disposition: form-data; name="$some_Value4" $some_text4 ----------------------------$boundary Content-Disposition: form-data; name="$some_Value5" $some_text5 ----------------------------$boundary Content-Disposition: form-data; name="$some_Value6" $some_text6 ----------------------------$boundary Content-Disposition: form-data; name="$some_Value7" $some_text7 ----------------------------$boundary Content-Disposition: form-data; name="$some_Value8" $some_text8 ----------------------------$boundary Content-Disposition: form-data; name="$some_Value9" ----------------------------$boundary Content-Disposition: form-data; name="$some_Value10" ----------------------------$boundary-- Here is a piece of code. <? //Include files set_time_limit(0); include'body.php'; include'keyword.php'; include'bio.php'; include'summary.php'; include'headline.php'; include'category.php'; include'spin.php'; include'random-text.php'; $category = category(); $headline = headline() ; $summary = summary(); $keyword = keyword(); $body = body(); $bio = bio(); $target="url"; $ref ="url_ref"; $c = "Content-Disposition: form-data; name="; $boundary = "---------------------------".random_text(); $category = category(); $headline = headline() ; $summary = summary(); $keyword = keyword(); $body = body(); $bio = bio(); // emulating content form as it appears on livehttp header $data = "\r\n".$boundary."\r\n".$c."\"pen_id\"\r\n\r\n".$Auth_id."\r\n".$boundary."\r\n".$c."\"cat_id\"\r\n\r\n".category()."\r\n".$boundary."\r\n".$c."\"title\"\r\n\r\n".headline()."\r\n".$boundary."\r\n".$c."\"meta_desc\"\r\n\r\n".summary()."\r\n".$boundary."\r\n".$c."\"meta_keys\"\r\n\r\n".keyword()."\r\n".$boundary."\r\n".$c."\"content\"\r\n\r\n".body()."\r\n".$boundary."\r\n".$c."\"author_bio\"\r\n\r\n".bio()."\r\n".$boundary."\r\n".$c."\"allow_comments\"\r\n\r\ny\r\n".$boundary."\r\n".$c."\"id\"\r\n\r\n\r\n".$boundary."\r\n".$c."\"action\"\r\n\r\n\r\n".$boundary."--\r\n"; // inserting content into a file $file = "C:\file_path.txt"; $fh = fopen($file, 'w+') or die("Can't open file"); fwrite($fh,$data); fclose($fh); // pulling out content from a file as multipart/form-data $data_array = array ("field" => "<C:\file_path.txt"); $headers = array ( 'POST /myhome/article/new HTTP/1.1', 'Host: url', 'User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.20) Gecko/20081217 Firefox/2.0.0.20 (.NET CLR 3.5.30729)', 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9;q=0.8', 'Accept-Language: en-us,en;q=0.5', 'Accept-Encoding: gzip,deflate', 'Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7', 'Keep-Alive: 300', 'Connection: keep-alive', 'Content-Type: multipart/form-data; boundary='.$boundary, 'Content-Length: '.strlen($data), ); # Create the cURL session $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $target); // Define target site curl_setopt($ch, CURLOPT_POST,1); curl_setopt($ch, CURLOPT_HEADER, $headers); // No http head //curl_setopt($ch, CURLOPT_REFERER, $ref); curl_setopt($ch, CURLOPT_NOBODY, FALSE); curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); // Return page in string curl_setopt($ch, CURLOPT_COOKIEJAR, "c:\cookie\cookies.txt"); // Tell cURL where to write curl_setopt($ch, CURLOPT_COOKIEFILE, "c:\cookie\cookies.txt"); // Tell cURL which cookies //curl_setopt($ch, CURLOPT_USERAGENT, $agent); curl_setopt($ch, CURLOPT_POST, TRUE); curl_setopt($ch, CURLOPT_POSTFIELDS, "$data_array"); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE); // Follow redirects curl_setopt($ch, CURLOPT_MAXREDIRS, 4); # Execute the PHP/CURL session and echo the downloaded page $page = curl_exec($ch); $err = curl_error($ch); $info =curl_getinfo($ch); # Close the cURL session curl_close($ch); print_r($err); print_r($info); ?>

    Read the article

  • Routing in php vs routing in rails..

    - by piemesons
    I was working on php from past 1 yr and now a days i m learning rails. In rails:-- Routing takes an incoming URL and decodes it into a set of parameters that are used by Rails to dispatch to the appropriate controller and action for example rs.recognize_path "/blog/show/123" {:controller=>"blog", :action=>"show", :id=>"123"} M i right?? We mention this (written down) line of code in our routes.rb under config directory to tell rails how to handle the request like "/blog/show/123" using this line of code. map.connect "blog/show/:id", :controller => "blog", :action => "show", :id => /\d+/ Fine.. Now in php when we do something like this www.xxx.com/profile.php?profile_id=2 How the request is sent to the requested page. Means i never wrote anything for routing in php, then how this request has been handled. How the rounting is done in php (anything i missed during my learning/working in php) R u getting what i am asking. Please let me know if there is any problem.

    Read the article

  • Client-Server Networking Between PHP Client and Java Server

    - by Muhammad Yasir
    Hi there, I have a university project which is already 99% completed. It consists of two parts-website (PHP) and desktop (Java). People have their accounts on the website and they wish to query different information regarding their accounts. They send an SMS which is received by desktop application which queries database of website (MySQL) and sends the reply accordingly. This part is working superbly. The problem is that some times website wishes to instruct the desktop application to send a specific SMS to a particular number. Apparently there seems no way other than putting all the load to the DB server... This is how I made it work. Website puts SMS jobs in a specific table. Java application polls this table again and again and if it finds a job, it executes it. Even this part is working correctly but unfortunately it is not acceptable by my university to poll the DB like this. :( The other approach I could think of is to use client-server one. I tried making Java server and its PHP client. So that whenever an SMS is to be sent, the website opens a socket connection to desktop application and sends two strings (cell # and SMS message). Unfortunately I am unable to do this. I was successfully to make a Java server which works fine when connected by a Java client, similarly my PHP client connects correctly to a PHP server, but when I try to cross them, they start hating each other... PHP shows no error but Java gives StreamCorruptedException when it tries to read header of input stream. Could someone please tell what I can try to make PHP client and Java server work together? Or if the said purpose can be achieved by another means, how? Regards, Yasir

    Read the article

  • replace double quotes to parse JSON in PHP

    - by hunt
    hi, i have following json format { "status": "ACTIVE", "result": false, "isworking": false, "margin": 1, "employee": { "111": { "val1": 5.7000000000000002, "val2": "9/2", "val3": 5.7000000000000002 }, "222": { "val1": 31.550000000000001, "val2": "29/1", "val3": 31.550000000000001 } } } how the problem is when i am trying to decode above json response in php using json_decode($res,true) { true param for associative array } i am getting following result as few fields like "result":false is not "result":"false" i.e. at many of the places doubles quotes are missing in values of json. see in val1 and val3 fields resultant data after decoding in php (associative array) Array ( [status] => > ACTIVE [result] => > [isworking] => > [margin] => > 1 [employee] => > Array ( [111] => > Array ( [val1] => > 5.7 [val2] => > 9/2 [val3] => > 5.7 ) [222] => > Array ( [val1] => > 31.55 [val2] => > 29/1 [val3] => > 31.55 ) ) ) please help me on how would i insert double quotes in values ? Thanks

    Read the article

  • search form in html/php via ajax

    - by fusion
    i've a search form wherein the database query has been coded in php and the html file calls this php file via ajax to display the results in the search form. the problem is, i would like the result to be displayed in the same form as search.html; yet while the ajax works, it goes to search.php to display the results. search.html: <!DOCTYPE html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <script src="scripts/search_ajax.js" type="text/javascript"></script> </head> <body> <form id="submitForm" method="post"> <div class="wrapper"> <div class="field"> <input name="search" id="search" /> </div><br /> <input id="button1" type="submit" value="Submit" class="submit" onclick="run_query();" /><br /> </div> <div id="searchContainer"> </div> </form> </body> </html> if i add action="search.php" to the form tag, it displays the result but on search.php. i'd like it to display on the same form [i.e search.html, and not search.php] if i just add the javascript function [as done above], it displays nothing on search.html

    Read the article

  • Call to undefined function query() - using PDO in PHP

    - by webworm
    I have a written a script in PHP that reads from data from a MySQL database. I am new to PHP and I have been using the PDO library. I have been developing on a Windows machine using the WAMP Server 2 and all has been working well. However, when I uploaded my script to the LINUX server where it will be used I get the following error when I run my script. Fatal error: Call to undefined function query() This is the line where the error is occuring ... foreach($dbconn->query($sql) as $row) The variable $dbconn is first defined in my dblogin.php include file which I am listing below. <?php // Login info for the database $db_hostname = 'localhost'; $db_database = 'MY_DATABASE_NAME'; $db_username = 'MY_DATABASE_USER'; $db_password = 'MY_DATABASE_PASSWORD'; $dsn = 'mysql:host=' . $db_hostname . ';dbname=' . $db_database . ';'; try { $dbconn = new PDO($dsn, $db_username, $db_password); $dbconn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); } catch (PDOException $e) { echo 'Error connecting to database: ' . $e->getMessage(); } ?> Inside the function where the error occurs I have the database connection defined as a superglobal as such ... global $dbconn; I am a bit confused as to what is happening since all worked well on my development machine. I was wondering if the PDO library was installed but from what I thought it was installed by default as part of PHP v5. The script is running on an Ubuntu (5.0.51a-3ubuntu5.4) machine and the PHP version is 5.2.4. Thank you for any suggestions. I am really lost on this.

    Read the article

  • append a numpy array to a numpy array

    - by Fraz
    I just started programming in python and am very new to numpy packages.. so still trying to get a hang of it. I have a an numpy_array so something like [ a b c] And then I want to append it into anotehr numpyarray (Just like we create a list of lists) How do we create an array of numpy arrays containing numpy arrays I tried to do the following without any luck >>> M = np.array([]) >>> M array([], dtype=float64) >>> M.append(a,axis=0) Traceback (most recent call last): File "<stdin>", line 1, in <module> AttributeError: 'numpy.ndarray' object has no attribute 'append' >>> a array([1, 2, 3])

    Read the article

  • php: how to return an HTTP 500 code on any error, no matter what

    - by Jake
    Hi guys. I'm writing an authentication script in PHP, to be called as an API, that needs to return 200 only in the case that it approves the request, and 403 (Forbidden) or 500 otherwise. The problem I'm running into is that php returns 200 in the case of error conditions, outputting the error as html instead. How can I make absolutely sure that php will return an HTTP 500 code unless I explicitly return the HTTP 200 or HTTP 403 myself? In other words, I want to turn any and all warning or error conditions into 500s, no exceptions, so that the default case is rejecting the authentication request, and the exception is approving it with a 200 code. I've fiddled with set_error_handler() and error_reporting(), but so far no luck. For example, if the code outputs something before I send the HTTP response code, PHP naturally reports that you can't modify header information after outputting anything. However, this is reported by PHP as a 200 response code with html explaining the problem. I need even this kind of thing to be turned into a 500 code. Is this possible in PHP? Or do I need to do this at a higher level like using mod_rewrite somehow? If that's the case, any idea how I'd set that up? Thanks for any help. Jake

    Read the article

  • Array of ArrayList Java

    - by David Bobo
    Hi, I am creating an PriorityQueue with multiple queues. I am using an Array to store the multiple ArrayLists that make up my different PriorityQueues. Here is what I have for my constructor so far: ArrayList<ProcessRecord> pq; ArrayList[] arrayQ; MultiList(){ arrayQ = new ArrayList[9]; pq = new ArrayList<ProcessRecord>(); } The problem comes when I am trying to get the size of the entire array, that is the sum of the sizes of each ArrayList in the array. public int getSize(){ int size = 0; for(int i = 1; i <=9; i++){ size = size + this.arrayQ[i].size(); } return size; } is not seeming to work. Am I declaring the Array of ArrayList correctly? I keep getting an error saying that this.arrayQ[i].size() is not a method. (the .size() being the problem) Thanks for any help! David

    Read the article

  • PHP and Regular Expressions question?

    - by php
    I was wondering if the codes below are the correct way to check for a street address, email address, password, city and url using preg_match using regular expressions? And if not how should I fix the preg_match code? preg_match ('/^[A-Z0-9 \'.-]{1,255}$/i', $trimmed['address']) //street address preg_match ('/^[\w.-]+@[\w.-]+\.[A-Za-z]{2,6}$/', $trimmed['email'] //email address preg_match ('/^\w{4,20}$/', $trimmed['password']) //password preg_match ('/^[A-Z \'.-]{1,255}$/i', $trimmed['city']) //city preg_match("/^[a-zA-Z]+[:\/\/]+[A-Za-z0-9\-_]+\\.+[A-Za-z0-9\.\/%&=\?\-_]+$/i", $trimmed['url']) //url

    Read the article

  • how to include .pl (PERL) file in PHP

    - by dexter
    i have two pages one in php(index.php) and another one in Perl(dbcon.pl). basically i want my php file to show only the UI and all the data operations would be done in Perl file. i have tried in index.pl <?php include("dbcon.pl");?> <html> <br/>PHP</br> </html> and dbcon.pl has #!/usr/bin/perl use strict; use warnings; use DBI; use CGI::Simple; my $cgi = CGI::Simple->new; my $dsn = sprintf('DBI:mysql:database=%s;host=%s','dbname','localhost'); my $dbh = DBI->connect($dsn,root =>'',{AutoCommit => 0,RaisError=> 0}); my $sql= "SELECT * FROM products"; my $sth =$dbh->prepare($sql); $sth->execute or die "SQL Error: $DBI::errstr\n"; while (my @row = $sth->fetchrow_array){ print $cgi->header, <<html; <div>&nbsp;@row[0]&nbsp;@row[1]&nbsp;@row[2]&nbsp;@row[3]&nbsp;@row[4]</div> html } but when i run index.php in browser it prints all the code in dbcon.pl file instead of executing it how to overcome this problem? note: i am running this in windows environment is there any other way to do this?

    Read the article

  • Why is PHP not allowing comparison?

    - by dcp3450
    I'm using PHP to read if an entry in my table on the database is set to "yes" or "no" and auto check the radio button that corresponds: <?php include 'file.php'; $query = "SELECT * FROM TABLE"; $runquery = odbc_exec($connect,$query); $status= odbc_result($runquery,"status"); odbc_close($file); ?> <form> <div class="formContainer"> <fieldset> <legend>Campus Alert<span class="tooltip">Turn campus alert on and off.</span></legend> <?php echo $status; ?> Yes <input type="radio" name="alertStatus" id="alertStatus" value="yes" <?php if($status== "yes") echo "checked";?>> No <input type="radio" name="alertStatus" id="alertStatus" value="no" <?php if($status== "no") echo "checked";?>> </fieldset> </div> the is for debugging so I can make sure what the database says and the form's reaction is correct. It prints "yes" (no quotes). However, the if statement will not respond. Any idea why it's doing this?

    Read the article

  • PHP Mail() to Gmail = Spam

    - by grantw
    Recently Gmail has started marking emails sent directly from my server (using php mail()) as spam and I'm having problems trying to find the issue. If I send an exact copy of the same email from my email client it goes to the Gmail inbox. The emails are plain text, around 7 lines long and contain a URL link in plain text. As the emails sent from my client are getting through fine I'm thinking that the content isn't the issue. It would be greatly appreciated if someone could take a look at the the following headers and give me some advice why the email from the server is being marked as spam. Email from Server: Delivered-To: [email protected] Received: by 10.49.98.228 with SMTP id el4csp101784qeb; Thu, 15 Nov 2012 14:58:52 -0800 (PST) Received: by 10.60.27.166 with SMTP id u6mr2296595oeg.86.1353020331940; Thu, 15 Nov 2012 14:58:51 -0800 (PST) Return-Path: [email protected] Received: from dom.domainbrokerage.co.uk (dom.domainbrokerage.co.uk. [174.120.246.138]) by mx.google.com with ESMTPS id df4si17005013obc.50.2012.11.15.14.58.51 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 15 Nov 2012 14:58:51 -0800 (PST) Received-SPF: pass (google.com: domain of [email protected] designates 174.120.246.138 as permitted sender) client-ip=174.120.246.138; Authentication-Results: mx.google.com; spf=pass (google.com: domain of [email protected] designates 174.120.246.138 as permitted sender) [email protected]; dkim=pass [email protected] DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=domainbrokerage.co.uk; s=default; h=Date:Message-Id:Content-Type:Reply-to:From:Subject:To; bh=2RJ9jsEaGcdcgJ1HMJgQG8QNvWevySWXIFRDqdY7EAM=; b=mGebBVOkyUhv94ONL3EabXeTgVznsT1VAwPdVvpOGDdjBtN1FabnuFi8sWbf5KEg5BUJ/h8fQ+9/2nrj+jbtoVLvKXI6L53HOXPjl7atCX9e41GkrOTAPw5ZFp+1lDbZ; Received: from grantw by dom.domainbrokerage.co.uk with local (Exim 4.80) (envelope-from [email protected]) id 1TZ8OZ-0008qC-Gy for [email protected]; Thu, 15 Nov 2012 22:58:51 +0000 To: [email protected] Subject: Offer Accepted X-PHP-Script: www.domainbrokerage.co.uk/admin.php for 95.172.231.27 From: My Name [email protected] Reply-to: [email protected] Content-Type: text/plain; charset=Windows-1251 Message-Id: [email protected] Date: Thu, 15 Nov 2012 22:58:51 +0000 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - dom.domainbrokerage.co.uk X-AntiAbuse: Original Domain - gmail.com X-AntiAbuse: Originator/Caller UID/GID - [500 500] / [47 12] X-AntiAbuse: Sender Address Domain - domainbrokerage.co.uk X-Get-Message-Sender-Via: dom.domainbrokerage.co.uk: authenticated_id: grantw/from_h Email from client: Delivered-To: [email protected] Received: by 10.49.98.228 with SMTP id el4csp101495qeb; Thu, 15 Nov 2012 14:54:49 -0800 (PST) Received: by 10.182.197.8 with SMTP id iq8mr2351185obc.66.1353020089244; Thu, 15 Nov 2012 14:54:49 -0800 (PST) Return-Path: [email protected] Received: from dom.domainbrokerage.co.uk (dom.domainbrokerage.co.uk. [174.120.246.138]) by mx.google.com with ESMTPS id ab5si17000486obc.44.2012.11.15.14.54.48 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 15 Nov 2012 14:54:49 -0800 (PST) Received-SPF: pass (google.com: domain of [email protected] designates 174.120.246.138 as permitted sender) client-ip=174.120.246.138; Authentication-Results: mx.google.com; spf=pass (google.com: domain of [email protected] designates 174.120.246.138 as permitted sender) [email protected]; dkim=pass [email protected] DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=domainbrokerage.co.uk; s=default; h=Content-Transfer-Encoding:Content-Type:Subject:To:MIME-Version:From:Date:Message-ID; bh=bKNjm+yTFZQ7HUjO3lKPp9HosUBfFxv9+oqV+NuIkdU=; b=j0T2XNBuENSFG85QWeRdJ2MUgW2BvGROBNL3zvjwOLoFeyHRU3B4M+lt6m1X+OLHfJJqcoR0+GS9p/TWn4jylKCF13xozAOc6ewZ3/4Xj/YUDXuHkzmCMiNxVcGETD7l; Received: from w-27.cust-7941.ip.static.uno.uk.net ([95.172.231.27]:1450 helo=[127.0.0.1]) by dom.domainbrokerage.co.uk with esmtpa (Exim 4.80) (envelope-from [email protected]) id 1TZ8Ke-0001XH-7p for [email protected]; Thu, 15 Nov 2012 22:54:48 +0000 Message-ID: [email protected] Date: Thu, 15 Nov 2012 22:54:50 +0000 From: My Name [email protected] User-Agent: Postbox 3.0.6 (Windows/20121031) MIME-Version: 1.0 To: [email protected] Subject: Offer Accepted Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - dom.domainbrokerage.co.uk X-AntiAbuse: Original Domain - gmail.com X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - domainbrokerage.co.uk X-Get-Message-Sender-Via: dom.domainbrokerage.co.uk: authenticated_id: [email protected]

    Read the article

  • Numpy: Sorting a multidimensional array by a multidimensional array

    - by JD Long
    Forgive me if this is redundant or super basic. I'm coming to Python/Numpy from R and having a hard time flipping things around in my head. I have a n dimensional array which I want to sort using another n dimensional array of index values. I know I could wrap this in a loop but it seems like there should be a really concise Numpyonic way of beating this into submission. Here's my example code to set up the problem where n=2: a1 = random.standard_normal(size=[2,5]) index = array([[0,1,2,4,3] , [0,1,2,3,4] ]) so now I have a 2 x 5 array of random numbers and a 2 x 5 index. I've read the help for take() about 10 times now but my brain is not groking it, obviously. I thought this might get me there: take(a1, index) array([[ 0.29589188, -0.71279375, -0.18154864, -1.12184984, 0.25698875], [ 0.29589188, -0.71279375, -0.18154864, 0.25698875, -1.12184984]]) but that's clearly reordering only the first element (I presume because of flattening). Any tips on how I get from where I am to a solution that sorts element 0 of a1 by element 0 of the index ... element n?

    Read the article

  • PHP and C# communication on IIS7 (to generate dynamic PDF)

    - by David Murdoch
    Background: I couldn't find any decent free HTML to PDF conversion utilities in C#. There are 100s of them for PHP with extensive documentation, support, and CSS support. So I am using html2ps and html2pdf (php). I have PHP 5.2 installed on IIS7 and its working beautifully to create PDFs. I have the following in getPDF.aspx <!-- Output the header --> <DM:header runat="server" ID="header" /> <asp:Placeholder id="content" runat="server" /> <!-- Output the footer --> <DM:footer runat="server" ID="footer" /> and in getPDF.aspx.cs: protected void Page_Load(object sender, EventArgs e){ // AddContentControl simples adds a controls to the content Placeholder. AddContentControl("controls/page1.ascx"); AddContentControl("controls/page2.ascx"); AddContentControl("controls/page3.ascx"); } and in generatePDF.php: <?php /* ... includes and stuff here ... */ $data = "THE HTML GOES HERE!"; // creates the PDF from the $data and Outputs the created file. convert_to_pdf($data); ?> -- getPDF.aspx works perfectly...except the output is HTML. So how can I get getPDF.aspx to output its HTML as PDF generated by generatePDF.php?

    Read the article

  • PHP gettext function only returns orignal untranslated string

    - by Camsoft
    I'm trying to use gettext add localisation support to my website. I've followed various guides on how to setup gettext and have done the following: I've created the following files and directories in the root of my project dir: test.php locale/ de_DE LC_MESSAGES messages.mo messages.po en_GB LC_MESSAGES messages.mo messages.po I've used Poedit to create the above .po and mo files. I've made sue it use Unix line endings, UTF-8 and set the language and country accordingly. I've then created a PHP script called test.php which has the following code: <?php define('LOCALE', 'de_DE'); // Set up environmental variables putenv("LC_ALL=" . LOCALE); setlocale(LC_ALL, LOCALE); bindtextdomain("messages", "./locale"); bind_textdomain_codeset("messages", LOCALE .".utf8"); textdomain("messages"); die(gettext('This is a test.')); ?> I've imported the text "This is a test." to Poedit and supplied the translation and saved it. But for some reason the test.php script will only output the original text untranslated. It refuses to load the version for the translation files. It's worth noting that the server is running Linux (Ubuntu), Apache 2.2.11 and PHP 5.2.6-3ubuntu4.5. I've checked phpinfo() and gettext is enabled. Can someone help me? Thanks.

    Read the article

  • jquery add to an array on click?

    - by KittyYoung
    I'm confused regarding each() and .each()... I think I need to use both, but I'm not sure how... Basically, I have a series of checkboxes and when they're checked, I want to get the id of the closest table row and add it to an array that I can then serialize and pass to a function. So, the html looks like this: <tr id="t1"><td><input type="checkbox" name="did[]" value="232" class="bd" /></td></tr> <tr id="t2"><td><input type="checkbox" name="did[]" value="234" class="bd" /></td></tr> <tr id="t3"><td><input type="checkbox" name="did[]" value="676" class="bd" /></td></tr> <tr><td><button id="tsid" name="tsid" type="button">Send</button></td></tr> And, when (and if) the checkbox is selected, I want to get the closest tr id and store it in an array: var trids = [] And then serialize the input data and the trids array... So far, I only have this: $('#tsid').click(function() { //meant to get the values of the selected checkboxes var myData = $('input[name=did[]]').serialize(); //meant to find and store the closest tr ids in an array... $('.bd').each(function() { var trids = $(this).closest("tr").get(0); //and now I'm lost... }); }

    Read the article

  • PHP/MySQL Printing Duplicate Labels

    - by Michael
    Using an addon of FPDF, I am printing labels using PHP/MySQL (http://www.fpdf.de/downloads/addons/29/). I'd like to be able to have the user select how many labels to print. For example, if the query puts out 10 records and the user wants to print 3 labels for each record, it prints them all in one set. 1,1,1,2,2,2,3,3,3...etc. Any ideas? <?php require_once('auth.php'); require_once('../config.php'); require_once('../connect.php'); require('pdf/PDF_Label.php'); $sql="SELECT $tbl_members.lastname, $tbl_members.firstname, $tbl_members.username, $tbl_items.username, $tbl_items.itemname FROM $tbl_members, $tbl_items WHERE $tbl_members.username = $tbl_items.username"; $result=mysql_query($sql); if(mysql_num_rows($result) == 0){ echo "Your search criteria does not return any results, please try again."; exit(); } $pdf = new PDF_Label("5160"); $pdf->AddPage(); // Print labels while($rows=mysql_fetch_array($result)){ $name = $rows['lastname'].', '.$rows['firstname'; $item= $rows['itemname']; $text = sprintf(" * %s *\n %s\n", $name, $item); $pdf->Add_Label($text); } $pdf->Output('labels.pdf', 'D'); ?>

    Read the article

  • Forking in PHP on Windows

    - by Doug Kavendek
    We are running PHP on a Windows server (a source of many problems indeed, but migrating is not an option currently). There are a few points where a user-initiated action will need to kick off a few things that take a while and about which the user doesn't need to know if they succeed or fail, such as sending off an email or making sure some third-party accounts are updated. If I could just fork with pcntl_fork(), this would be very simple, but the PCNTL functions are not available in Windows. It seems the closest I can get is to do something of this nature: exec( 'php-cgi.exe somescript.php' ); However, this would be far more complicated. The actions I need to kick off rely on a lot of context that already will exist in the running process; to use the above example, I'd need to figure out the essential data and supply it to the new script in some way. If I could fork, it'd just be a matter of letting the parent process return early, leaving the child to work on a few more things. I've found a few people talking about their own work in getting various PCNTL functions compiled on Windows, but none seemed to have anything available (broken links, etc). Despite this question having practically the same name as mine, it seems the problem was more execution timeout than needing to fork. So, is my best option to just refactor a bit to deal with calling php-cgi, or are there other options? Edit: It seems exec() won't work for this, at least not without me figuring some other aspect of it, as it waits until the call returns. I figured I could use START, sort of like exec( 'start php-cgi.exe somescript.php' );, but it still waits until the other script finishes.

    Read the article

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