ltwCalendar
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Codewalkers ForumsProjectsltwCalendar

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Codewalkers Forums Sponsor:
  #1  
Old August 11th, 2003, 03:49 PM
cflorig cflorig is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Mechanicsburg, PA 17055 USA
Posts: 31 cflorig User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 3
Apostrophe problem

Hi. I'm having trouble working with an apostrophe in my Event Title field. When I add a new event, and I enter an apostrophe in the Event Title field and submit, the calendar returns the item with a "'" (slash apostrophe) instead of just the apostrophe. It shows up this way in the event listing in the calendar layout and in the title field when I want to "update" the record. But yet, if I just click on the event item in the calendar and view the event in the popup window, the apostrophe is okay (no slash).

Any idea why this is happening? I know I can use the "&#146" instead, but this is confusing for non-web people to use.

Thanks!

Reply With Quote
  #2  
Old August 11th, 2003, 04:11 PM
opus006 opus006 is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 65 opus006 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 3
RE: Apostrophe problem

The next version will solve this problem (I'll send a note to Tom)

Use AddSlashes and StripSlashes before inserting into database

Reply With Quote
  #3  
Old August 11th, 2003, 04:43 PM
cflorig cflorig is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Mechanicsburg, PA 17055 USA
Posts: 31 cflorig User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 3
RE: Apostrophe problem

So it sounds like it's not something I have wrong, but something in the logic? I take it then, that it's not an easy fix.

But what do you mean by:
"Use AddSlashes and StripSlashes before inserting into database"?

Reply With Quote
  #4  
Old August 11th, 2003, 06:13 PM
opus006 opus006 is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 65 opus006 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 3
RE: Apostrophe problem

Look for addslashes in the file calendar.php
such as:
php Code:
Original - php Code
  1.  
  2. $calendar->addEvent(addslashes($_POST['eName']), $date, $start_time, $end_time, addslashes($_POST['eDescription']), $eRecur, $eDayEvent, $eCatId, $_REQUEST['updateit']);

and change it to:
php Code:
Original - php Code
  1.  
  2. $calendar->addEvent(mysql_escape_string(addslashes($_POST['eName'])), $date, $start_time, $end_time, mysql_escape_string(addslashes($_POST['eDescription'])), $eRecur, $eDayEvent, $eCatId,$_REQUEST['updateit']);


see the following for more details:
http://se.php.net/manual/en/function.mysql-escape-string.php
http://se.php.net/manual/en/function.addslashes.php

Reply With Quote
  #5  
Old August 11th, 2003, 06:27 PM
cflorig cflorig is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Mechanicsburg, PA 17055 USA
Posts: 31 cflorig User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 3
RE: Apostrophe problem

Thank you, thank you, thank you.

THANK YOU!

Reply With Quote
  #6  
Old August 13th, 2003, 11:50 AM
prrk47002 prrk47002 is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Pennsylvania
Posts: 275 prrk47002 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 3
RE: Apostrophe problem

Actually, since the title gets put in the database properly escaped, the problem is more likely a missing stripslashes() in the display() and edit() functions in the file ltw_classes.php.


As far as adding mysql_escape_string() calls to where the data gets written seems redundant from the two links opus provided. Plus, you have now moved db specific functions out of the ltwDb class and into the main code, making it much harder to add another db driver (if anyone is so inclined).

Reply With Quote
  #7  
Old August 13th, 2003, 01:04 PM
cflorig cflorig is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Mechanicsburg, PA 17055 USA
Posts: 31 cflorig User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 3
RE: Apostrophe problem

Thanks, prrk47002.
Can you tell me "exactly" what the syntax is that I should add to the display() and edit() functions? And where would I put it?

Reply With Quote
  #8  
Old August 14th, 2003, 12:39 AM
prrk47002 prrk47002 is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Pennsylvania
Posts: 275 prrk47002 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 3
RE: Apostrophe problem

wherever you see an echo statement that includes $row['name'] or $row['description'], surround them with stripslashes(). ie stripslashes($row['name'])

wherever the values are gettting put in an SQL query, use addslashes() in a similar manner.

Or wait a week or so for V4 of the calendar.....

Reply With Quote
  #9  
Old August 15th, 2003, 02:14 PM
cflorig cflorig is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Mechanicsburg, PA 17055 USA
Posts: 31 cflorig User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 3
RE: Apostrophe problem

Thanks, prrk47002.
That works just fine for me. I'm new to PHP and database stuff, but I'm learning boatloads thanks to you guys.

Reply With Quote
  #10  
Old August 22nd, 2003, 12:29 AM
prrk47002 prrk47002 is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Pennsylvania
Posts: 275 prrk47002 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 3
RE: Apostrophe problem

No problem.
I was new to PHP & MySql until I needed a calendar for my web site and found ltwCalendar. Then I wanted a little change like color coded categories and Matt said "Go ahead". That's how V3 was born. Then I wanted user accounts and Matt said "Go ahead!" 21 new features later, V4 is soon to be unleashed upon the world.

(And V4.1 just behind it adding a list view, better DB use in the month display, password aging & db cleanup interface)


Reply With Quote
Reply

Viewing: Codewalkers ForumsProjectsltwCalendar > Apostrophe problem


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump




 Free IT White Papers!
 
Create the Optimal Architecture for your Critical Applications
Warburton's the largest independently owned bakery in the UK faced a number of difficult challenges in providing the most robust yet efficient IT infrastructure for their organization's success. IBM's services combined with their xSeries servers created the perfect platform for their SAP environment with sufficient flexibility, and did so in very time effective fashion.

Request Your Free Technology Downloads!
 
Five Best Practices for Deploying a Successful Service-Oriented Architecture
This white paper describes the benefits you can expect with SOA, and how IBM can help take your business there.

Request Your Free Technology Downloads!
 
Gartner Magic Quadrant for Application Delivery Controllers
Gartner summarizes its view on Application Delivery Controllers, evaluates strengths and weaknesses of solutions, and provides Magic Quadrant reporting for a quick comparison across all vendors. Learn from Gartner how you can benefit from an all-in-one device like Citrix NetScaler that delivers the highest levels of availability, performance and security.

Request Your Free Technology Downloads!
 
Knowledge is Power
What you don't know can hurt you, and is likely costing you money and increasing your security risks during an era of scarce resources. This white paper proposes six key strategies that enterprise security managers can use to improve their network defense posture.

Request Your Free Technology Downloads!
 
Rationalizing the Multi-Tool Environment
The rationalized multi-tool approach is flexible, scalable and cost effective. It provides the necessary input to the IT service management business processes. It preserves prior investments in monitoring tools, empowers technologists to select the best tools with which to do their jobs, and enhances effective response to incidents.

Request Your Free Technology Downloads!
 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 




© 2003-2010 by Developer Shed. All rights reserved. DS Cluster 7 Hosted by Hostway
For more Enterprise Application Development news, visit eWeek