-
Posts
9,409 -
Joined
-
Last visited
-
Days Won
1
Everything posted by MadTechie
-
No you don't need that.. Please READ but if you insist you do it like this.. $string = preg_replace('/[^a-z0-9]/sim', '', $string);
-
I was thinking the same thing! just wondering.., try this (may give some insight) <?php $strURL = 'http://dcl.vg.to/fetchme.php?id=11602'; $ch = curl_init($strURL); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); $strContent= curl_exec($ch); $info = curl_getinfo($ch); curl_close($ch); //$strContent = file_get_contents($strURL); echo $strContent; echo "<br /><br />DEBUG\n<pre>"; var_dump($info); echo "</pre>"; ?>
-
Well the server your connecting to seams okay, as the connection is valid the server your running dvdcoverlinks.com on did it used to work and have you changed anything as i would suggest checking that allow_url_fopen is enabled in PHP.INI configuration file. allow_url_fopen = On also try another URL see if its any URL or just that one
-
Bottom left "topic solved"
-
`values` not 'values'
-
returns this via PHP (here)
-
Whats the name of the table your inserting into ? is it called values ? if change to $query = "INSERT INTO `values` ($fields) VALUES ($values)"; which is kinda confusing! (personally I would change the table name)
-
Need more info.. ie the url your trying, best guess is your URL is incorrect, (check for spaces)
-
LOL oooops $query = "INSERT INTO values ($fields) VALUES ($values)"; should be $query = "INSERT INTO ($fields) VALUES ($values)";
-
trying to preg_match text from another page
MadTechie replied to Jnerocorp's topic in PHP Coding Help
Hi Jnerocorp, Everyone is try to help you workout the problem for yourself, as this will help you more than just giving the answer, Now you know its not a variables and know its a problem with the functions, so are you calling the correct/existing one or not ? or in this case are we being insensitive ? I really hope that helps -
Hi Colton, After looking at your code i noticed that your code assumes the next value is the next one in the list, for example, your code would work with this <warehouseloc>0-00-00-00</warehouseloc> <trackingnumber>152130</trackingnumber> <partnumber>DU1277</partnumber> but with <warehouseloc>0-00-00-00</warehouseloc> <partnumber>DU1277</partnumber> <trackingnumber>152130</trackingnumber> partnumber & trackingnumber would be in the wrong fields in the database.. Normally i would write this as a class thus to avoid the unneeded use of sessions, you could also use global but i have left the sessions in.. and written is differently, It should work fine, any questions just let ask <?php session_start(); $_SESSION['parts'] = array(); ?> <html> <head> <link rel="shortcut icon" href="/favicon.ico" /> <title>title</title> </head> <body> <?php mysql_connect('', '', ''); mysql_select_db('products'); $parser = xml_parser_create(); xml_set_element_handler($parser, "start", "stop"); xml_set_character_data_handler($parser, "char"); $fp = fopen("xml.xml", "r"); while ($data = fread($fp, 4096)) { xml_parse($parser, $data, feof($fp)) or die(sprintf("XML Error: %s at line %d", xml_error_string(xml_get_error_code($parser)), xml_get_current_line_number($parser))); } xml_parser_free($parser); /** * Ooow a new tag, lets take a note. */ function start ($parser, $element_name, $element_attrs) { $_SESSION['TAG'] = $element_name; } /** * collection finshed, Let's add it to the database */ function stop ($parser, $element_name) { if ($element_name == "PART") { //Lucky the fieldname are the same as the elementnames soo //Build SQL statement from ONLY fields that have been set $fields = ""; $values = ""; foreach ($_SESSION['parts'] as $K => $V) { if (! empty($V)) { $K = mysql_real_escape_string($K); $V = mysql_real_escape_string($V); $fields .= "`$K`,"; $values .= "'$V',"; } } $fields = trim($fields, ","); //remove trailing , $values = trim($values, ","); //remove trailing , $query = "INSERT INTO values ($fields) VALUES ($values)"; //error report failed to insert (for debugging you may want to change to die mysql_query($query) or trigger_error("MySQL Failed: [$query]".mysql_error()."<br />\n",E_USER_NOTICE); $_SESSION['TAG'] = ""; $_SESSION['parts'] = array(); // create an empty set } } /** * Data Collection */ function char ($parser, $data) { $data = trim($data); if(empty($data)) return false; switch ($_SESSION['TAG']) { case 'WAREHOUSELOC': $_SESSION['parts']['WAREHOUSELOC'] = $data; break; case 'TRACKINGNUMBER': $_SESSION['parts']['TRACKINGNUMBER'] = $data; break; case 'PARTNUMBER': $_SESSION['parts']['PARTNUMBER'] = $data; break; case 'NAME': $_SESSION['parts']['NAME'] = $data; break; case 'IMAGENAME': $_SESSION['parts']['IMAGENAME'] = $data; break; case 'PRIMARYCATALOG': $_SESSION['parts']['PRIMARYCATALOG'] = $data; break; case 'PRIMARYYEAR': $_SESSION['parts']['PRIMARYYEAR'] = $data; break; case 'PRIMARYPAGE': $_SESSION['parts']['PRIMARYPAGE'] = $data; break; case 'ORIGINCOUNTRY': $_SESSION['parts']['ORIGINCOUNTRY'] = $data; break; case 'WEIGHT': $_SESSION['parts']['WEIGHT'] = $data; break; case 'PRICE': $_SESSION['parts']['PRICE'] = $data; break; case 'CATAGORY1': $_SESSION['parts']['CATAGORY1'] = $data; break; case 'CATAGORY2': $_SESSION['parts']['CATAGORY2'] = $data; break; case 'CATAGORY3': $_SESSION['parts']['CATAGORY3'] = $data; break; case 'CATAGORY4': $_SESSION['parts']['CATAGORY4'] = $data; break; case 'WEB_CATAGORY1': $_SESSION['parts']['WEB_CATAGORY1'] = $data; break; case 'WEB_CATAGORY2': $_SESSION['parts']['WEB_CATAGORY2'] = $data; break; case 'WEB_CATAGORY3': $_SESSION['parts']['WEB_CATAGORY3'] = $data; break; case 'WEB_CATAGORY4': $_SESSION['parts']['WEB_CATAGORY4'] = $data; break; case 'DESCRIPTION': $_SESSION['parts']['DESCRIPTION'] = $data; break; } } ?> </body> </html>
-
I'm going to move this to the JavaScript Section, the reason is because the solution seams to more client based.. if you change your onclick to something like (untested) onclick="javascript:window.location = maincheck.php?name=<?php echo $name;?>&ymail=<?php echo $ymail;?>&temp=getElementByName('temp').options[getElementByName('temp').selectedIndex].value" it maybe easier to write a small JS function get all of the values and then to open the page
-
1. user code tags [ not < (or use the # button) 2. $mid = $roE ['id']; echo"<option value='$id'>$title</option>"; should be $mid = $roE ['id']; echo"<option value='$mid'>$title</option>"; 3. I assume the code <?php //echo temp; $temp = $_REQUEST['temp']; //echo $temp;?> is on the page the form posts to (PS i can't see any forms)
-
is this JUST for pdfs ?
-
Do you have a an XML i can see
-
you may want to remove header("Content-Description: File Transfer"); header("Content-Disposition: attachment; filename=\"$asfname\"");
-
a quick way would be to change your $_SESSION['parts'] = array() to $_SESSION['parts'] = array("WAREHOUSELOC"=>"", "TRACKINGNUMBER"=>"", "PARTNUMBER"=>"") ect etc etc also change if(!isset($_SESSION['parts']['WAREHOUSELOC'])){ $_SESSION['parts']['WAREHOUSELOC'] = $data; } elseif(!isset($_SESSION['parts']['TRACKINGNUMBER']) to if(empty($_SESSION['parts']['WAREHOUSELOC'])){ $_SESSION['parts']['WAREHOUSELOC'] = $data; } elseif(empty($_SESSION['parts']['TRACKINGNUMBER']) $_SESSION['parts']['TRACKINGNUMBER'] = $data; etc etc etc this will make a default value empty and non-empty values replace them
-
I'm sorry i don't get the question ? PS s','%s','%s','%s',)", should be s','%s','%s','%s')", *remove the last ,
-
ERM.. .html
-
I assumed the code wasn't parsing and the <?php was being treated as a HTML tag, thus not displaying (try viewing source)
-
check list 1. PHP installed and working (all setup etc) 2. check the filename ends with .php NOT .html or .htm try this <?php phpinfo(); ?> in its own file called phpinfo.php you should get a ton of settings info
-
well MD5 will return a 32 character hexadecimal code, which is easier and quicker to deal with than //over kill if(base64_encode(file_get_contents("a.mp3")) == base64_encode(file_get_contents("b.mp3"))) { echo "dup"; }
-
An array in an array $myArray = array(); $myArray['object1'] = array(0,0); $myArray['object2'] = array(1,0); $myArray['object3'] = array(1,1); foreach($myArray as $name => $nums) { echo "$name - ".nums[0]." , "nums[1]; }
-
Where did you get the code ? What's it for ? what are you trying to do ?
-
Your need to index the files with a hash ie $hash = md5_file("a.mp3"); if 2 hashes are the same then the contents is probably the same,