Jump to content

cyberRobot

Moderators
  • Posts

    3,145
  • Joined

  • Last visited

  • Days Won

    37

Everything posted by cyberRobot

  1. That looks like a viable solution so far. Have you tried the code? If so, does it not work...are you getting errors?
  2. @anderson_catchme - Do you need the associative array for the function output? If not, you could change this: $data[] = array('label' => '<img src="/imageuploads/'.$imagepointer.'/'.$image.'" alt="thumbnail"> <br/>'); To this: $data[] = '<img src="/imageuploads/'.$imagepointer.'/'.$image.'" alt="thumbnail"> <br/>'; And then use implode() here: <p><?php echo implode(generate_img($imagepointer, $imageornot)); ?></p> Edit: sorry I forgot the to add "echo" before the implode() function. I guess I'm not quite awake yet.
  3. Perhaps, what is the error message?
  4. Do you have PHP errors enabled and set to be shown? You can add the following to the top of your script to show all PHP errors and warnings: <?php //REPORT ALL PHP ERRORS error_reporting(E_ALL); ini_set('display_errors', 1); ?> Of course, you'll want to remove the above debugging once the issue has been resolved. Also, note that the last echo statement in your code is missing a semi-colon. echo "</table>"
  5. For what it's worth, fopen(), fwrite(), and fclose() could be replaced with a call to file_put_contents(). More information can be found here: http://php.net/manual/en/function.file-put-contents.php
  6. For what it's worth, you could look into using a combination of AJAX and PHP.
  7. Perhaps you can start here: http://php.net/manual/en/tutorial.forms.php There also many tutorials online to get you started. https://www.google.com/search?q=php%20form
  8. @james909 - If you're looking for guidance on using preg_match(), the PHP manual has some examples that might help: http://php.net/manual/en/function.preg-match.php
  9. I guess it depends on what the code is used for. When I've had code like this in the past, the array of characters is used in other parts of the script. However, you're probably right about regular expressions fitting better in this case.
  10. Instead of using a regular expression, you could just create an array of values (A-J and k-t). You can then see if $checkChar is in the array with in_array(). More information about in_array() can be found here: http://php.net/manual/en/function.in-array.php Also note that you could create the array using a combination of range() and array_merge().
  11. It's worth a shot. Note that the double quotes aren't needed here: if($result['vpsid'] == "$row[vpsid]") It could be changed to: if($result['vpsid'] == $row['vpsid'])
  12. In your loops which display all results, you could add an if test which tests the value of vpsid. If it's equal to 1967, display the entry. Otherwise, skip to the next entry.
  13. For what it's worth, you can see what information gets passed through the form by adding the following to the top of the script which processes your form: <?php print '<pre>' . print_r($_POST, true) . '</pre>'; ?> Of course, you'll need to comment out the header() redirect.
  14. Yep, the "//...do whatever you need to do with the proxies here..." part would be whatever it takes to process the proxies. Note that you'll need to figure out how you're going to break up the proxies supplied by the user, assuming that you're allowing them to enter more than one. You could ask the user to separate multiple proxies with a delimiter or maybe have each listed on a new line. You could then use something like explode() to break the proxies apart to get the array to randomize.
  15. Yep, that should work. Note that the header() function needs to be called before anything is outputted to the screen.
  16. The redirect happens here: header("Location: $redirect_url"); To redirect to a different page, you'll need to modify the entire value of $redirect_url. More information about the header() function can be found here: http://php.net/manual/en/function.header.php
  17. Just in case you're still looking for help, here's a quick example of a working form: <?php //IF THE FORM WAS SUBMITTED if(isset($_POST['submit'])) { //GET USER-SUGGESTED PROXIES $proxies = trim($_POST['proxies']); var_dump($proxies); //<-- this line just shows that a value was passed; it isn't needed for your final code //...do whatever you need to do with the proxies here... } ?> <form method="post" action=""> <textarea cols='22' class='area' rows='14' name='proxies' placeholder="PROXIES"></textarea><br> <input type='submit' name="submit" value='Test'> </form>
  18. This could potentially be accomplished using JavaScript / jQuery. My preference would be to use PHP though. If you can use PHP, you could build an HTML form (or some selection mechanism) that allows visitors to choose how the videos are sorted. The form would submit to the same page and display the videos again. But this time, you'll have a GET or POST variable which says how to sort the videos. That variable could be used in a database query so that the videos are sorted based on the chosen option. Once you get that figured out, you'll need to determine how you'll pass the sort-order flag through the rest of your pagination links. You could embed the flag as a GET variable, utilize SESSION variables, etc.
  19. This forum seems to have an issue when posting multiple blocks. To get around this issue, I usually need to clicking the "More Reply Options" button instead of Post. At times I also need to click the "Preview Post" button after clicking "More Reply Options" for the extra code blocks to appear. As for your code, is your script including itself? $message = include 'process.php';
  20. What does your code look like? And perhaps you already know this, but please surround the code with tags when posting to this forum. It will make your post easier to read.
  21. Assuming that there are always 6 images and you want the images to always be positioned and sized the same, you could: Read the values into an array Output the images into a table Use CSS to position and size the images Here is a quick and crude example: <?php $images = array(); $result = mysqli_query($con, "SELECT * FROM photo ORDER BY id DESC LIMIT 6"); while($row = mysqli_fetch_assoc($result)) { $images[] = '<a href="photo.php?id='.$row['id'].'"><img src="images/'.$row['id'].'.jpg" alt=""/></a>'; } ?> <style type="text/css"> table .left { width:200px; } table .left img { width:200px; height:232px; } table .center { width:100px; } table .center img { width:100px; height:112px; } table .right { width:50px; } table .right img { width:50px; height:72px; } </style> <table> <tr> <td class="left"><?php print $images[0] ?></td> <td class="center"><?php print $images[1] . $images[2]; ?></td> <td class="right"><?php print $images[3] . $images[4] . $images[5]; ?></td> </tr> </table>
  22. Have you considered using PHP's DOMDocument class? You could use the getElementsByTagName method to get the <span> tag(s).
  23. What does your updated code look like?
  24. Sorry, I'm not sure what you're asking. Are you just trying to figure out how to get the value from the textarea? If so, you use $_GET['proxies'] or $_POST['proxies'] depending on what the method attribute for your form is set to.
  25. Side note: the cargar_login.php script currently runs the same query twice. ... $consulta = "SELECT * FROM Users WHERE user = '{$_POST['user']}' AND pass = '{$_POST['pass']}'"; ... $sql = "SELECT * FROM Users WHERE (user= '$user') AND pass='$pass'"; ... Your code could be modified so that it only needs one query. You'll also want to make sure you run the username and password through mysql_real_escape_string() before every query. As your code stands, the first query in cargar_login.php and the query in teacher/index.php, are both susceptible to SQL injection attacks. And in case you're not aware, the mysql_* functions have been deprecated. At some point, you'll need to look into using MySQLi or PDO. More information can be found here: http://php.net/manual/en/mysqlinfo.api.choosing.php
×
×
  • 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.