Jump to content

fubowl

Members
  • Posts

    37
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

fubowl's Achievements

Member

Member (2/5)

0

Reputation

  1. Unsure if this belongs here, but I thought it might fall under php "configuration". How would I go about learning how to interface my php-written website with software installed on the web server. From what I've read it involves using the command line, but as I've never done anything other than using existing php extensions, I wouldn't know how to go about it. What I'm eventually attempting to do is to use Abbyy OCR software or something similar on my website and since I found no easy way of using OCR with php, I need to think of other ways to go about it. Any thoughts on how to go about it, any plugins for OCR or tutorials on how to go about interfacing software with php would be appreciated. Thanks.
  2. Certainly. Thanks Pikachu2000.
  3. I never really thought about it before, but recently I visited a site with a url like: www.example.com/?OR Which made me wonder how you would go about getting that keyname since it is without a value. Any ideas?
  4. Ha. I see. Well I guess I'd have to use a different function since I don't see a way of removing that option. Thanks.
  5. Taken from http://php.net/manual/en/function.is-numeric.php <?php $tests = array( "42", 1337, "1e4", "not numeric", Array(), 9.1 ); foreach ($tests as $element) { if (is_numeric($element)) { echo "'{$element}' is numeric", PHP_EOL; } else { echo "'{$element}' is NOT numeric", PHP_EOL; } } ?> Outputs: WHY does 1e4 validate as TRUE using is_numeric?
  6. No but I've set it up to use it as default validation. I mainly just want to check only for numerals and it being 4 digits long.
  7. Hi, I'm using preg_match to validate various fields. I wish to check that a string the length of four numbers, as a year, eg. 2010. How would I do this, something like: /^[0-9'\s]{4}*$/i ? As usual, I have no idea.
  8. Hey all. mysql_real_escape_string() seems to be working fine for me, but I'm wondering why the entries in the database don't reflect my SQL query. For example, here is the string php is sending to MYSQL: insert into bands (bandname, hometown, website, creation, bio, addedon) values ('band', '\'gaewg\"f gswogsw<?php OR \'\'=\' rswaiohgri ', '', '1992', '\' OR \'\'=\'', '10182010') This has already been run through mysql_real_escape_string(), but when I go to phpmyadmin here is what I see: `bands` (`id`, `bandname`, `creation`, `photo`, `bio`, `hometown`, `website`, `addedon`) VALUES (34, 'band', '1992', '', ''' OR ''''=''', '''gaewg"f gswogsw<?php OR ''''='' rswaiohgri ', '', '10182010'); My question is does it matter if it's not slashed in the database? Might be just a newbie here but isn't that how injection works? Anyhow, just let me know wise phpfreaks users. Thanks in advance.
  9. Whoops, that wasn't the issue. $sql should have = $sql = "UPDATE $table SET $column='$value' WHERE $where";
  10. public function update($data, $table, $where) { foreach ($data as $column => $value) { $sql = "UPDATE $table SET $column = $value WHERE $where"; print "table: ".$table." column: ".$column." where: ".$where; mysql_query($sql) or die(mysql_error()); } return true; } $data: $data = array( "username" => "Jack", "email" => "jack.gmail@gmail.com" ); $db->update($data, "users", 'id=1'); Working on this code that updates a column from a class. Everything is fine except for one issue. As of right now $column is set to "Jack" which outputs an error, instead of what it should be as "username". I'm sure it's something really simple, so any assistance is appreciated. Any ideas? Problem area is listed in red.
  11. Thanks very much for your responses Pikachu2000 and premiso.
  12. So you think that gmail is just sending them to every possible carrier @ once?
  13. I am well aware of how to send text messages using php's mail() command: <?php $from = $_POST['from']; $to = $_POST['to']; $carrier = $_POST['carrier']; $message = stripslashes($_POST['message']); if ((empty($from)) || (empty($to)) || (empty($message))) { header ("Location: sms_error.php"); } else if ($carrier == "verizon") { $formatted_number = $to."@vtext.com"; mail("$formatted_number", "SMS", "$message"); // Currently, the subject is set to "SMS". Feel free to change this. header ("Location: sms_success.php"); } else if ($carrier == "tmobile") { $formatted_number = $to."@tmomail.net"; mail("$formatted_number", "SMS", "$message"); header ("Location: sms_success.php"); } else if ($carrier == "sprint") { $formatted_number = $to."@messaging.sprintpcs.com"; mail("$formatted_number", "SMS", "$message"); header ("Location: sms_success.php"); } My question however, is if anyone knows how to detect the carrier automatically WITHOUT input from the user. I know gmail allows the ability the only enter the phone number and it goes to the correct carrier, but how do they do this without knowing the carrier? Do they simply send the sms to each carrier or do they have the knowhow to send it to the carrier based on the phone number itself? Thanks.
  14. Well, since I received no answers, I found an alternative solution. Using DOM method to access XML file: // DOMElement->getElementsByTagName() -- Gets elements by tagname // nodeValue : The value of this node, depending on its type. // Load XML File. You can use loadXML if you wish to load XML data from a string $objDOM = new DOMDocument(); $objDOM->load("test.xml"); //make sure path is correct $note = $objDOM->getElementsByTagName("thumbnail"); // for each note tag, parse the document and get values for // tasks and details tag. foreach( $note as $value ) { $tasks = $value->getElementsByTagName("filename"); $task = $tasks->item(0)->nodeValue; $details = $value->getElementsByTagName("url"); $detail = $details->item(0)->nodeValue; echo "$task :: $detail <br>"; } where test.xml: <thumbnails> <thumbnail> <filename>http://thumb1</filename> <url>Set 1 URL</url> <description>Album 1</description> </thumbnail> <thumbnail> <filename>http://thumb2</filename> <url>Set 2 URL</url> <description>Album 2</description> </thumbnail> <thumbnail> <filename>http://thumb3</filename> <url>Set 3 URL</url> <description>Album 3</description> </thumbnail> <thumbnail> <filename>http://thumb4</filename> <url>Set 4 URL1</url> <description>Album 4</description> </thumbnail> </thumbnails> or to get xml attribute: // example on using the 'getAttribute()' method $dom=new DOMDocument(); $dom->load('test2.xml'); $headlines=$dom->getElementsByTagName('thumbnail'); foreach($headlines as $headline){ echo 'ID attribute of current node is the following: '.$headline->getAttribute('filename').'<br />'; } where test2.xml: <thumbnails> <thumbnail filename="http://thumb1" url="72157620019981688" description="Cat 1"/> <thumbnail filename="http://thumb2" url="72157619839911144" description="Cat 2"/> <thumbnail filename="http://thumb3" url="72157619840761942" description="Cat 3"/> <thumbnail filename="http://thumb4" url="72157619935624301" description="Cat 4"/> </thumbnails>
  15. Using the script located here: http://www.phpfreaks.com/tutorial/handling-xml-data I receive the following error: Fatal error: Call to undefined function SimpleXMLElement() in C:\...\xml.php on line 7 xml.php: <?php // Passing the XML $data = file_get_contents("http://".$_SERVER['SERVER_NAME'].dirname($_SERVER['PHP_SELF'])."/album_output.php"); //loads fine $books = SimpleXMLElement($data); foreach($books as $book) // loop through our books { echo <<<EOF <tr> <td>{$book->url}</td> <td>{$book->description}</td> <td>{$book->filename}</td> </tr> EOF; } ?> Running WAMPServer with php 5.3.0 phpinfo(); says: Simplexml support enabled Revision $Revision: 1.151.2.22.2.35.2.32 $ Schema support enabled However, unable to find an extension for simplexml inside php.ini or httpd.conf (if it's even supposed to be in there) Any help would be appreciated.
×
×
  • 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.