PHP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming LanguagesPHP Development

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 Dev Shed Forums Sponsor:
  #1  
Old March 1st, 2013, 05:16 AM
jonnyfreak jonnyfreak is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2012
Posts: 69 jonnyfreak User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 17 h 56 m 42 sec
Reputation Power: 1
Event calender link to checkout not working

i have an event calendar from Kubelabs that i have adapted. The calander is working fine and when you select event it takes you to the detail page and this shows the correct event based on the filtering the event_id

but the problem i am having is i have a query thats send the event to the shopping cart but it is not selecting the correct variable. I dont know how to say i want the variable that has been passed by the calander - event_id='$_GET[id]' i beleive

PHP Code:
<?
require_once("includes/config.php");
$db_connection mysql_connect ($DBHost$DBUser$DBPass) OR die (mysql_error()); 
$db_select mysql_select_db ($DBName) or die (mysql_error());
$db_table $TBL_PR "events";
 
 
$query "SELECT * FROM $db_table WHERE event_id='$_GET[id]' LIMIT 1";
$query_result mysql_query ($query);
while (
$info mysql_fetch_array($query_result)){
    
$date date ("l, jS F Y"mktime(0,0,0,$info['event_month'],$info['event_day'],$info['event_yea r']));
    
$time_array split(":"$info['event_time']);
    
$time date ("g:ia"mktime($time_array['0'],$time_array['1'],0,$info['event_month'],$info ['event_day'],$info['event_year']));
?>
<?
//  *** Add item to Shopping Cart via link ***
$XC_AddLink1 $_SERVER["PHP_SELF"];
if (!isset(
$XC_newQS) || $XC_newQS == "") {
  
$XC_AddLink1 .= "?XC_AddId1=";
} else {
  
$XC_AddLink1 .= "?" $XC_newQS "&XC_AddId1=";
}
$XC_uniqueCol1="event_id";
if (isset(
$_GET["XC_AddId1"])) {
  
$NewRS=mysql_query($query_rsEvent$lotties) or die(mysql_error());
  
$ln "1";
  
$XC_rsName="rsEvent";
  
$XC_uniqueCol "XC_uniqueCol$ln";
  
$XC_redirectTo "../already-added.php";
  
$XC_AddViaLinkRedirect "../shopping-cart.php";
  
$XC_BindingTypes=array("RS","LITERAL","RS","RS","NONE");
  
$XC_BindingValues=array("event_id","1","event_title","event_price","" );
  
$XC_BindingLimits=array("","","","","");
  
$XC_BindingSources=array("","","","","");
  
$XC_BindingOpers=array("","","","","");
  require_once(
'XCInc/AddToXCartViaLink.inc');
}
?>


i think i need to tell the

PHP Code:
 $XC_uniqueCol1="event_id";
to use the  event_id='$_GET[id]' 


in order to pass the correct information

i should also include the fact that the // *** Add item to Shopping Cart via link *** is getting its information from a different SQL

PHP Code:
 mysql_select_db($database_lot$lot);
$query_rsEvent sprintf("SELECT * FROM calendar_events WHERE event_title = %s"GetSQLValueString($colname_rsEvent"text"));
$rsEvent mysql_query($query_rsEvent$lotties) or die(mysql_error());
$row_rsEvent mysql_fetch_assoc($rsEvent);
$totalRows_rsEvent mysql_num_rows($rsEvent); 


i have tried

PHP Code:
 $XC_uniqueCol1="$_GET[id]"


i have tried this in different variants but it returns an empty results

if i leave it as it was i sends the first record in the database to the cart

http://site.com/beta/kubelabs/event.php?id=14&XC_AddId1=13

id 13 being the first record in the DB

PHP Code:
 $XC_AddLink1 $_SERVER["PHP_SELF"];
if (!isset(
$XC_newQS) || $XC_newQS == "") {
  
$XC_AddLink1 .= "?XC_AddId1=";
} else {
  
$XC_AddLink1 .= "?" $XC_newQS "&XC_AddId1=";
}
$XC_uniqueCol1="event_id";
if (isset(
$_GET["XC_AddId1"])) {
  
$NewRS=mysql_query($query_rsEvent$lotties) or die(mysql_error());
  
$ln "1";
  
$XC_rsName="rsEvent";
  
$XC_uniqueCol "XC_uniqueCol$ln";
  
$XC_redirectTo "../already-added.php";
  
$XC_AddViaLinkRedirect "../shopping-cart.php";
  
$XC_BindingTypes=array("RS","LITERAL","RS","RS","NONE");
  
$XC_BindingValues=array("event_id","1","event_title","event_price","" );
  
$XC_BindingLimits=array("","","","","");
  
$XC_BindingSources=array("","","","","");
  
$XC_BindingOpers=array("","","","","");
  require_once(
'XCInc/AddToXCartViaLink.inc');




if i replace the
PHP Code:
 $XC_uniqueCol1="event_id"

with
PHP Code:
 $XC_uniqueCol1="$_GET[id]"

it returns an empty result

http://site.com/beta/kubelabs/event.php?id=14&XC_AddId1=


can anyone see where i am going wrong?

thanks in advance

Reply With Quote
  #2  
Old March 1st, 2013, 06:03 AM
Jacques1's Avatar
Jacques1 Jacques1 is offline
pollyanna
Dev Shed Regular (2000 - 2499 posts)
 
Join Date: Jul 2012
Location: Germany
Posts: 2,033 Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level) 
Time spent in forums: 1 Month 2 Weeks 6 Days 20 h 57 m 29 sec
Reputation Power: 812
Hi,

I'm sorry to tell you, but the code you've downloaded isn't good.

It's vulnerable to both SQL and JavaScript injections, the MySQL library is hopelessly outdated (since 10 years, by the way), and some things are just nonsense like printing each day of the month separately or fetching a single row with a while loop or the infamous "... or die (mysql_error())". And last but not least: The code is abandoned since 2 years.

Unless you've already invested hundreds of hours of work into this stuff, I'd simply throw it away and look for a better library, hire someone or write it yourself.

Be aware that a lot of these "code for free" sites have very bad and unsecure code. So don't use anything you've found somewhere on the Internet. At least have somebody who knows PHP have a look at it.

Good code is more likely to be found in active projects on professional sites like GitHub.

Reply With Quote
  #3  
Old March 1st, 2013, 06:13 AM
jonnyfreak jonnyfreak is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2012
Posts: 69 jonnyfreak User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 17 h 56 m 42 sec
Reputation Power: 1
oh really, thats not good, i was hoping that it was an easy fix...

Reply With Quote
  #4  
Old March 1st, 2013, 06:31 AM
jonnyfreak jonnyfreak is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2012
Posts: 69 jonnyfreak User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 17 h 56 m 42 sec
Reputation Power: 1
ok say i build my own. the only thing i dont know how to do is build a calander. I know how to create the events i just need to build a calander that shows the title of the events in the correct date.

any ideas

Reply With Quote
  #5  
Old March 1st, 2013, 08:03 AM
Jacques1's Avatar
Jacques1 Jacques1 is offline
pollyanna
Dev Shed Regular (2000 - 2499 posts)
 
Join Date: Jul 2012
Location: Germany
Posts: 2,033 Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level) 
Time spent in forums: 1 Month 2 Weeks 6 Days 20 h 57 m 29 sec
Reputation Power: 812
Start off by making a simple calendar with one box for each day. Use the DateTime class for that, don't fumble with low-level functions like strtotime().

After that, select all events of the calendar range and order them by date. Loop through the days of the calendar, and for each day, fetch all rows from the result set for that day. Note that the last fetched event of each day can belong to a later date, because you have to fetch an event before you can check if it even is on that date. So you have to check the last event again on the next day.

The basic logic looks like this:
Code:
events :=
	sql("
		SELECT
			title
			, date
		FROM
			events
		WHERE
			(date in calendar range)
		ORDER BY
			date ASC
	")

event := null
for current_date in calendar:
	print(current_date)
	if event = null or event.date = current_date:
		if event = null
			event := next(events)
		while event != null and event.date = current_date:
			print(event.title)
			event := next(events)


Selecting the events for each day separately would be a bad idea, because this would result in many, many unnecessary database queries.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPHP Development > Event calender link to checkout not working

Developer Shed Advertisers and Affiliates



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

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


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap