-
Posts
9,409 -
Joined
-
Last visited
-
Days Won
1
Everything posted by MadTechie
-
so just add set_time_limit(0); to code B
-
[SOLVED] back button on PHP mail page... help!!!
MadTechie replied to kcotter's topic in PHP Coding Help
Sure (req. JS) change print "Thank you $name for registering to win!"; to print "Thank you $name for registering to win! <a href="javascript:window.close()">close me</a>"; -
[SOLVED] back button on PHP mail page... help!!!
MadTechie replied to kcotter's topic in PHP Coding Help
change print 'Please go back and Enter name and Email...';<html><a href="form.html">Back</a></html> to print 'Please go back and Enter name and Email...<a href="form.html">Back</a>'; -
How to identify if the input string is valid IP address format
MadTechie replied to bloodgoat's topic in Regex Help
A little better would be a valid IPv4 address Use this regex to match IP numbers with accurracy. preg_match('/(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)/', $IP); Matches 0.0.0.0 through 255.255.255.255 -
its a no from me as well.. sorry! Can't you just include "postnewitem.php" in the updatepic.php script and remove the and next ?
-
No thats why we use a MX lookup, as allworknoplay said in my example i said This is one of the things where you CAN check but you may not want to.. this requires your server connecting to another server to do some checks.. of course its useful if you want to have check they are valid before sending bulk mail or something like that.. personally i use a JS RegEX, once submitted re-check via a PHP RegEx then send a link.. but it depends on the project
-
Of couse you can check if its real!! can you check if its used by the person whos entered it.. no (well only via an activation link or that sort of thing) okay let get down to business First whats the problem you say you have already tried a lot of scripts from net but all went in vain, what are you trying to do ? To check if a email is "Real" you need to get the email address and checks its valid but doing the following (in order) [*]Its a Valid Email address format [*]The domain exists [*]get the MX (mail exchange) for the domain [*]if theirs more than one MX then check each in priorities order [*]if all MX fail attempt to use the domain [*]Pass the email address to the Mail Exchange and see if the address is accepted as valid on that domain So for example (use a simple regex ie basic example '%\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}\b%i') A = madtechie@notmydomain B = madtechie@notmydomain.com C = NOTmadtechie@mydomain.com D = madtechie@mydomain.com 1. Its a Valid Email address format? A = False B = True C = True D = True So A has Failed it won't be tested anymore 2. The domain exists (ie ping the domain) sockets are fine here B = false C = True D = True So B has Failed it won't be tested anymore -. get the MX (mail exchange) for the domain (use getmxrr() or for windows Net_DNS_Resolver class) (were say only 1 MX exists and its mail.mydomain.com) 3. Pass the C & D email address to the mail.mydomain.com and see if the address is accepted as valid on that domain. (again sockets) open socket mail.mydomain.com:25 send ("HELO mydomain.com") C = send("MAIL FROM: <NOTmadtechie@mydomain.com@mydomain.com>"); D = send("MAIL FROM: <madtechie@mydomain.com@mydomain.com>"); C = send("RCPT TO: <NOTmadtechie@mydomain.com@mydomain.com>"); D = send("RCPT TO: <madtechie@mydomain.com@mydomain.com>"); Return C = code (not 250) No valid mailbox D = code(250) Valid Mailbox So C has Failed it won't be tested anymore Okay so only D passed all thus its a valid email So send an email to that email address with a activation link when thats url is used its done EDIT: LOL took me a while to type so missed a few replies
-
i missed the ; off this line if(preg_match('/\.ipa$/sim', $_FILES['ufile']['name'])) die("Wrong file type, .ipa file required");
-
Using objects in session_set_save_handlers();
MadTechie replied to sjwspud's topic in PHP Coding Help
sounds like $db isn't being set, maybe use mysql_connect to setup the $db in session_open function -
try this <form action="index.php#process" method="post" enctype="multipart/form-data" name="form1" id="form1"> <input name="ufile" type="file" id="ufile" size="20" /> <input name="nfile" type="text" id="nfile" size="20" /> <input type="submit" name="Submit" value="Upload" /> </form> <?php if(preg_match('/\.ipa$/sim', $_FILES['ufile']['name'])) die("Wrong file type, .ipa file required") $cleanname = preg_replace('/[^a-z0-9]/sim', '', $_POST['nfile']).".ipa"; $path1= "upload/".$cleanname; copy($_FILES['ufile']['tmp_name'], $path1); echo " Download Link, http://teambrod.110mb.com/upload/".$cleanname."<BR/>"; $filesize1=$_FILES['ufile']['size']; if($filesize1 != 0) { echo "Upload Complete"; } ?>
-
looks fine to me except $results = mysql_result($sql, "0"); should be $results = mysql_result($sql, 0); check the database to see if the query is what you expect
-
[SOLVED] php help. but i don't know how should i ask..
MadTechie replied to bogdaniel's topic in PHP Coding Help
you should be able to edit my code above to work with 12 numbers, are you having trouble storing to a mysql database? what do you have so far ? -
[SOLVED] I'm so unclean. Please help me to sanitize...
MadTechie replied to Potatis's topic in PHP Coding Help
include("functions.php"); require_once("connection.php"); swap require_once("connection.php"); include("functions.php"); -
Nope thats not right change if (isset($_POST['username']) && isset($_POST['password'])) { $username = $_POST['username']; $password = $_POST['password']; to if (isset($_POST['user_name']) && isset($_POST['password'])) { $username = $_POST['user_name']; $password = $_POST['password'];
-
[SOLVED] I'm so unclean. Please help me to sanitize...
MadTechie replied to Potatis's topic in PHP Coding Help
make sure you connect to the database before you use mysql_real_escape_string -
$_SESSION['valid_user'] = $username should be $_SESSION['valid_user'] = $username;
-
The problem is likely due to Magic Quotes are being on your need to use stripslashes, but that opens a security hole.. so try this <?php if(get_magic_quotes_gpc()) { $eventDate = stripslashes($_POST['eventDate']); $eventTime= stripslashes($_POST['eventTime']); $eventTitle = stripslashes($_POST['eventTitle']); $eventLocation = stripslashes($_POST['eventLocation']); $eventDescription = stripslashes($_POST['eventDescription']); $showOnWeb = stripslashes($_POST['showOnWeb']); $eventID = stripslashes($_POST['eventID']); } else { $eventDate = $_POST['eventDate']; $eventTime= $_POST['eventTime']; $eventTitle = $_POST['eventTitle']; $eventLocation = $_POST['eventLocation']; $eventDescription = $_POST['eventDescription']; $showOnWeb = $_POST['showOnWeb']; $eventID = $_POST['eventID']; } $query = sprintf("Update tblEvents set eventDate = '%s', eventTime = '%s', eventTitle = '%s', eventLocation = '%s', eventDescription = '%s', showOnWeb = '%s' where eventID = %d", mysql_real_escape_string($eventDate), mysql_real_escape_string($eventTime), mysql_real_escape_string($eventTitle), mysql_real_escape_string($eventLocation), mysql_real_escape_string($eventDescription), mysql_real_escape_string($showOnWeb), $eventID ); ?>
-
[SOLVED] php help. but i don't know how should i ask..
MadTechie replied to bogdaniel's topic in PHP Coding Help
Heres a quick untested example <?php $user_array = explode(",", $_POST['uservalues']); //ie <input name="uservalues" type="text" value="1,2,3"> //build array of 2 unique numbers $sysarray = array(); while(count($sysarray)<2) { $sysarray[] = rand(1, 80); $sysarray = array_unique($sysarray); } if(in_array($sysarray[1], $user_array) && in_array($sysarray[1], $user_array) ) { //both found echo ""woohoo; } ?> -
[SOLVED] php help. but i don't know how should i ask..
MadTechie replied to bogdaniel's topic in PHP Coding Help
So am i correct in saying you want, the user to enter 20 number(range 1-80), and then th server, to generates 2 random number (also range 1-80) and then check to see if its 2 are in the list of 20 the user submitted ? one question.. where does the mysql come into play ? -
not sure if this helps but $results=`/usr/bin/smbclient -N //labelprint/ZEBRA -c 'print strainlabeltemp.prn' 2>&1`; is basically a command line.. this is used later probably exec($results); or system($results); Now to fix this, you need to find out how to print from the command line this may work change $results=`/usr/bin/smbclient -N //labelprint/ZEBRA -c 'print strainlabeltemp.prn' 2>&1`; to $results='print /d:LTP1 strainlabeltemp.prn';
-
Maybe reverse the order and limit to 1 ie ORDER BY p.showtime DESC LIMIT 1
-
I'm using WAMPserver2 on Windows XP SP3 i tweaked the code due to the time() being in a script and added isset for the sessions, however i have not had a page expire yet! My form2.php code <?php session_start(); if(isset($_POST['submit']) && isset($_SESSION['security_code']) && $_SESSION['security_code'] == $_POST['security_code']) { echo 'Thank you. Your message said "'.$_POST['message'].'"'; unset($_SESSION['security_code']); }else{ if(isset($_POST['security_code']) && isset($_SESSION['security_code']) && $_SESSION['security_code'] != $_POST['security_code']) { echo 'Sorry, you have provided an invalid security code'; } echo ' <form action="form2.php" method="post"> <label for="name">Name: </label><input type="text" name="name" id="name" /><br /> <label for="email">Email: </label><input type="text" name="email" id="email" /><br /> <label for="message">Message: </label><textarea rows="5" cols="30" name="message" id="message"></textarea><br /> <img src="captcha.php?width=100&height=40&characters=5&'.time().'" /><br /> <label for="security_code">Security Code: </label><input id="security_code" name="security_code" type="text" /><br /> <input type="submit" name="submit" value="Submit" /> </form> '; } ?>
-
I see.. thier is probably a few ways but heres a simple one basically i grab the string inside the [code ] tag and encode it then do the bbreplace then decode the code tag's <?php $markup = array( '/\[b\](.*?)\[\/b\]/is' => '<strong>$1</strong>', '/\[i\](.*?)\[\/i\]/is' => '<em>$1</em>', '/\[u\](.*?)\[\/u\]/is' => '<span style="text-decoration: underline">$1</span>', '/\[align=(left|center|right)\](.*?)\[\/align\]/is' => '<div style="text-align: $1">$2</div>', '/\[color=(#[0-9a-fA-F]{6}|[a-z]+)\](.*?)\[\/color\]/is' => '<span style="color: $1">$2</span>', '/\[font=\"(.*?)\"\](.*?)\[\/font\]/is' => '<span style="font-family: \'$1\', sans-serif;">$2</span>', '/\[h([1-6]{1})\](.*?)\[\/h([1-6]{1})\]/is' => '<h$1>$2</h$3>', '/\[size=((?:[1-2]{1})?[0-9]{1})\](.*?)\[\/size\]/is' => '<span style="font-size: $1px">$2</span>', '/\[sub\](.*?)\[\/sub\]/is' => '<sub>$1</sub>', '/\[sup\](.*?)\[\/sup\]/is' => '<sup>$1</sup>' ); //remove the first space from code $string = "this is [b]BOLD[/b][ code]so is [b]THIS[/b][/ code]"; //code without the spaces //remove the first space from code $string = preg_replace_callback('/\[ code\](.*?)\[\ /code\]/is',create_function('$string','return "[newcode]".base64_encode($string[1])."[/newcode]";'),$string); $string = preg_replace(array_keys($markup), $markup, $string); $string = preg_replace_callback('/\[newcode\](.*?)\[\/newcode\]/is',create_function('$string','return "<pre>".base64_decode($string[1])."</pre>";'),$string); echo $string; ?>
-
LOL, Yeah getting some sleep myself.. Just to confirm.. you are testing via my form example right!