PHP - If Exchange Placements - What Have I Done Wrong?
Hi guys,
New to PHP but learning every day. This is probably a really newbie error but I've tried multiple different ways and can't get it to work. $tableData = ''; if(mysql_num_rows($result)==0) { $tableData = "<tr><td colspan=\"4\">No results returned.</td></tr>\n"; } else { while($row = mysql_fetch_assoc($result)) { $tableData .= " <tr bgcolor='#FFFFFF' align='center'>\n"; $tableData .= " <td>{$rank}</td>\n"; $tableData .= " </tr>\n"; $rank = ($row['rank']); if ($rank == 0) { print "Cadet"; } if ($rank == 1) { print "Sergeant"; } if ($rank == 2) { print "2nd Lieutenant"; } if ($rank == 3) { print "1st Lieutenant"; } if ($rank == 4) { print "Captain"; } if ($rank == 5) { print "Major"; } if ($rank == 6) { print "Lt. Colonel"; } if ($rank == 7) { print "Colonel"; } } } ?> <table class="tables" cellspacing="0" cellpadding="0"> <tr> <th>Rank</th> </tr> <?php echo $tableData; ?> </table> When this script is run the $rank variable shows the numbers 1,2,3,4,5,6,7 instead of the textual translations for example if 0 is displayed then "cadet" should be shown instead. The current script shows the numbers in the table but prints the accurate translations at the top outside the table tag..... Can anyone show me what I've done wrong here? Thank you in advance. Similar TutorialsHello, I have tried to figure it out on my own for two months, but just don't get it. My goal is to have automated data exchange to my e-shop. It is in Estonian. http://www.elnetsec.ee/pood/ And the place I have to get the data from is a e-shop called Acme. acc.acme.lt All they gave me was a php document and told me to use it. I'll copy it here, so maybe someone can give me advice, which lines do I have to add and which to change. <?php class Filter { public $Name; public $Value; } class ArrayOfFilter { public $Filter; } class GetProductListRequest { public $Filters; } class GetProductList { public $GetProductListRequest; } class GetInvoiceListRequest { public $Filters; } class GetInvoiceList { public $GetInvoiceListRequest; } class GetInvoiceDetailsRequest { public $Filters; } class GetInvoiceProductSerialList { public $GetInvoiceProductSerialListRequest; } class GetInvoiceProductSerialListRequest { public $Filters; } class GetInvoiceDetails { public $GetInvoiceDetailsRequest; } class GetProductSpecification { public $GetProductSpecificationRequest; } class GetProductSpecificationRequest { public $Filters; } class GetProductResourcesRequest { public $Filters; } class GetProductResources { public $GetProductResourcesRequest; } class GetProductBarcodeList { public $GetProductBarcodeListRequest; } class GetProductBarcodeListRequest { public $Filters; } class GetAddressList { public $GetAddressListRequest; } class GetAddressListRequest { public $Filters; } class GetCustomerUserList { public $GetCustomerUserListRequest; } class GetCustomerUserListRequest { public $Filters; } class GetInvoiceShipments { public $GetInvoiceShipmentsRequest; } class GetInvoiceShipmentsRequest { public $Filters; } class GetOrderDetails { public $GetOrderDetailsRequest; } class GetOrderDetailsRequest { public $Filters; } class PurchaseProducts { public $PurchaseProductsRequest; } class PurchaseProductsRequest { public $Filters; public $PurchaseLines; } class ProductPurchaseLine { public $ProductPurchaseLineId; public $SupplierCode; public $Quantity; public $DeliveryTypeId; public $DeliveryAddress; public $Note; } class Address { public $AddressId; public $Street; public $City; public $PostalCode; public $CountryCode; } class AcmeAPI { public $licenseKey = '498ec72c-e8e7-48f2-b300-d95666aeb141'; private $soapClient = null; private $soapHeader = null; private $wsdl = 'https://api.acme.lt/1.0/commerce.asmx?WSDL'; private function init () { $map = array( "Filter"=>"Filter", "ArrayOfFilter" => "ArrayOfFilter", "GetProductListRequest"=>"GetProductListRequest", "GetProductList"=>"GetProductList", "GetInvoiceList"=>"GetInvoiceList", "GetInvoiceListRequest"=>"GetInvoiceListRequest", "GetProductSpecification"=>"GetProductSpecification", "GetProductSpecificationRequest"=>"GetProductSpecificationRequest", "GetProductResources"=>"GetProductResources", "GetInvoiceDetails"=>"GetInvoiceDetails", "GetInvoiceDetailsRequest"=>"GetInvoiceDetailsRequest", "GetInvoiceProductSerialList"=>"GetInvoiceProductSerialList", "GetInvoiceProductSerialListRequest"=>"GetInvoiceProductSerialListRequest", "GetAddressList" => "GetAddressList", "GetAddressListRequest" => "GetAddressListRequest", "GetCustomerUserList" => "GetCustomerUserList", "GetCustomerUserListRequest" => "GetCustomerUserListRequest", "GetInvoiceShipments" => "GetInvoiceShipments", "GetInvoiceShipmentsRequest" => "GetInvoiceShipmentsRequest", "GetOrderDetails" => "GetOrderDetails", "GetOrderDetailsRequest" => "GetOrderDetailsRequest", "PurchaseProducts" => "PurchaseProducts", "PurchaseProductsRequests" => "PurchaseProductsRequest", "ProductPurchaseLine" => "ProductPurchaseLine", "DeliveryAddress" => "Address" ); $this->soapClient = new SoapClient($this->wsdl,array('classmap'=> $map ,'trace' => 1, 'features' => SOAP_SINGLE_ELEMENT_ARRAYS )); $this->soapHeader = new SoapHeader('http://schemas.acme.eu/', 'LicenseHeader', array('LicenseKey'=>$this->licenseKey), false); $this->soapClient->__setSoapHeaders(array($this->soapHeader)); } public function getVendors() { try { $this->init(); $result = $this->soapClient->GetVendorList(); foreach ($result->GetVendorListResult->VendorList->Vendor as $b) { print $b->VendorId." ".$b->VendorName."<br />"; } //echo "<pre>". print_r($result,1) . '</pre>'; } catch(SoapFault $e) { echo '<xmp>' . $this->soapClient->__getLastRequestHeaders() . $this->soapClient->__getLastRequest() . '</xmp>'; echo "<pre>". print_r($e,1) . '</pre>'; } } public function getInvoiceList() { try { $this->init(); $request = new GetInvoiceListRequest(); $request->Filters = new ArrayOfFilter(); $datefrom = new Filter(); $datefrom->Name = "InvoiceDateFrom"; $datefrom->Value= "2008.01.01"; $dateTo = new Filter(); $dateTo->Name = "InvoiceDateTo"; $dateTo->Value = "2009.03.16"; $parameters = $request->Filters->Filter = array( $datefrom,$dateTo); $params = new GetInvoiceList(); $params->GetInvoiceListRequest = $request; $result = $this->soapClient->GetInvoiceList($params); if(isset($result->GetInvoiceListResult->InvoiceHeaderList->InvoiceHeader)) { foreach ($result->GetInvoiceListResult->InvoiceHeaderList->InvoiceHeader as $inv) { print $inv->InvoiceNumber." ".$inv->InvoiceDate."</br>"; } } else { print "no invoices found"; } //echo "<pre>". print_r($result,1) . '</pre>'; } catch(SoapFault $e) { echo '<xmp>' . $this->soapClient->__getLastRequestHeaders() . $this->soapClient->__getLastRequest() . '</xmp>'; echo "<pre>". print_r($e,1) . '</pre>'; } } public function getInvoiceDetails() { try { $this->init(); $request = new GetInvoiceDetailsRequest(); $request->Filters = new ArrayOfFilter(); $invoice = new Filter(); $invoice->Name = "InvoiceNumber"; $invoice->Value= "ACC-01722223"; $parameters = $request->Filters->Filter = array($invoice); $params = new GetInvoiceDetails(); $params->GetInvoiceDetailsRequest = $request; $result = $this->soapClient->GetInvoiceDetails($params); foreach ($result->GetInvoiceDetailsResult->InvoiceList as $inv) { print $inv->InvoiceHeader->InvoiceNumber." ".$inv->InvoiceHeader->InvoiceDate."</br>"; foreach($inv->InvoiceLine as $line) { print $line->SupplierCode." | ".$line->ShortName." | ".$line->LineAmount."<br />"; } } //echo "<pre>". print_r($result,1) . '</pre>'; } catch(SoapFault $e) { echo '<xmp>' . $this->soapClient->__getLastRequestHeaders() . $this->soapClient->__getLastRequest() . '</xmp>'; echo "<pre>". print_r($e,1) . '</pre>'; } } public function getInvoiceProductSerials() { try { $this->init(); $request = new GetInvoiceProductSerialListRequest(); $request->Filters = new ArrayOfFilter(); $invoice = new Filter(); $invoice->Name = "InvoiceNumber"; $invoice->Value= "ACC-00761335"; $parameters = $request->Filters->Filter = array($invoice); $params = new GetInvoiceProductSerialList(); $params->GetInvoiceProductSerialListRequest = $request; $result = $this->soapClient->GetInvoiceProductSerialList($params); foreach ($result->GetInvoiceProductSerialListResult->ProductSerialList->ProductSerial as $ps) { print $ps->SupplierCode." ".$ps->SerialNumber."</br>"; } //echo "<pre>". print_r($result,1) . '</pre>'; } catch(SoapFault $e) { echo '<xmp>' . $this->soapClient->__getLastRequestHeaders() . $this->soapClient->__getLastRequest() . '</xmp>'; echo "<pre>". print_r($e,1) . '</pre>'; } } public function getProductSpecification() { try { $this->init(); $request = new GetProductSpecificationRequest(); $request->Filters = new ArrayOfFilter(); $language = new Filter(); $language->Name = "Language"; $language->Value= "en-us"; $product = new Filter(); $product->Name = "SupplierCode"; $product->Value= "032016"; $parameters = $request->Filters->Filter = array($language, $product); //$parameters = $request->Filters->Filter = array($language); $params = new GetProductSpecification(); $params->GetProductSpecificationRequest = $request; $result = $this->soapClient->GetProductSpecification($params); foreach ($result->GetProductSpecificationResult->ProductSpecification as $spec) { print $spec->SupplierCode." "; foreach($spec->ProductProperty as $property) { print $property->PropertyName.": ".$property->PropertyValue."<br />" ; } } //echo "<pre>". print_r($result,1) . '</pre>'; } catch(SoapFault $e) { echo '<xmp>' . $this->soapClient->__getLastRequestHeaders() . $this->soapClient->__getLastRequest() . '</xmp>'; echo "<pre>". print_r($e,1) . '</pre>'; } } public function getProductResources() { try { $this->init(); $request = new GetProductResourcesRequest(); $request->Filters = new ArrayOfFilter(); $language = new Filter(); $language->Name = "Language"; $language->Value= "en-us"; $product = new Filter(); $product->Name = "SupplierCode"; $product->Value= "025348"; $parameters = $request->Filters->Filter = array($language, $product); //$parameters = $request->Filters->Filter = array($language); // all resources will be returned if no product filter supplied $params = new GetProductResources(); $params->GetProductResourcesRequest = $request; $result = $this->soapClient->GetProductResources($params); foreach ($result->GetProductResourcesResult->ProductResources as $res) { print $res->SupplierCode." "; if(isset($res->ProductResource)) { foreach($res->ProductResource as $r) { print $r->ResourceName.": ".$r->ResourceURL."<br />" ; } } } //echo "<pre>". print_r($result,1) . '</pre>'; } catch(SoapFault $e) { echo '<xmp>' . $this->soapClient->__getLastRequestHeaders() . $this->soapClient->__getLastRequest() . '</xmp>'; echo "<pre>". print_r($e,1) . '</pre>'; } } public function getProductBarcodes() { try { $this->init(); $request = new GetProductBarcodeListRequest(); $params = new GetProductBarcodeList(); $params->GetProductBarcodeListRequest = $request; $result = $this->soapClient->GetProductBarcodeList($params); if($result->GetProductBarcodeListResult->ProductBarcodeList->ProductBarcode) { foreach ($result->GetProductBarcodeListResult->ProductBarcodeList->ProductBarcode as $b) { print $b->SupplierCode." ".$b->Barcode."<br />"; } } //echo "<pre>". print_r($result,1) . '</pre>'; } catch(SoapFault $e) { echo '<xmp>' . $this->soapClient->__getLastRequestHeaders() . $this->soapClient->__getLastRequest() . '</xmp>'; echo "<pre>". print_r($e,1) . '</pre>'; } } public function getProductClassification () { try { $this->init(); $result = $this->soapClient->GetProductClassification(); // segments print "Segments list:<br />"; foreach ($result->GetProductClassificationResult->SegmentList->Segment as $b) { print $b->SegmentId." ".$b->SegmentName."<br />"; } print "-----------------------------------------------<br />"; // Groups print "Group list:<br />"; foreach ($result->GetProductClassificationResult->GroupList->Group as $b) { print $b->GroupId." ".$b->GroupName."<br />"; } print "-----------------------------------------------<br />"; // Classes print "Class list:<br />"; foreach ($result->GetProductClassificationResult->ClassList->Class as $b) { print $b->ClassId." ".$b->ClassName."<br />"; } print "-------------------------------------------------<br />"; // Series print "Series list:<br />"; foreach ($result->GetProductClassificationResult->SeriesList->Series as $b) { print $b->SeriesId." ".$b->SeriesName."<br />"; } //echo "<pre>". print_r($result,1) . '</pre>'; } catch(SoapFault $e) { echo '<xmp>' . $this->soapClient->__getLastRequestHeaders() . $this->soapClient->__getLastRequest() . '</xmp>'; echo "<pre>". print_r($e,1) . '</pre>'; } } public function getProductList () { try { $this->init(); $request = new GetProductListRequest(); $request->Filters = new ArrayOfFilter(); $language = new Filter(); $language->Name = "Language"; $language->Value= "lt-lt"; $currency = new Filter(); $currency->Name = "Currency"; $currency->Value = "LTL"; $request->Filters->Filter = array( $language,$currency); $params = new GetProductList(); $params->GetProductListRequest = $request; $result = $this->soapClient->GetProductList($params); foreach ($result->GetProductListResult->ProductList->Product as $p) { print $p->SupplierCode." ".$p->Name."<br />"; } //echo "<pre>". print_r($result,1) . '</pre>'; } catch(SoapFault $e) { echo '<xmp>' . $this->soapClient->__getLastRequestHeaders() . $this->soapClient->__getLastRequest() . '</xmp>'; echo "<pre>". print_r($e,1) . '</pre>'; } } public function getInvoiceShipments() { try { $this->init(); $request = new GetInvoiceShipmentsRequest(); $request->Filters = new ArrayOfFilter(); $invoice = new Filter(); $invoice->Name = "InvoiceNumber"; $invoice->Value= "ACC-00761335"; // set invoice number here $parameters = $request->Filters->Filter = array($invoice); $params = new GetInvoiceShipments(); $params->GetInvoiceShipmentsRequest = $request; $result = $this->soapClient->GetInvoiceShipments($params); foreach ($result->GetInvoiceShipmentsResult->ShipmentList->Shipment as $ps) { print $ps->CarrierId." ".$ps->Number."</br>"; } //echo "<pre>". print_r($result,1) . '</pre>'; } catch(SoapFault $e) { echo '<xmp>' . $this->soapClient->__getLastRequestHeaders() . $this->soapClient->__getLastRequest() . '</xmp>'; echo "<pre>". print_r($e,1) . '</pre>'; } } public function getOrderDetails() { try { $this->init(); $request = new GetOrderDetailsRequest(); $request->Filters = new ArrayOfFilter(); $parameters = $request->Filters->Filter = array(); $params = new GetOrderDetails(); $params->GetOrderDetailsRequest = $request; $result = $this->soapClient->GetOrderDetails($params); if(isset($result->GetOrderDetailsResult->OrderList->Order)) { foreach ($result->GetOrderDetailsResult->OrderList->Order as $o) { print "OrderId: ".$o->OrderHeader->OrderId." <br />"; foreach($o->OrderLine as $line) { print "OrderLineId: ".$line->OrderLineId." SupplierCode: ".$line->SupplierCode." LineAmount: ".$line->LineAmount." <br />"; } print "----------------------------------------------------<br />"; } } else { print "no orders found"; } //echo "<pre>". print_r($result,1) . '</pre>'; } catch(SoapFault $e) { echo '<xmp>' . $this->soapClient->__getLastRequestHeaders() . $this->soapClient->__getLastRequest() . '</xmp>'; echo "<pre>". print_r($e,1) . '</pre>'; } } public function purchaseProducts() { try { $this->init(); $request = new PurchaseProductsRequest(); $request->Filters = new ArrayOfFilter(); $request->Filters->Filter = array(); $line = new ProductPurchaseLine(); $line->ProductPurchaseLineId = "demo"; $line->SupplierCode = "003315"; $line->Quantity = 1; $line->DeliveryTypeId = 0; $line->Note = "test order"; $address = new Address(); $address->AddressId = "ecommtest-001"; $line->DeliveryAddress = $address; $request->PurchaseLines = array($line); $params = new PurchaseProducts(); $params->PurchaseProductsRequest = $request; $result = $this->soapClient->PurchaseProducts($params); foreach ($result->PurchaseProductsResult->StatusList->ProductPurchaseStatus as $st) { print $st->ProductPurchaseLineId." ".$st->Status."<br />"; } //echo "<pre>". print_r($result,1) . '</pre>'; } catch(SoapFault $e) { echo '<xmp>' . $this->soapClient->__getLastRequestHeaders() . $this->soapClient->__getLastRequest() . '</xmp>'; echo "<pre>". print_r($e,1) . '</pre>'; } } public function getAddressList() { try { $this->init(); $request = new GetAddressListRequest(); $request->Filters = new ArrayOfFilter(); $request->Filters->Filter = array(); $params = new GetAddressList(); $params->GetAddressListRequest = $request; $result = $this->soapClient->GetAddressList($params); foreach ($result->GetAddressListResult->AddressList->Address as $b) { print $b->AddressId." ".$b->Street." ".$b->City."<br />"; } //echo "<pre>". print_r($result,1) . '</pre>'; } catch(SoapFault $e) { echo '<xmp>' . $this->soapClient->__getLastRequestHeaders() . $this->soapClient->__getLastRequest() . '</xmp>'; echo "<pre>". print_r($e,1) . '</pre>'; } } public function getCustomerUserList() { try { $this->init(); $request = new GetCustomerUserListRequest(); $request->Filters = new ArrayOfFilter(); $request->Filters->Filter = array(); $params = new GetCustomerUserList(); $params->GetCustomerUserListRequest = $request; $result = $this->soapClient->GetCustomerUserList($params); if(isset($result->GetCustomerUserListResult->UserList->User)) { foreach ($result->GetCustomerUserListResult->UserList->User as $b) { print $b->UserId." ".$b->FirstName." ".$b->LastName."<br />"; } } // uncomment this line to see raw result of this method response //echo "<pre>". print_r($result,1) . '</pre>'; } catch(SoapFault $e) { echo '<xmp>' . $this->soapClient->__getLastRequestHeaders() . $this->soapClient->__getLastRequest() . '</xmp>'; echo "<pre>". print_r($e,1) . '</pre>'; } } } $client = new AcmeAPI() ; $client->getVendors(); //$client->getProductClassification(); //$client->getProductList(); //$client->getProductBarcodes(); //$client->getInvoiceList(); //$client->GetInvoiceDetails(); //$client->GetInvoiceProductSerials(); //$client->getProductSpecification(); //$client->getProductResources(); //$client->getAddressList(); //$client->getCustomerUserList(); //$client->getInvoiceShipments(); //$client->getOrderDetails(); //$client->purchaseProducts(); ?> Thanks! Hi .. i have an array format like (mysql result array) $new_array=Array ( [0] => Array ( [quantity] => 5 ) [1] => Array ( [quantity] => 25 ) [2] => Array ( [quantity] => 20 ) ) I have to convert this array into the following format $new_array['quantity'][0]=5 $new_array['quantity'][1]=25 $new_array['quantity'][2]=20 How to convert this array format using any standard array method. $html = @file_get_contents($urlw) or problem('Can\'t open Your Remote URL!'); $html = strtolower($html); $site_url = strtolower($set['site_url']); if (preg_match_all('/<a\s[^>]*href=([\"\']??)([^" >]*?)\\1([^>]*)>/siU', $html, $matches, PREG_SET_ORDER)) { foreach($matches as $match) { if ($match[2] == $set['site_url'] || $match[2] == $set['site_url'].'/') { $found = 1; if (strstr($match[3],'nofollow')) { $nofollow = 1; } break; } } } if ($found == 0) { echo "<center><h2>Our URL Not FOund on your page please submit or check again</h2></center>"; } else next proceggerr.... in $html we getting the content of that page which that user give where he put our link what is this actually this all code is doing infact i was making a link exchange site where on a page people can submit their link for exchange and give their site link and the that page link where they have put our link this code verify at the sPot did they have put our code or not but m facing some problem.. beacuse it's not working good Hi, I making a banner exchange script. Members will have to place a banner code on their sites to make banners appear. Some members might cheat by using bots to refresh the page to gain impressions and to waste other members impressions so i wanted to know if bots have ip addresses? because i want to only give member impressions if their visitors have ip. What are the other things i can do to check if members are cheating?. Thanks
$ip=$_SERVER['REMOTE_ADDR']; Hi, am trying without much luck, (I am new), to define an exchange rate on the page and then mutiplying it by a value I am extracting from a mysql db. I write the value as below normally but having trouble writing this entry and multiplying it by my defined exchanged rate of say 2.22. <?php if(!empty($row['Band_1_Price'])) {echo "<div class=pricing_box_right2>£".$row['Band_1_Price']."</div></div>"; } ?> Thanks so much. Hello php Freaks, before i start , let me tell you ; BY GOD, i googled, i used countless search functions on several websites and forums, i even called some friends that told me once, they are good with php, but guess what : No Results , AT ALL! So here i am, sorta desperate and hungry for a solution. I need to admit, and somehow its obvious, i am not much of a Programmer, or Coder of some kind. I be more the gfx type of Guy ! Well, here we go : I bought a php Script, and ran a first test on a free web host ( like always ) to check if all looks fine, works well and runs like a charm. And it did. So i went over to my paid space account, bought a domain, and installed the Script on my new domain. All was fine, until i registered a test account. The Script suppose to send an activation email , with an activation link in it. As i said before, on the FREE web space , it worked just fine, even though i entered a gmail Admin Email. (not like i planed to do support@newdomain.com) After a lot of research and 3 re-installations i contacted the Support to tell them that my script dont work on their Server. And here it comes : They don`t allow php Mail for Spamming Reasons. And they are not willing to make an exception. But, they gave me the advice to implement an authenticated smpt script in order to get the job done. The Vendor, is not willing to help me, and i am to much of a php noob to actually know or understand what to do now. Basically i need to know how i pull of a switch from php mail() to authenticate smpt. Here the original Code, with the mail function : Code: [Select] <?php include('header.php'); if(isset($_POST['register'])){ foreach($_POST as $key => $value) { $sec[$key] = filter($value); } $verificare1 = mysql_query("SELECT * FROM `users` WHERE `login`='{$sec['user']}' OR `email`='{$sec['email']}'"); $verificare = mysql_num_rows($verificare1); if ($verificare > 0) { $mesaj = "<div class=\"error\">ERROR: Username or email already registered!</div>"; }else if (!isUserID($sec['user'])) { $mesaj = "<div class=\"error\">ERROR: Username is incorrect!</div>"; }else if(!isEmail($sec['email'])) { $mesaj = "<div class=\"error\">ERROR: Enter a valid email address!</div>"; }else if (!checkPwd($sec['password'],$sec['password2'])) { $mesaj = "<div class=\"error\">ERROR: Passwords do not match!</div>"; }else{ if(isset($_COOKIE['PlusREF'])){ $ref = $_COOKIE['PlusREF']; $user1 = mysql_query("SELECT * FROM `users` WHERE `id`='{$ref}'"); $user = mysql_fetch_object($user1); mysql_query("INSERT INTO `referals`(user,referal,date) values('{$user->login}','{$sec['user']}',NOW())"); } $activare = rand(000000000, 999999909); mail($sec['email'],"Activate your account"," Hello, Thank you for your signup on our site. Click on this link to activate your account: {$site->site_url}/activate.php?cod={$activare} Best Regards!","From: Site Admin <{$site->site_email}>"); $final = VisitorIP(); $passa = $sec['password']; $passc = MD5($passa); mysql_query("INSERT INTO `users`(email,login,IP,pass,passdecoded,ref,signup,activate) values('{$sec['email']}','{$sec['user']}','$final','$passc','$passa','{$ref}',NOW(),'{$activare}')")or die(mysql_error()); $mesaj = "<div class=\"success\">Registered! You need to confirm your email address now!</div>"; }} ?> <div class="block medium right"> <div class="top"> <h1>Register</h1> </div> <div class="content"><div class="msg"><?echo $mesaj;?></div> <form action="" method="post"> <fieldset> <p> <label>Username</label><br/> <input class="text big" type="text" value="" name="user"/> </p> <p> <label>Email</label><br/> <input class="text big" type="email" value="" name="email"/> </p> <p> <label>Password</label> <br/> <input class="password" type="password" value="" name="password"/> </p> <p> <label>Repeat Password</label> <br/> <input class="password" type="password" value="" name="password2"/> </p> <p> <input type="submit" class="button gray small" value="Register" name="register" /> </p> </fieldset> </form> </div> </div> <?include('footer.php');?> Hi All, Its been a while since i've posted, its good to be back. I am currently trying to pull two exchange rates against the $ using YQL's restful url. Unfortunately I am having a huge problem returning the results correct.... currently my array will only output a single rate (instead of two) and the hash array returns with the base rate name rather than the expected currency code. I hope someone can help me sort this as it's given me quite a headache! Please see the code below: Code: [Select] <?php require_once('uwe_proxy.php'); /* * To change this template, choose Tools | Templates * and open the template in the editor. */ # use the yahoo YQL rest service to return any number of rates in a hash function get_yahoo_rest_rate ($base, $curr_arr) { $params = ''; $rates = array(); # define the YQL rest url head & tail $yql_base_uri = "http://query.yahooapis.com/v1/public/yql"; $yql_tail_uri = '&env=store%3A%2F%2Fdatatables.org%2Falltableswithkeys'; # build up the $params value foreach($curr_arr as $curr) { $params .= $curr.$base.','; } #strip last comma $params = substr($params, 0, -1); # build the query with the params as comma sep. string eg. USDGBP,USDBOB,.. $yql_query = "select * from yahoo.finance.xchange where pair IN ('{$params}')"; # build the the complete YQL query $yql_query_url = $yql_base_uri . "?q=" . urlencode($yql_query) . $yql_tail_uri; # send the query via proxy and get as string and load as simplexml object $yql_response = @simplexml_load_string(file_get_contents_proxy($yql_query_url)); Print_r($yql_query_url); //- debugging only # process simplexml object and return a sorted hash of rates or FALSE on error if ($yql_response) { foreach($yql_response->results->rate as $rate) { if ((float)$rate->Rate>0) { $rates[substr((string)$rate->attributes()->id, -3)] = (float)$rate->Rate; } } ksort($rates); return $rates; } else { return FALSE; }// print_r($yql_response); - debugging only } /////// - debugging only $curr_arr = array('GBP','GBP'); $rates = get_yahoo_rest_rate ('USD', $curr_arr); //PRINT_R($yql_response); print_r($rates); ?> Sorry about dumping the whole lot - but I really don't know where this is going wrong! Thanks in Advance for any help or pointers in the right direction! imap_fetchstructure is not returing information about attachments for certain e-mails after the mailbox is migrated to exchange 2010. Using IMAP protocol and was working fine until the migration from exchange 2007 to 2010. 99% of emails with attachments works fine, but few don't. I can replicate the issue when an attachment is sent from gmail accounts or some xerox devices to exchange 2010. The output of imap_fetchstructure (message has no body, only attachment) looks like below, as you can see, parts is returning null. I have tested it using imap-2006e and imap-4.7b libraries and produces same issues. Any ideas how to resolve the issue or debug this issue? Can also replicate the problem in Thunderbird 2.0.0.24 stdClass Object ( [type] => 1 [encoding] => 5 [ifsubtype] => 1 [subtype] => MIXED [ifdescription] => 0 [ifid] => 0 [ifdisposition] => 0 [ifdparameters] => 0 [ifparameters] => 1 [parameters] => Array ( => stdClass Object ( [attribute] => boundary [value] => AHNKAKBLDCDIDAGCDHGDAAAKACAK ) ) [parts] => Array ( ) ) I am querying... $sql = "SELECT `messages_inbox`.`message_id`, `users`.`firstname`, `users`.`lastname`, `users`.`username` AS `from`, '${user_info['username']}' AS `to`, `subject`, LENGTH(`files`) AS `len`, 'inbox' AS `box`, DATE_FORMAT(`messages_inbox`.`time` ,'%T %D-%M-%Y') AS `time` "; $sql .= "FROM `messages_inbox` INNER JOIN `users` ON `messages_inbox`.`from_id` = `users`.`id` WHERE `to_id` = ${user_info['uid']} AND `messages_inbox`.`deleted` = 0 ORDER BY `messages_inbox`.`message_id` DESC"; and I am trying to output $displayName = ucwords("${message['firstname']} ${message['lastname']}"); by using $messages = pm_fetch_all($_GET['box']); I know my fetch works but for some reason firstname and lastname are only returning the logged in users first name and last name, not the person who sent the message. $result3 = mysql_query("SELECT User_ID FROM leaderboards WHERE User_ID = '$user'"); if(mysql_num_rows($result3) == 0){ $query1 = "INSERT INTO leaderboards (User_ID, CollegeFootballPoints) VALUES ('$user','$points')"; $result1 = mysql_query($query1); }else{ $query2 = "UPDATE leaderboards SET CollegeFootballPoints='$points' WHERE User_ID='$user'"; $result2 = mysql_query($query2); } I keep getting this error...' Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in update_collegeFBpoints_points.php on line 40 And the script is not working! (LINE 40 is $result3 = mysql_query("SELECT User_ID FROM leaderboards WHERE User_ID = '$user'"); if(mysql_num_rows($result3) == 0){ specifically mysql_num_rows) Code: [Select] <!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 content="text/html; charset=utf-8" http-equiv="Content-Type" /> <title>Send Data Form</title> </head> <body> <?php if(!$_POST) exit; $email = $_POST['Email']; $name = $_POST['Name']; $telephone = $_POST['Telephone']; $comments = $_POST['Comments']; //$error[] = preg_match('/\b[A-Z0-9._%-]+@[A-Z0-9.-]+\.[A-Z]{2,4}\b/i', $_POST['email']) ? '' : 'INVALID EMAIL ADDRESS'; if(!eregi("^[a-z0-9]+([_\\.-][a-z0-9]+)*" ."@"."([a-z0-9]+([\.-][a-z0-9]+)*)+"."\\.[a-z]{2,}"."$",$email )){ $errors=1; } if($errors==1) echo $error; else{ $values = array ('Name','Email','Telephone','Comments'); $required = array('Name','Email','Telephone','Comments'); $your_email = "****************"; $email_subject = "Comment posted from website:"; foreach($values as $key => $value){ if(in_array($value,$required)){ if ($key != 'Name' && $key != 'Comments' && $key != 'Telephone') { if( empty($_POST[$value]) ) { echo 'Please go back and complete all fields, thank you.'; exit; } } $email_content .= $value.': '.$_POST[$value]."\n"; } } } $headers = "From: $email\r\n"."Reply-To: $email\r\n".'X-Mailer: PHP/' . phpversion(); mail($your_email, $email_subject, $email_content, $headers); if($send_contact){ echo "Thank you for your submission"; } else { echo "ERROR, your comment was not sent"; ?> </body> </html> MOD EDIT: [code] . . . [/code] tags added. I have all error reporting turned on. And no errors are showing. I've been staring at this code for 2 hours and can't find the error. But the form is blank! The form shows up with the radio buttons but is blank! Heres the code... <?php error_reporting(E_ALL); ?> <?php include 'dbc.php'; //----------------------------------------- $result = mysql_query("SELECT * FROM users ORDER BY nc_points DESC"); while ($row = mysql_fetch_object($result)) { $leaderboard[] = $row->user_name; $leaderboardPoints[] = $row->cfb_points; } $result1 = mysql_query("SELECT CollegeFootballGames.ID, CollegeFootballGames.Week, CollegeFootballGames.Away, CollegeFootballGames.Home, CollegeFootballTeams.Team FROM CollegeFootballGames INNER JOIN CollegeFootballTeams ON CollegeFootballGames.Away = CollegeFootballTeams.ID || CollegeFootballGames.Home=CollegeFootballTeams.ID"); while ($row = mysql_fetch_object($result1)) { $GameID[] = $row->ID; $Teams[] = $row->Team; } //---------------------------------------- $date =("now"); if ( strtotime($date) > strtotime('18 July 2010') && strtotime($date) < strtotime('2 September 2010')){$wknum = '1'; $wk = "Week";} elseif ( strtotime($date) > strtotime('6 September 2010') && strtotime($date) < strtotime('11 September 2010')){$wknum = '2'; $wk = "Week";} elseif ( strtotime($date) > strtotime('11 September 2010') && strtotime($date) < strtotime('16 September 2010')){$wknum = '3'; $wk = "Week";} elseif ( strtotime($date) > strtotime('18 September 2010') && strtotime($date) < strtotime('23 September 2010')){$wknum = '4'; $wk = "Week";} elseif ( strtotime($date) > strtotime('25 September 2010') && strtotime($date) < strtotime('2 October 2010')){$wknum = '5'; $wk = "Week";} elseif ( strtotime($date) > strtotime('2 October 2010') && strtotime($date) < strtotime('9 October 2010')){$wknum = '6'; $wk = "Week";} elseif ( strtotime($date) > strtotime('9 October 2010') && strtotime($date) < strtotime('16 October 2010')){$wknum = '7'; $wk = "Week";} elseif ( strtotime($date) > strtotime('16 October 2010') && strtotime($date) < strtotime('23 October 2010')){$wknum = '8'; $wk = "Week";} elseif ( strtotime($date) > strtotime('23 October 2010') && strtotime($date) < strtotime('28 October 2010')){$wknum = '9'; $wk = "Week";} elseif ( strtotime($date) > strtotime('30 October 2010') && strtotime($date) < strtotime('4 November 2010')){$wknum = '10'; $wk = "Week";} elseif ( strtotime($date) > strtotime('6 November 2010') && strtotime($date) < strtotime('13 November 2010')){$wknum = '11'; $wk = "Week";} elseif ( strtotime($date) > strtotime('13 November 2010') && strtotime($date) < strtotime('20 November 2010')){$wknum = '12'; $wk = "Week";} elseif ( strtotime($date) > strtotime('20 November 2010') && strtotime($date) < strtotime('27 November 2010')){$wknum = '13'; $wk = "Week";} else{} //Form 12 $form12 = ('<h3><em style="color: #F00"> <?php echo $wk;?> <?php echo $wknum;?> </em></h3> <form name="Picks" method="post" action="<?php echo $process; ?>"> <p><br> <input name="P0" type="hidden" value="<?php echo ($p[0]); ?>"> <label> <input type="radio" name="game1" value="<?php echo ($away[0]);?>" > <?php echo ($away[0]);?></label> at <label> <input type="radio" name="game1" value="<?php echo ($home[0]);?>" > <?php echo ($home[0]);?></label> <br> <input name="P1" type="hidden" value="<?php echo ($p[1]); ?>"> <label> <input type="radio" name="game2" value="<?php echo ($away[1]);?>" > <?php echo ($away[1]);?></label> at <label> <input type="radio" name="game2" value="<?php echo ($home[1]);?>" > <?php echo ($home[1]);?></label> <br> <input name="P2" type="hidden" value="<?php echo ($p[2]); ?>"> <label> <input type="radio" name="game3" value="<?php echo ($away[2]);?>" > <?php echo ($away[2]);?></label> at <label> <input type="radio" name="game3" value="<?php echo ($home[2]);?>" > <?php echo ($home[2]);?></label> <br> <input name="P3" type="hidden" value="<?php echo ($p[3]); ?>"> <label> <input type="radio" name="game4" value="<?php echo ($away[3]);?>" > <?php echo ($away[3]);?> </label> at <label> <input type="radio" name="game4" value="<?php echo ($home[3]);?>" > <?php echo ($home[3]);?></label> <input name="P4" type="hidden" value="<?php echo ($p[4]); ?>"> <br> <label> <input type="radio" name="game5" value="<?php echo ($away[4]);?>" > <?php echo ($away[4]);?></label> at <label> <input type="radio" name="game5" value="<?php echo ($home[4]);?>" > <?php echo ($home[4]);?></label> <br> <input name="P5" type="hidden" value="<?php echo ($p[5]); ?>"> <label> <input type="radio" name="game6" value="<?php echo ($away[5]);?>" > <?php echo ($away[5]);?></label> at <label> <input type="radio" name="game6" value="<?php echo ($home[5]);?>" > <?php echo ($home[5]);?></label> <br> <input name="P6" type="hidden" value="<?php echo ($p[6]); ?>"> <label> <input type="radio" name="game7" value="<?php echo ($away[6]);?>" > <?php echo ($away[6]);?></label> at <label> <input type="radio" name="game7" value="<?php echo ($home[6]);?>" > <?php echo ($home[6]);?></label> <br> <input name="P7" type="hidden" value="<?php echo ($p[7]); ?>"> <label> <input type="radio" name="game8" value="<?php echo ($away[7]);?>" > <?php echo ($away[7]);?></label> at <label> <input type="radio" name="game8" value="<?php echo ($home[7]);?>" > <?php echo ($home[7]);?></label> <br> <input name="P8" type="hidden" value="<?php echo ($p[8]); ?>"> <label> <input type="radio" name="game9" value="<?php echo ($away[8]);?>" > <?php echo ($away[8]);?> </label> at <label> <input type="radio" name="game9" value="<?php echo ($home[8]);?>" > <?php echo ($home[8]);?></label> <br> <input name="P9" type="hidden" value="<?php echo ($p[9]); ?>"> <label> <input type="radio" name="game10" value="<?php echo ($away[9]);?>" > <?php echo ($away[9]);?> </label> at <label> <input type="radio" name="game10" value="<?php echo ($home[9]);?>" > <?php echo ($home[9]);?></label> <br> <input name="P10" type="hidden" value="<?php echo ($p[10]); ?>"> <label> <input type="radio" name="game11" value="<?php echo ($away[10]);?>" > <?php echo ($away[10]);?></label> at <label> <input type="radio" name="game11" value="<?php echo ($home[10]);?>" > <?php echo ($home[10]);?></label> <br> <input name="P11" type="hidden" value="<?php echo ($p[11]); ?>"> <label> <input type="radio" name="game12" value="<?php echo ($away[11]);?>" > <?php echo ($away[11]);?></label> at <label> <input type="radio" name="game12" value="<?php echo ($home[11]);?>" > <?php echo ($home[11]);?></label> <br> <br> <label> <input type="reset" name="button" id="button" value="Reset"> </label> <label> <input type="submit" name="button2" id="button2" value="Submit"> </label> <br> </p> </form>'); if ( strtotime($date) > strtotime('18 July 2010') && strtotime($date) < strtotime('2 September 2010')){$wknum = '1'; $formDisplay = $form12; $wk = "Week"; $process = 'cfb_picks_process.php'; $away =array("$Teams[0]","$Teams[2]","$Teams[4]","$Teams[6]","$Teams[8]","$Teams[10]","$Teams[12]","$Teams[14]","$Teams[16]","$Teams[18]","$Teams[20]","$Teams[22]"); $home =array("$Teams[1]","$Teams[3]","$Teams[5]","$Teams[7]","$Teams[9]","$Teams[11]","$Teams[13]","$Teams[15]","$Teams[17]","$Teams[19]","$Teams[21]","$Teams[23]"); $p = array ("$GameID[0]","$GameID[2]","$GameID[4]","$GameID[6]","$GameID[8]","$GameID[10]","$GameID[12]","$GameID[14]","$GameID[16]","$GameID[18]","$GameID[20]","$GameID[22]");} elseif ( strtotime($date) > strtotime('6 September 2010') && strtotime($date) < strtotime('11 September 2010')){$wknum = '2';$formDisplay = $form12; $wk = "Week";$process = 'cfb_picks_process.php'; $away =array("$Teams[24]","$Teams[26]","$Teams[28]","$Teams[30]","$Teams[33]","$Teams[34]","$Teams[36]","$Teams[38]","$Teams[40]","$Teams[42]","$Teams[44]","$Teams[46]"); $home =array("$Teams[25]","$Teams[27]","$Teams[29]","$Teams[31]","$Teams[32]","$Teams[35]","$Teams[37]","$Teams[39]","$Teams[41]","$Teams[43]","$Teams[45]","$Teams[47]"); $p = array ("$GameID[24]","$GameID[26]","$GameID[28]","$GameID[30]","$GameID[32]","$GameID[34]","$GameID[36]","$GameID[38]","$GameID[40]","$GameID[42]","$GameID[44]","$GameID[46]"); } elseif ( strtotime($date) > strtotime('11 September 2010') && strtotime($date) < strtotime('16 September 2010')){$wknum = '3';$formDisplay = $form12; $wk = "Week";$process = 'cfb_picks_process.php'; $away =array("$Teams[49]","$Teams[50]","$Teams[52]","$Teams[55]","$Teams[56]","$Teams[58]","$Teams[61]","$Teams[62]","$Teams[64]","$Teams[66]","$Teams[68]","$Teams[70]"); $home =array("$Teams[48]","$Teams[51]","$Teams[53]","$Teams[54]","$Teams[57]","$Teams[59]","$Teams[60]","$Teams[63]","$Teams[65]","$Teams[67]","$Teams[69]","$Teams[71]"); $p = array ("$GameID[48]","$GameID[50]","$GameID[52]","$GameID[54]","$GameID[56]","$GameID[58]","$GameID[60]","$GameID[62]","$GameID[64]","$GameID[66]","$GameID[68]","$GameID[70]"); } elseif ( strtotime($date) > strtotime('18 September 2010') && strtotime($date) < strtotime('23 September 2010')){$wknum = '4';$formDisplay = $form12; $wk = "Week";$process = 'cfb_picks_process.php'; $away =array("$Teams[72]","$Teams[74]","$Teams[76]","$Teams[78]","$Teams[80]","$Teams[83]","$Teams[85]","$Teams[87]","$Teams[88]","$Teams[91]","$Teams[92]","$Teams[94]"); $home =array("$Teams[73]","$Teams[75]","$Teams[77]","$Teams[79]","$Teams[81]","$Teams[82]","$Teams[84]","$Teams[86]","$Teams[89]","$Teams[90]","$Teams[93]","$Teams[95]"); $p = array ("$GameID[72]","$GameID[74]","$GameID[76]","$GameID[78]","$GameID[80]","$GameID[82]","$GameID[84]","$GameID[86]","$GameID[88]","$GameID[90]","$GameID[92]","$GameID[94]"); } elseif ( strtotime($date) > strtotime('25 September 2010') && strtotime($date) < strtotime('2 October 2010')){$wknum = '5';$formDisplay = $form12; $wk = "Week";$process = 'cfb_picks_process.php'; /*$away =array("$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]"); $home =array("$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]"); $p = array ("$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]"); */} elseif ( strtotime($date) > strtotime('2 October 2010') && strtotime($date) < strtotime('9 October 2010')){$wknum = '6';$formDisplay = $form12; $wk = "Week";$process = 'cfb_picks_process.php'; /*$away =array("$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]"); $home =array("$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]"); $p = array ("$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]"); */} elseif ( strtotime($date) > strtotime('9 October 2010') && strtotime($date) < strtotime('16 October 2010')){$wknum = '7';$formDisplay = $form12;$wk = "Week";$process = 'cfb_picks_process.php'; /*$away =array("$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]"); $home =array("$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]"); $p = array ("$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]"); */} elseif ( strtotime($date) > strtotime('16 October 2010') && strtotime($date) < strtotime('23 October 2010')){$wknum = '8';$formDisplay = $form12;$wk = "Week";$process = 'cfb_picks_process.php'; /*$away =array("$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]"); $home =array("$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]"); $p = array ("$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]"); */} elseif ( strtotime($date) > strtotime('23 October 2010') && strtotime($date) < strtotime('28 October 2010')){$wknum = '9';$formDisplay = $form12;$wk = "Week";$process = 'cfb_picks_process.php'; /*$away =array("$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]"); $home =array("$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]"); $p = array ("$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]"); */} elseif ( strtotime($date) > strtotime('30 October 2010') && strtotime($date) < strtotime('4 November 2010')){$wknum = '10';$formDisplay = $form12;$wk = "Week";$process = 'cfb_picks_process.php'; /*$away =array("$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]"); $home =array("$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]"); $p = array ("$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]"); */} elseif ( strtotime($date) > strtotime('6 November 2010') && strtotime($date) < strtotime('13 November 2010')){$wknum = '11';$formDisplay = $form12;$wk = "Week";$process = 'cfb_picks_process.php'; /*$away =array("$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]"); $home =array("$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]"); $p = array ("$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]"); */} elseif ( strtotime($date) > strtotime('13 November 2010') && strtotime($date) < strtotime('20 November 2010')){$wknum = '12';$formDisplay = $form12;$wk = "Week";$process = 'cfb_picks_process.php'; /*$away =array("$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]"); $home =array("$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]"); $p = array ("$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]"); */} elseif ( strtotime($date) > strtotime('20 November 2010') && strtotime($date) < strtotime('27 November 2010')){$wknum = '13';$formDisplay = $form12;$wk = "Week";$process = 'cfb_picks_process.php'; /*$away =array("$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]"); $home =array("$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]"); $p = array ("$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]"); */} else{$formDisplay = $wk = " "; $formDisplay = ("<br><br><h2>Picks For this week are final!</h2> <br><br><br> Check Back Later To Make Your Picks For Next Week");} $result = mysql_query("SELECT * FROM users ORDER BY nc_points DESC"); while ($row = mysql_fetch_object($result)) { $leaderboard[] = $row->user_name; $leaderboardPoints[] = $row->cfb_points; } $result1 = mysql_query("SELECT CollegeFootballGames.ID, CollegeFootballGames.Week, CollegeFootballGames.Away, CollegeFootballGames.Home, CollegeFootballTeams.Team FROM CollegeFootballGames INNER JOIN CollegeFootballTeams ON CollegeFootballGames.Away = CollegeFootballTeams.ID || CollegeFootballGames.Home=CollegeFootballTeams.ID"); while ($row = mysql_fetch_object($result1)) { $GameID[] = $row->ID; $Teams[] = $row->Team; } ?> <? echo $formDisplay; ?> If you see what is wrong please tell me. it's supposed to check the file, to see if it's available for download, the code below looks okay to me, what's wrong? if($row[2]==2) // 4shared check { $row[1]="http://www.".$row[1]; $index=getpage($row[1]); preg_match("/Download ([^<]+)<\/div>/",$index,$match); if(strpos($index,"The file is shared for public access and download.")===false || !$match) { mysql_query("UPDATE `v2links` SET `checked`='-1',`lastcheck`=NOW() WHERE `id`=".$row[0]); print "bad link\n"; logstr("log-c.txt","bad link\n"); } else { $words=trim($match[1]); $words=preg_split("/[_\.\-\s]/",$words); $lastword=array_pop($words); $words=implode(" ",$words); $words=preg_replace("/\s{2,}/"," ",$words); $caption=mysql_real_escape_string($words); unset($words); unset($match); preg_match("/<td>Size\:<\/td><td>([^<]+)<\/td>/",$index,$match); $fsize=$match[1]; unset($match); print "$caption :: $fsize\n"; logstr("log-c.txt","$caption :: $fsize\n"); mysql_query("UPDATE `v2links` SET `checked`='1',`lastcheck`=NOW(),`fsize`='$fsize',`caption`='$caption' WHERE `id`=".$row[0]); if(mysql_errno()) print mysql_error()."\n"; } } I'm wondering if the sharing website has changed anything, because for rapidshare it works fine, code: if($row[2]==1) // rapidshare check { $index=getpage($row[1]); if(strpos($index,"<p><script>alert(\"File not found.\")</script>File not found.</p>")===false && strpos($index,"This file has been deleted.")===false) { preg_match("/<form action=\"([^\"]+)\" method=\"post\">/",$index,$match); //print $index; if($match[1]) { $fpath=$match[1]; $index=getpage($fpath,"dl.start=Free",$row[1]); preg_match("/<\/font> \(([^\(]+)\)\.<\/p>/",$index,$match); $fsize=0; if($match[1]) $fsize=mysql_real_escape_string(strip_tags($match[1])); print $fsize."\n"; logstr("log-c.txt",$fsize."\n"); mysql_query("UPDATE `v2links` SET `checked`='1',`fsize`='$fsize',`lastcheck`=NOW() WHERE `id`=".$row[0]); if(mysql_errno()) print mysql_error()."\n"; } else { print "bad link\n"; logstr("log-c.txt","bad link\n"); mysql_query("UPDATE `v2links` SET `checked`='-1',`lastcheck`=NOW() WHERE `id`=".$row[0]); if(mysql_errno()) print mysql_error()."\n"; } } else { print "bad link\n"; logstr("log-c.txt","bad link\n"); mysql_query("UPDATE `v2links` SET `checked`='-1',`lastcheck`=NOW() WHERE `id`=".$row[0]); if(mysql_errno()) print mysql_error()."\n"; } } any help would be appreciated! mysql_query("UPDATE categories SET active=0 WHERE id=$id"); What am I doing wrong here to get: Parse error: syntax error, unexpected T_STRING ??? ok so before this.. if there isnt description for the company..the logo cant be click..only can be clicked if there is description added..im confused.. Code: [Select] <? if(isset($_GET[ttid])) { $ttid = $_GET[ttid]; } $connection=mysql_connect("$server", "$username", "$password") or die("Could not establish connection"); mysql_select_db($database_name, $connection) or die ("Could not select database"); $query = "select master_event.* , (DATE_FORMAT(event_datefrom, '%d %M %Y')) as datefrom, (DATE_FORMAT(event_dateto, '%d %M %Y')) as dateto, ucase(event_name) as eventname from master_event where master_event.event_id = '$ttid '"; $result=mysql_query($query); while($row = mysql_fetch_array($result)){ $eventname = $row['eventname']; $eventdesc = $row['event_desc']; //$companydescription = $row['company_description']; $eventvenue = $row['event_venue']; $eventfee = $row['event_fee']; $datefrom = $row['datefrom']; $dateto = $row['dateto']; echo "<font color='#000000' face='arial' ><b> $eventname </b> </font> <br>"; echo "<font color='#000000' face='arial' ><i>Date</i> : $datefrom - $dateto <br>"; echo "<i>Venue</i> : $eventvenue <br>"; $querypstype = "SELECT DISTINCT master_pstype.pstype_id, pstype_desc FROM master_pstype INNER JOIN master_psevent ON master_psevent.pstype_id= master_pstype.pstype_id where master_psevent.event_id = '$ttid' ORDER BY pstype_order"; $resultpstype=mysql_query($querypstype); while($rowpstype = mysql_fetch_array($resultpstype)){ $pstypeid = $rowpstype['pstype_id']; $pstypedesc = $rowpstype['pstype_desc']; echo "<br><font color='#8B3A3A' size='1' face='georgia' ><b><i>$pstypedesc</i></b></font> <br>"; $queryps = "SELECT master_psevent.*, pstype_desc, company_name, company_link, company_description, logo_filename FROM master_psevent LEFT JOIN master_pstype ON master_psevent.pstype_id = master_pstype.pstype_id LEFT JOIN master_ps ON master_ps.ps_id = master_psevent.ps_id WHERE master_psevent.event_id = '$ttid' and master_pstype.pstype_id= '$pstypeid' ORDER BY pstype_desc,company_name "; $resultps=mysql_query($queryps); while($rowps = mysql_fetch_array($resultps)){ $companyname = $rowps['company_name']; $companyid = $rowps['ps_id']; $companylinkori = $rowps['company_link']; $companydescription = $rowps['company_description']; $logopath = $rowps['logo_filename']; $describelink = "index.php?ttid=$ttid&content=describe&pstypeid=$pstypeid&psid=$companyid"; echo "<a href=\"$describelink\" target=\"_blank\"><img src=".$logo_dir."/".$logopath." width=\"15%\"></a>"; ?> <br> <? } echo "<br>"; } } ?> im new..so to make it simple..the problem is ..i want it to be (if there is description = logo can be click, if no = otherwise) I did a big upgrade to my CMS and now the editing of an upload doesn't seem to work. The id is pulled from a list on the previous page and is functional. Here is the form: $id=$_GET['id']; $data = mysql_query("SELECT * FROM headerimg WHERE id = '$id'") or die(mysql_error()); while($info = mysql_fetch_array( $data )) { echo " <div id='edit'> <form method='post' action='headerimgeditprocess.php?id=".$id ."' enctype='multipart/form-data'> <fieldset> <legend>".$info['title'] ."</legend> <table> <tr><td colspan='2' style='text-align:center'><img src='../upload/headerimg/".$info['image'] ."' width='300'><br /><br /></tr></td> <td> Title:</td> <td> <input type='text' name='title' value='".$info['title'] ."'> </td></tr> <tr><td> Image: </td><td> <input type='file' name='image'></td></tr> </table> <br/> <br/> <input TYPE='submit' name='upload' title='Add data to the Database' value='Submit'/> </fieldset> </form> Here is the processor: $target = "/var/chroot/home/content/87/6409087/html/upload/headerimg/"; //This gets all the other information from the form $title=$_POST['title']; $id=$_GET['id']; if ($image != ''){ $image = ($_FILES['image']['name']); foreach($_FILES as $file) { move_uploaded_file($file['tmp_name'], $target . $file['name']); } mysql_query("UPDATE headerimg SET image ='$image' WHERE id ='$id'"); } //Writes the information to the database mysql_query("UPDATE headerimg SET title = '$title' WHERE id ='$id' "); ?> <p>Update Successful... <a href="../main.php">click here</a> to return to the administration area.</p> I am trying to create a very basic object but am having troubles. Code: [Select] <?php class item{ public $name; public $price; function __construct($name,$price){ $this->name=$name; $this->price=$price;} function getName(){ return $this->name; } } $object = new item("car",400); echo $object->getName(); ?> The HTML output is: name=$name; $this->price=$price;} function getName(){ return $this->name; } } $object = new item("car",400); echo $object->getName(); ?> I'm sure that this code is clean but for some reason will not output the desired result! any help would be great. thanks. Hi guys (again), thanks a lot for your previous help. I'm trying to learn about conditional statements and I've tried to create a form to produce a echo statement when all the conditions are met. Below is my code, it is in two files... baconandeggs.php <html> <head></head> <body> <form action="baconandeggsform.php" method="post"> <!-- Question One --> <p>Please choose what day it is:</p> <select name="$day"> <option value="monday">Monday</option> <option value="tuesday">Tuesday</option> <option value="wednesday">Wednesday</option> <option value="thursday">Thursday</option> <option value="friday">Friday</option> <option value="saturday">Saturday</option> <option value="sunday">Sunday</option> </select> <br /> <!-- Question Two --> <p>Please enter the time:</p> <input type="$time" name="time"> <br /> <!-- Question Three --> <p>Please choose what country you are from...</p> <select name="$country"> <option value="uk">UK</option> <option value="usa">USA</option> <option value="europe">Europe</option> </select> <!-- Form Submit --> <input type="submit"> </form> </body> </html> baconandeggsform.php <html> <head></head> <body> <?php if ($day == 'thursday') { if ($time == '0800') { if ($country == 'uk') {$meal = 'bacon and eggs';} else {$meal = 'sausages';} } } ?> <?php echo $meal; ?> </body> </html> Any ideas why it isn't working? I've probably done something really obvious, but I have been trying to figure it out for a few hours now and it's doing my head in! |