139 Posted Topics

Member Avatar for Joe34

As always it is best to do it yourself. However, this is one easy way that is recommended by Zend: [URL="http://www.zend.com/en/products/server-ce/"]Zend Server CE[/URL].

Member Avatar for Joe34
0
108
Member Avatar for bops
Member Avatar for klemmerj
0
134
Member Avatar for arctushar

That's more or less how most people do it. Just be careful not to ever echo out your password while debugging :) You could just establish the connection within the include too. Saves you the trouble of having to always do that elsewhere.

Member Avatar for madCoder
0
60
Member Avatar for happygeek

[QUOTE=Graphix;1334975]The book sounds like it has some good information on how to create web applications on the large-scale, but why is there a dog on the cover? Just wondering...;)[/QUOTE] :) O'Reilly technical books always have some animal on the cover. No rhyme or reason to it that I've ever figured …

Member Avatar for Devendra_WIPRO
0
500
Member Avatar for BaSk

Before tackling the code, I have a question about your database schema. It seems that you have a category row for (potentially) every quote? I notice you store the quote id within the category record instead of the other way around. Often this is done with a bridge table -- …

Member Avatar for BaSk
0
120
Member Avatar for lit108

The result sets are always an array. Even if it contains one column. A couple minor changes are needed: [CODE] $productCountSql = "SELECT COUNT(*) as rowcount FROM products WHERE `user_id` = '" . $_SESSION['user_id'] . "'"; $productCountResult = mysql_query($productCountSql); $countProducts = mysql_fetch_assoc($productCountResult); echo "<tr><td>Products uploaded:</td><td>{$countProducts['rowcount']} products</td></tr>"; [/CODE] In the sql …

Member Avatar for lit108
0
94
Member Avatar for shoucate

The book you are using may be old. It relies on a very old, deprecated method called 'register globals.' With register globals, form input field names were automagically converted into global variables of the same name. That technique turned out to be a real security headache though and is not …

Member Avatar for shoucate
0
108
Member Avatar for shenbagam

hielo's example is actually calling itself (see the url in line 20) to retrieve and display the images. The loop that displays all the images is just there as a proof of concept. In practice, the second half (no id was passed) should return an http 404 error: [ICODE]header("HTTP/1.1 404 …

Member Avatar for hielo
0
114
Member Avatar for nduarte

You are concerned that a user can alter the url to retrieve records they are not meant to access. Sessions are probably only a piece of the solution for you. You will need to pass a key in the request for the record. I think we need a better sense …

Member Avatar for Will Gresham
0
2K
Member Avatar for ankit.pandey3

You are getting a syntax error in the query. Echo the query out so you can see what it contains. Also, you must scrub information being put into the database. Some characters need '[B]escaping[/B]' or you will either get a syntax error or you risk exposing your database to a …

Member Avatar for madCoder
0
155
Member Avatar for ppetree

You are trying to refer to numeric keys in an associative array. If you run this script with error_reporting(E_ALL) turned on, you'll see notice messages like this: [ICODE]Notice: Undefined offset: 0 in C:\www\webroot\DaniWeb\arraytest.php on line 10[/ICODE] For an associative array, use [COLOR="Green"]foreach[/COLOR] instead. [CODE=php] <?php $geo_addr = array("number"=>1600, "zip"=>34208, "suffix"=>'', …

Member Avatar for ppetree
0
197
Member Avatar for Cool&Awesome

For learning OOP with PHP I highly recommend [URL="http://www.amazon.com/Objects-Patterns-Practice-Experts-Source/dp/143022925X/ref=sr_ob_6?ie=UTF8&s=books&qid=1290976833&sr=8-6"]PHP 5 Objects, Patterns, and Practice[/URL] by Matt Zandstra. I read the first edition of this book and learned a LOT about OOP. The MVC pattern is discussed in the book.

Member Avatar for diafol
0
291
Member Avatar for Sorcher

You can do this directly in the sql so you never receive unactivated users. [CODE=sql] SELECT `loginid`, `username`, `website`, `disabled` FROM `login` WHERE activated = 1 ORDER BY `loginid` [/CODE] In your query you also reference a 'disabled' column. So assuming that disabled gets set to '1' when a user …

Member Avatar for Sorcher
0
93
Member Avatar for rolandrogers

I've run into problems with Daylight Saving Time in the past. Your method of adding 86400 as 1 day in seconds breaks down when it crosses a daylight savings boundary. To further complicate things, date functions in PHP rely very heavily on the operating system hosting them and some OSs …

