PHP - Link Exchange Automatic Check
$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 Similar TutorialsHi .. 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. 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. Hello, 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 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 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! 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');?> 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 ( ) ) Hi! I have a question that I need help with. I guess almost everyone of us have played a webgame where something happends automaticly. Some examples: Attacks, resources in Travian, Tribalwars, Khan Wars ... How are these things done? Now I'm talking about automatical things that happends every second. Is there a Cron Job that every second connectes to a database and adds more resources to the player? Regards Worqy I want to upload a file automatically at any time from my home PC to a website I am developing. I can upload OK using a form with 'enctype="multipart/form-data"' but this requires manual operation to select a file and to submit the upload request. Is there a way the upload process can be made to happen with no operator present? I also want to download from the website to my PC automatically ie. download a file (as it becomes available) from the website to a specified location on my PC, without operator intervention. Help. Thanks. Hi All, Not sure if this is the right forum or not, so here goes! Just trying to generate a sitemap using: http://www.sitemapdoc.com/Default.aspx but get the error: Quote too many automatic redirections were attempted. I've a 301.php redirect file on my site to handle redirects and contains: if (isset($map[$_SERVER['REDIRECT_URL']])) { $new_loc = 'http://' . $_SERVER['HTTP_HOST'] . $map[$_SERVER['REDIRECT_URL']]; if (isset($_SERVER['REDIRECT_QUERY_STRING'])) { $new_loc .= '?' . $_SERVER['REDIRECT_QUERY_STRING']; } header("HTTP/1.1 301 Moved Permanently"); header("Location: $new_loc"); } else { header("HTTP/1.1 301 Moved Permanently"); header("Location: ".$_SERVER['HTTP_HOST']); } Is it an issue with my 301 causing the above error or something else? Many thanks is there any way to submit a form without using a submit button? I want the form to post after the user has entered a certain amount of charaters? maybe using javascript? Any help is appreciated Ant I have a MySQL database that has a list of items which gets updated everyday. The database is truncated everyday and filled back with the recent posts. After it is filled out, I need an automatic system that will send out the emails to users who have provided certain keyword. I have a search query in place that will search through those posts, but I cannot figure out the email alert part. I just want to make something similar to a new job alert... What could be the potential tools that I can use to accomplish this? Currently all my website is in php. Thanks!! <?php $files=glob('apk/*'); foreach( $files as $file) { echo '<img scr="'.$file.'">'.basename($file).'</img><br/>'; } ?> I'm trying to create a table that looks like this: 25/11/2011 28/09/2012 02/08/2013 23/12/2011 26/10/2012 30/08/2013 20/01/2012 23/11/2012 27/09/2013 17/02/2012 21/12/2012 25/10/2013 16/03/2012 18/01/2013 22/11/2013 13/04/2012 15/02/2013 20/12/2013 11/05/2012 15/03/2013 17/01/2014 08/06/2012 12/04/2013 14/02/2014 06/07/2012 10/05/2013 14/03/2014 03/08/2012 07/06/2013 11/04/2014 31/08/2012 05/07/2013 09/05/2014 Basically it formats the dates automatically every 4 weeks into 3 columns. So far, I have the following code: Code: [Select] <?php $startDate = '2011-11-25'; $columns = 3; $number_of_dates = 33; // calculate number of rows per column $rows_per_column = ceil($number_of_dates / $columns); // make your table echo "<table>\n"; //here we changed the condition to $i < $rows for($i = 0; $i < $rows_per_column; $i++) { echo "<tr>\n"; //here will run another loop for the amount of columns for($j = 0; $j < $columns; $j++) { $weekOffset = $i * 4; $nextDate = strtotime("{$startDate} +{$weekOffset} weeks"); echo "<td width = '100'>" . date('d/m/y', $nextDate) . "</td>\n"; } echo "</tr>\n"; } echo "</table>\n"; ?> Which creates the first column fine, but then repeats the same column two more times... 25/11/2011 25/11/2011 25/11/2011 23/12/2011 23/12/2011 23/12/2011 20/01/2012 20/01/2012 20/01/2012 17/02/2012 17/02/2012 17/02/2012 16/03/2012 16/03/2012 16/03/2012 13/04/2012 13/04/2012 13/04/2012 11/05/2012 11/05/2012 11/05/2012 08/06/2012 08/06/2012 08/06/2012 06/07/2012 06/07/2012 06/07/2012 03/08/2012 03/08/2012 03/08/2012 31/08/2012 31/08/2012 31/08/2012 I know that this means there is a problem with my loop resetting itself rather than continuing, but I'm not sure how to fix it. Please could someone point out my stupid mistake? Thanks Hi, i am still trying to learn html and php, but i am also trying to create a website which contains a registration form. I want the validation of each field of that form to be performed automatically. So using onBlur, whenever the user steps out of a textbox field, i want to execute a php function located in another file, which will check the value of the field and display a note if the value is invalid. I want to do this using as less javascript as possible. I am not sure if what i am asking is possible but if it is i would like to know the easiest way to do this. I would appreciate any help i can get. Thanks for your time. Hello ,
I'm here with a problem facing with automatic login , I'm not able to login programmatically and fill the forms programatically to other website . here is the code which i have tried .
<?php I would like to have my site automatically email me about progress of users at certain times of the day. I am using PHP, but I think this is a server issue. I just need someone to point me in the right direction so I can search out the solution. Thank you. Hi Guy, First Post ..so please help! I have rows returning from a mYSQL Database which I put in a form which is php generated and im sending this form to the next page with a SUBMIT button. I want PHP/Javascript to do this automatically when the data is loaded from the MYSQL Table Ive tried fsockpen and document.form.submit() but it doesnt seem to work Any help. Thanks in Adv, Hittesh Ahuja <?php session_start(); if(isset($_POST['submit'])) { header("Location: http://localhost/PHP/brk_plan.php"); } ?> <!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>Untitled Document</title> </head> <body> <p> <?php require_once('connect.php'); $email=$_SESSION['email']; $query="SELECT glycemic_index.gi_id,glycemic_index.value FROM food_preference JOIN glycemic_index ON glycemic_index.gi_id=food_preference.gi_id WHERE food_preference.email='$email' and glycemic_index.value >= 55 " or die("Update not Possible"); $result=mysql_query($query); $session_array=array(); echo "<form method='post' action='brk_plan.php' name='recommend'>"; echo "<p>This area is filtered from the user's table showing values only > 55</p>"; while($row=mysql_fetch_array($result)) { echo "Instead of: ".$row[0]."-".$row[1]."<br/>"; $one=$row[0]; $one_trimmed=substr($one,2,strlen($one)-5); $one_search="%".$one_trimmed."%"; $query2="SELECT glycemic_index.gi_id,glycemic_index.value,glycemic_index.food FROM glycemic_index WHERE glycemic_index.gi_id LIKE '$one_search' AND glycemic_index.value <55 AND glycemic_index.gi_id!='$row[0]' ORDER BY RAND() LIMIT 1 "; $result2=mysql_query($query2); while($row2=mysql_fetch_array($result2)) { echo "<input type='hidden' value='$row2[2]' name='fields[]'></input>"; echo "<p>You can have ".$row2[2].": ".$row2[0]."-".$row2[1]."</p>"; } } echo "<input type='submit' name='submit' value='dikha!'></input>"; echo "</form>"; //$_SESSION['higher_gi']=$session_array; //foreach($session_array as $value) //{ // echo $value."<br/>"; //} ?> </p> <p></p> <p></p> <p></p> <p></p> <p> </p> </body> </html> Hi there, I am working on a php project on my WAMP server where I have access to XML datafeed from xe.com once a day to get the Exchange rates. This xml datafeed is saved on my localhost as an archived copy. Now I would like to automatically access the fresh xml datafeed file from xe.com once a day and replace (or update) the xml file on my localhost to have the updated information (rates). How can I schedule this task automatically and make php access the updated xml file once a day. All comments and feedbacks are always welcomed Thank you! |