Jump to content

twsowerby

Members
  • Posts

    79
  • Joined

  • Last visited

    Never

About twsowerby

  • Birthday 07/25/1986

Contact Methods

  • Website URL
    http://www.wordplayweb.com.au

Profile Information

  • Gender
    Male
  • Location
    Perth, Western Australia

twsowerby's Achievements

Member

Member (2/5)

0

Reputation

  1. Hi Guys, I have a query regarding best practice for performance on a web application I'm developing. I am retrieving data via an API that I then need to display on a website. The data retrieved all relates to a product ID. The issue I am having is that each product has a UniqueID, but also a GroupID. The GroupID is used to display the same products but of different colour/size combinations. ie. UniqueID GroupID Size Colour 1 1 n/a n/a 2 2 Small Red 3 2 Medium Blue 4 2 Large Green I need to display the products in a list, but where there are multiple products in a group, I need to provide a dropdown selector for size and a dropdown selector for colour. I'm struggling a bit with how to structure it with just the array spat out by the API, so I was considering saving the data to a MySQL database and then querying that to get what I need. Is this a good way to go or is the double query hit going to be horribly inefficient? Cheers!
  2. It may be a little bit of a heavy handed approach, but Drupal has a module called Webform that allows users to create forms on the fly. It then stores the form results for you and has the facility to add additional processing such as email confirmation on form completion.
  3. Hi guys, I'm trying to develop a 'silent' install script for Drupal. Ideally what I would like is to be able to define the database host/name/password as variables and then also pass in the admin username and password so that the initial drupal installation form is no longer needed. Has anyone tried this before or have any ideas on the best way to do it? Cheers!
  4. Hi All, I've searched around for the answer to this and can't find anything useful. I have a virtual private server that runs apache. I manage it via webhost manager. F every new website I create for a client, I set up a hosting package for them which gives them some file space, emails and a Cpanel login. I want to set it up so that I can run all of the website from a single drupal codebase and also share the database. I know you can set this up using Drupal's multisite functionality, but that requires all the sites to use a single CPanel account. I need to be able to share the single codebase between multiple Cpanel accounts. If that doesnt make sense then please ask questions, happy to try and elaborate! Cheers!
  5. Ah yes I see the difference now. Thanks for your help!
  6. Excellent thanks, thats pretty much what I figured, just wondered of there was a different way that might be better. Cheers
  7. I ahve a call referral system that allows a user to log in and view referral records one at a time. The user looks at the record, makes a call, adds a note and clicks submit. The record is then updated. I am fast approaching a situation where I will have more than one user. Given the way the system retrieves records it is possible that two people using the system at the same time may be shown the same record and attempt to edit the same record at the same time. To get around this I was planning on implementing a random selection function. The function would randomly select a record and display it. Upon selection, a 'currently being edited' marker would be placed against that record. The next time a user calls the random selection function, it will do a check to see if the 'currently being edited' marker exists for that record. If it does then call the random select function again and so on until it gets one with no marker. Is there a better way of doing this? Cheers!
  8. Hi, In order to develop in php you will need to set up some sort of development environment. Your best bet for this is possibly to take a look at something like XAMPP which will allow you to set up a local installation of apache and mysql. Once installed correctly you will be able to browse to http://localhost and see a page that should indicate you have set up your local development environment correctly. After you've wrapped your head around this you could then look at setting up a separate server that will serve files to the computer you are developing on, but for now you may be better just getting it all running on one computer.
  9. This is the function that apiGetD() connects to: Function GetDashboard($sessionID, $user, $dbc, $api, $dataBase){ $userChars = GetAPIKeys($sessionID, $user, $dbc); if(!count($userChars) < 1){ foreach($userChars as $key => $value){ if($value["info"]["skilllevel"] > 0){ $value["info"]["skilllevel"] = SkillLevel($value["info"]["skilllevel"]); $tqTime = strtotime($value["info"]["evetime"]); $endTime = strtotime($value["info"]["skillTime"]); $timeLeft = TimeLeft($endTime, $tqTime); $value["return"]["name"] = $value["details"]["name"]; $value["return"]["skillintraining"] = $api->GetTypeName($value["info"]["skillintraining"], $dataBase); $value["return"]["skilllevel"] = $value["info"]["skilllevel"]; if($ft < 0){ $value["return"]["skillTime"]["note"] = "Finished"; $value["return"]["skillTime"]["days"] = abs($timeLeft['days']); $value["return"]["skillTime"]["hours"] = abs($timeLeft['hours']); $value["return"]["skillTime"]["minutes"] = abs($timeLeft['minutes']); $value["return"]["skillTime"]["seconds"] = abs($timeLeft['seconds']); } else { $value["return"]["skillTime"]["note"] = ""; $value["return"]["skillTime"]["days"] = $timeLeft['days']; $value["return"]["skillTime"]["hours"] = $timeLeft['hours']; $value["return"]["skillTime"]["minutes"] = $timeLeft['minutes']; $value["return"]["skillTime"]["seconds"] = $timeLeft['seconds']; } $value["return"]["WalletAmount"] = number_format($value["details"]["balance"],2)." ISK"; $returnArray[$key] = $value["return"]; } } } return $returnArray; }
  10. Ok, how would i change it to return an array? I know that the function that it connects to with fsockopen returns an array so somewhere along the line its becoming a string but im not sure where.
  11. I thought that too but keep getting an error. The code im using to connectt o the access class and return the array is as follows: <?php $vars = array('user'=>'demo', 'password'=>'demo', 'skey'=>'abc123', 'request'=>'Dashboard', 'userID'=>'2'); $data = apiGetD($vars); function apiGetD($vars) { $accessURL = 'www.eve-tool.com'; $apiURL = '/api/class/class.access.php'; $poststring = http_build_query($vars, '', '&'); $fp = fsockopen($accessURL, 80); fputs($fp, "POST " . $apiURL . " HTTP/1.0\r\n"); fputs($fp, "Host: " . $accessURL . "\r\n"); fputs($fp, "Content-Type: application/x-www-form-urlencoded\r\n"); fputs($fp, "User-Agent: PHPApi\r\n"); fputs($fp, "Content-Length: " . strlen($poststring) . "\r\n"); fputs($fp, "Connection: close\r\n\r\n"); if (strlen($poststring) > 0) fputs($fp, $poststring . "\r\n"); $contents = ""; while (!feof($fp)) { $contents .= fgets($fp); } fclose($fp); $start = strpos($contents, "\r\n\r\n"); if ($start !== false) { return substr($contents, $start + strlen("\r\n\r\n")); } } foreach($data as $key=>$value) { echo $key.": ".$value; } Warning: Invalid argument supplied for foreach() in E:\xampp\htdocs\test.php on line 50 is what i get. If I remove the foreach at the bottom and just print $data i get the array data back fine. any ideas?
  12. Hey guys, I would like to take an array returned from an access class and style the data so it looks good. Currently I get this: Array ( [576113096] => Array ( [name] => Nobues [skillintraining] => Fighters [skilllevel] => IV [skillTime] => Array ( [note] => [days] => 2 [hours] => 5 [minutes] => 53 [seconds] => 40 ) [WalletAmount] => 65,508,812.57 ISK ) [1404986087] => Array ( [name] => Lireil Crow [skillintraining] => Astrometric Triangulation [skilllevel] => IV [skillTime] => Array ( [note] => [days] => 1 [hours] => 3 [minutes] => 21 [seconds] => 32 ) [WalletAmount] => 9,177,531.37 ISK ) [217317000] => Array ( [name] => Hansoloo [skillintraining] => Amarr Carrier [skilllevel] => V [skillTime] => Array ( [note] => [days] => 60 [hours] => 22 [minutes] => 26 [seconds] => 33 ) [WalletAmount] => 65,100.15 ISK ) [689240734] => Array ( [name] => Mung Lore [skillintraining] => Torpedoes [skilllevel] => V [skillTime] => Array ( [note] => [days] => 8 [hours] => 9 [minutes] => 30 [seconds] => 3 ) [WalletAmount] => 194,399.22 ISK ) ) Obviously that isnt very nice to look at, how would i go about separating each bit of data to style and position?
  13. Hmmm the sitekey variable I'm using is just used for passing a value into the class which sits on another server, surely it cant be conflicting with any Drupal sitekeys? The error message im getting is nothing to do with drupal, its an array that is returned from a standalone function when it cant reference the value being passed in.
  14. Hi all, Ok I cant figure something out. I have this code: <?php $vars = array('user'=>'demo', 'password'=>'demo', 'skey'=>'abc123', 'request'=>'Dashboard', 'userID'=>'2'); $data = apiGetD($vars); function apiGetD($vars) { $accessURL = 'www.eve-tool.com'; $apiURL = '/api/class/class.access.php'; $poststring = http_build_query($vars); $fp = fsockopen($accessURL, 80); fputs($fp, "POST " . $apiURL . " HTTP/1.0\r\n"); fputs($fp, "Host: " . $accessURL . "\r\n"); fputs($fp, "Content-Type: application/x-www-form-urlencoded\r\n"); fputs($fp, "User-Agent: PHPApi\r\n"); fputs($fp, "Content-Length: " . strlen($poststring) . "\r\n"); fputs($fp, "Connection: close\r\n\r\n"); if (strlen($poststring) > 0) fputs($fp, $poststring . "\r\n"); $contents = ""; while (!feof($fp)) { $contents .= fgets($fp); } fclose($fp); $start = strpos($contents, "\r\n\r\n"); if ($start !== false) { return substr($contents, $start + strlen("\r\n\r\n")); } } print_r($data); ?> Which is meant to connect to a class on another server and return an array. When I run it in a standalone "test.php" file on the same server as my drupal installation it works perfectly and I get the correct return. If I then take that exact same code and insert it into a drupal block with the php filter on, it doesnt seem to be sending the "skey" variable and I get this pre-programmed error array back: Array ( [0] => Array ( [message] => Authorization fail. [user] => demo [request] => [iP] => 74.208.43.153 [stamp] => 1232445084 ) [1] => Array ( [message] => No siteKey found. [user] => demo [request] => [iP] => 74.208.43.153 [stamp] => 1232445084 ) ) Note the "No siteKey found" error. Does anyone have any idea what might be messing this up? Or a way around it that I could try? Cheers, Tom
  15. Ok ill elaborate a bit, its an API basically. This: http://www.eve-tool.com/api/class/class.access.php?user=demo&password=demo&skey=abc123&request=Dashboard&userID=127 Returns an array of values based on the variables passed in. How do I get the array created by the functions in that class so that I can manipulate them in my code?
×
×
  • 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.