Jump to content

dark_destroyer

Members
  • Posts

    33
  • Joined

  • Last visited

About dark_destroyer

  • Birthday 07/01/1980

Contact Methods

  • Website URL
    http://www.peoplesafe.ie

Profile Information

  • Gender
    Male
  • Location
    UK

dark_destroyer's Achievements

Member

Member (2/5)

0

Reputation

  1. Hi guys, many thanks for the inputs, i have made some progress Below this now loads the page and triggers the SMS that i wanted. $homepage = file_get_contents('https://www.somedomain.com/secure/messenger/formpost/SendSMS.aspx?username=myusername&account=%%%%%%%&password=password&recipient=353871111111&body=test&plaintext=1 '); However i want to replace the recipient from 353871111111 to a variable $_SMS but it doesnt recognise it as a variable. Is there a way to pass a variable into the URL using file_get_contents? Thanks P
  2. Hi, Ive been trying to come up with a simple solution. I run a scheduled task every 1 minute, it checks for a certain message in a MySQL DB. If the message is there then i need to access a link such as: https://www.somedomain.com/secure/messenger/formpost/SendSMS.aspx?username=xxxx@xxxx.com&account=xxxxxxxx&xxxxxxxx&recipient=447800000000&body=This is the SMS to be sent&plaintext=1 This essentially sends an SMS to a user. both the recipient and the body need to be a variable. Is there a way then to get PHP to load/run the link without actually opening a browser? ive been trying to check out allow_url_fopen but i cant seem to find any examples of how this works. Any info or pointers would be great thanks.
  3. Hi, Thanks for the reply, but the count distinct is only counting distinct contactid's not accountid's so it shouldnt affect the query?
  4. Hi All, I have been struggling with what seems a simple enough query. I have three tables, Accounts, Contacts & Activities. Everytime an Activity is logged it logs the AccountID, Contact Subject, TimeDate. I query the Activities table to show me all the activity count from the previous week for each AccountID. I use: select accounts.account as Account, count(distinct activities.contactid) as Users, from accounts, activities where activities.accountid=accounts.accountid AND completeddate >= curdate() - INTERVAL DAYOFWEEK(curdate())+6 DAY AND completeddate < curdate() - INTERVAL DAYOFWEEK(curdate())-1 DAY group by accounts.account asc; The result is something like This: Account Users ACME Ltd 4 Warner Bros 6 RBS 9 etc.. The activities table has baout 20 million rows and this runs in about 20 seconds. However, I want a comprehensive list. I want to combine the results with a list of AccountID's that havent had any activity for that month. Account Users ACME Ltd 4 Warner Bros 6 RBS 9 Microsoft 0 or NULL etc... i have tried to UNION like this: select Account, '' from Accounts UNION select accounts.account as Account, count(distinct activities.contactid) as Users from accounts, activities where activities.accountid=accounts.accountid AND completeddate >= curdate() - INTERVAL DAYOFWEEK(curdate())+6 DAY AND completeddate < curdate() - INTERVAL DAYOFWEEK(curdate())-1 DAY group by accounts.account asc; From what i understand about UNION is that it should return a unique list (without duplicates). But what i get is a list of aprox 1400 accounts with when I only have approx 900 Accounts. I have tried LEFT OUTER JOIN but this just seemed to run forever ( i killed it after 2 hours) Does anyone have any suggestions on what I can try? Thanks Dark
  5. Hi All, I have a straightforward page that has about 30 text boxes in it. But... theres always a but... I want to be able to validate the text before update the record in MySQL. For example the IMEI field should have a minimum of 15 chars and no spaces.. Ive used: if (strpos($myString, " ") !== false) to check for blank spaces on a single field before, but i know what to check multiple fields. What is the best way to do this, should I: 1. Use a lot of elseif statements 2. Add all the values of the text boxes to a variable and insert/update them one by one using an if & elseif statement Can anyone suggest the "proper" way to do this?
  6. I have toyed around with $_GET and $_POST, i understand them at a basic level.. but im still not sure why, that when AccountID and ContactID are declared, only the ContactID is being pulled through.
  7. still very much confused, i have tried adding the $_AccoundID into the mysql insert statement, but it fails as $_AccountID is blank. when i do that i get the $_AccountID in the URL but it is blank. Im lost... completley lost...
  8. http://localhost/update_pool_details.php?ContactID=FSWRG2456&Account=ACME+LTD&Pool01Name=test2&Pool01Number=&PoolDOB01=0000-00-00&Pool02Name=test3&Pool02Number=&PoolDOB02=0000-00-00&Pool03Name=test4&Pool03Number=&PoolDOB03=0000-00-00&Pool04Name=&Pool04Number=&PoolDOB04=0000-00-00&Pool05Name=&Pool05Number=&PoolDOB05=0000-00-00&Pool06Name=&Pool06Number=&PoolDOB06=0000-00-00&Pool07Name=&Pool07Number=&PoolDOB07=0000-00-00&Pool08Name=&Pool08Number=&PoolDOB08=0000-00-00&Pool09Name=&Pool09Number=&PoolDOB09=0000-00-00&Pool10Name=&Pool10Number=&PoolDOB10=0000-00-00
  9. thats where im really struggling.. i would have thought that since the URL on the link containts the contactid and accountid, and it populates the contactid it would also populate the accountid. Since the contactid and accountid are declared in the same manner: $_AccountID = $_GET['AccountID']; $_Account = $_GET['Account']; $_ContactID = $_GET['ContactID']; i would have thought that it was passed to the URL link in the same way?
  10. Hi, no the AccountID is just blank http://localhost/user_details.php?ContactID=AAABBBBCCC&AccountID= when it should be http://localhost/user_details.php?ContactID=AAABBBBCCC&AccountID=DDDEEEFFF Thanks
  11. If i add in the echo i get: Array ( [ContactID] => AAABBBBCCC [Account] => ACME LTD [Pool01Name] => test2 [Pool01Number] => [PoolDOB01] => 0000-00-00 [Pool02Name] => test3 [Pool02Number] => [PoolDOB02] => 0000-00-00 [Pool03Name] => test4 [Pool03Number] => [PoolDOB03] => 0000-00-00 [Pool04Name] => [Pool04Number] => [PoolDOB04] => 0000-00-00 [Pool05Name] => [Pool05Number] => [PoolDOB05] => 0000-00-00 [Pool06Name] => [Pool06Number] => [PoolDOB06] => 0000-00-00 [Pool07Name] => [Pool07Number] => [PoolDOB07] => 0000-00-00 [Pool08Name] => [Pool08Number] => [PoolDOB08] => 0000-00-00 [Pool09Name] => [Pool09Number] => [PoolDOB09] => 0000-00-00 [Pool10Name] => [Pool10Number] => [PoolDOB10] => 0000-00-00 ) 1 So is this telling me that $_AccountID isnt pulling a value? My url should look like: http://localhost/user_details.php?ContactID=AAABBBBCCC&AccountID=DDDEEEFFF
  12. Hi, After the insert, i simply want to pass the variables, $_AccountID, $_Account, $_ContactID to the URL's, I can see the variables for the last 2, but not $_AccountID. THis is how i have defined them: $_AccountID = $_GET['AccountID']; $_Account = $_GET['Account']; $_ContactID = $_GET['ContactID']; $_AccountID is the one giving me a headache.. here is the full code i have used: <html> <head> <title>PeopleSafe</title> </head> <body> <?php $_AccountID = $_GET['AccountID']; $_Account = $_GET['Account']; $_ContactID = $_GET['ContactID']; $_FirstName = $_REQUEST["FirstName"]; $_LastName = $_REQUEST["LastName"]; $_Pool01Name = $_REQUEST["Pool01Name"]; $_Pool02Name = $_REQUEST["Pool02Name"]; $_Pool03Name = $_REQUEST["Pool03Name"]; $_Pool04Name = $_REQUEST["Pool04Name"]; $_Pool05Name = $_REQUEST["Pool05Name"]; $_Pool06Name = $_REQUEST["Pool06Name"]; $_Pool07Name = $_REQUEST["Pool07Name"]; $_Pool08Name = $_REQUEST["Pool08Name"]; $_Pool09Name = $_REQUEST["Pool09Name"]; $_Pool10Name = $_REQUEST["Pool10Name"]; $_Pool11Name = $_REQUEST["Pool11Name"]; $_Pool12Name = $_REQUEST["Pool12Name"]; $_Pool13Name = $_REQUEST["Pool13Name"]; $_Pool14Name = $_REQUEST["Pool14Name"]; $_Pool15Name = $_REQUEST["Pool15Name"]; $_Pool16Name = $_REQUEST["Pool16Name"]; $_Pool17Name = $_REQUEST["Pool17Name"]; $_Pool18Name = $_REQUEST["Pool18Name"]; $_Pool19Name = $_REQUEST["Pool19Name"]; $_Pool20Name = $_REQUEST["Pool20Name"]; $_Pool01Number = $_REQUEST["Pool01Number"]; $_Pool02Number = $_REQUEST["Pool02Number"]; $_Pool03Number = $_REQUEST["Pool03Number"]; $_Pool04Number = $_REQUEST["Pool04Number"]; $_Pool05Number = $_REQUEST["Pool05Number"]; $_Pool06Number = $_REQUEST["Pool06Number"]; $_Pool07Number = $_REQUEST["Pool07Number"]; $_Pool08Number = $_REQUEST["Pool08Number"]; $_Pool09Number = $_REQUEST["Pool09Number"]; $_Pool10Number = $_REQUEST["Pool10Number"]; $_Pool11Number = $_REQUEST["Pool11Number"]; $_Pool12Number = $_REQUEST["Pool12Number"]; $_Pool13Number = $_REQUEST["Pool13Number"]; $_Pool14Number = $_REQUEST["Pool14Number"]; $_Pool15Number = $_REQUEST["Pool15Number"]; $_Pool16Number = $_REQUEST["Pool16Number"]; $_Pool17Number = $_REQUEST["Pool17Number"]; $_Pool18Number = $_REQUEST["Pool18Number"]; $_Pool19Number = $_REQUEST["Pool19Number"]; $_Pool20Number = $_REQUEST["Pool20Number"]; $_Pool01DOB = $_REQUEST["Pool01DOB"]; $_Pool02DOB = $_REQUEST["Pool02DOB"]; $_Pool03DOB = $_REQUEST["Pool03DOB"]; $_Pool04DOB = $_REQUEST["Pool04DOB"]; $_Pool05DOB = $_REQUEST["Pool05DOB"]; $_Pool06DOB = $_REQUEST["Pool06DOB"]; $_Pool07DOB = $_REQUEST["Pool07DOB"]; $_Pool08DOB = $_REQUEST["Pool08DOB"]; $_Pool09DOB = $_REQUEST["Pool09DOB"]; $_Pool10DOB = $_REQUEST["Pool10DOB"]; $_Pool11DOB = $_REQUEST["Pool11DOB"]; $_Pool12DOB = $_REQUEST["Pool12DOB"]; $_Pool13DOB = $_REQUEST["Pool13DOB"]; $_Pool14DOB = $_REQUEST["Pool14DOB"]; $_Pool15DOB = $_REQUEST["Pool15DOB"]; $_Pool16DOB = $_REQUEST["Pool16DOB"]; $_Pool17DOB = $_REQUEST["Pool17DOB"]; $_Pool18DOB = $_REQUEST["Pool18DOB"]; $_Pool19DOB = $_REQUEST["Pool19DOB"]; $_Pool20DOB = $_REQUEST["Pool20DOB"]; $link = mysql_connect("localhost", "xxxxxx","xxxxxx") or die(mysql_error()); if (!$link) { die('Could not connect: ' . mysql_error()); } mysql_select_db("peoplesafe") or die(mysql_error()); $sql="UPDATE contacts SET Pool01Name='$_Pool01Name', Pool02Name='$_Pool02Name', Pool03Name='$_Pool03Name', Pool04Name='$_Pool04Name', Pool05Name='$_Pool05Name', Pool06Name='$_Pool06Name', Pool07Name='$_Pool07Name', Pool08Name='$_Pool08Name', Pool09Name='$_Pool09Name', Pool10Name='$_Pool10Name', Pool11Name='$_Pool11Name', Pool12Name='$_Pool12Name', Pool13Name='$_Pool13Name', Pool14Name='$_Pool14Name', Pool15Name='$_Pool15Name', Pool16Name='$_Pool16Name', Pool17Name='$_Pool17Name', Pool18Name='$_Pool18Name', Pool19Name='$_Pool19Name', Pool20Name='$_Pool20Name', Pool01Number='$_Pool01Number', Pool02Number='$_Pool02Number', Pool03Number='$_Pool03Number', Pool04Number='$_Pool04Number', Pool05Number='$_Pool05Number', Pool06Number='$_Pool06Number', Pool07Number='$_Pool07Number', Pool08Number='$_Pool08Number', Pool09Number='$_Pool09Number', Pool10Number='$_Pool10Number', Pool11Number='$_Pool11Number', Pool12Number='$_Pool12Number', Pool13Number='$_Pool13Number', Pool14Number='$_Pool14Number', Pool15Number='$_Pool15Number', Pool16Number='$_Pool16Number', Pool17Number='$_Pool17Number', Pool18Number='$_Pool18Number', Pool19Number='$_Pool19Number', Pool20Number='$_Pool20Number', Pool01DOB='$_Pool01DOB', Pool02DOB='$_Pool02DOB', Pool03DOB='$_Pool03DOB', Pool04DOB='$_Pool04DOB', Pool05DOB='$_Pool05DOB', Pool06DOB='$_Pool06DOB', Pool07DOB='$_Pool07DOB', Pool08DOB='$_Pool08DOB', Pool09DOB='$_Pool09DOB', Pool10DOB='$_Pool10DOB', Pool11DOB='$_Pool11DOB', Pool12DOB='$_Pool12DOB', Pool13DOB='$_Pool13DOB', Pool14DOB='$_Pool14DOB', Pool15DOB='$_Pool15DOB', Pool16DOB='$_Pool16DOB', Pool17DOB='$_Pool17DOB', Pool18DOB='$_Pool18DOB', Pool19DOB='$_Pool19DOB', Pool20DOB='$_Pool20DOB' WHERE ContactID='$_ContactID'"; $query = mysql_query($sql); if ($query) { ini_set('display_errors',1); error_reporting(E_ALL); } echo "ContactID: ".$_ContactID; echo "<BR>"; echo "AccountID: ".$_AccountID; mysql_close(); ?> <center><ul id="tabs"> <a href="return_contacts_list.php?username=<?php echo $_Account;?>&password=<?php echo $_AccountID;?>">User List</a> <a href="user_details.php?ContactID=<?php echo $_ContactID;?>&AccountID=<?php echo $_AccountID;?>">User Details</a> <a href="escalation_details.php?ContactID=<?php echo $_ContactID;?>&AccountID=<?php echo $_AccountID;?>">Escalation Details</a> <a href="pool_users.php?ContactID=<?php echo $_ContactID;?>&AccountID=<?php echo $_AccountID;?>">Pool Users</a> </ul> <BR> <a href="logout.html">Logout</a> </body> </html>
  13. Thanks, I changed it too: if ($query) { ini_set('display_errors',1); error_reporting(E_ALL); } mysql_close(); ?> <center><ul id="tabs"> <a href="return_contacts_list.php?username=<?php echo $_Account;?>&password=<?php echo $_AccountID;?>">User List</a> <a href="user_details.php?ContactID=<?php echo $_ContactID;?>&AccountID=<?php echo $_AccountID;?>">User Details</a> <a href="escalation_details.php?ContactID=<?php echo $_ContactID;?>&AccountID=<?php echo $_AccountID;?>">Escalation Details</a> <a href="pool_users.php?ContactID=<?php echo $_ContactID;?>&AccountID=<?php echo $_AccountID;?>">Pool Users</a> </ul> <BR> <a href="logout.html">Logout</a> I now get a value in my links for $_Account and $_ContactID, but not for $_AccountID, ill keep working on it and post the result if i fix it. Thanks!
  14. Hi Jesirose, thanks for the detailed reply, i'm revisiting PHP/MySQL for the first time in many years, actually using code i wrote in college many moons ago.. Appreciate the comments on sanitizing and sql injection, looks like i need to do some more reading up. I have amended the code now (PS the update always worked fine.. so $ContactID must have been working somehow..) i now have: <?php $_AccountID = $_GET['AccountID']; $_Account = $_GET['Account']; $_ContactID = $_GET['ContactID']; The update still works so it must mean that the variables are declared and are actually pulling in information. However, i still cannot seem to pass the variable to the HTML code outside the PHP code. Actually, i cannot get the webpage to display anything, its just a blank, i would have thought that at least it would have displayed the links, even if they were useless. here: if ($query) { exit; } mysql_close(); ?> <center><ul id="tabs"> <a href="return_contacts_list.php?username=<?php echo $_Account;?>&password=<?php echo $_AccountID;?>">User List</a> <a href="user_details.php?ContactID=<?php echo $_ContactID;?>&AccountID=<?php echo $_AccountID;?>">User Details</a> <a href="escalation_details.php?ContactID=<?php echo $_ContactID;?>&AccountID=<?php echo $_AccountID;?>">Escalation Details</a> <a href="pool_users.php?ContactID=<?php echo $_ContactID;?>&AccountID=<?php echo $_AccountID;?>">Pool Users</a> </ul> <BR> <a href="logout.html">Logout</a> </body> </html>
×
×
  • 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.