Jump to content

tutorialstuff

Members
  • Posts

    35
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

tutorialstuff's Achievements

Member

Member (2/5)

0

Reputation

  1. I'm trying to extract the data and place them into variables from the below xml document from the line that says :<day0 name="Monday" date="01/25" max="50" min="41" code="13" phrase="Showers"/> basically I would like it to be like $name=Monday, $max=50 etc... I'm not sure if this would be a job for preg_match or something else and if so, what would be the best way to do this? Thanks for any help! <data> <provider>qwikcast.com</provider> <date>01/25/2010</date> <time>11:05</time> <loc city="Longview" state="WA" country="US" county="Cowlitz" lat="46.1300" lon="-122.9300" elev="21"/> <icon dir="NA"/> − <fcst> <day0 name="Monday" date="01/25" max="50" min="41" code="13" phrase="Showers"/> <day1 name="Tuesday" date="01/26" max="49" min="37" code="12" phrase="PM Showers"/> <day2 name="Wednesday" date="01/27" max="49" min="35" code="2" phrase="Partly Cloudy"/> <day3 name="Thursday" date="01/28" max="51" min="36" code="16" phrase="Light Rain"/> <day4 name="Friday" date="01/29" max="50" min="42" code="16" phrase="Light Rain"/> </fcst> <obs id="KKLS" time="10:35 AM" code="1" phrase="Clear" tempUnit="F" temp="46" appTemp="46" appWord="Apparent" dew="42" rh="87" windSpd="11" windDir="SSE" windUnit="mph" vis="10" visUnit="mi" baro="29.91" baroUnit="in"/> </data>
  2. This seems to work fine in IE8, but whenever I view it in FF3, There is some weird trailing characters after the decrypted text. $decryption_key = "Yru8S09edICE"; $cipher_alg=MCRYPT_RIJNDAEL_256; function hex2bin($data) { $len = strlen($data); return pack("H" . $len, $data); } $iv = bin2hex(mcrypt_create_iv(mcrypt_get_iv_size($cipher_alg, MCRYPT_MODE_CBC), MCRYPT_RAND)); $encryppted_text = mcrypt_encrypt($cipher_alg, $decryption_key, 'this is text', MCRYPT_MODE_CBC, hex2bin($iv)); print $encryppted_text."<br />"; $decrypted_text = mcrypt_decrypt($cipher_alg, $decryption_key, $encryppted_text, MCRYPT_MODE_CBC, hex2bin($iv)); print $decrypted_text;
  3. I am currently trying to work with a 3rd party vendor(acxiom) that requires the use of SOAP requests. Link to vendor dev center https://aissreports.acxiom.com/devzone login: devzone1 password: acxiom Once inside, click the link on the left that says "XML Background Checks" I have several diferent versions of code that I've tried using. I've gone with the built in PHP SOAP class and tried nusoap as well and have had no luck. Here's my attemtp with built in PHP SOAP Class <?php $client = new SoapClient('https://aissreports.acxiom.com/xmlbackgroundtests/xmlresults.asmx?wsdl'); $header = new SoapHeader('https://aissreports.acxiom.com/XMLBackgroundTests/SubmitRequest', 'echoMeStringRequest', 'hello world'); $client->__setSoapHeaders($header); $params = array("fileasstring" =>$requestString); $requestString = file_get_contents('https://aissreports.acxiom.com/devzone/src/1-Integrations/1-XML_Background_Checks/Xml_Request_Examples/Sample_Requests/Sample_A_la_Carte_Product_Request.xml'); $client->__soapCall("SubmitRequest", $params, null); ?> This gives me the error Here's my attempt with nusoap <?php // Pull in the NuSOAP code require_once('../nusoap/lib/nusoap.php'); // Create the client instance $client = new soapclient('https://aissreports.acxiom.com/XMLBackgroundTests/Request.asmx?wsdl'); // Call the SOAP method $result = $client->call('PersonName', array('GivenName' => 'Mischa')); // Display the result print_r($result); ?> which gives me the error Any and all help is greatly appreciated. I've been stumped on this for many days now and am about to lose my mind. :'(
  4. I had this sugguested to me in another forum. function getInput($key) { if(isset($_GET[$key]) && trim($_GET[$key]) !== '') { return(trim($_GET[$key])); } elseif(isset($_POST[$key]) && trim($_POST[$key]) !== '') { return(trim($_POST[$key])); } return null; } $age = getInput('age'); $gender = getInput('gender'); // etc....
  5. Not a bad idea gevans! Anybody else have some other thoughts?
  6. I'm currently creating a search page and I have I'm declaring some php variables and I was wondering if there is a way to shorten this or a better way to do this. if($_GET['age'] != ''){ $age = $_GET['age']; }elseif($_POST['age'] != ''){ $age = $_POST['age']; } if($_GET['gender'] != ''){ $gender = $_GET['gender']; }elseif($_POST['gender'] != ''){ $gender = $_POST['gender']; } if($_GET['rate'] != ''){ $rate = $_GET['rate']; }elseif($_POST['rate'] != ''){ $rate = $_POST['rate']; } if($_GET['last_login'] != ''){ $last_login = $_GET['last_login']; }elseif($_POST['last_login'] != ''){ $last_login = $_POST['last_login']; }
  7. Your method would only produce one checkbox I need something more like this: <?php if($_GET['id'] != ''){ $restaurant_query = mysql_query("SELECT * FROM `restaurant` WHERE approved = 'yes' AND id = $_GET[id]"); $num_rows = mysql_num_rows($restaurant_query); if($num_rows == 0){ print "We don't currently have any restaurants that match your criteria."; }else{ while($restaurant_results = mysql_fetch_assoc($restaurant_query)){ $category_query = mysql_query("SELECT * FROM restaurant_category"); while($category_results = mysql_fetch_assoc($category_query)){ "code to see if restaurant currently has this category" print "<input type=\"checkbox\" name=\"type[]\" value=\"$category_results[id]\" $checked /> $category_results[name]"; } } } } ?>
  8. <?php if($_GET['id'] != ''){ $restaurant_query = mysql_query("SELECT * FROM `restaurant` WHERE approved = 'yes' AND id = $_GET[id]"); $num_rows = mysql_num_rows($restaurant_query); if($num_rows == 0){ print "We don't currently have any restaurants that match your criteria."; }else{ while($restaurant_results = mysql_fetch_assoc($restaurant_query)){ "code for check boxes would go here" } } } ?>
  9. I have a table called restaurant_types that has two fields (restaurant_id and category_id). so basically I make the quert of SELECT * FROM restaurant_types WHERE restaurant_id = (whatever the id of the current restaurant I'm on is such as 4) Let's say the query came up with two results of category_id = 9 and category_id = 8 the check box area should end up looking something like this (note that the categories that came up in the query are checked and the categoris are in alphabetical order): <input type="checkbox" name="type[]" value="9" checked="checked" /> American <input type="checkbox" name="type[]" value="12" /> Bakery <input type="checkbox" name="type[]" value="8" checked="checked" /> BBQ <input type="checkbox" name="type[]" value="18" /> Breakfast <input type="checkbox" name="type[]" value="21" /> Brewery <input type="checkbox" name="type[]" value="1" /> Chinese <input type="checkbox" name="type[]" value="13" /> Coffee/Tea <input type="checkbox" name="type[]" value="3" /> Fast Food <input type="checkbox" name="type[]" value="22" /> Fine Dining <input type="checkbox" name="type[]" value="17" /> German Hope this explains it a little better.
  10. I am working on a CMS for a restaurant guide. The admin section will let users change/add normal restaurant details such as name, phone, description etc... The problem I'm having is figuring out the best way to list a group of check boxes that let's the user select the restaurant category. For example: A restaurant can have multiple categories such as: American food, Chinese, Cafe, Burgers, steaks, fast food etc... I have no problem setting up the database to get this right. The problem I'm running into is what is the best way to query the database and populate the check boxes to be checked or un-checked for a particular restaurant. Hope this makes sense.
  11. I think you need to "fetch" the information from your query. Try <?php include("config.php"); //If they're logged in, ask them if they want to log out if($logged_in=="true") { echo "You're already logged in! <a href=\"logout.php\">Logout?</a>"; } //If not logged in, display the log in form else { //Or the process code if($_GET['act']=='process') { //Put what they inputted into variables $usern = $_POST['usern']; $pw = $_POST['pw']; // Get the pw from that username mysql_select_db("badges") or die(mysql_error()); $qry = mysql_query("SELECT * FROM user WHERE username='$usern'") or die(mysql_error()); while($qry_result = mysql_fetch_assoc($qry)){ //See if they're equal $pas = $qry_result['password']; if ($pas==$pw) { echo "Yay you're logged in!"; } else { echo "failed"; } } } else { //Log in form echo "Here is the log in form."; echo "<form method=\"post\" action=\"login.php?act=process\">Name: <input type=\"text\" maxlength=\"40\" name=\"usern\"><br />"; echo "Password: <input type=\"password\" maxlength=\"20\" name=\"pw\">"; echo "<input type=\"submit\" value=\"Log In\"></form>"; } } ?>
  12. I have a script that I thought was working just fine but it appears to be only working in firefox and not IE. Can anybody take a look at it and tell me if there's anything there that would cause it not to work in IE? Thanks! - Mike <?php include('../site_files/includes/constants.php'); function save_image($file, $id, $sizex, $sizey, $pre){ global $image_path; $image=$file['name']; $userfile_tmp = $file['tmp_name']; $userfile_size = $file['size']; $userfile_type = $file ['type']; if($image){ if($userfile_type == "image/jpg" || $userfile_type == "image/jpeg" || $userfile_type == "image/png" || $userfile_type == "image/gif"){ $max_x = $sizex; $max_y = $sizey; if ($userfile_type == "image/jpg" || $userfile_type == "image/jpeg"){ $img = imagecreatefromjpeg($userfile_tmp); }elseif ($userfile_type == "image/gif"){ $img = imagecreatefromgif($userfile_tmp); }elseif ($userfile_type == "image/png"){ $img = imagecreatefrompng($userfile_tmp); }else{ print "didn't work"; } $imagex = imagesx($img); $imagey = imagesy($img); $dim = max($imagex/$max_x, $imagey/$max_y); $nx = $imagex/$dim; $ny = $imagey/$dim; $image = imagecreatetruecolor($nx, $ny); if ($userfile_type == "image/jpg" || $userfile_type == "image/jpeg"){ imagecopyresampled($image, $img, 0, 0, 0, 0, $nx, $ny, $imagex, $imagey); $image_path = '<img src="http://techguymike.com/window/images/uploads/'.$pre.$id.'.jpg" />'; return imagejpeg($image, '../images/uploads/'.$pre.$id.'.jpg'); }elseif($userfile_type == "image/gif"){ //change the RGB(255, 255, 255) to change background color fill $background_color = imagecolorallocate($image, 255, 255, 255); imagefill($image, 0, 0, $background_color); imagecopyresampled($image, $img, 0, 0, 0, 0, $nx, $ny, $imagex, $imagey); $image_path = '<img src="http://techguymike.com/window/images/uploads/'.$pre.$id.'.gif" />'; return imagegif($image, '../images/uploads/'.$pre.$id.'.gif'); }elseif ($userfile_type == "image/png"){ //change the RGB(255, 255, 255) to change background color fill $background_color = imagecolorallocate($image, 255, 255, 255); imagefill($image, 0, 0, $background_color); imagecopyresampled($image, $img, 0, 0, 0, 0, $nx, $ny, $imagex, $imagey); $image_path = '<img src="http://techguymike.com/window/images/uploads/'.$pre.$id.'.png" />'; return imagepng($image, '../images/uploads/'.$pre.$id.'.png'); } //return $image_path; } } } ?> <?php if (isset($_POST['submit'])=='submit'){ if(isset($_FILES['image']) && $_FILES['image']['name'] != ''){ save_image($_FILES['image'], 14, 250, 300, front); $image_front = $image_path; }else{ print "didn't work"; } } ?> <!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=iso-8859-1" /> <title>Untitled Document</title> </head> <body> <form action="image-upload.php" method="post" enctype="multipart/form-data"> <table class="announcement-form" cellspacing="0"> <tr> <th>Image</th> <td><input type="file" name="image" id="image" size="65" /></td> </tr> <tr> <th> </th> <td><input type="submit" name="submit" value="submit" /></td> </tr> </table> </form> </body> </html>
  13. The problem with this one though is that they aren't always in order it could be qty3, qty7, qty9 rather thean just qty1, qty2, qty3. So I can't just use qty$i. I need to figure out away to put them in an array some how or something.
×
×
  • 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.