Jump to content

Ch0cu3r

Staff Alumni
  • Posts

    3,404
  • Joined

  • Last visited

  • Days Won

    55

Everything posted by Ch0cu3r

  1. You get the selected value from $_GET or $_POST (depending on your forms submit method), example code <?php if(isset($_POST['day'])) { echo 'You selected: ' . $_POST['day']; } $days = ('Monday', 'Tuesday', 'Wednesday', 'etc...'); ?> <form action="" method="post"> <select name="day"> <?php foreaach($days as $today) { <option><?php echo $today ?></option> <?php } ?> </select> <input type="submit" value="Go" /> </form>
  2. I dont use XAMPP. but does it not provided an option to delete/disable the current Apache service? If not, then type services.msc into the Windows start menu. From the list of services find the service used by Apache 2.2. Right click it and click Properties. From the Startup type menu change from automatic to disabled. Now click the Stop button and finally click OK. The Apache 2.2 service is now disabled. You should now be able to run the Apache2.4 service.
  3. Remove var before iserror
  4. You need to stop/remove the current apache 2.2 httpd.exe service before starting the newer apache 2.4 httpd.exe service. Ports cannot be shared by multiple services/applications.
  5. Try preg_match $message =strip_tags($message, "<br><div><p><u><hr></section>"); $message =preg_replace("</p>", "br /", $message); $message = preg_match('~(.*?)(?:--Reply below this line to respond--)~is', $message, $m); $message =clean("<br/><hr><u>Received On $rep_date / $from_email</u><br><br/>{$m[0]}");
  6. if $server is set to <server> and $ticket is set to moOaH6BAKFMGGszd_IQHTvpA and $url is set to <dashboard>?format=png Then the code you posted should resemble this output http://<server>/trusted/moOaH6BAKFMGGszd_IQHTvpA/views/<dashboard>?format=png The output you posted, has the ticket string before the http:// and $ticket has been replaced by 1. It seems you may be echo'ing the output of the curl response rather than capturing the response into a variable. It is hard to tell with the single line of code you posted
  7. Not when you have LIMIT 1 in your first query. Why are you duplicating data in separate databases?
  8. What? That HTML does not match what you posted in your OP. What is the output of var_dump($row->images);
  9. You sure? The HTML you posted is correct. The problem may lie in the css for the mask3 and/or span3 classes. Try removing the class definitions for the div containing the link and image. Do you see the link/images now? Also the whole <article></article> HTML bloxk should be part of the while loop, otherwise only the last record returned by your query will be displayed. Your while loop should be constructed something like this while($row = $STH->fetch()) { // using HEREDOC syntax // see http://php.net/heredoc for details echo <<<HTML <article class="span12 post"> <div class="mask3 span3"> <a rel="prettyPhoto" href="{$row->images}"><img src="{$row->images}"></a> </div> <div class="inside"> <div class="span8 entry-content"> <div class="span12"> <h2>{$row->title}</h2> <p>{$row->entry}</p> </div> </div> </div> </article> HTML; // DO NOT CHANGE THE ABOVE LINE - see link above for why }
  10. No need for regex, Try using parse_url
  11. PHP will not read the text file as PHP code. It will see it as just plain text. If you need to save an array to a flat file, you should either serialise it or json_encode it. You then use unserialize or json_decode to read the array back into PHPs memory.
  12. You're using mysqli_prepare incorrectly, With mysqli_prepare you only define the query, the values being replaced by placeholders. It them returns a statement object ($stmt). With the $stmt object you'd call the bind_param() method to bind the values to the placeholders. Finally you'd call mysqli_execute to execute the query. Example code // prepare the query $stmt = $this->db->prepare('INSERT INTO prueba (id,nombre) VALUES (?, ?)'); $assocArray = array('id' => '', 'name' => ''); // define $assocArrat var first // bind the values to the placeholders, describing their data types $stmt->bind_param('is', intval($assocArray['id']), $assocArray['name']); // loop througght he json objects to insert into mysql foreach($obj as $assocArray) { $stmt->execute(); // execute the query }
  13. if you're using the $subtotal property outside of your class you wont be able to because you have set its visibility to protected. Either set its visibility to public or create a new method which will return the value of the subtotal property
  14. I do not recommend the use of addslashes for santizing input for use in query Use stripslashes if get_magic_quotes_gpc is enabled and then sanitize the input using mysql_real_escape_string Or better yet use PDO or MySQLi and use prepared queries. Do note though the mysql_* functions are deprecated and could be removed from future versions of PHP. Converting your code over to PDO or MySQLi function libraries now will help keep your code future proof.
  15. You have not shown how the mostrarOcultar() function called? I assume it is called with a checkbox onclick event? which you'd toogle the checkbox to show/hide the table? I testing the code like this <input type="checkbox" onclick="mostrarOcultar(this)"> <table width="100%" border="1" id="seguro" style="visibility:visible"> <tr> <td bgcolor="#B4ED89" class="Estilo3"><?php echo "Cantidad Asegurada Bs" ?></td> <td width="47%"><input name="asegu" type="text" id="asegu" size="39" onkeypress="return NumCheck(event,this)" onpaste="return false"/></td> <tr> </table> <script type="text/javascript"> function mostrarOcultar(obj) { document.getElementById('seguro').style.visibility = (obj.checked) ? 'hidden' : 'visible'; } </script> Works fine in IE11 and FF28 on Win7
  16. PHP statements cannot be split across multiple files. I see no reason why you'd need to do that. All php files must be syntactically correct The code you posted is for handling the login. It would make more sense to have that code in its own file and then include that in header.php when required. <?php include 'process_login.php'; // include the file for processing site logins // other php code for handling the site header ?> ... html code for the site header
  17. You mean to say you get errors when submitting the form. It would be helpful if you post all errors you get here in full. Also when posting code please paste it between tags. I have edited your post this time, but please remember to do this for further posts.
  18. Ok you're on the right track. The problem is with line 6 list = explode(' ',$line);//you get an array of 4 per line, first item is author, etc... list should be $list you forgot the dollar sign Next problem is your data is separated by tabs, not a single space character. To explode the data using tabs you can use the \t escape character inside double quotes. Line 6 should now read as $list = explode("\t",$line); // explode the data by tabs if you only want to read the first 11 lines and ignore the first line you can create a simple counter function get_rows() { $file=fopen("jimtest.txt",'r'); $i = 0; // initiate counter while($line = fgets($file)) //while we can still read the file { $i++; // increments $i by one on each iteration of the loop // if the counter $i is equal to zero (meaning were reading the first line of the text file) if($i == 0 ) continue; // skip to the next iteration (which will read the next line in he file) // else if the counter $i is greater than 11 (meaning were now reading line 11) else if($i > 11) break; //terminate the while loop (stops reading the remain lines in the file) $list = explode("\t", trim($line)); // remove the line endings and extra white-spaces at start and end, then explode the line contents by tabs echo "<tr><td>$list[2]</td><td>$list[5]</td><td>$list[6]</td><td>$list[7]</td><td>$list[8]</td><td>$list[9]</td><td>$list[10]</td></tr>\n";//use the \n to clean up the source a code a bit to make it readable } }
  19. If you are to store the blog entries in a flat file format. You'd probably want to also include the year and month in the filename, so not to overwrite blog entries entered from a previous year. You could then do something like this // define the path to the blogs $blog_entries_path = 'path/to/blog_files/' . date('Y-m') . '.txt'; // example file path produced path/to/blog_files/2014-06.txt // check to see if the path does not exists. if(!file_exists($blog_entries_path)) { // create a new empty blog file for current year and month. file_put_contents($blog_entries_path, ''); } // read the contents of the current months blog entries $current_entries = file_get_contents($blog_entries_path); // or use file() - docs http://php.net/file Maybe they first want you to create an application using PHP's file functions, so you can develop a good understanding of the PHP language. Then maybe later on in your course they will start to introduce you to databases.
  20. The error is message is straight forward. The variable $places you past to each() is not array or an object. How is the $places variable defined and why are casting it as global?
  21. Ch0cu3r

    Changing ISP

    No not really as I do not know what script your sites uses. Usually the database credits are stored in a global config script for your application. You'll need to go through your sites files and find that file, open it and change the database credentials to the the ones supplied by your host.
  22. Ch0cu3r

    Changing ISP

    Yes you'll first need to create the new database. Then modify your script to use the new database.
  23. Topic locked. You already have a topic open here http://forums.phpfreaks.com/topic/288907-from-osm-openstreetmap-to-mysql-with-php/?do=findComment&comment=1481537 Please do not create duplicate topics.
  24. This line should be generating the <pieces> XML elements for each item in the $packages array/object $pieces .= '<piece actual_weight="'.$singleweight.'" length="'.$length.'" height="'.$height.'" width="'.$width.'">'; The .= stands for concatenation assignment operator. If you echo $pieces after the foreach loop does it show the correct generated xml structure? echo htmlentities($pieces); // apply htmlentities otherwise it will be treated as HTML and wont be displayed I dont understand why the XML being sent in the url? What is the reason for this?
×
×
  • 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.