Member Avatar for rolandrogers
0
138
Member Avatar for radovanov

This matches a sentence as you've defined it. It will also match across multiple lines: [CODE=php] <?php $rx = '/\b[A-Z].*[\.?!]/msU'; $testPhrases = "Alas, can I put time in a bottle? The quick brown \nfox jumps over the lazy dog. Sally \nsells seashells by the seashore."; $arFound = array(); $count = …

Member Avatar for radovanov
0
118
Member Avatar for GreaseJunkie

You can use a switch statement to get the body of the text. If the body will be static, you can use file_get_contents to read in a text file into a string variable like this: [CODE=php] <?php ... $type = $_POST['type']; switch($type) { case 'intro': $body = file_get_contents('email/intro.txt', true); break; …

Member Avatar for GreaseJunkie
0
241
Member Avatar for Clarkeez

You can write a simple function to do this. I use something like this: [CODE=php] function dbNull($value) { if(empty($value)) { return 'NULL'; } else { return "'".mysql_real_escape_string($value)."'"; } } // and you apply it like this: $add_proc = mysql_query(" INSERT INTO `proc` (active, title, desc, notes, link, tags1, tags2, tags3) …

Member Avatar for Clarkeez
0
100
Member Avatar for designershiv

Your sql query has a syntax error in it. There should be a space after *: [CODE=php]$news_sql=mysql_query( "SELECT * FROM latestnews WHERE id = '$show' ");[/CODE]

Member Avatar for nonshatter
0
491
Member Avatar for lili.edryana

Are the columns seperated by spaces or tabs? If they are tabs, explode by "\t" instead of space. Flat files like that are often tab separated. If the separator is not a tab, then this is a "fixed column width" text file (sort of, see below.) You will have to …

Member Avatar for lili.edryana
0
463
Member Avatar for gunnarflax

As long as $var1 and $var2 are primitive types and not objects, then $var2 is not a pointer to $var1 (however, I have read that PHP will store it internally with a pointer until the value of $var2 is changed to something else.) If you need $var2 to be a …

Member Avatar for gunnarflax
0
101
Member Avatar for Puster

On line 11: [ICODE]$check = mysql_query("SELECT * FROM upload_file WHERE name='$name'");[/ICODE] Is $name being set to anything outside the script snippet you posted? On line 20 [icode]$allowedExtensions=='png'[/icode] will NEVER be true. $allowedExtensions is an array, not a string. Use a function like basename() or pathinfo() to get the filename extension. …

Member Avatar for madCoder
0
132
Member Avatar for Awah Mohamed

Using phpMyAdmin it generates this: [CODE=mysql] CREATE TABLE `news` ( `id` INT( 11 ) NOT NULL AUTO_INCREMENT PRIMARY KEY , `title` VARCHAR( 250 ) NOT NULL , `news` TEXT NOT NULL ) ENGINE = InnoDB COMMENT = 'For DaniWeb user The Prince Awah'; [/CODE]

Member Avatar for chrishea
0
101
Member Avatar for dfaulted

The complaint about $result is that you are appending to an uninitialized variable. $result could be initialized early in the function to an empty string for example. [iCODE]$result='';[/iCODE] I don't use list() very often so not sure about the other notices. Seems like "offset 1" would be the second element …

Member Avatar for mschroeder
0
281
Member Avatar for george61

Try losing the the single quotes around $construct. Instead you want to prepend the SELECT statement right? [CODE=php] $construct = "SELECT * FROM search WHERE $construct"; [/CODE]

Member Avatar for george61
0
186
Member Avatar for timpogue

Sounds like you want a [I]regular expression[/I]. A regular expression lets you do pretty sophisticated pattern matching. However, be warned that they can be slow. [CODE=php] <?php $incomingString = 'Hi, my name is John Doe'; $rxIntroduction = '/HI,? MY NAME IS ([\w ]+)\.?/i'; $matches = array(); // preg_match() : http://php.net/manual/en/function.preg-match.php …

Member Avatar for edwinhermann
0
142
Member Avatar for pearll

Set up your link something like this... [CODE=php] <a href="update.php?emailid=<?=$rows['emailid']?>">Edit</a> [/CODE] Update.php then displays a form and handles the edit on a submit.

Member Avatar for pearll
0
205
Member Avatar for brown23

[CODE=php] if ($ua="HelloWorld") [/CODE] You are using an assignment operator '=' instead of a comparison of equality '=='. [CODE=php] if ("HelloWorld" == $ua) { // do stuff } [/CODE]

Member Avatar for Stefano Mtangoo
0
91
Member Avatar for Awah Mohamed

Looks like you downloaded the Source Code. Download the Windows binary version which comes as an installer. [URL="http://apache.cs.utah.edu/httpd/binaries/win32/"]http://apache.cs.utah.edu/httpd/binaries/win32/[/URL] httpd-2.2.16-win32-x86-no_ssl.msi --- .msi is a Windows extension indicating an installer. You can have it install Apache Web Server as a service that runs automatically upon start-up. You can turn it on and …

Member Avatar for madCoder
0
93
Member Avatar for Kieran Y5

[QUOTE=Kieran Y5;1343178]Hi, I am currently creating a CMS which will allow PHP code to be used but I need to make sure that certain functions are not used that can ruin the CMS. ... Is there any way of solving this problem??[/QUOTE] Are you using the eval() function to execute …

Member Avatar for Kieran Y5
0
93
Member Avatar for a1suria

MySQL does offer [URL="http://dev.mysql.com/doc/refman/5.0/en/fulltext-search.html"]FULL-TEXT search[/URL] capabilities. What you describe sounds similar to that. It lets you search on strings, including multiple columns and returns a 'relevance' with each row. Hope that helps.

Member Avatar for a1suria
0
2K
Member Avatar for design.eng

If I understand your question/problem correctly, you say the session isn't being initialized. I don't see anything wrong with how you are doing it, unless tp_ser isn't being passed in. I see you are manipulating the form fields by hiding unused ones. Something may not be getting posted. To debug, …

Member Avatar for design.eng
0
141
Member Avatar for dwssassin

It's the single quotes around the variable $tz. [code=php] new DateTimeZone('$tz') // should be new DateTimeZone("$tz") [/code]

Member Avatar for dwssassin
0
110
Member Avatar for Bar2aYunie

[QUOTE=Bar2aYunie;1305395]Can anybody help me out here plz?[/QUOTE] Could you post the database schema for the table you are working with? It might make it easier to see what you want. If I read your question right, you could use SQL to do the selection of lowest or highest value for …

Member Avatar for Bar2aYunie
0
129
Member Avatar for Smudly

It looks like you are not formatting the additional_headers (from email) correctly. See example 2 at: [url]http://php.net/manual/en/function.mail.php[/url]

Member Avatar for madCoder
0
87
Member Avatar for aneeka

Aneeka, The usual pattern for this is to break it up into two pages. One is a list of employees that displays the data in a report. A link stores the key for each record and points to an edit form where a single employee record is edited. (That's the …

Member Avatar for madCoder
0
79
Member Avatar for fasharlht

You can't combine checkboxes within a select list. HTML just doesn't work that way. However, the effect would be the same a MULTIPLE selection box. See [URL="http://www.w3schools.com/tags/att_select_multiple.asp"]HTML <select> multiple Attribute[/URL] for details. This will let a user Ctrl-click (or Cmd-click on Mac) multiple choices from a select list. Since you …

Member Avatar for madCoder
0
596
Member Avatar for Chosen13

Most systems I have worked with test for a valid session with every call to a member's only section of a website. This includes RESTful scripts that should only be accessed by logged in users. If the session doesn't pass your validity test, redirect them to a login page. Basically, …

Member Avatar for metalix
0
125
Member Avatar for YousefAB

When you loop over the DirectoryIterator object it is returning DirectoryIterator objects, not strings containing filenames. At the end of your script add a line like this: [CODE]echo "<pre>".print_r($fileNames,true)."</pre>";[/CODE] print_r will show you what $fileNames contains. You can use the [B]getFilename()[/B] method to get the filename and store it into …

Member Avatar for YousefAB
0
1K
Member Avatar for lwaterfo

It sounds like you are setting a multiple page form/wizard. You can display the id to the user using something like this: [CODE] <!-- Page 2 of form. --> <form action="something.php" method="post" > <input type="hidden" name="id" value="<?php echo $_POST['id'];?>" /> <label>ID:</label> <?php echo $_POST['id'];?> <label for="more_info">More Info:</label><textarea name="more_info" id="more_info"></textarea> ... …

Member Avatar for lwaterfo
0
161

The End.