Search Results

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

Page 128/1708 | < Previous Page | 124 125 126 127 128 129 130 131 132 133 134 135  | Next Page >

  • Allow PHP to write file without 777

    - by camerongray
    I am setting up a simple website on webspace provided by my university. I do not have database access so I am storing all the data in a flat file. The issue I am experiencing is related to file permissions. I need PHP to be able to read and write the data file but I don't really want to set the file to 777 as anybody else on the system could modify it, they already have read access to everyone's web directories. Does anyone have any ideas on how to accomplish this? Thanks in advance

    Read the article

  • IIS 7 with PHP in Domain with Windows Authentication

    - by Michal Saiyan Hajdony
    I have Windows Server 2008 R2 x64b installed with IIS 7, PHP 5.5. This server is added to domain exampledomain , so I have win authentication enabled and all others disabled. I left the two default providers NTLM and negotiate, I granted IIS_IUSRS read access to wwwroot. So far it has worked for me only as I am added to the Administrators group which has read/write access to wwwroot folder. Yet, when someone else is trying to connect, he gets a credentials window and when he puts the domain name and password he cannot get access to the page. The issue is solved when I add read permission to "Domain users" - then all works fine. BUT. My issue is that if one opens windows explorer and types \\servername\wwwroot one can see the files and read them. I have never configured IIS before so I know I miss some really important thing. How can I solve the file visibility problem?

    Read the article

  • Apache server, PHP

    - by user65649
    I am running a php site on my apache server (Mac). I am having trouble displaying images on the site when I access it externally or from another computer on the same server. If I try to access the image directly. website.com/image.jpg I get a broken link icon and can't display the image. Any ideas what could cause this? My images are embedded using a style.css file. background-image:url(image.jpg);

    Read the article

  • installing php gd on ubuntu on a vps server

    - by user235196
    I was working on localhost with resizing images and everything was great. Than I uploaded to my server and things got interesting. After searching around, looks like I have to enable php-gd on my server. I tried running the line sudo apt-get install php5-gd using putty, and it didn't work. Any ideas why? Also, after the install, I assume I will need to run the function sudo reboot right? clearly I'm not an expert in this area :p

    Read the article

  • How do I sum up weighted arrays in PHP?

    - by christian studer
    Hod do I multiply the values of a multi-dimensional array with weigths and sum up the results into a new array in PHP or in general? The boring way looks like this: $weights = array(0.25, 0.4, 0.2, 0.15); $values = array ( array(5,10,15), array(20,25,30), array(35,40,45), array(50,55,60) ); $result = array(); for($i = 0; $i < count($values[0]); ++$i) { $result[$i] = 0; foreach($weights as $index => $thisWeight) $result[$i] += $thisWeight * $values[$index][$i]; } Is there a more elegant solution?

    Read the article

  • How does PHP5 fare with the earlier versions of the language

    - by Pankaj Upadhyay
    Many times, I like to learn PHP for web development but been drawn back due to comments like the following :- (Comments are just for reference and does not invite Flame-war) "PHP is good but generates spaghetti code" "PHP is nice but Python is marriage material" "PHP lags stuff that you get in other languages like C# or JAVA" But for PHP5 i have seen some promising comments. So, What my question is how does PHP5 fare with the earlier versions of the language and is it good enough now to learn for web development. NOTE:- No comparison of PHP with other languages is sorted here. Please comment just on PHP and it's comparison with itself

    Read the article

  • Apple pushnotification [closed]

    - by VIVEK
    I have a PHP script located in path like /var/www/vhosts/hostname/httpdocs/webservices, I have both PHP script and .pem files there, and I have called the .pem file in the script properly, but still when I run the script , I don't get push notification , instead i get warnings such as: Warning: stream_socket_client() [function.stream-socket-client]: Unable to set local cert chain file `ck_push_test.pem'; Check that your cafile/capath settings include details of your certificate and its issuer in /var/www/vhosts/ipartyapps.com/httpdocs/webservices/testPush.php on line 12 Warning: stream_socket_client() [function.stream-socket-client]: failed to create an SSL handle in /var/www/vhosts/ipartyapps.com/httpdocs/webservices/testPush.php on line 12 Warning: stream_socket_client() [function.stream-socket-client]: Failed to enable crypto in /var/www/vhosts/ipartyapps.com/httpdocs/webservices/testPush.php on line 12 Warning: stream_socket_client() [function.stream-socket-client]: unable to connect to ssl://gateway.push.apple.com:2195 (Unknown error) in /var/www/vhosts/ipartyapps.com/httpdocs/webservices/testPush.php on line 12 Failed to connect 0 I double checked everything path, permissions and owner/group of both script and .pem files, still not getting push notification. Any suggestions please, as it's urgent.

    Read the article

  • Best way to trigger editing and dynamically show editing features? [on hold]

    - by Tim Marshall
    Page In Question: http://rafflebananza.com/admin/StatisticalData/expenses/expenses.html Hiya Everyone, On my page, I have an 'Actions' drop down to the top-right hand side of the page. This actions drop down I would like to have an action to 'Enable Editing'. Upon clicking to enable editing, I would like a PHP variable modified from 'EnableEditing = false' to 'EnableEditing = true'. Why I would like to use PHP maybe questionable, here is why I would like to use PHP under my understanding to clarify; Sections on my page will show to different administrators depending on their level. Upon enabling editing mode, certain contents will then dynamically. <?php if ($_SESSION['user_level_status'] < 2) { if ($editing = enabled) { show this } else { show this } } ?> Something similar to this, I'm new at PHP so this may look incorrect. The question really is, is PHP the correct language to use to trigger editing and how can I do this please? Best Regards, Tim

    Read the article

  • I am trying to link my php form and my sql but having difficulties

    - by user1912599
    I am not sure what I am doing wrong as far as my php goes but I can't get my form to link with my sql. Here are the codes for my form and php code for my link to sql <?php echo displayform(); function displayForm() { $r = ''; //build it $r .='<form action="database.php" method="post">'; //table $r .=displayNiceFormBegin(); $r .=displayRow('FirstName:', '<input type="text" name="fname" id="fname"/>'); $r .=displayRow('LastName:', '<input type="text" name="lname" id="lname"/>'); $r .=displayRow('Address:', '<input type="text" name="address" id ="address"/>'); $r .=displayRow('Phone:', '<input type="text" name="phone" id ="phone"/>'); $r .=displayRow('Deparment:', '<input type="text" name="department"id="department"/>'); $r .=displayRow('', '<input type="submit" value="Submit Registration" />'); $r .=displayNiceFormEnd(); $r .='</form>'; return $r; } function displayRow($left, $right) { $r .= ''; //build it $r .='<tr>'; $r .= '<td>' . $left . '</td>'; $r .= '<td>' . $right . '</td>'; $r .='</tr>'; return $r; } function displayNiceFormBegin(){ $r .=''; //build it $r .= '<table style="background-color: beige; border: 1px dashed #999"><tr><td>'; $r .='<table style="margin:10px">'; return $r; } function displayNiceFormENd() { $r .=''; //build it $r .='</table>'; $r .='</td></tr><table>'; return $r; } ?> <?php $host="localhost"; // Host name $username="695788_ogems"; // Mysql username $password="opd69715"; // Mysql password $db_name="ottawaglandorfems_zzl_ogems"; // Database name $tbl_name=".*"; // Table name // Connect to server and select database. mysql_connect("$host", "$username", "$password")or die("cannot connect"); mysql_select_db("$db_name")or die("cannot select DB"); // Get values from form $fname=$_POST['fname']; $lname=$_POST['lname']; $address=$_POST['address']; $phone=$_POST['phone']; $department=$_POST['deparment']; // Insert data into mysql $sql="INSERT INTO $tbl_name(FirstName,LastName,Address,Phone,Department)VALUES('$fname', '$lname', '$address','$phone','$deparment')"; $result=mysql_query($sql); // if successfully insert data into database, displays message "Successful". if($result){ echo "Successful"; echo "<BR>"; echo "<a href='ottawa-glandorfems.org/form3.php'>Back to main page</a>"; } else { echo "ERROR"; } ?> <?php // close connection mysql_close(); ?> I keep getting an error. Thank you!!!!

    Read the article

  • iPhone: How to write plist array of dictionary object

    - by Alessandro
    Hello, I'm a young Italian developer for the iPhone. I have a plist file (named "Frase") with this structure: Root Array - Item 0 Dictionary Frase String Preferito Bool - Item 1 Dictionary Frase String Preferito Bool - Item 2 Dictionary Frase String Preferito Bool - Item 3 Dictionary Frase String Preferito Bool exc. An array that contains many elements dictionary, all the same, consisting of "Frase" (string) and "Preferito" (BOOL). The variable "indirizzo", increase or decrease the click of the button Next or Back. The application interface: http://img691.imageshack.us/img691/357/schermata20100418a20331.png When I click on AddPreferito button, the item "Preferito" must be YES. Subsequently, the array must be updated with the new dictionary.The code: (void)addpreferito:(id)sender { NSString *plistPath = [[NSBundle mainBundle] pathForResource:@"Frase" ofType:@"plist"]; MSMutableArray *frase = [[NSMutableArray alloc] initWithContentsOfFile:plistPath]; NSMutableDictionary *dictionary = [frase objectAtIndex:indirizzo]; [dictionary setValue: YES forKey:@"Preferito"]; [frase replaceObjectAtIndex:indirizzo withObject:dictionary]; [frase writeToFile:plistPath atomically:YES]; } Why not work? Thanks Thanks Thanks!

    Read the article

  • Gomoku array-based AI-algorithm?

    - by Lasse V. Karlsen
    Way way back (think 20+ years) I encountered a Gomoku game source code in a magazine that I typed in for my computer and had a lot of fun with. The game was difficult to win against, but the core algorithm for the computer AI was really simply and didn't account for a lot of code. I wonder if anyone knows this algorithm and has some links to some source or theory about it. The things I remember was that it basically allocated an array that covered the entire board. Then, whenever I, or it, placed a piece, it would add a number of weights to all locations on the board that the piece would possibly impact. For instance (note that the weights are definitely wrong as I don't remember those): 1 1 1 2 2 2 3 3 3 444 1234X4321 3 3 3 2 2 2 1 1 1 Then it simply scanned the array for an open location with the lowest or highest value. Things I'm fuzzy on: Perhaps it had two arrays, one for me and one for itself and there was a min/max weighting? There might've been more to the algorithm, but at its core it was basically an array and weighted numbers Does this ring a bell with anyone at all? Anyone got anything that would help?

    Read the article

  • php variable scope in oop

    - by mr o
    Hi, I wonder if anyone can help out here, I'm trying to understand how use an objects properties across multiple non class pages,but I can't seem to be able to get my head around everything i have tried so far. For example a class called person; class person { static $name; } but i have a number of different regular pages that want to utilize $name across the board. I have trying things like this; pageone.php include "person.php"; $names = new Person(); echo person::$name; names::$name='bob'; pagetwo.php include "person.php"; echo person::$name; I can work with classes to the extent I'm OK as long as I am creating new instances every page, but how can make the properties of one object available to all, like a shared variable ? Thanks

    Read the article

  • PHP invalid image's and error handling

    - by Emdiesse
    Using PHP's Image and GD functions you can use the following method to finally output the php image imagepng($image); Sometimes, for whatever reason the image may not be displayed typically the error is not with the image but with the actual php functions not executing successfully. However this causes a blank image to be returned which doesn't help me. What I want to know is, is there a way to detect a blank or an invalid image and create a new image, write the errors to the new image using imagestring() and then display this new (debug) image instead. for example, a successfully displayed image with no errors: $image = imagecreate(256, 256); //create image imagecolortransparent($image, $BLUE); //set transparent imagefilledrectangle($image, 0, 0, 256, 256, $BLUE); //fill with 'transparent colour' //Draw a border round the image imageline($image, 0, 0, 0, 255, $Black); imageline($image, 0, 0, 255, 0, $Black); imageline($image, 255, 0, 255, 255, $Black); imageline($image, 0, 255, 255, 255, $Black); imagestring($image, 1, 10, 10, "I am an image!", $Black); imagepng($image); imagedestroy($image); but if I then introduce some errors in the php script that may or may not be to do with the actual image creation then the php script fails and the image will not be visible... $image = imagecreate(256, 256); //create image imagecolortransparent($image, $BLUE); //set transparent imagefilledrectangle($image, 0, 0, 256, 256, $BLUE); //fill with 'transparent colour' //Draw a border round the image imageline($image, 0, 0, 0, 255, $Black); imageline($image, 0, 0, 255, 0, $Black); imageline($image, 255, 0, 255, 255, $Black); imageline($image, 0, 255, 255, 255, $Black); imagestring($image, 1, 10, 10, "I am an image!", $Black); /* I am here to cause problems with the php script ** and cause the execution to fail, I am a function ** that does't exist... ** ** and I am missing a semi colon! ;)*/ non_existant_function() imagepng($image); imagedestroy($image); At this point I want to create a new image like above but in replacement of the I am an image! text I would put the actual error that has occured.

    Read the article

  • Calling Msbuild from Php - Wrong Codepage and Culture

    - by miasbeck
    I have a Php script that calls Msbuild via System: <?php system( "msbuild umlaut.proj" ); ?> This is the project file: <?xml version="1.0" encoding="UTF-8"?> <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="EchoUmlaut" ToolsVersion="3.5"> <Target Name="EchoUmlaut"> <Message Text="Umlaute: Ä Ö Ü ä ö ü ß" /> </Target> </Project> When I call Msbuild directly from the command line the output of msbuild is in German (as excpected) and the umlauts come out OK (I chcp to 1252). But when I use php to call msbuild the umlauts are wrong, and the output of msbuild is changed to English. I wonder what I can do to prevent this. C:\>chcp Aktive Codepage: 1252. C:\>msbuild umlaut.proj Microsoft (R)-Buildmodul, Version 3.5.30729.1 [Microsoft .NET Framework, Version 2.0.50727.3607] Copyright (C) Microsoft Corporation 2007. Alle Rechte vorbehalten. Das Erstellen wurde am 13.04.2010 08:57:04 gestartet. Projekt "D:\Cvsroot\projekte\e4elaui\v1.0\umlaut.proj" auf Knoten 0 (Standardziele). Umlaute: Ä Ö Ü ä ö ü ß Die Erstellung von Projekt "D:\Cvsroot\projekte\e4elaui\v1.0\umlaut.proj" ist abgeschlossen (Standardziele). Das Erstellen war erfolgreich. 0 Warnung(en) 0 Fehler Vergangene Zeit 00:00:00 C:\>php call_from_php.php Microsoft (R) Build Engine Version 3.5.30729.1 [Microsoft .NET Framework, Version 2.0.50727.3607] Copyright (C) Microsoft Corporation 2007. All rights reserved. Build started 13.04.2010 08:57:11. Project "D:\Cvsroot\projekte\e4elaui\v1.0\umlaut.proj" on node 0 (default targets). Umlaute: Ž ™ š „ ” á Done Building Project "D:\Cvsroot\projekte\e4elaui\v1.0\umlaut.proj" (default targets). Build succeeded. 0 Warning(s) 0 Error(s) Time Elapsed 00:00:00

    Read the article

  • How often are design patterns used in the workplace using PHP

    - by Metropolis
    Hey everyone, I read a book awhile back called PHP Design Patterns and Practice, and ever since then I have been using design patterns whenever I think they are needed. However it just occurred to me that maybe most companies do not use design patterns very often for PHP, or at all. What I was wondering is, do most companies use design patterns to help improve code flexibility? And if so, what are the best design patterns to learn for PHP? Thanks for any help on this, Metropolis

    Read the article

  • PHP SimpleXML recursive function to list children and attibutes

    - by Phill Pafford
    I need some help on the SimpleXML calls for a recursive function that lists the elements name and attributes. Making a XML config file system but each script will have it's own config file as well as a new naming convention. So what I need is an easy way to map out all the elements that have attributes, so like in example 1 I need a simple way to call all the processes but I don't know how to do this without hard coding the elements name is the function call. Is there a way to recursively call a function to match a child element name? I did see the xpath functionality but I don't see how to use this for attributes. Any ideas? Also does the XML in the examples look correct? can I structure my XML like this? Example 1: <application> <processes> <process id="123" name="run batch A" /> <process id="122" name="run batch B" /> <process id="129" name="run batch C" /> </processes> <connections> <databases> <database usr="test" pss="test" hst="test" dbn="test" /> </databases> <shells> <ssh usr="test" pss="test" hst="test-2" /> <ssh usr="test" pss="test" hst="test-1" /> </shells> </connections> </application> Example 2: <config> <queues> <queue id="1" name="test" /> <queue id="2" name="production" /> <queue id="3" name="error" /> </queues> </config> Pseudo code: // Would return matching process id getProcess($process_id) { return the process attributes as array that are in the XML } // Would return matching DBN (database name) getDatabase($database_name) { return the database attributes as array that are in the XML } // Would return matching SSH Host getSSHHost($ssh_host) { return the ssh attributes as array that are in the XML } // Would return matching SSH User getSSHUser($ssh_user) { return the ssh attributes as array that are in the XML } // Would return matching Queue getQueue($queue_id) { return the queue attributes as array that are in the XML } EDIT: Can I pass two parms? on the first method you have suggested @Gordon public function findProcessById($id, $name) { $attr = false; $el = $this->xml->xpath("//process[@id='$id']"); // How do I also filter by the name? if($el && count($el) === 1) { $attr = (array) $el[0]->attributes(); $attr = $attr['@attributes']; } return $attr; }

    Read the article

  • how to install posix in php

    - by Nizzy
    posix does not appear when I run php -m cmd, however, I see it from the phpinfo() –enable-posix=shared on Linux with Plesk 9. Basically, I can't use posix_*() functions as described at http://www.php.net/manual/en/ref.posix.php this shows doesn't exists: if (function_exists(‘posix_getuid’)) { echo “posix_getuid available”; } else { echo “posix_getuid not available”; // this prints in my server. } could someone show me how to install it? thank you [PHP Modules] bz2 calendar ctype curl date dbase dom exif fileinfo filter ftp gd geoip gettext gmp hash iconv imap ionCube Loader json libxml mbstring mcrypt memcache mhash mysql mysqli openssl pcntl pcre PDO pdo_mysql pdo_sqlite readline Reflection session shmop SimpleXML sockets SPL sqlite standard tokenizer wddx xml xmlreader xmlwriter xsl zip zlib

    Read the article

  • Traverse 2D Array (Matrix) Diagonally

    - by jonobr1
    So I found this thread that was extremely helpful in traversing an array diagonally. I'm stuck though on mirroring it. For example: var m = 3; var n = 4; var a = new Array(); var b = 0; for(var i = 0; i < m; i++) { a[i] = new Array(n); for(var j = 0; j < n; j++) { a[i][j] = b; b++; } } for (var i = 0; i < m + n - 1; i++) { var z1 = (i < n) ? 0 : i - n + 1; var z2 = (i < m) ? 0 : i - m + 1; for (var j = i - z2; j >= z1; j--) { console.log(a[j][i - j]); } } Console reads [[0],[4,1],[8,5,2],[9,6,3],[10,7],[11]] I'd like it to read [[8],[4,9],[0,5,10],[1,6,11],[2,7],[3]] Been stumped for awhile, it's like a rubik's cube _<

    Read the article

  • Text mining with PHP

    - by garyc40
    Hi, I'm doing a project for a college class I'm taking. I'm using PHP to build a simple web app that classify tweets as "positive" (or happy) and "negative" (or sad) based on a set of dictionaries. The algorithm I'm thinking of right now is Naive Bayes classifier or decision tree. However, I can't find any PHP library that helps me do some serious language processing. Python has NLTK (http://www.nltk.org). Is there anything like that for PHP? I'm planning to use WEKA as the back end of the web app (by calling Weka in command line from within PHP), but it doesn't seem that efficient. Do you have any idea what I should use for this project? Or should I just switch to Python? Thanks

    Read the article

  • PHP - can a method return a pointer?

    - by Kerry
    I have a method in a class trying to return a pointer: <?php public function prepare( $query ) { // bla bla bla return &$this->statement; } ?> But it produces the following error: Parse error: syntax error, unexpected '&' in /home/realst34/public_html/s98_fw/classes/sql.php on line 246 This code, however, works: <?php public function prepare( $query ) { // bla bla bla $statement = &$this->statement; return $statement; } ?> Is this just the nature of PHP or am I doing something wrong?

    Read the article

  • Twitter Oauth home timeline display with php

    - by Srinivas Tamada
    $hometime= $Twitter-get_statusesHome_timeline(); Fatal error: Uncaught exception 'Exception' with message 'SimpleXMLElement::__construct() expects parameter 1 to be string <?php include 'EpiCurl.php'; include 'EpiOAuth.php'; include 'EpiTwitter.php'; include 'key.php'; $Twitter = new EpiTwitter($consumerKey, $consumerSecret); $oauthToken='xxxxxxxxxxxxxxxxxxxxxxx'; $oauthSecret='xxxxxxxxxxxxxxxxxxxxxxxxx'; // user switched pages and came back or got here directly, stilled logged in $Twitter->setToken($oauthToken,$oauthSecret); $user= $Twitter->get_accountVerify_credentials(); echo "<img src=\"{$user->profile_image_url}\">"; echo "{$user->name}"; $hometime= $Twitter->get_statusesHome_timeline(); $twitter_status = new SimpleXMLElement($hometime); foreach($twitter_status->status as $status){ echo '<div class="twitter_status">'; foreach($status->user as $user){ echo '<img src="'.$user->profile_image_url.'" class="twitter_image">'; echo '<a href="http://www.twitter.com/'.$user->name.'">'.$user->name.'</a>: '; } echo $status->text; echo '<br/>'; echo '<div class="twitter_posted_at"><strong>Posted at:</strong> '.$status->created_at.'</div>'; echo '</div>'; } ?>

    Read the article

  • Intercept page request behind firewall return altered content with php and apache

    - by Matthew
    I'm providing free wifi service and need an ad to be added to all page requests. Currently I have a router forwarding all http requests to an apache server, which redirects all requests to an index.php page. The index.php page reads the request, fetches the content from the appropriate site, and edits the content to include the ad. The problem is that all images and css files etc. cannot be accessed, because when the browser tries to get the image <img src="site.com/image.jpg"> it's just redirected back to the index.php. I can change settings for the router (running dd-wrt) and the webserver (apache2 and php 5.2). Is there a solution that allows content to be edited before returning to the client, and allows css and images to be accessed?

    Read the article

  • Inversion of Control Container for PHP?

    - by George Mauer
    I am trying to code TDD style in PHP and one of my biggest stumbling blocks (other than lack of a decent IDE) is that I have to make my own hacked together IoC container just to inject all my mock objects properly. Has anyone used an Ioc container in php? All I've been able to find is PHP IOC on the ever-annoying phpclasses.org and it seems to have almost no documentation and not much of a following.

    Read the article

< Previous Page | 124 125 126 127 128 129 130 131 132 133 134 135  | Next Page >