Jump to content

sassenach

Members
  • Posts

    32
  • Joined

  • Last visited

    Never

Everything posted by sassenach

  1. I have a site which I am working on (www.agilitegear.com). I already implemented UPS & USPS (domestic only) shipping, but now I have a problem with USPS International shipping. This is my usps script: <?php // This script was written by Mark Sanborn at http://www.marksanborn.net // If this script benefits you are your business please consider a donation // You can donate at http://www.marksanborn.net/donate. function USPS($isInt, $pounds, $ounces, $service, $dest_zip, $country, $length, $width, $height, $stotal, $pobox, $isgift, $long_country) { // ========== CHANGE THESE VALUES TO MATCH YOUR OWN =========== $userName = '542AGILI4002'; $orig_zip = '50665'; // =============== DON'T CHANGE BELOW THIS LINE =============== /* FIRST CLASS PRIORITY EXPRESS BPM PARCEL MEDIA LIBRARY ALL */ //NOTES : If First Class is selected, package cannot weigh more than 13 ounces. //NOTES : Maximum USPS package size is 70 pounds 0 ounces. $url = "http://production.shippingapis.com/ShippingAPI.dll"; $ch = curl_init(); // set the target url curl_setopt($ch, CURLOPT_URL,$url); curl_setopt($ch, CURLOPT_HEADER, 1); curl_setopt($ch,CURLOPT_RETURNTRANSFER,1); // parameters to post curl_setopt($ch, CURLOPT_POST, 1); //YF if($service=='FIRST CLASS') { $fctype="<FirstClassMailType>PARCEL</FirstClassMailType>"; } //$fctype = ($service=='FIRST CLASS') ? "<FirstClassMailType>PARCEL</FirstClassMailType>":''; $fctype = "<FirstClassMailType>PARCEL</FirstClassMailType>"; //international delivery only if($isInt && $country!='US'){ //<Machinable>false</Machinable> /*$data = "API=IntlRate&XML= <IntlRateRequest USERID=\"$userName\"> <Package ID=\"1ST\"> <Pounds>$pounds</Pounds> <Ounces>$ounces</Ounces> <MailType>Package</MailType> <GXG> <Length>$length</Length> <Width>$width</Width> <Height>$height</Height> <POBoxFlag>$pobox</POBoxFlag> <GiftFlag>$isgift</GiftFlag> </GXG> <ValueOfContents>$stotal</ValueOfContents> <Country>$long_country</Country> </Package> </IntlRateRequest>";*/ $data = "API=IntlRate&XML= <IntlRateRequest USERID=\"$userName\"> <Package ID=\"1ST\"> <Prohibitions>An issue of a publication in which more than 5 pe<!--1901 skipped-->.</Prohibitions> <Restrictions>The maximum value of a GXG shipment to CANADA is <!--2134 skipped-->.</Restrictions> <Observations>1. Banknotes valued at $100 or more must be put u<!--3374 skipped-->.</Observations> <CustomsForms>First-Class Mail International items and Priority<!--150 skipped-->)</CustomsForms> <ExpressMail>Country Code:CAReciprocal Service Name: There is <!--1281 skipped-->l</ExpressMail> <AreasServed>Please reference Express Mail for Areas Served.</AreasServed> <Service ID=\"1\"> <Pounds>4</Pounds> <Ounces>3</Ounces> <MailType>Package</MailType> <Country>JAPAN</Country> <Postage>101.00</Postage> <ValueOfContents>250.00</ValueOfContents> <Insurance>2.00</Insurance> <SvcCommitments>1 - 3 Days</SvcCommitments> <SvcDescription>Global Express Guaranteed (GXG)</SvcDescription> <MaxDimensions>Max. length 46\", width 35\", height 46\" and max. l<!--29 skipped-->\"</MaxDimensions> <MaxWeight>70</MaxWeight> </Service> </Package> </IntlRateRequest>"; } else { $data = "API=RateV3&XML= <RateV3Request USERID=\"$userName\"> <Package ID=\"1ST\"> <Service>$service</Service> <FirstClassMailType>PARCEL</FirstClassMailType> <ZipOrigination>$orig_zip</ZipOrigination> <ZipDestination>$dest_zip</ZipDestination> <Pounds>$pounds</Pounds> <Ounces>$ounces</Ounces> <Size>REGULAR</Size> <Machinable>TRUE</Machinable> </Package> </RateV3Request>"; } // send the POST values to USPS curl_setopt($ch, CURLOPT_POSTFIELDS,$data); //echo '<br/><br/>-- '. $data. ' -- <br/>'; // Uncomment to show XML in comments $result=curl_exec ($ch); $data = strstr($result, '<?'); $xml_parser = xml_parser_create(); xml_parse_into_struct($xml_parser, $data, $vals, $index); xml_parser_free($xml_parser); $params = array(); $level = array(); $rate=0; foreach ($vals as $xml_elem) { //print_r($xml_elem); /*if(isset($xml_elem['tag']) && eregi('error', strtolower($xml_elem['tag']))){ echo 'has error, do not proceed<br/>'; } */ if(isset($xml_elem['tag']) && eregi('rate', strtolower($xml_elem['tag'])) && isset($xml_elem['value'])){ $rate = $xml_elem['value']; } /* if ($xml_elem['type'] == 'open') { if (array_key_exists('attributes',$xml_elem)) { list($level[$xml_elem['level']],$extra) = array_values($xml_elem['attributes']); } else { $level[$xml_elem['level']] = $xml_elem['tag']; } } if ($xml_elem['type'] == 'complete') { $start_level = 1; $php_stmt = '$params'; while($start_level < $xml_elem['level']) { $php_stmt .= '[$level['.$start_level.']]'; $start_level++; } $php_stmt .= '[$xml_elem[\'tag\']] = $xml_elem[\'value\'];'; eval($php_stmt); } */ } curl_close($ch); //echo '<pre>'; print_r($params); echo'</pre>'; // Uncomment to see xml tags /* $i=1; while($i < 15) { if($params['RATEV3RESPONSE']['1ST']["$i"]['RATE']=='') { $i++; } else { return $params['RATEV3RESPONSE']['1ST']["$i"]['RATE']; break; } } */ return $rate; } ?> i keep on getting an error with $0 value. Has anyone done this before with USPS international shipping? thanks in advance.
  2. thank you sooo much. that line had an extra "?", i removed it and it worked!!! thanks again. i will go over the site again to make sure all the links work.
  3. i also attached the header that deals with the mod write. <?php # header.html date_default_timezone_set('America/Toronto'); ob_start(); session_start(); echo ' <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <title>Women\'s Health in Women\'s Hands</title> <meta name="description" content="" /> <meta name="keywords" content="" /> <link rel="stylesheet" type="text/css" media="screen" href="/includes/layout.php" /> <script language="javascript" type="text/javascript" src="/includes/functions.js"></script> <script language="javascript" type="text/javascript" src="/backend/includes/progress_bar.js"></script>'; ?> <!--[if IE 6]> <style type="text/css"> .menuTitleStrip{ clear:both; float:left; margin: 0px; background: url('/images/menu/menu_0_off.jpg') no-repeat; width:80px; font-family:arial; height:113px; border:0px solid red; } .subMenuDiv a{ float:right; color:#f6f6f6; font-size:13px; text-decoration:none; /*word-wrap: break-word;*/ padding:11px 4px 5px 3px; border:0px solid red; } </style> <![endif]--> <?php echo '</head>'; require_once ('includes/config.inc.php'); require_once ('includes/functions.inc.php'); require_once ('includes/mysql_connect.php'); require_once ('includes/header_params.php'); echo '<body'.$homeOnload.'> <table width="996" border="0" cellpadding="0" cellspacing="0" align="center"><tr><td class="bgImage" valign="top"> <div id="outterBox"> <div id="logoBox" onclick="javascript:goToUrl(\'/index.php\');" title="Home">'; if($mid==1){ echo '<div id="logo" class="logo"><img src="'.$site_url.'images/logo1.gif" border="0" alt="" /><img src="'.$site_url.'images/logo2.gif" id="logoimg" border="0" alt="" /></div>'; echo '<script language="javascript" type="text/javascript">window.onload = function() {initImage()}</script>'; } else { echo '<div id="logo" class="logo"><img src="'.$site_url.'images/logo.gif" border="0" id="logoimg" alt="" /></div>'; echo '<script language="javascript" type="text/javascript">document.getElementById(\'logoimg\').style.visibility = "visible";</script>'; } echo '</div> <div id="mainMenuBox">'; if($mid=={$isOn8 = '/images/menu/menu_ylw_on.jpg';} else {$isOn8 = '/images/menu/menu_ylw_off.jpg';} if($mid==1){$isOn1 = '/images/menu/menu_purple_on.jpg';} else {$isOn1 = '/images/menu/menu_purple_off.jpg';} if($mid==2){$isOn2 = '/images/menu/menu_brown_on.jpg';} else {$isOn2 = '/images/menu/menu_brown_off.jpg';} if($mid==3){$isOn3 = '/images/menu/menu_org_on.jpg';} else {$isOn3 = '/images/menu/menu_org_off.jpg';} if($mid==4){$isOn4 = '/images/menu/menu_beige_on.jpg';} else {$isOn4 = '/images/menu/menu_beige_off.jpg';} if($mid==10){$isOn10 = '/images/menu/menu_rust_on.jpg';} else {$isOn10 = '/images/menu/menu_rust_off.jpg';} if($mid==5){$isOn5 = '/images/menu/menu_grey_on.jpg';} else {$isOn5 = '/images/menu/menu_grey_off.jpg';} if($mid==7){$isOn7 = '/images/menu/menu_green_on.jpg';} else {$isOn7 = '/images/menu/menu_green_off.jpg';} if($mid==6){$isOn6 = '/images/menu/menu_pink_on.jpg';} else {$isOn6 = '/images/menu/menu_pink_off.jpg';} if($mid==9){$isOn9 = '/images/menu/menu_burg_on.jpg';} else {$isOn9 = '/images/menu/menu_burg_off.jpg';} ?> <!-- YELLOW - LOGIN - 8--> <div id="menu_8" class="menuButton" onmouseover="javascript:changeMenuImage(8,'/images/menu/menu_ylw_on.jpg',1);" onmouseout="javascript:changeMenuImage(8,'<?php echo $isOn8; ?>',0);" onclick="javascript:goToUrl('<?php echo $site_url; ?>login/');" style="width:89px;background: url('<?php echo $isOn8; ?>') no-repeat;"><img src="/images/spacer.gif" border="0" alt="" /></div> <!-- PURPLE - HOME - 1--> <div id="menu_1" class="menuButton" onmouseover="javascript:changeMenuImage(1,'/images/menu/menu_purple_on.jpg',1);" onmouseout="javascript:changeMenuImage(1,'<?php echo $isOn1; ?>',0);" onclick="javascript:goToUrl('<?php echo $site_url; ?>');" style="background: url('<?php echo $isOn1; ?>') no-repeat;"><img src="/images/spacer.gif" border="0" alt="" /></div> <!-- BROWN - WHO WE ARE - 2--> <div id="menu_2" class="menuButton" onmouseover="javascript:changeMenuImage(2,'/images/menu/menu_brown_on.jpg',1);" onmouseout="javascript:changeMenuImage(2,'<?php echo $isOn2; ?>',0);" onclick="javascript:goToUrl('<?php echo $site_url; ?>who_we_are/');" style="background: url('<?php echo $isOn2; ?>') no-repeat;"><img src="/images/spacer.gif" border="0" alt="" /></div> <!-- ORANGE - PROGRAMS & SERVICES - 3--> <div id="menu_3" class="menuButton" onmouseover="javascript:changeMenuImage(3,'/images/menu/menu_org_on.jpg',1);" onmouseout="javascript:changeMenuImage(3,'<?php echo $isOn3; ?>',0);" onclick="javascript:goToUrl('<?php echo $site_url; ?>programs_and_services/');" style="background: url('<?php echo $isOn3; ?>') no-repeat;"><img src="/images/spacer.gif" border="0" alt="" /></div> <!-- BEIGE - CALENDAR OF EVENTS - 4--> <div id="menu_4" class="menuButton" onmouseover="javascript:changeMenuImage(4,'/images/menu/menu_beige_on.jpg',1);" onmouseout="javascript:changeMenuImage(4,'<?php echo $isOn4; ?>',0);" onclick="javascript:goToUrl('<?php echo $site_url; ?>calendar_of_events/events/');" style="background: url('<?php echo $isOn4; ?>') no-repeat;"><img src="/images/spacer.gif" border="0" alt="" /></div> <!-- RUST - RESEARCH - 10--> <div id="menu_10" class="menuButton" onmouseover="javascript:changeMenuImage(10,'/images/menu/menu_rust_on.jpg',1);" onmouseout="javascript:changeMenuImage(10,'<?php echo $isOn10; ?>',0);" onclick="javascript:goToUrl('<?php echo $site_url; ?>research/');" style="background: url('<?php echo $isOn10; ?>') no-repeat;"><img src="/images/spacer.gif" border="0" alt="" /></div> <!-- GREY - RESOURCE - 5--> <div id="menu_5" class="menuButton" onmouseover="javascript:changeMenuImage(5,'/images/menu/menu_grey_on.jpg',1);" onmouseout="javascript:changeMenuImage(5,'<?php echo $isOn5; ?>',0);" onclick="javascript:goToUrl('<?php echo $site_url; ?>resources/');" style="background: url('<?php echo $isOn5; ?>') no-repeat;"><img src="/images/spacer.gif" border="0" alt="" /></div> <!-- GREEN - GET INVOLVED - 7--> <div id="menu_7" class="menuButton" onmouseover="javascript:changeMenuImage(7,'/images/menu/menu_green_on.jpg',1);" onmouseout="javascript:changeMenuImage(7,'<?php echo $isOn7; ?>',0);" onclick="javascript:goToUrl('<?php echo $site_url; ?>get_involved/');" style="background: url('<?php echo $isOn7; ?>') no-repeat;"><img src="/images/spacer.gif" border="0" alt="" /></div> <!-- PINK - IN THE NEWS - 6--> <div id="menu_6" class="menuButton" onmouseover="javascript:changeMenuImage(6,'/images/menu/menu_pink_on.jpg',1);" onmouseout="javascript:changeMenuImage(6,'<?php echo $isOn6; ?>',0);" onclick="javascript:goToUrl('<?php echo $site_url; ?>in_the_news/');" style="background: url('<?php echo $isOn6; ?>') no-repeat;"><img src="/images/spacer.gif" border="0" alt="" /></div> <!-- BURGUNDY - CONTACT US - 9--> <div id="menu_9" class="menuButton" onmouseover="javascript:changeMenuImage(9,'/images/menu/menu_burg_on.jpg',1);" onmouseout="javascript:changeMenuImage(9,'<?php echo $isOn9; ?>',0);" onclick="javascript:goToUrl('<?php echo $site_url; ?>contact_us/');" style="background: url('<?php echo $isOn9; ?>') no-repeat;"><img src="/images/spacer.gif" border="0" alt="" /></div> <?php $menuColor=array("0"=>"F1EB6F","1"=>"301448","2"=>"584209","3"=>"CD6A4A","4"=>"c6ab7b","5"=>"9f8e80","6"=>"9b194e","7"=>"747144","8"=>"f1eb6f","9"=>"4d0000","10"=>"8d4131"); echo '<script language="javascript" type="text/javascript">currentColor="'.$menuColor[$mid].'";</script>'; //SUB MENU echo '<div id="subMenuBox" >'; echo '<div id="sub_'.$mid.'" class="subMenuDiv" onmouseover="showCurrentSub(this.id,'.$mid.',1);">'; if($mid == {$smenuUrl = 'login'; } else {$smenuUrl = '';} //echo 'mid= '.$mid.'---smid='.$smid; if(!isLogged()){ //not logged in, dont show WHIWH login menu $menuSubQ = mysql_query("SELECT smenu.menu_id as menu_id, smenu.smenu_id AS smenu_id, smenu.title AS stitle, menu.title AS mtitle FROM smenu INNER JOIN menu ON menu.menu_id=smenu.menu_id WHERE smenu.menu_id = ".$mid." AND smenu.menu_id <> 8 ORDER BY smenu.smenu_id DESC") or trigger_error("Query: $menuSubQ\n<br />MySQL Error: " .mysql_error()); $countSubR = 0; while ($menuSubR = mysql_fetch_array($menuSubQ, MYSQL_ASSOC)) { $countSubR++; $smenuTitle = str_replace(' ', '_', strtolower($menuSubR['stitle'])); $smenuTitle = str_replace('&', 'and', $smenuTitle); $menuTitle = str_replace(' ', '_', strtolower($menuSubR['mtitle'])); $menuTitle = str_replace('&', 'and', $menuTitle); //?mid='.$menuSubR['menu_id'].'&smid='.$menuSubR['smenu_id'].'&ssmid=0 if($smid == $menuSubR['smenu_id']){$smidON = ' style="font-weight:600;text-decoration:underline;" ';} else {$smidON = "";} echo '<a href="'.$site_url.''.$smenuUrl.''.$menuTitle.'/'.$smenuTitle.'/" title="'.$menuSubR['stitle'].'" '.$smidON.'>'.$menuSubR['stitle'].''; if($countSubR == 1) {echo '';} else {echo ' | ';} echo '</a>'; } } elseif(isLogged()){ //is logged in, show WHIWH login menu if($mid == { if($_SESSION['staffbod'] == 0 || $_SESSION['staffbod'] == 1){ //show STAFF or BOD only $menuSubQ = mysql_query("SELECT pages.menu_id AS menu_id, pages.smenu_id AS smenu_id, smenu.title AS stitle FROM pages INNER JOIN smenu ON pages.smenu_id=smenu.smenu_id WHERE pages.menu_id = 8 AND pages.isbod={$_SESSION['staffbod']} GROUP BY pages.smenu_id ORDER BY smenu.smenu_id DESC") or trigger_error("Query: $menuSubQ\n<br />MySQL Error: " .mysql_error()); } else { //show BOTH $menuSubQ = mysql_query("SELECT pages.menu_id AS menu_id, pages.smenu_id AS smenu_id, smenu.title AS stitle FROM pages INNER JOIN smenu ON (pages.smenu_id=smenu.smenu_id) WHERE pages.menu_id = 8 GROUP BY pages.smenu_id ORDER BY smenu.smenu_id DESC") or trigger_error("Query: $menuSubQ\n<br />MySQL Error: " .mysql_error()); } } else {//all other menu boxes $menuSubQ = mysql_query("SELECT smenu.menu_id AS menu_id, smenu.smenu_id AS smenu_id, smenu.title AS stitle, menu.title AS mtitle FROM smenu INNER JOIN menu ON menu.menu_id=smenu.menu_id WHERE smenu.menu_id = ".$mid." ORDER BY smenu.smenu_id ASC") or trigger_error("Query: $menuSubQ\n<br />MySQL Error: " .mysql_error()); } if(mysql_num_rows($menuSubQ) > 0){ $countSubR = 0; while ($menuSubR = mysql_fetch_array($menuSubQ, MYSQL_ASSOC)) { $countSubR++; if($smid == $menuSubR['smenu_id'] && $mid=={$smidON = ' style="font-weight:600;text-decoration:underline;color:#9E1B51;" ';} elseif($smid == $menuSubR['smenu_id']){$smidON = ' style="font-weight:600;text-decoration:underline;" ';} elseif($mid=={$smidON = ' style="color:#9E1B51;" ';} else {$smidON = '';} $smenuTitle = str_replace(' ', '_', strtolower($menuSubR['stitle'])); $smenuTitle = str_replace('&', 'and', $smenuTitle); $smenuTitle = str_replace('/', 'or', $smenuTitle); if($mid == {$menuTitle = 'login'; } else { $menuTitle = str_replace(' ', '_', strtolower($menuSubR['mtitle'])); $menuTitle = str_replace('&', 'and', $menuTitle); } if($countSubR != mysql_num_rows($menuSubQ)) {$putDiv = ' | ';} else {$putDiv = '';} echo '<a href="'.$site_url.''.$menuTitle.'/'.$smenuTitle.'/" title="'.$menuSubR['stitle'].'" '.$smidON.'>'.$menuSubR['stitle']; if($countSubR == 1) {echo '';} else {echo ' | ';} echo '</a>'; } } if(isLogged() && $mid=={ echo '<a href="'.$site_url.'logout/" title="Logout" style="color:#9E1B51;">Logout | </a>'; } } //close is logged in function call mysql_free_result ($menuSubQ); // Free up the resources. echo '</div>'; //close subMenuDiv echo '</div>'; //close subMenuBox echo '</div>'; // <!-- CLOSE mainMenuBox --> echo '<div id="mainContentArea" onmouseover="showCurrentSub(0,\''.$mid.'\',0);">'; echo '<div id="qlContent" '; if($mid==1 && $smid==0){echo 'style="min-height:100px;width:770px;"';} //home page only echo '>'; echo '<div id="qlBox" '; if($mid==1 && $smid==0){echo 'style="margin: 0px 0px 0px 0px; "';} //home page only echo '>'; //QUICK LINKS $qlMenuQ = mysql_query("SELECT ql_id FROM ql_to_menus WHERE menu_id=".$mid."") or trigger_error("Query: $qlMenuQ\n<br />MySQL Error: " .mysql_error()); $qlMenuR = @mysql_fetch_array ($qlMenuQ); if (mysql_affected_rows() > 0) { $qlQ = mysql_query("SELECT quicklinks.ql_id AS ql_id, quicklinks.file_name AS file_name, quicklinks.url AS url, quicklinks.caption AS caption, ql_positions.pos_num AS pos, quicklinks.color_r AS color_r, quicklinks.color_g AS color_g, quicklinks.color_b AS color_b, quicklinks.color_effect AS color_effect, quicklinks.pos_x AS pos_x, quicklinks.pos_y AS pos_y FROM quicklinks INNER JOIN ql_positions ON quicklinks.ql_id = ql_positions.field_num WHERE ql_positions.field_num2 = ".$mid." ORDER BY ql_positions.pos_num ASC LIMIT 5") or trigger_error("Query: $qlQ\n<br />MySQL Error: " .mysql_error()); while ($qlR = mysql_fetch_array($qlQ, MYSQL_ASSOC)) { //echo '<div class="qlDivider"><img src="/images/spacer.gif" border="0" alt="" /></div>'; $showImage = displayFontonImage(str_replace($qlR['file_name'], 'quicklinksimage'.$qlR['ql_id'].'_site_thumb.jpg', $qlR['file_name']), 6, 'quicklinks', '', $qlR['color_r'], $qlR['color_g'], $qlR['color_b'], $qlR['pos_x'], $qlR['pos_y'], $qlR['color_effect']); echo '<div class="qlText" onclick="javascript:goToUrl(\''.$qlR['url'].'\');" title="'.$qlR['caption'].'">'.$qlR['caption'].'</div>'; echo '<div id="ql_'.$qlR['ql_id'].'" class="qlImg" onmouseover="javascript:setOpacity(this.id,0.7);" onmouseout="javascript:setOpacity(this.id,1.0);" onclick="javascript:goToUrl(\''.$qlR['url'].'\');">'.$showImage.'</div>'; } mysql_free_result ($qlQ); // Free up the resources. } mysql_free_result ($qlMenuQ); // Free up the resources. echo '</div>'; //<!-- CLOSE qlBox --> ?> and the header params page. <?php //get menu, smenu and ssmenu ids in order to display quicklinks and page content $mid = 0; $smid = 0; $ssmid = 0; if (isset($_GET['mid']) && $_GET['mid'] > 0) { $mid = (int) $_GET['mid'];} else { $mid = 1;} if (isset($_GET['smid']) && $_GET['smid'] > 0) { $smid = (int) $_GET['smid'];} else { $smid = 0;} if (isset($_GET['ssmid']) && $_GET['ssmid'] > 0) { $ssmid = (int) $_GET['ssmid'];} else { $ssmid = 0;} //echo 'pname= '.$_GET['pname'].'--spname= '.$_GET['spname'].'<br/>'; if (isset($_GET['pname'])) { $pname = str_replace('_', ' ', $_GET['pname']); $pname = str_replace ('and', '&', $pname); $pname = ucwords($pname); $pnameQ = mysql_query("SELECT menu_id, title FROM menu WHERE title = '".$pname."' ") or trigger_error("Query: $pnameQ\n<br />MySQL Error: " .mysql_error()); if(mysql_affected_rows() > 0){ //if not empty, display $pnameR = @mysql_fetch_array ($pnameQ); $mid = (int) $pnameR['menu_id']; $midT = $pnameR['title']; mysql_free_result ($pnameQ); // Free up the resources. } } if (isset($_GET['spname'])) { $spname = str_replace('_', ' ', $_GET['spname']); $spname = str_replace ( 'and', '&', $spname); $spname = ucwords($spname); $spnameQ = mysql_query("SELECT smenu_id, title FROM smenu WHERE title = '".$spname."' ") or trigger_error("Query: $spnameQ\n<br />MySQL Error: " .mysql_error()); if(mysql_affected_rows() > 0){ //if not empty, display $spnameR = @mysql_fetch_array ($spnameQ); $smid = (int) $spnameR['smenu_id']; $smidT = $spnameR['title']; mysql_free_result ($spnameQ); // Free up the resources. } } if (isset($_GET['sspname'])) { $sspname = str_replace('_', ' ', $_GET['sspname']); $sspname = str_replace ('and', '&',$sspname); $sspname = ucwords($sspname); $sspnameQ = mysql_query("SELECT ssmenu_id, title FROM ssmenu WHERE title = '".$sspname."' ") or trigger_error("Query: $sspnameQ\n<br />MySQL Error: " .mysql_error()); if(mysql_affected_rows() > 0){ //if not empty, display $sspnameR = @mysql_fetch_array ($sspnameQ); $ssmid = (int) $sspnameR['ssmenu_id']; $ssmidT = $sspnameR['title']; mysql_free_result ($sspnameQ); // Free up the resources. } } //------------------------------ #if (isset($_GET['pid'])) {$pid = (int) $_GET['pid'];} #else {$pid = 0;} if($mid == 0){$mid = 'NULL';} if($smid == 0){$smid = 'NULL';} if($ssmid == 0){$ssmid = 'NULL';} $makeCond1 = $makeCond2 = 0; if($smid == 'NULL'){$makeCond1 = 'smenu_id IS NULL';} else {$makeCond1 = 'smenu_id = '.$smid;} if($ssmid == 'NULL'){$makeCond2 = 'ssmenu_id IS NULL';} else {$makeCond2 = 'ssmenu_id = '.$ssmid;} $homeOnload = ''; ?>
  4. the staff page is only the code where the body text of the website goes. <?php # index.php include ('includes/header.php'); //Content pages echo '<div id="mainContentBox">'; if($mid=={ //WHIWH LOGIN ONLY if((isset($_GET['login']) && $_GET['login']==1) && (!isLogged())){ //is not logged in, show login form echo '<p>WHIWH Login</p>'; if (isset($_POST['submitted'])) { // Handle the form. if (eregi ('^[[:alnum:]][a-z0-9_\.\-]*@[a-z0-9\.\-]', stripslashes(trim($_POST ['email'])))) { $e = escape_data($_POST ['email']); } else { $e = FALSE; $ErrorMsg .= 'Please enter a valid email address.<br />'; } if (eregi ('^[[:alnum:]]{4,20}$', stripslashes(trim($_POST ['pass'])))) { $p = escape_data($_POST ['pass']); } else { $p = FALSE; $ErrorMsg .= 'Please enter a password 4-20 characters long.<br />'; } $sendCurDate = returnLocalDateTime(); if ($e && $p) { // If everything's OK. // Make sure the email and pass are available, and user is not blocked and activated account. $staffQ = mysql_query("SELECT staff_id, CONCAT_WS(' ', first_name, last_name) AS fn, email, bod FROM staff_members WHERE (email='$e' AND pass=SHA('$p')) AND active IS NULL") or trigger_error("Query: $staffQ\n<br />MySQL Error: " .mysql_error()); if (mysql_affected_rows() > 0) { // A match was made. $staffR = @mysql_fetch_array ($staffQ); $updateQ = mysql_query("UPDATE staff_members SET last_login_date='$sendCurDate' WHERE staff_id=".$staffR['staff_id']."") or trigger_error("Query: $updateQ\n<br />MySQL Error: " .mysql_error()); $_SESSION['staffn'] = $staffR['fn']; $_SESSION['staffid'] = $staffR['staff_id']; $_SESSION['staffe'] = $staffR['email']; $_SESSION['staffbod'] = $staffR['bod']; ob_end_clean(); // Delete the buffer. $smenu1Q = mysql_query("SELECT smenu_id FROM smenu WHERE menu_id=".$mid." ORDER BY smenu_id ASC LIMIT 1") or trigger_error("Query: $smenu1Q\n<br />MySQL Error: " .mysql_error()); $staffR = @mysql_fetch_array ($staffQ); //staff.php?mid=".$mid."&smid=".$staffR['smenu_id']."&ssmid=0&login=1 header("Location: ".$site_url."login/"); //redirect to insert exit(); // Quit the script. } else {$ErrorMsg .= 'The information was incorrect or you haven\'t activated your account yet, please try again.<br />';} } } //close is submitted if (isset($_POST['email'])) {$e = $_POST['email'];} else {$e = '';} echo '<div class="ErrMsg">' . $ErrorMsg . '</div>'; echo '<form action="'.$site_url.'login/" method="post" name="frmMain">'; echo '<table width="100%" border="0" cellpadding="0" cellspacing="5">'; echo '<tr> <td width="100" class="inputText">Email*:</td> <td><input type="text" name="email" value="'.$e.'" /></td> </tr>'; echo '<tr> <td class="inputText">Password*:</td> <td><input type="password" name="pass" /></td> </tr>'; echo '<tr> <td> </td><td> <div id="progbarSubmit" style="position:relative;visibility:visible;"> <input type="submit" class="submitBTN" name="submit" onclick="BeforeSending();this.form.submitted.value=\'true\';" value="'.strtoupper('Login').'" /> <input type="hidden" name="submitted" value="TRUE" /> </div> <script language="javascript" type="text/javascript"> var bar1= createBar(barBWidth,barBHeight,barBgColor,1,barBorderColor,barBlockColor,85,7,3,""); </script> </td></tr>'; echo '<tr><td> </td><td><a href="'.$site_url.'forgot/" style="font-size:11px;" title="forgot password?">forgot password?</a></td></tr>'; echo '</table></form>'; } elseif((isset($_GET['logout']) && $_GET['logout']==1) && (isLogged())){ //if logged in, show welcome screen, logout unset($_SESSION['staffn'], $_SESSION['staffid'], $_SESSION['staffe'], $_SESSION['staffu'], $_SESSION['staffbod']); #setcookie (session_name(), '',time()-300, '/', '', 0); // Destroy the cookie. header("Location: ".$site_url."login/"); //redirect to insert } elseif((isset($_GET['login']) && $_GET['login']==1) && (isLogged())){ //is logged in, show my account echo '<br/>Hi '.$_SESSION['staffn'].',<br/><br/>Welcome to the WHIWH Internal Site.<br/><br/>Use the links on the bar above to navigate through the internal site.'; echo '<br/><br/><strong>Manage your account</strong><ul class="cardeptsUL">'; echo '<li><a href="'.$site_url.'account/" title="My Account" >Modify Account</a></li>'; echo '<li><a href="'.$site_url.'modpass/" title="Change Password" >Modify Password</a></li>'; echo '<li><a href="'.$site_url.'logout/" title="Logout" >Logout</a></li>'; echo '</ul>'; } elseif((isset($_GET['active']) && $_GET['active']==1) && (!isLogged())){ //is not logged in, activate account if (isset($_GET['x'])) {$x = (int) $_GET['x'];} else {$x = 0;} if (isset($_GET['y'])) {$y = $_GET['y'];} else {$y = 0;} if (($x > 0) && (strlen($y) == 32)) { $updateQ = mysql_query("UPDATE staff_members SET active=NULL WHERE (staff_id=$x AND active='" . escape_data($y) . "') LIMIT 1") or trigger_error("Query: $updateQ\n<br />MySQL Error: " .mysql_error()); if (mysql_affected_rows() == 1) { echo '<p>Your WHIWH login account is now activated.<br /><br />You may now <a href="'.$site_url.'login/">login</a>.<br /><br />Thank You</p>'; } else { echo '<p>Your account has already been activated.<br /><br />You may now <a href="'.$site_url.'login/">login</a>.<br /><br />Thank You</p>'; } } } elseif((isset($_GET['pass']) && $_GET['pass']==1) && (!isLogged())){ //is not logged in, forgot password $isSuccess = false; echo '<p>Forgot Password</p>'; if (isset($_POST['submitted'])) { // Handle the form. if (eregi ('^[[:alnum:]][a-z0-9_\.\-]*@[a-z0-9\.\-]', stripslashes(trim($_POST ['email'])))) { $e = escape_data($_POST ['email']); } else { $e = FALSE; $ErrorMsg .= 'Please enter a valid email address.<br />'; } if ($e) { // If everything's OK. $emailQ = mysql_query("SELECT staff_id, first_name, last_name FROM staff_members WHERE email='".$e. "'") or trigger_error("Query: $emailQ\n<br />MySQL Error: " .mysql_error()); if (mysql_num_rows($emailQ) > 0) { //retieve member id list($cid, $fn, $ln) = @mysql_fetch_array ($emailQ);// Retrieve the user ID. } else { $ErrorMsg .= 'The email address you entered is incorrect.<br />'; $cid = FALSE; } if ($cid) { // If everything's OK. $p = substr ( md5(uniqid(rand(),1)), 3, 6); // Create a new, random password. [3-6 characters] $updateQ = mysql_query("UPDATE staff_members SET pass = SHA('$p') WHERE staff_id = ".$cid."") or trigger_error("Query: $updateQ\n<br />MySQL Error: " .mysql_error()); $isSuccess = true; if (mysql_affected_rows() > 0) { // A match was made. $bmsg = "Hi ".$fn." ".$ln.",<br/><br/>"; $bmsg .= "Your password has been changed to [ <b>$p</b> ].<br /><br />"; $bmsg .= "Please keep this in a secure place.<br /><br />"; $bmsg .= "Please <a href='".$site_url."login/' title='Login'>click here</a> to login with your new password.<br /><br />"; $bmsg .= "Or copy and paste this link [ ".$site_url."login/ ] to login.<br /><br />"; $bmsg .= "Thank You"; #$combinedResults['info'][] = 'info@whiwh.com'; mymailer($e, 'WHIWH Password Reset', $bmsg, 1); //no BCC needed echo 'Thank you for reseting your password!<br /><br />An email has been sent to your email address with the new password to <a href="'.$site_url.'login/" title="login">login</a>.<br /><br />Thank You'; } else {$ErrorMsg .= "Reset password failed, try again.<br />";} } else {$ErrorMsg .= "Try again.<br />";} } } //close is submitted if(!$isSuccess){ //if not submitted successfully echo '<div class="ErrMsg">' . $ErrorMsg . '</div>'; echo '<form action="'.$site_url.'forgot/" method="post" name="frmMain">'; echo '<table width="100%" border="0" cellpadding="0" cellspacing="5">'; echo '<tr> <td width="100" class="inputText">Email*:</td> <td><input type="text" name="email" /><br/></td> </tr>'; echo '<tr> <td> </td><td> <div id="progbarSubmit" style="position:relative;visibility:visible;"> <input type="submit" class="submitBTN" name="submit" onclick="BeforeSending();this.form.submitted.value=\'true\';" value="'.strtoupper('RESET').'" /> <input type="hidden" name="submitted" value="TRUE" /> </div> <script language="javascript" type="text/javascript"> var bar1= createBar(barBWidth,barBHeight,barBgColor,1,barBorderColor,barBlockColor,85,7,3,""); </script> </td></tr>'; echo '<tr><td colspan="2"><em><small>[you will receive a new password to your registered email]</small></em></td></tr>'; echo '</table></form>'; } //close if !issuccess } elseif((isset($_GET['modpass']) && $_GET['modpass']==1) && (isLogged())){ //is logged in, change password $isSuccess = false; echo '<p>Modify Password</p>'; if (isset($_POST['submitted'])) { // Handle the form. if (eregi ('^[[:alnum:]]{4,20}$', stripslashes(trim($_POST ['password1'])))) { if ($_POST['password1'] == $_POST['password2']) { $p = escape_data($_POST ['password1']); } else { $p = FALSE; $ErrorMsg .= 'The passwords do not match.<br />'; } } else { $p = FALSE; $ErrorMsg .= 'Please enter a correct password 4-20 characters long.<br />'; } if ($p) { // If everything's OK. $updateQ = mysql_query("UPDATE staff_members SET pass=SHA('$p') WHERE staff_id={$_SESSION['staffid']}") or trigger_error("Query: $updateQ\n<br />MySQL Error: " .mysql_error()); $isSuccess = true; if ($updateQ > 0) { // updated correctly $bmsg = "Hi ".$_SESSION['staffn'].",<br/><br/>"; $bmsg .= "Your password has been changed to [ <b>$p</b> ].<br /><br />"; $bmsg .= "Please keep this in a secure place.<br /><br />"; $bmsg .= "Please <a href='".$site_url."login/' title='Login'>click here</a> to login with your new password.<br /><br />"; $bmsg .= "Or copy and paste this link [ ".$site_url."login/ ] to login.<br /><br />"; $bmsg .= "Thank You"; #$combinedResults['info'][] = 'info@whiwh.com'; mymailer($_SESSION['staffe'], 'WHIWH Password Modification', $bmsg, 1); //no BCC needed echo 'Thank you for changing your password!<br /><br />An email has been sent to your email address with the new password to <a href="'.$site_url.'login/" title="login">login</a>.<br /><br />Thank You'; } else {$ErrorMsg .= "Modifing password failed, try again.<br />";} } else {$ErrorMsg .= "Try again.<br />";} } //close is submitted if(!$isSuccess){ //if not submitted successfully echo '<div class="ErrMsg">' . $ErrorMsg . '</div>'; echo '<form action="'.$site_url.'modpass/" method="post" name="frmMain">'; echo '<table width="100%" border="0" cellpadding="0" cellspacing="5">'; echo '<tr> <td width="210" class="inputText">*New Password:</td> <td><input type="password" name="password1" /><br/></td> </tr>'; echo '<tr> <td class="inputText">*Confirm New Password:</td> <td><input type="password" name="password2" /><br/></td> </tr>'; echo '<tr> <td> </td><td> <div id="progbarSubmit" style="position:relative;visibility:visible;"> <input type="submit" class="submitBTN" name="submit" onclick="BeforeSending();this.form.submitted.value=\'true\';" value="'.strtoupper('modify').'" /> <input type="hidden" name="submitted" value="TRUE" /> </div> <script language="javascript" type="text/javascript"> var bar1= createBar(barBWidth,barBHeight,barBgColor,1,barBorderColor,barBlockColor,85,7,3,""); </script> </td></tr>'; echo '<tr><td colspan="2"><em><small>[you password will be sent to your registered email address]</small></em></td></tr>'; echo '</table></form>'; } //close if !issuccess } elseif((isset($_GET['account']) && $_GET['account']==1) && (isLogged())){ //is logged in, account details $isSuccess = false; echo '<p>Modify Account Details</p>'; if (isset($_POST['submitted'])) { // Handle the form. if (eregi ('^[[:alpha:]\.\' \-]{2,15}$', stripslashes(trim($_POST['first_name'])))) { $fn = escape_data($_POST ['first_name']); } else { $fn = FALSE; $ErrorMsg .= 'Please enter your first name.<br />'; } // Check for a last name. if (eregi ('^[[:alpha:]\.\' \-]{1,30}$', stripslashes(trim($_POST ['last_name'])))) { $ln = escape_data($_POST ['last_name']); } else { $ln = FALSE; $ErrorMsg .= 'Please enter your last name.<br />'; } if ($fn && $ln) { //If everything's OK. // Make sure the email addresss are available. #$staffQ = mysql_query("SELECT staff_id FROM staff_members WHERE email='$e' AND staff_id <> {$_SESSION['staffid']}") or trigger_error("Query: $staffQ\n<br />MySQL Error: " .mysql_error()); #if (mysql_num_rows($staffQ) == 0) { //email is Available. $updateQ = mysql_query("UPDATE staff_members SET first_name='$fn', last_name='$ln' WHERE staff_id = {$_SESSION['staffid']}") or trigger_error("Query: $updateQ\n<br />MySQL Error: " .mysql_error()); $isSuccess = true; if (mysql_affected_rows() > 0) { // A match was made. echo 'Your account details were modified successfully.<br/><a href="'.$site_url.'login/" title="WHIWH Login">Back to WHIWH Login</a>'; } else {$ErrorMsg .= "Reset password failed, try again.<br />";} #} else { $ErrorMsg .= 'That email has already been registered. Please try another.<br />';} // The email address is not available. #mysql_free_result($staffQ); } else {$ErrorMsg .= "Try again.<br />";} } //close is submitted if(!$isSuccess){ //if not submitted successfully $staffQ = mysql_query("SELECT first_name, last_name FROM staff_members WHERE staff_id={$_SESSION['staffid']}") or trigger_error("Query: $staffQ\n<br />MySQL Error: " .mysql_error()); $staffR = @mysql_fetch_array ($staffQ); if(isset($staffR['first_name'])) {$fn = $staffR['first_name'];} else {$fn = '';} if(isset($staffR['last_name'])) {$ln = $staffR['last_name'];} else {$ln = '';} echo '<div class="ErrMsg">' . $ErrorMsg . '</div>'; echo '<form action="'.$site_url.'account/" method="post" name="frmMain">'; echo '<table width="100%" border="0" cellpadding="0" cellspacing="5">'; echo '<tr> <td width="100" class="inputText">First Name*:</td> <td><input type="text" name="first_name" value="'.$fn.'" /><br/></td> </tr> <tr> <td width="100" class="inputText">Last Name*:</td> <td><input type="text" name="last_name" value="'.$ln.'" /><br/></td> </tr> <tr> <td> </td><td> <div id="progbarSubmit" style="position:relative;visibility:visible;"> <input type="submit" class="submitBTN" name="submit" onclick="BeforeSending();this.form.submitted.value=\'true\';" value="'.strtoupper('MODIFY').'" /> <input type="hidden" name="submitted" value="TRUE" /> </div> <script language="javascript" type="text/javascript"> var bar1= createBar(barBWidth,barBHeight,barBgColor,1,barBorderColor,barBlockColor,85,7,3,""); </script> </td></tr>'; echo '</table></form>'; mysql_free_result($staffQ); } //close if !issuccess } elseif(isLogged()) { //CLOSE $_GET['login'], then if logged in, show welcome screen /******************ALL CONTENT PAGES START**********************/ if($_SESSION['staffbod'] == 0 || $_SESSION['staffbod'] == 1){ //show all STAFF or BOD content pages $pagesQ = mysql_query("SELECT isbod, description FROM pages WHERE menu_id = 8 AND ".$makeCond1." AND ".$makeCond2." AND isbod={$_SESSION['staffbod']}") or trigger_error("Query: $pagesQ\n<br />MySQL Error: " .mysql_error()); } else { //show all staff & BOD content pages $pagesQ = mysql_query("SELECT isbod, description FROM pages WHERE menu_id = 8 AND ".$makeCond1." AND ".$makeCond2."") or trigger_error("Query: $pagesQ\n<br />MySQL Error: " .mysql_error()); } if(mysql_affected_rows() > 0){ //if not empty, display $pagesR = @mysql_fetch_array ($pagesQ); echo $pagesR['description']; mysql_free_result ($pagesQ); // Free up the resources. } else {echo '<small>This page can be viewed by Board of Directors only.</small><br/><br/>';} /******************ALL CONTENT PAGES END**********************/ if($smid == 22){ //show staff meeting minutes if(isset($_GET['meet']) && $_GET['meet']==1){ //show meeting details $meetQ = mysql_query("SELECT date_FORMAT(meet_date, '%M %d, %Y %H:%i') as newdate, title, description FROM staff_meetings WHERE display=1 AND meet_id={$_GET['meet']}") or trigger_error("Query: $meetQ\n<br />MySQL Error: " .mysql_error()); $meetR = @mysql_fetch_array ($meetQ); echo '<p>'.$meetR['newdate'].'</p>'; echo '<p><strong>'.$meetR['title'].'</strong></p>'; echo '<p>'.$meetR['description'].'</p>'; echo '<p><a href="'.$site_url.'login/" title="Meeting Minutes">Back to Meeting Minutes List</a></p>'; mysql_free_result ($meetQ); // Free up the resources. } else { $meetQ = mysql_query("SELECT meet_id, date_FORMAT(meet_date, '%M %d, %Y %H:%i') as newdate, title FROM staff_meetings WHERE display=1 ORDER BY meet_date DESC") or trigger_error("Query: $meetQ\n<br />MySQL Error: " .mysql_error()); if(mysql_num_rows($meetQ) > 0){ //if not empty, display echo '<br/><br/><ul class="cardeptsUL">'; //vladamir while ($meetRow = mysql_fetch_array($meetQ, MYSQL_ASSOC)) {echo '<li><a href="'.$site_url.'meet='.$meetRow['meet_id'].'" title="'.$meetRow['title'].'">'.$meetRow['newdate'].' - '.$meetRow['title'].'</a></li>';} echo '</ul>'; } mysql_free_result ($meetQ); // Free up the resources. } } } else { //if none of the options above, redirect to login page header("Location: ".$site_url."login/"); //redirect to insert } //close IF logged in } //close MID echo '</div>'; include ('includes/footer.php'); ?>
  5. i am guessing these lines are clashing in the htaccess file: RewriteRule ^login/$ /staff.php?mid=8&smid=0&ssmid=0&login=1 [L] and RewriteRule ^([0-9a-z\_]+)/([0-9a-z\_]+)/$ /index.php?pname=$1&spname=$2 [L] If we open this http://www.whiwh.com/login/ then its fine, i see the login page. but if we go to an inner page (sub menu) within the login page, such as this one http://www.whiwh.com/login/general_info/, then i think its clashing. how can i solve this?
  6. you were right! the problem with some of the pages (not in the login) was that i use "ucwords()" which capitalizes the first character of every word. some of the words had a lower case, and the mysql query was case sensitive, so it wouldn't show the correct page. the other problem with the login page, well that i cant seem to figure out. HELP????
  7. also say i login http://www.whiwh.com/login/ user: admin@dachooch.com pass: 1234 i see sub menu at the yellow strip. it works the same way as the rest of the site. we have main menu (mid) like "WHIWH Login" or "Who We Are", then we have sub menu (smid) like "General Info". For example, i log into WHIWH Login, then i see the sub menu, i click on General Info and it opens this "http://www.whiwh.com/login/general_info/". This does not open the page it suppose to. Remember, in mod write, we change the menu title "WHIWH Login" to "login". So therefore i would assume the link goes like this "http://www.whiwh.com/login/general_info/". When I try to change the link to "http://www.whiwh.com/whiwh_login/general_info/", it still does not work. i am not sure where i am going wrong with this as well.
  8. i reversed as suggested, as well as the login mod write: RewriteRule ^login/$ /staff.php?mid=8&smid=0&ssmid=0&login=1 [L] RewriteRule ^forgot/$ /staff.php?mid=8&smid=0&ssmid=0&pass=1 [L] RewriteRule ^account/$ /staff.php?mid=8&smid=0&ssmid=0&account=1 [L] RewriteRule ^modpass/$ /staff.php?mid=8&smid=0&ssmid=0&modpass=1 [L] RewriteRule ^meet/$ /staff.php?mid=8&smid=0&ssmid=0&meet=1 [L] RewriteRule ^logout/$ /staff.php?mid=8&smid=0&ssmid=0&logout=1 [L] RewriteRule ^newsletter/$ /newsletter.php?mid=7&smid=44&ssmid=8&news=1 [L] RewriteRule ^([0-9a-z\_]+)/([0-9a-z\_]+)/([0-9a-z\_]+)/$ /index.php?pname=$1&spname=$2&sspname=$3 [L] RewriteRule ^([0-9a-z\_]+)/([0-9a-z\_]+)/$ /index.php?pname=$1&spname=$2 [L] RewriteRule ^([0-9a-z\_]+)/$ /index.php?pname=$1 [L] so now i got the login to work, but something like this http://www.whiwh.com/who_we_are/bill_of_rights/ is not opening the correct page. any ideas?
  9. Hi, I have a site which i added mod write to the url. Some of the pages are not opening correctly. For example, the WHIWH login, should open a user & pass field in the page. You can see it is not opening it. http://www.whiwh.com/login/ Also a page like this http://www.whiwh.com/who_we_are/bill_of_rights/ does not open the actual page. it is sort of the same problem as the login page above. This is my htaccess code: RewriteEngine On RewriteRule ^([0-9a-z\_]+)/$ /index.php?pname=$1 [L] RewriteRule ^([0-9a-z\_]+)/([0-9a-z\_]+)/$ /index.php?pname=$1&spname=$2 [L] RewriteRule ^([0-9a-z\_]+)/([0-9a-z\_]+)/([0-9a-z\_]+)/$ /index.php?pname=$1&spname=$2&sspname=$3 [L] RewriteRule ^login/$ /staff.php?mid=8&smid=0&ssmid=0&login=1 [L] RewriteRule ^forgot/$ /staff.php?mid=8&smid=0&ssmid=0&pass=1 [L] RewriteRule ^account/$ /staff.php?mid=8&smid=0&ssmid=0&account=1 [L] RewriteRule ^modpass/$ /staff.php?mid=8&smid=0&ssmid=0&modpass=1 [L] RewriteRule ^meet/$ /staff.php?mid=8&smid=0&ssmid=0&meet=1 [L] RewriteRule ^logout/$ /staff.php?mid=8&smid=0&ssmid=0&logout=1 [L] RewriteRule ^newsletter/$ /newsletter.php?mid=7&smid=44&ssmid=8&news=1 [L] IndexIgnore .htaccess */.??* *~ *# */HEADER* */README* */_vti* AuthName whiwh.com AuthUserFile /home/xxx/public_html/_vti_pvt/service.pwd AuthGroupFile /home/xxx/public_html/_vti_pvt/service.grp ErrorDocument 400 /400.php ErrorDocument 401 /401.php ErrorDocument 403 /403.php ErrorDocument 404 /404.php ErrorDocument 500 /500.php AddHandler server-parsed .scss AddType application/x-javascript .js suPHP_ConfigPath /home/xxx/public_html Here is the code where i deal with the mod write within the php page. if (isset($_GET['pname'])) { $pname = str_replace('_', ' ', $_GET['pname']); $pname = str_replace ('and', '&', $pname); $pname = ucwords($pname); if ($_GET['pname']=='calendar_of_events') { $mid = 4; $midT = 'Calendar of Events'; } else { $pnameQ = mysql_query("SELECT menu_id, title FROM menu WHERE title = '".$pname."' ") or trigger_error("Query: $pnameQ\n<br />MySQL Error: " .mysql_error()); if(mysql_affected_rows() > 0){ //if not empty, display $pnameR = @mysql_fetch_array ($pnameQ); $mid = (int) $pnameR['menu_id']; $midT = $pnameR['title']; mysql_free_result ($pnameQ); // Free up the resources. } } } if (isset($_GET['spname'])) { $spname = str_replace('_', ' ', $_GET['spname']); $spname = str_replace ( 'and', '&', $spname); $spname = ucwords($spname); $spnameQ = mysql_query("SELECT smenu_id, title FROM smenu WHERE title = '".$spname."' ") or trigger_error("Query: $spnameQ\n<br />MySQL Error: " .mysql_error()); if(mysql_affected_rows() > 0){ //if not empty, display $spnameR = @mysql_fetch_array ($spnameQ); $smid = (int) $spnameR['smenu_id']; $smidT = $spnameR['title']; mysql_free_result ($spnameQ); // Free up the resources. } } if (isset($_GET['sspname'])) { $sspname = str_replace('_', ' ', $_GET['sspname']); $sspname = str_replace ('and', '&',$sspname); $sspname = ucwords($sspname); $sspnameQ = mysql_query("SELECT ssmenu_id, title FROM ssmenu WHERE title = '".$sspname."' ") or trigger_error("Query: $sspnameQ\n<br />MySQL Error: " .mysql_error()); if(mysql_affected_rows() > 0){ //if not empty, display $sspnameR = @mysql_fetch_array ($sspnameQ); $ssmid = (int) $sspnameR['ssmenu_id']; $ssmidT = $sspnameR['title']; mysql_free_result ($sspnameQ); // Free up the resources. } } If you look above, i had the same problem in Calendar of Events, therefore, i had to manually declare the variables $mid and midT. That is the only way it worked. any help is welcomed. thanks
  10. this is the options i have in the php config in cpanel: PHP5 All files with the extension .php will be handled by the PHP5 engine. Current, most reliable and best performing version of PHP PHP5 (Single php.ini) Same as PHP5, but all subdirectories will use ~/public_html/php.ini PHP5 (FastCGI) All files with the extension .php will be handled by PHP5 FastCGI processes. FastCGI for PHP makes all your PHP applications run through mod_fastcgi instead of mod_suphp. This eliminates the overhead of loading the PHP interpretor on every hit. Since it is always in memory ready for the next hit, the responses will be generated faster. PHP5 (Single php.ini) is selected.
  11. there is one php.ini file in the main web root directory and the file is in another folder. in this website cpanel, it has php config area. there the php file is selected as single file. meaning one file for the whole site. so i wont need to duplicate the php.ini file.
  12. these are local and master. same values. I am getting error value 1. I tried a couple of files over 2M and it gave me this error. When i try a file that is under 2M it seems to work. that is why i have no clue what to do now.
  13. PHP Version 5.2.9 post_max_size 50M upload_max_filesize 50M safe_mode Off register_globals On file_uploads On memory_limit 32M anything else?
  14. im not sure what you mean. u want me to show u the phpinfo()?
  15. Hi, I am using a script to upload media files. Here it is: $filename_audio = 'uploadintaudio'; $tmpName_audio = $_FILES[$filename_audio]['tmp_name']; if(empty($_POST['intclip_which'])) {$_POST['intclip_which'] = 0;} if($_POST['intclip_which'] == 1){ //change image only echo 'MEDIA --> <br/> name '.strtolower($_FILES[$filename_audio]['name']).'<br/> isset? '.isset($_FILES[$filename_audio]).'<br/> which '.$_POST['intclip_which'].'<br/> error '.$_FILES[$filename_audio]['error'].'<br/> type '.ereg($media_types,strtolower($_FILES[$filename_audio]['type'])).'---- '.$_FILES[$filename_audio]['type']; if (isset($_FILES[$filename_audio]) && ($_FILES[$filename_audio]['error'] != 4) && ereg($media_types,strtolower($_FILES[$filename_audio]['type']))) { $intaudio = array_change_key_case($_FILES[$filename_audio],CASE_LOWER); } else { $intaudio = FALSE; $ErrorMsg .= 'Either the file format is incorrect or you have not choosen a media file.<br />'; } } else {$intaudio = TRUE;} $intaudio_name = strtolower($intaudio['name']); $intaudio_type = strtolower($intaudio['type']); $intaudio_size = strtolower($intaudio['size']); Note: $media_types = "(rmi|wav|wma|wmv|wm|wmvhd|wax|mpg|mid|midi|mpeg|m1v|mp2|mp3|mpa|mpe)\$";/*avi|asf|asx|*/ You can see i print (echo) the file name, error, type, etc. This is my result: As you can see the file type is missing. And the error =1 which means the max-uploadsize is not enough. The file size im trying to upload is 2.5M and my max post and max upload size is set to 50M. I am not sure where the problem is. Any help is welcomed. thanks
  16. ok so i got it to work. this works: $menuQ = mysql_query("SELECT menu_id, title FROM menu ORDER BY menu_id ASC") or trigger_error("Query: $menuQ\n<br />MySQL Error: " .mysql_error()); if(mysql_num_rows($menuQ) > 0){ while ($menuR = mysql_fetch_array($menuQ, MYSQL_ASSOC)) { $mylinks[] = array('title'=>''.$menuR['title'].'', 'URL'=>'/index.php?mid='.$menuR['menu_id'].''); } $editor->links = $mylinks; }
  17. I am using wysiwygPro editor and i want to be able to display the menu titles coming from the database. This is an example layout: $editor->links = array( array('title'=>'Home', 'URL'=>'/'), array('title'=>'About Us','URL'=>'/about/', 'children'=>array( array('title'=>'Company History','URL'=>'/about/history.php'), array('title'=>'Franchise Information','URL'=>'/about/franchise.php'), array('title'=>'Shareholders Information','URL'=>'/about/shareholders.php'), )), array('title'=>'Services', 'URL'=>'/services/'), array('title'=>'Contact Us', 'URL'=>'/contact/'), ); So this is my SELECT query with the array. But i cant seem to get it right. $menuQ = mysql_query("SELECT menu_id, title FROM menu ORDER BY menu_id ASC") or trigger_error("Query: $menuQ\n<br />MySQL Error: " .mysql_error()); if(mysql_num_rows($menuQ) > 0){ echo 'array('; while ($menuR = mysql_fetch_array($menuQ, MYSQL_ASSOC)) { //echo $menuR['title'].'<br/>'; $mylinks[] = array('title'=>''.$menuR['title'].'', 'URL'=>'/?mid='.$menuR['menu_id'].''); } echo ');'; $editor->links = array($mylinks); } can anyone correct me please? thanks
  18. Hi, I have a email piping code show below. It works fine, except that when i print the $message, it also shows me some headers. How do i strip the headers from the message itself? email_piping.php file #!/usr/bin/php -q <?php //header('Content-Type: text/html; charset=utf-8'); header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); // always modified header("Cache-Control: no-store, no-cache, must-revalidate"); // HTTP/1.1 header("Cache-Control: post-check=0, pre-check=0", false); header("Pragma: no-cache"); // HTTP/1.0 date_default_timezone_set('America/New_York'); ob_start(); require_once ('includes/config.inc.php'); require_once ('includes/functions.inc.php'); require_once ('includes/mysql_connect.php'); // read from stdin $fd = fopen("php://stdin", "r"); $email = ""; while (!feof($fd)) { $email .= fread($fd, 1024); } fclose($fd); // handle email $lines = explode("\n", $email); // empty vars $from = ""; $subject = ""; $headers = ""; $message = ""; $sendmail = ""; $splittingheaders = true; //we have processed the headers and can start adding the lines to $message. for ($i=0; $i < count($lines); $i++) { if ($splittingheaders) { // this is a header $headers .= $lines[$i]."\n"; // look out for special headers if (preg_match("/^Subject: (.*)/", $lines[$i], $matches)) { $subject = $matches[1]; } if (preg_match("/^From: (.*)/", $lines[$i], $matches)) { $from = $matches[1]; } } else { // not a header, but message $message .= $lines[$i]."\n"; } if (trim($lines[$i])=="") { // empty line, header section has ended $splittingheaders = false; } //$a = "RE: [119-24] Work Order Request - test - dsfsd"; preg_match("/\[[0-9]*-[0-9]*\]/",$subject,$matches); list($jobid, $custid) = split('[-]', $matches[0]); $jobid = substr($jobid, 1); //removes first string $custid = substr($custid, 0, (strlen($custid)-1)); //removes last string } $cur_date = returnLocalDate(); $cur_time = returnLocalTime(); $sendmail .= 'job id = '.$jobid.'<br/><br/>'; $sendmail .= 'customer id = '.$custid.'<br/><br/>'; $sendmail .= 'reply date = '.$cur_date.' '.$cur_time.'<br/><br/>'; $sendmail .= 'message = '.$message.'<br/><br/>'; //$sendmail .= 'from = '.$from.'\n'; //$sendmail .= 'subject = '.$subject.'\n'; //$sendmail .= 'headers = '.$headers.'\n'; //$sendmail .= 'message = '.$message.'\n'; mymailer('admin@milano4you.com','test pipe id ', $sendmail); /* $insertQ = mysql_query("INSERT INTO test_pipe(job_id, cust_id, description, reply_date, reply_time, displayed) VALUES($jobid, $custid, '$message', '$cur_date', '$cur_time', 1)") or trigger_error("Query: $insertQ\n<br />MySQL Error: " .mysql_error()); if (mysql_affected_rows() > 0) { $new_reply_id = mysql_insert_id(); echo $new_reply_id; $sendmail .= 'job id = '.$jobid.'\n'; $sendmail .= 'customer id = '.$custid.'\n'; $sendmail .= 'reply date = '.$cur_date.' '.$cur_time.'\n'; $sendmail .= 'message = '.$message.'\n'; $sendmail .= 'from = '.$from.'\n'; $sendmail .= 'subject = '.$subject.'\n'; $sendmail .= 'headers = '.$headers.'\n'; $sendmail .= 'message = '.$message.'\n'; mymailer('admin@milano4you.com','test pipe id '.$new_reply_id.'', $sendmail); } */ return true; if (isset($_SESSION['custfn'])){mysql_close();} ob_end_flush(); ?> The email showed:
  19. hi, so i decided to use iframes and it works perfectly and pretty quickly as well. I still want to learn how to use jquery/ajax/json, etc, but that i will have to halt when i have some time. thanks again
  20. I am not sure, because i am using a third party gallery called SmoothGallery. You can have a look at the demo page within my site: http://www.maestro2007.co.il/includes/smoothgallery/demozoom.html You can do a view source on the above demo link to view the HTML, CSS & JS files. I duplicate "<div class="imageElement">" tags, then i call a JS function "startGallery()", then i do a JS "window.addEvent" to start this gallery. Since my photos come dynamically from the DB, this is how i display the gallery. My site: http://www.maestro2007.co.il/index.php?mid=3 I have my index.php page: On each thumbnail photo, i do an onclick onClick="javascript:MyAjaxRequest(\'response\', \'/projects.php?mid='.$mid.'&pid='.$projectsR['pid'].'\');" I also have the "response" id where that should display the gallery: <ul><li class="text2 corner" id="response" name="response"> </li></ul> I put it in a list, because the way i display the css. So now the onclick calls "MyAjaxRequest" which is in ajaxrequest.php: // start ajaxrequest.js // Following is a javascript function that makes a httprequest - AJAX. This is the AJAX bit and all that is needed in that manner. // Only in this one we won't be using XML in our response, we will accept and handle // pure text and html and display this response directly to the user within the // desired <div id> tags. It can even be used to include pure html files as a substitute // solution to the "old" frames method where as no php or other scripting language is nessesary on the server. // but use it with care - it is not a search engine supported method and indexing will fail. Workaround for this is not included here function MyAjaxRequest(target_div,file,check_div){ var MyHttpRequest = false; var MyHttpLoading = '<p>Loading...</p>'; // or use an animated gif instead: var MyHttpLoading = '<img src="loading.gif" border="0" alt="running" />'; var ErrorMSG = 'Sorry - No XMLHTTP support in your browser, buy a newspaper instead'; if(check_div){var check_value = document.getElementById(check_div).value;} else{var check_value = '';} if(window.XMLHttpRequest) // client use Firefox, Opera etc - Non Microsoft product { try{ MyHttpRequest = new XMLHttpRequest(); } catch(e){ MyHttpRequest = false; } } else if(window.ActiveXObject) // client use Internet Explorer { try{ MyHttpRequest = new ActiveXObject("Msxml2.XMLHTTP"); } catch(e){ try{ MyHttpRequest = new ActiveXObject("Microsoft.XMLHTTP"); } catch(e){ MyHttpRequest = false; } } } else { MyHttpRequest = false; } if(MyHttpRequest) // browser supports httprequest { var random = Math.random() * Date.parse(new Date()); // make a random string to prevent caching var file_array = file.split('.'); // prepare to check if we have a query string or a html/htm file if(file_array[1] == 'php') // no query string, just calling a php file { var query_string = '?rand=' + random; } else if(file_array[1] == 'htm' || file_array[1] == 'html') // calling a htm or html file { var query_string = ''; } else // we have presumable a php file with a query string attached { var query_string = check_value + '&rand=' + random; } MyHttpRequest.open("get", url_encode(file + query_string), true); // <-- run the httprequest using GET // handle the httprequest MyHttpRequest.onreadystatechange = function (){ if(MyHttpRequest.readyState == 4) // done and responded { document.getElementById(target_div).innerHTML = MyHttpRequest.responseText; // display result //alert('responsetext printing: '+document.getElementById(target_div).innerHTML); } else { document.getElementById(target_div).innerHTML = MyHttpLoading; // still working } } MyHttpRequest.send(null); } else { document.getElementById(target_div).innerHTML = ErrorMSG; // the browser was unable to create a httprequest } } // end of "AJAX" function // Here follows a function to urlencode the string we run through our httprequest, it has nothing to do with AJAX itself // If you look carefully in the above httprequest you se that we use this url_encode function around the file and query_string // This is very handy since we are using GET in our httprequest and for instance // any occurrance of the char # (from textboxes etc) will brake the string we are sending to our file - we don't want that to brake! // It will also convert spaces to + function url_encode(string) { var string; var safechars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz/-_.&?="; var hex = "0123456789ABCDEF"; var encoded_string = ""; for(var i = 0; i < string.length; i++){ var character = string.charAt(i); if(character == " "){ encoded_string += "+"; } else if(safechars.indexOf(character) != -1){ encoded_string += character; } else { var hexchar = character.charCodeAt(0); if(hexchar > 255){ encoded_string += "+"; } else { encoded_string += "%"; encoded_string += hex.charAt((hexchar >> 4) & 0xF); encoded_string += hex.charAt(hexchar & 0xF); } } } return encoded_string; } // end .js file And in projects.php this is where we display the gallery: <?php //projects header('Content-Type: text/html; charset=WINDOWS-1255'); /* MUST BE HERE TO DISPLAY HEBREW */ header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); header("Cache-Control: no-store, no-cache, must-revalidate"); header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); header("Cache-Control: post-check=0, pre-check=0", false); header("Pragma: no-cache"); require_once ('includes/config.inc.php'); require_once ('includes/functions.inc.php'); require_once ('includes/mysql_connect.php'); if(isset($_GET['pid'])) { $pid = (int) $_GET['pid']; //echo "project id: $pid---"; $projectsQ1 = mysql_query(" SELECT projects.proj_id AS pid, projects.location AS plocation, projects.title AS ptitle, images_to_proj.img_id AS img_id, images_to_proj.caption AS caption, images_to_proj.file_name AS file_name FROM projects INNER JOIN images_to_proj ON projects.proj_id=images_to_proj.proj_id WHERE projects.proj_id=".$pid."") or trigger_error("Query: $projectsQ1\n<br />MySQL Error: " .mysql_error()); if(mysql_num_rows($projectsQ1) > 0){ //$projectsR1 = @mysql_fetch_array ($projectsQ1); echo '<link rel="stylesheet" href="/includes/smoothgallery/css/layout.css" type="text/css" media="screen" charset="utf-8" /> <link rel="stylesheet" href="/includes/smoothgallery/css/jd.gallery.css" type="text/css" media="screen" charset="utf-8" /> <link rel="stylesheet" href="/includes/smoothgallery/css/ReMooz.css" type="text/css" media="screen" charset="utf-8" /> <script language="javascript" type="text/javascript" src="/includes/smoothgallery/scripts/mootools-1.2.1-core-yc.js"></script> <script language="javascript" type="text/javascript" src="/includes/smoothgallery/scripts/mootools-1.2-more.js"></script> <script language="javascript" type="text/javascript" src="/includes/smoothgallery/scripts/ReMooz.js"></script> <script language="javascript" type="text/javascript" src="/includes/smoothgallery/scripts/jd.gallery.js"></script> <div id="myGallery">'; while ($projectsR1 = mysql_fetch_array($projectsQ1, MYSQL_ASSOC)) { $getImg1 = getUploadImgPath(27, "/site_uploads/portfolio/", $projectsR1['file_name'], $projectsR1['img_id'], 1, "portfolio"); $ImgThumb_small = str_replace($image_ext, '_site_thumb.jpg', strtolower($getImg1)); list($width1, $height1, $type, $w) = getimagesize(strtolower($getImg1)); if($width1 >= 632){ //if image was large, get resized $thumbimg_large = str_replace($image_ext, '_large_thumb.jpg', strtolower($getImg1)); } else {$thumbimg_large = $getImg1;} //echo '--->'.$projectsR1['plocation'].' - '.$projectsR1['ptitle'].' - '.$projectsR1['img_id'].' - '.$thumbimg_large.'<br/>'; echo '<div class="imageElement"> <h3>'.$projectsR1['ptitle'].' '.$projectsR1['plocation'].'</h3> <p>'.$projectsR1['caption'].'</p> <a href="'.$thumbimg_large.'" title="open image" class="open"></a><img src="'.$thumbimg_large.'" class="full" /><img src="'.$ImgThumb_small.'" class="thumbnail" /> </div>'; } echo '</div> <script language="javascript" type="text/javascript"> function startGallery() { var myGallery = new gallery($(\'myGallery\'), { timed: false, useReMooz: true, embedLinks: false }); } window.addEvent(\'domready\',startGallery); </script>'; mysql_free_result ($projectsQ1); } } ?>
  21. it connects to the DB, retrieves all the photos content, then i display these photos using a photo gallery slide show by JonDesign SmoothGallery, which obviously has JS in the files.
  22. hi, thanks for the reply. index.php is the initial loaded page. i send the project id from index.php (thumbnail onclick) to the ajax request, which then sends that project id to projects.php that is suppose to connect to the DB and display all the photos within that project (according to the project id), without reloading the page. Is it possible to just send back to index.php the project id without reloading the page? My photo gallery uses javascript for the slide show, therefore clicking on a thumbnail, must refresh the slide show to display the correct photos for that project. Does that mean i need json?
  23. Hi Floydian, Yes, i am sending javascript, as well as html. What is happening is, clicking on a thumbnail (in index.php), sends the project ID which the thumbnail is located in to the xmlhttp request (ajaxrequest.php), then opens projects.php and suppose to display the full project album according to that ID. This album is obviously done in JS, and like you said, i can't transfer executable JS. Is there a way to send back the project ID to my index.php page, which is where my thumbnail is located, so that i can execute the JS there? I am new at this xmlhttp request, so i am not sure as to how to execute this correctly. Can you please give me a head start so I know follow? thanks
  24. hi, I have a gallery, upon clicking a gallery set, the page should open it's photos without refreshing, therefore i use XMLHttpRequest. It works fine if i am display just plain text/images, but im trying to display javascript & html content. I want to display my "smoothgallery" according to gallery set that was chosen. Here is a link to the website: http://www.maestro2007.co.il/index.php?mid=3 Click on an image on the right, it should open the smoothgallery on the left. This is my request page: function getMessageResponse(str){ var xmlHttp; var divelement = document.getElementById('response'); divelement.innerHTML = '<p>Loading, please be patient...</p>'; try{ // Firefox, Opera 8.0+, Safari xmlHttp=new XMLHttpRequest(); xmlHttp.overrideMimeType("text/html; charset=windows-1255"); /*TO DISPLAY HEBREW CHARACTERS*/ } catch (e){ // Internet Explorer try{ xmlHttp=new ActiveXObject("Msxml2.XMLHTTP"); } catch (e){ try{ xmlHttp=new ActiveXObject("Microsoft.XMLHTTP"); xmlHttp.setRequestHeader('Content-Type','text/html; charset=windows-1255') } catch (e){ alert("Your browser does not support AJAX!"); return false; } } } xmlHttp.onreadystatechange=function(){ //Used to set the callback function that handles request state changes. //alert(xmlHttp.status+' - '+xmlHttp.readyState); if(xmlHttp.readyState==4){ // 0 = uninitialized 1 = loading 2 = loaded 3 = interactive 4 = complete divelement.innerHTML=xmlHttp.responseText; //Returns the server response as a string. //alert(xmlHttp.responseText); //document.myform.message.value = ''; } } //url=url+"&message="+str; var url="projects.php?mid=3"; url=url+"&pid="+str; url=url+"&sid="+Math.random(); xmlHttp.open("GET",url,true); //Initializes the request parameters. / or POST data larger than 512 bytes xmlHttp.send(null); //Performs the HTTP request. }
  25. Hi there, I am using AJAX XMLHttpRequest with PHP in order to view full project photos according to project id. This is my ajax request: function getMessageResponse(str){ var xmlHttp; try{ // Firefox, Opera 8.0+, Safari xmlHttp=new XMLHttpRequest(); } catch (e){ // Internet Explorer try{ xmlHttp=new ActiveXObject("Msxml2.XMLHTTP"); } catch (e){ try{ xmlHttp=new ActiveXObject("Microsoft.XMLHTTP"); } catch (e){ alert("Your browser does not support AJAX!"); return false; } } } xmlHttp.onreadystatechange=function(){ if(xmlHttp.readyState==4){ document.getElementById('response').innerHTML=xmlHttp.responseText; //document.myform.message.value = ''; } } //url=url+"&message="+str; var url="projects.php?mid=3"; url=url+"&pid="+str; url=url+"&sid="+Math.random(); xmlHttp.open("GET",url,true); xmlHttp.overrideMimeType("text/html; charset=windows-1255"); /*TO DISPLAY HEBREW CHARACTERS*/ xmlHttp.send(null); } This is my <li> in index.php: <li class="text2 corner" id="response" name="response"> </li> This is my projects.php page: <?php //projects require_once ('includes/config.inc.php'); require_once ('includes/functions.inc.php'); require_once ('includes/mysql_connect.php'); if(isset($_GET['pid'])) { $pid = (int) $_GET['pid']; //echo "project id: $pid---"; $projectsQ1 = mysql_query(" SELECT projects.proj_id AS pid, projects.location AS plocation, projects.title AS ptitle, images_to_proj.img_id AS img_id, images_to_proj.caption AS caption, images_to_proj.file_name AS file_name FROM projects INNER JOIN images_to_proj ON projects.proj_id=images_to_proj.proj_id WHERE projects.proj_id=".$pid."") or trigger_error("Query: $projectsQ1\n<br />MySQL Error: " .mysql_error()); if(mysql_num_rows($projectsQ1) > 0){ //$projectsR1 = @mysql_fetch_array ($projectsQ1); echo '<link rel="stylesheet" href="/includes/smoothgallery/css/layout.css" type="text/css" media="screen" charset="utf-8" /> <link rel="stylesheet" href="/includes/smoothgallery/css/jd.gallery.css" type="text/css" media="screen" charset="utf-8" /> <link rel="stylesheet" href="/includes/smoothgallery/css/ReMooz.css" type="text/css" media="screen" charset="utf-8" /> <script language="javascript" type="text/javascript" src="/includes/smoothgallery/scripts/mootools-1.2.1-core-yc.js"></script> <script language="javascript" type="text/javascript" src="/includes/smoothgallery/scripts/mootools-1.2-more.js"></script> <script language="javascript" type="text/javascript" src="/includes/smoothgallery/scripts/ReMooz.js"></script> <script language="javascript" type="text/javascript" src="/includes/smoothgallery/scripts/jd.gallery.js"></script> <div id="myGallery">'; while ($projectsR1 = mysql_fetch_array($projectsQ1, MYSQL_ASSOC)) { $getImg1 = getUploadImgPath(27, "/site_uploads/portfolio/", $projectsR1['file_name'], $projectsR1['img_id'], 1, "portfolio"); $ImgThumb_small = str_replace($image_ext, '_site_thumb.jpg', strtolower($getImg1)); list($width1, $height1, $type, $w) = getimagesize(strtolower($getImg1)); if($width1 >= 632){ //if image was large, get resized $thumbimg_large = str_replace($image_ext, '_large_thumb.jpg', strtolower($getImg1)); } else {$thumbimg_large = $getImg1;} //echo '--->'.$projectsR1['plocation'].' - '.$projectsR1['ptitle'].' - '.$projectsR1['img_id'].' - '.$thumbimg_large.'<br/>'; echo '<div class="imageElement"> <h3>'.$projectsR1['ptitle'].' '.$projectsR1['plocation'].'</h3> <p>'.$projectsR1['caption'].'</p> <a href="'.$thumbimg_large.'" title="open image" class="open"></a><img src="'.$thumbimg_large.'" class="full" /><img src="'.$ImgThumb_small.'" class="thumbnail" /> </div>'; } echo '</div> <script language="javascript" type="text/javascript"> function startGallery() { var myGallery = new gallery($(\'myGallery\'), { timed: false, useReMooz: true, embedLinks: false }); } window.addEvent(\'domready\',startGallery); </script>'; mysql_free_result ($projectsQ1); } } ?> When I display the smoothgallery in index.php page, it works perfectly. It really displays the gallery show. Since I put the gallery in "projects.php" page, it only displays the photos and not inside a gallery show. You can test this by using this link [http://www.maestro2007.co.il/index.php?mid=3], click on a thumbnail on the right, that should open the gallery on the left. Is this an issue with ajax request that its not showing the gallery? Any suggestions/ideas are welcomed. Thanks, M
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.