QuickOldCar
Staff Alumni-
Posts
2,972 -
Joined
-
Last visited
-
Days Won
28
Everything posted by QuickOldCar
-
Display images from folder and delete images
QuickOldCar replied to jay_jg's topic in PHP Coding Help
I don't see anywhere where you delete files unlink() Be careful with this so you don't delete files accidentally. so something like this if(isset($_GET['filenames'])){ foreach($_GET['filenames'] as $del){ unlink($dir."/".$del); } } This is the simple explanation, you are gonna want to do a pile of checking and changes before allowing a delete coming from the browser -
How to add my own PHP code files to wordpress files
QuickOldCar replied to shwetapandit's topic in Other Libraries
Your question is not that specific. You can edit the plugin directly and save it's modified version, but then you have to also edit any newer updates of the plugin as well. Another option is to include your own modifications as a plugin if said plugin is active. http://codex.wordpress.org/Function_Reference/is_plugin_active sooo....if WPSQT plugin is active.....include custom_WPSQT plugin for simplicity you can add functions into a certain theme within a functions.php file versus making a new plugin -
Still not a good host, hard to find good ones, but this has to be an apache issue and apache not responding. Most likely is the amount of incoming traffic. Could be amount of connections exceeded, respawning child, not closing fast enough, ddos attacks, spammers View your apache error and access logs and try to narrow it down. On a sidenote, clear your browsers cache and cookies, it could have been an intermittent issue and still showing you old data.
-
Sounds more like server hosting issues than your script.
-
Then add this to the top of the page. <?php session_start(); if(!$_SESSION['loggedIn']){ header('Location: http://www.example.com/login.php');//take to login or registration page? die(); } ?>
-
By checking the session if a user is logged in, if not do a header or even meta refresh redirect Header must be used before any output to the browser. if(!$_SESSION['logged_in']){ header('Location: http://www.example.com/'); die(); } or if(!$_SESSION['logged_in']){ echo "<meta http-equiv='refresh' content='0;http://www.example.com/' />"; echo die(); }
-
Does dropdown menu input require filteration?
QuickOldCar replied to ajoo's topic in PHP Coding Help
Bots and humans alike beat captchas, many of the popular or poorly written ones are being bypassed. They use ocr or even humans to bypass, reuse a session id for capcha images Your best bet is using reCatpcha , although some manage to get past occasionally, google frequently changes it so they can't.- 8 replies
-
- ajoo
- input filteration
-
(and 1 more)
Tagged with:
-
Issues with displaying if else echo statement in contact page..
QuickOldCar replied to NickP's topic in Third Party Scripts
Right off i see a mistake change this: if (mail ($to, $subject, $body, $from))) { to this: if (mail ($to, $subject, $body, $from)) { Besides that, obviously php is not parsing correctly, first make sure xampp is configured and working. -
I guess the first thing should do is add this to the top of your script error_reporting(E_ALL | E_NOTICE); ini_set('display_errors', '1'); See if there are any errors. Next can explain how it's not working, what you are not seeing or expecting.
-
Auto adjust width image creation but set height
QuickOldCar replied to Russia's topic in PHP Coding Help
With this you can set a max width or height and will be a pretty close scale <?php $max_size = 100; $size = getimagesize($images); $ratio = $size[0] / $size[1]; if ($ratio >= 1) { $width = $max_size; $height = round($max_size / $ratio); } else { $width = round($max_size * $ratio); $height = $max_size; } $images_orig = imagecreatefromjpeg($images); $photoX = ImagesX($images_orig); $photoY = ImagesY($images_orig); $images_fin = ImageCreateTrueColor($width, $height); ImageCopyResampled($images_fin, $images_orig, 0, 0, 0, 0, $width, $height, $photoX, $photoY); ImageJPEG($images_fin, $new_images); imagedestroy($images_fin); //you should destroy at the end because will reside in memory ?> -
Did you paste a partial code? Should have an if here if(isset($_POST['getringan'])){ and also wrap it with another curly brace at the end
-
Does dropdown menu input require filteration?
QuickOldCar replied to ajoo's topic in PHP Coding Help
Because someone can use curl and do a POST or make their own form and direct it to your script. Protect and check your incoming data on the receiving script itself, then it doesn't matter where it comes from. Be sure is data you expect, filter/sanitize/escape anything before you use it.- 8 replies
-
- ajoo
- input filteration
-
(and 1 more)
Tagged with:
-
<?php function index() { chart($_POST['userinput']); } ?>
-
But as ginerjm stated...is very old and should be redone. Consider doing it in html5 http://www.html-5-tutorial.com/
-
My first project - Connected but no data - MySQL\PHP
QuickOldCar replied to Mouse51180's topic in PHP Coding Help
It could be case sensitive on your column names While($row = mysql_fetch_assoc($records)){ echo "<tr>"; echo "<td>".$row['Number']."</td>"; echo "<td>".$row['Depth']."</td>"; echo "</tr>"; }//end while -
Sounds like you are wanting pagination or to limit the results. Here is an older pagination tutorial that uses the deprecated mysql_* functions http://www.phpfreaks.com/tutorial/basic-pagination If you just need to limit some results can add this to the end of the query shows one result LIMIT 1 starting row zero and show one result LIMIT 0,1 starting row zero and show five results LIMIT 0,5 starting row ten and show ten results LIMIT 10,10
-
apply pagination to search results, limit pages
QuickOldCar replied to Evgeniya's topic in PHP Coding Help
An old pagination tutorial for your old code. http://www.phpfreaks.com/tutorial/basic-pagination -
That's fine, you can also select the table, click operations and change the storage engine to myisam.
-
Or this odbc:DRIVER={Microsoft Access Driver (*.mdb, *.accdb)};
-
You may need to use the 32 bit version of wamp
-
Can't you just add an additional wp_mail() call there? <?php if (get_post_meta( $post->ID, '_listing_contact_form', true) != '') { echo do_shortcode(get_post_meta( $post->ID, '_listing_contact_form', true) ); } else { $nameError = ''; $emailError = ''; if(isset($_POST['submitted'])) { $url = get_permalink(); $listing = get_the_title(); if(trim($_POST['contactName']) === '') { $nameError = 'Please enter your name.'; $hasError = true; } else { $name = trim($_POST['contactName']); } if(trim($_POST['email']) === '') { $emailError = 'Please enter your email address.'; $hasError = true; } else if (!preg_match("/^[[:alnum:]][a-z0-9_.-]*@[a-z0-9.-]+\.[a-z]{2,4}$/i", trim($_POST['email']))) { $emailError = 'You entered an invalid email address.'; $hasError = true; } else { $email = trim($_POST['email']); } $phone = trim($_POST['phone']); if(function_exists('stripslashes')) { $comments = stripslashes(trim($_POST['comments'])); } else { $comments = trim($_POST['comments']); } if(!isset($hasError)) { $emailTo = get_the_author_meta( 'user_email', $post->post_author ); if (!isset($emailTo) || ($emailTo == '') ){ $emailTo = get_option('admin_email'); } $subject = 'Listing Inquiry from '.$name; $body = "Name: $name \n\nEmail: $email \n\nPhone: $phone \n\nListing: $listing \n\nURL: $url \n\nComments: $comments"; $headers = 'From: '.$name.' <'.$emailTo.'>' . "\r\n" . 'Reply-To: ' . $email; wp_mail($emailTo, $subject, $body, $headers); wp_mail('help@dealfiles.com', $subject, $body, $headers); $emailSent = true; } } ?>
-
Browser address bar not showing full url
QuickOldCar replied to Pavlos1316's topic in Javascript Help
I guess you can write or save the data with js. Try adding the meta using something like opengraph to the head of the page http://ogp.me/ -
display image from uploaded directory (php mysql)
QuickOldCar replied to benidopogi's topic in PHP Coding Help
You can do the multiple echo with one also eliminating the need to keep breaking in and out of php <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR...nsitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> </head> <body> <form enctype="multipart/form-data"> <?php include 'connect.php'; $dir = '/images/advisory'; $res = mysql_query("Select * from image_advisory INNER JOIN main_advisory ON image_advisory.advisory_id = main_advisory.id "); echo "<table border='1px'>"; while ($row = mysql_fetch_array($res)) { echo "<tr>"; echo "<td>" . $row['advisory'] . "</td>"; echo "<td><img src='" . $dir . "/" . $row['ad_img'] . "' height='100' width ='100' ></td>"; echo "</tr>"; } echo "</table>"; ?> </form> </body> </html> -
Not sure if you want to add this to send or upon recieving. if (isset($_GET['region']) && ctype_digit($_GET['region'])) { $region = $_GET['region']; } else { $region = 1; } $params = array( 'region' => $region ); Or just grab the request and insert using whichever method you use, GET,POST,REQUEST Cleaning and checking them before using them. $client->call('function1', ($_GET));
-
Encoding is messy and sometimes difficult. You first need to detect the encoding and iconv doesn't do that. mb_detect_encoding() It's possible to use the header of the file info or a pages charset info, but is not always accurate or mixed encodings. This person made an always utf-8 class that could help. It could also fix garbled utf-8 https://github.com/neitanod/forceutf8 Even if you want to encode it to something else...at least it should be utf-8 to start with.