-
Posts
9,409 -
Joined
-
Last visited
-
Days Won
1
Everything posted by MadTechie
-
on any SQL you should use mysql_real_escape_string(); on your strings and convert your integers to integers and floats to floats the number is safe providing filter is used before the sql statement, also the date is safe, anything from the user is unsafe
-
as your other errors use die then that would be okay I guess
-
how to add my website on the first page of google search engine?
MadTechie replied to asad_black's topic in Miscellaneous
*Waits for this page to gets indexed by google* No result yet Google link to 'oxygarphmicalisys' -
Need help with Script? Thank you for your help!
MadTechie replied to bchandel's topic in PHP Coding Help
$query = "SELECT * FROM Business WHERE `City` LIKE '%$variable%' or State LIKE '%variable%' or Country Like '%variable'"; -
I would recommend you have starttime as a timestamp and then do $hours = date("G",$s_row['starttime']); $minutes = date("i",$s_row['starttime']); however if you keep it as a string, you can split it like this list($hours,$minutes) = explode(":",$s_row['starttime']); EDIT: also this question suite the PHP Help section better (I'll move it)
-
you need to put it where you deal with the posted data, (from looking at your form), I would have to say yes, it goes in the mail.php script
-
That's very interesting, however 1. What part you stuck on? 2. What does this have to do with Regular expressions ? 3. What with the initial word caps? 4. Sorry I am not going to read all that code. 5. I'm moving this to Third Party PHP Scripts (help with a script someone else wrote)
-
okay var_dump($valid); should be replaced with your error capturing ie if(!$valid) echo "ERROR: in-valid number";
-
if your first query fails all you arrays will be empty, double check it also is error reporting on ? try $stations = mysql_query($get_stations) or die(mysql_error());
-
Can you post the code,
-
[SOLVED] Strange MySQL Error that wasnt there before.
MadTechie replied to Woodsyx's topic in PHP Coding Help
i would say update the line to $result = mysql_query("SELECT lasttime FROM idlers WHERE name='".mysql_real_escape_string($name)."'") or die(mysql_error()); to display the error but your code doesn't contain the line with the error ! mysql_num_rows() isn't in that code! -
[SOLVED] how can i avoid long words on string??
MadTechie replied to yami007's topic in PHP Coding Help
/*No Comment*/ -
that's 11 numbers, thus is more than 10
-
Great just over 11 minutes, that's how long my genius dream lasted thanks corbin Yeah I know, as I said the subject is just to get people to view it, I think drawing a circle was one of the first programs I ever created. I found it a little iconic I used the imageellipse() function to draw the dots of a circle
-
What was the input?
-
Personally after reading [WARNING:Genius needed] I wasn't going to reply as I find post that are labelled like this are only done so to get a quicker response, hence I intentionally ignore them, for awhile, however I decided to have some fun, and relive some old school coding, of drawing remove the GD stuff and uncomment the echo for the function you need (also for each 10th degrees your need 36 side (360 / 10) <?php header("Content-type: image/png"); drawCircle(100, 100, 50, 100); function drawCircle($centerX, $centerY, $radius, $sides){ $im = @imagecreate(500, 500) or die("Cannot Initialize new GD image stream"); $background_color = imagecolorallocate($im, 255, 255, 255); $color = imagecolorallocate($im, 0, 0, 0); for($i=0; $i<=$sides; $i++) { $pointRatio = $i/$sides; $xSteps = cos($pointRatio*2*pi()); $ySteps = sin($pointRatio*2*pi()); $pointX = $centerX + $xSteps * $radius; $pointY = $centerY + $ySteps * $radius; // echo "$pointX, $pointY\n"; imageellipse($im, $pointX, $pointY, 1, 1, $color); } imagepng($im); imagedestroy($im); } ?>
-
Options I can think of, [*]Use a command line utility via exec(), system(), shell_exec() [*]maybe send commands directly to the scanner (read the control commands for the scanner) [*]Create a ActiveX/Plug-in, Scanner COM Control [*]Off the shelf Dynamic Web TWAIN
-
[SOLVED] AJAX populating form fields from Select Drop Down
MadTechie replied to ncosgrove's topic in Javascript Help
No worries, any problems just ask -
try this <?php $valid = false; //check it has a value if(!empty($_POST['number'])) { //remove unwanted (leave numbers only) $num = preg_replace('/[^\d]/', '', $_POST['number']); //only valid if its 0 to 10 numbers only $valid = (bool)preg_match('/^\d{0,10}$/', $num); } var_dump($valid); ?> 0123456789 = valid 0123456789abcd = valid (with clean up used) 01234567890 = not valid (11 numbers) 123 = valid 123abc = valid(with clean up used)
-
like so $find = "Hello"; //your string $ifind = preg_quote($find, '/'); //$find = "/$ifind/i"; //case insensitive OR $ifind = "/$ifind/"; //case sensitive $replace = array('1','2','3','4','5'); foreach($replace as $R) { $string = preg_replace($ifind, $R, $string,1); } echo $string;
-
Here's a sample from what you have posted I believe you shouldn't have any problems integrating it $notice_text = "This is a multi-part message in MIME format."; $plain_text = "This is a plain text email.\r\nIt is very cool."; $html_text = "<html><body>This is an <b style='color:purple'>HTML</b> text email.\r\nIt is very cool.</body></html>"; $semi_rand = md5(time()); $mime_boundary = "==MULTIPART_BOUNDARY_$semi_rand"; $mime_boundary_header = "\"$mime_boundary\""; $to = "Me <me@me.com>"; $bcc = "You <you@you.com>, Them <them@them.com>"; $from = "Me.com <me@me.com>"; $subject = "My Email"; $body = "$notice_text --$mime_boundary Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit $plain_text --$mime_boundary Content-Type: text/html; charset=us-ascii Content-Transfer-Encoding: 7bit $html_text --$mime_boundary--"; if (@mail($to, $subject, $body, "From: " . $from . "\n\r" . "bcc: " . $bcc . "\n\r" . "MIME-Version: 1.0\n\r" . "Content-Type: multipart/alternative;\n\r" . " boundary=" . $mime_boundary_header)) { echo "Email sent successfully."; }else{ echo "Email NOT sent successfully!"; }
-
[SOLVED] require_once path help.. should be easy...
MadTechie replied to Jonotron's topic in PHP Coding Help
Sure, __FILE__ = the full path and name of the current file dirname() function extracts the path from the given parameter result is the path of the current file your in. EDIT: just remember the resulting path doesn't have the leading slash so you need to add it ie __FILE__ // return /root/testing/myfile.php dirname("/root/testing/myfile.php"); // returns /root/testing so dirname(__FILE__); // returns /root/testing so add the / at the end -
[SOLVED] require_once path help.. should be easy...
MadTechie replied to Jonotron's topic in PHP Coding Help
try this require_once dirname(__FILE__).'/../include/database.php'; -
[SOLVED] how can i avoid long words on string??
MadTechie replied to yami007's topic in PHP Coding Help
You could create a regex to break up these words but i feel this be down to your HTML/CSS ! here's a concept of adding a space after the 5th repeated letter $para = "hellllllllllllllllllllo"; echo preg_replace('/(\w{5})(\1)/im', '\1 \2', $para); //returns helllll llllllllll lllllo -
if you've downloaded the details into a database that PHP can access then, it should be a simple cron/scheduled task of checking the database for upcoming tasks and firing off an email.