Jump to content

MadTechie

Staff Alumni
  • Posts

    9,409
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by MadTechie

  1. Welcome I think I had that problem a long time again..
  2. when using parseInt () If the string begins with "0", the radix is 8 (octal). try setting the radix to base 10 ie parseInt("08",10);
  3. I had a quick read, it okay but was probably written is PHP4 (or by a PHP 4 developer) php 5 is a standard and 6 is out soon. for example session_is_registered() & session_register() has been DEPRECATED as of PHP 5.3.0 and REMOVED as of PHP 6.0.0. Relying on this feature is highly discouraged. InFact Use of $_SESSION was preferred, as of PHP 4.1.0 so change session_is_registered('whatever') to isset($_SESSION['whatever']) and session_register("whatever"); to $_SESSION['whatever'] = $whatever; however session_start(); must be called at the start, so add that to the start of checklogin.php login_success.php has it already here's some code you could add for a members only page (after that tut) <?php stsession_start(); if(!isset($_SESSION['myusername'])) { die("Ahhha a guest.. Go away!"); } echo "Hello ".$_SESSION['myusername']; ?>
  4. Can't help too much but a little warning.. if you get your money back.. they will still own the domain.. and probably cut their losses and you won't get the domain until it expires..
  5. okay I just reviewed all of the code, (didn't test it as I don't have the database and i'm too lazy to setup one ) here's an update <?php //Config.php $host="localhost"; // Host name $username="*****"; // Mysql username $password="****"; // Mysql password $db_name="websmart_registeredmembers"; // Main Database name $db_tempname="websmart_tempmembersdb"; // Temp Database name $tbl_tempname="websmart_tempmembersdb"; $tbl_membername="websmart_registeredmembers"; //Connect to server and select database. mysql_connect("$host", "$username", "$password")or die("cannot connect to server"); //mysql_select_db("$db_name")or die("cannot select DB"); ?> <?php //signup-ac.php include('config.php'); // Random confirmation code $confirm_code=md5(uniqid(rand())); // values sent from form $name=$_POST['name']; $email=$_POST['email']; $country=$_POST['country']; // Insert data into database $sql=sprintf("INSERT INTO $db_tempname.$tbl_tempname (confirm_code, name, email, password, country)VALUES('%s', '%s', '%s', '%s', '%s')", $confirm_code,mysql_real_escape_string($name), mysql_real_escape_string($email), mysql_real_escape_string($password), mysql_real_escape_string($country)); $result=mysql_query($sql); // if suceesfully inserted data into database, send confirmation link to email if($result){ // ---------------- SEND MAIL FORM ---------------- // send e-mail to ... $to=$email; // Your subject $subject="Websmartin confirmation link here"; // From $header="from: Websmartin.co.uk"; // Your message $message="Your Comfirmation link \r\n"; $message.="Click on the below link to activate your account \r\n"; $message.="http://www.websmartin.co.uk/confirmation.php?passkey=$confirm_code"; $message.="Kinds regards,"; $message.="Websmartin"; // send email $sentmail = mail($to,$subject,$message,$header); }else { echo "Not found your email in our database"; } // if your email succesfully sent if($sentmail){ echo "Your Confirmation link Has Been Sent To Your Email Address<br>Please close this window."; }else { echo "Cannot send Confirmation link to your e-mail address"; } ?> <?php //Confirmation.php include('config.php'); // Passkey that got from link $passkey=$_GET['passkey']; // Retrieve data from table where row that match this passkey $sql1=sprintf("SELECT * FROM $db_tempname.$tbl_tempname WHERE confirm_code ='%s'",mysql_real_escape_string($passkey)); $result1=mysql_query($sql1) or die($sql1.mysql_error()); // If successfully queried if($result1){ // Count how many row has this passkey $count=mysql_num_rows($result1); // if found this passkey in our database, retrieve data from table "websmart_tempmembersdb" if($count==1){ $rows=mysql_fetch_array($result1); $name=$rows['name']; $email=$rows['email']; $password=$rows['password']; $country=$rows['country']; // Insert data that retrieves from "websmart_tempmembersdb" into table "websmart_registeredmembers" $sql2=sprintf("INSERT INTO $db_name.$tbl_membername(name, email, password, country)VALUES('%s', '%s', '%s', '%s')", mysql_real_escape_string($name), mysql_real_escape_string($email), mysql_real_escape_string($password), mysql_real_escape_string($country)); $result2=mysql_query($sql2)or die($sql2.mysql_error()); } // if not found passkey, display message "Wrong Confirmation code" else { echo "Wrong Confirmation code"; } // if successfully moved data from table "websmart_tempmembersdb" to table "registered_members" displays message "Your account has been activated" and don't forget to delete confirmation code from table "temp_members_db" if($result2){ echo "Your account has been activated"; // Delete information of this user from table "websmart_tempmembersdb" that has this passkey $sql3=sprintf("DELETE FROM $db_tempname.$tbl_tempname WHERE confirm_code = '%s'",mysql_real_escape_string($passkey)); $result3=mysql_query($sql3)or die($sql3.mysql_error()); } } ?> EDIT: oops updated confirmation.php changed $db_tempname to $db_name updated to // Insert data that retrieves from "websmart_tempmembersdb" into table "websmart_registeredmembers" $sql2=sprintf("INSERT INTO $db_name.$tbl_membername(name, email, password, country)VALUES('%s', '%s', '%s', '%s')", mysql_real_escape_string($name), mysql_real_escape_string($email), mysql_real_escape_string($password), mysql_real_escape_string($country)); $result2=mysql_query($sql2)or die($sql2.mysql_error());
  6. try these updates <?php $host="localhost"; // Host name $username="*****"; // Mysql username $password="****"; // Mysql password $db_name="websmart_registeredmembers"; // Main Database name $db_tempname="websmart_tempmembersdb"; // Temp Database name //Connect to server and select database. mysql_connect("$host", "$username", "$password")or die("cannot connect to server"); mysql_select_db("$db_name")or die("cannot select DB"); ?> <?php include('config.php'); // Passkey that got from link $passkey=$_GET['passkey']; $tbl_name1="websmart_tempmembersdb"; mysql_select_db($db_tempname)or die("cannot select temp DB"); // Retrieve data from table where row that match this passkey $sql1="SELECT * FROM $tbl_name1 WHERE confirm_code ='$passkey'"; $result1=mysql_query($sql1) or die($sql1.mysql_error()); // If successfully queried if($result1){ // Count how many row has this passkey $count=mysql_num_rows($result1); // if found this passkey in our database, retrieve data from table "websmart_tempmembersdb" if($count==1){ $rows=mysql_fetch_array($result1); $name=$rows['name']; $email=$rows['email']; $password=$rows['password']; $country=$rows['country']; $tbl_name2="websmart_registeredmembers"; mysql_select_db($db_name)or die("cannot select main DB"); // Insert data that retrieves from "websmart_tempmembersdb" into table "websmart_registeredmembers" $sql2="INSERT INTO $tbl_name2(name, email, password, country)VALUES('$name', '$email', '$password', '$country')"; $result2=mysql_query($sql2)or die($sql2.mysql_error()); } // if not found passkey, display message "Wrong Confirmation code" else { echo "Wrong Confirmation code"; } // if successfully moved data from table "websmart_tempmembersdb" to table "registered_members" displays message "Your account has been activated" and don't forget to delete confirmation code from table "temp_members_db" if($result2){ echo "Your account has been activated"; mysql_select_db($db_tempname)or die("cannot select temp DB"); // Delete information of this user from table "websmart_tempmembersdb" that has this passkey $sql3="DELETE FROM $tbl_name1 WHERE confirm_code = '$passkey'"; $result3=mysql_query($sql3)or die($sql3.mysql_error()); } } ?>
  7. Where did you get it ? also why do you want a temporary database for unactivated people ?
  8. Try this (maybe have some bugs, its from an old script) <?php // the email to validate $emails = array ('check@email.com' ); //Check syntax first (option A) foreach($emails as $K => $email) { if (preg_match('/^(?:[a-z0-9!#$%&\'*+\/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&\'*+\/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(??:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(??:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])$/i', $email)){ $results [$email] = false; unset($emails[$K]); //remove from list } } // an optional sender //$sender = 'user@example.com'; $SMTP_Valid = new SMTP_validateEmail ( ); // do the validation (option B) $result = $SMTP_Valid->validate ( $emails, $sender ); // view results var_dump ( $result ); echo $email . ' is ' . ($result ? 'valid' : 'invalid') . "\n"; // send email? if ($result) { //mail(...); } ?> <?php class SMTP_validateEmail { /** * PHP Socket resource to remote MTA * @var resource $sock */ var $sock; /** * Current User being validated */ var $user; /** * Current domain where user is being validated */ var $domain; /** * List of domains to validate users on */ var $domains; /** * SMTP Port */ var $port = 25; /** * Maximum Connection Time to an MTA */ var $max_conn_time = 30; /** * Maximum time to read from socket */ var $max_read_time = 5; /** * username of sender */ var $from_user = 'user'; /** * Host Name of sender */ var $from_domain = 'localhost'; /** * Nameservers to use when make DNS query for MX entries * @var Array $nameservers */ var $nameservers = array ('192.168.0.1' ); var $debug = false; /** * Initializes the Class * @return SMTP_validateEmail Instance * @param $email Array[optional] List of Emails to Validate * @param $sender String[optional] Email of validator */ function SMTP_validateEmail($emails = false, $sender = false) { if ($emails) { $this->setEmails ( $emails ); } if ($sender) { $this->setSenderEmail ( $sender ); } } function _parseEmail($email) { $parts = explode ( '@', $email ); $domain = array_pop ( $parts ); $user = implode ( '@', $parts ); return array ($user, $domain ); } /** * Set the Emails to validate * @param $emails Array List of Emails */ function setEmails($emails) { foreach ( $emails as $email ) { list ( $user, $domain ) = $this->_parseEmail ( $email ); if (! isset ( $this->domains [$domain] )) { $this->domains [$domain] = array (); } $this->domains [$domain] [] = $user; } } /** * Set the Email of the sender/validator * @param $email String */ function setSenderEmail($email) { $parts = $this->_parseEmail ( $email ); $this->from_user = $parts [0]; $this->from_domain = $parts [1]; } /** * Validate Email Addresses * @param String $emails Emails to validate (recipient emails) * @param String $sender Sender's Email * @return Array Associative List of Emails and their validation results */ function validate($emails = false, $sender = false) { $results = array (); if ($emails) { $this->setEmails ( $emails ); } if ($sender) { $this->setSenderEmail ( $sender ); } // query the MTAs on each Domain foreach ( $this->domains as $domain => $users ) { $mxs = array (); // retrieve SMTP Server via MX query on domain list ( $hosts, $mxweights ) = $this->queryMX ( $domain ); // retrieve MX priorities for($n = 0; $n < count ( $hosts ); $n ++) { $mxs [$hosts [$n]] = $mxweights [$n]; } asort ( $mxs ); // last fallback is the original domain array_push ( $mxs, $this->domain ); $this->debug ( print_r ( $mxs, 1 ) ); $timeout = $this->max_conn_time / count ( $hosts ); // try each host while ( list ( $host ) = each ( $mxs ) ) { // connect to SMTP server $this->debug ( "try $host:$this->port\n" ); if ($this->sock = fsockopen ( $host, $this->port, $errno, $errstr, ( float ) $timeout )) { stream_set_timeout ( $this->sock, $this->max_read_time ); break; } } // did we get a TCP socket if ($this->sock) { $reply = fread ( $this->sock, 2082 ); $this->debug ( "<<<\n$reply" ); preg_match ( '/^([0-9]{3}) /ims', $reply, $matches ); $code = isset ( $matches [1] ) ? $matches [1] : ''; if ($code != '220') { // MTA gave an error... foreach ( $users as $user ) { $results [$user . '@' . $domain] = false; } continue; } // say helo $this->send ( "HELO " . $this->from_domain ); // tell of sender $this->send ( "MAIL FROM: <" . $this->from_user . '@' . $this->from_domain . ">" ); // ask for each recepient on this domain foreach ( $users as $user ) { // ask of recepient $reply = $this->send ( "RCPT TO: <" . $user . '@' . $domain . ">" ); // get code and msg from response preg_match ( '/^([0-9]{3}) /ims', $reply, $matches ); $code = isset ( $matches [1] ) ? $matches [1] : ''; if ($code == '250') { // you received 250 so the email address was accepted $results [$user . '@' . $domain] = true; } elseif ($code == '451' || $code == '452') { // you received 451 so the email address was greylisted (or some temporary error occured on the MTA) - so assume is ok $results [$user . '@' . $domain] = true; } else { $results [$user . '@' . $domain] = false; } } // quit $this->send ( "quit" ); // close socket fclose ( $this->sock ); } } return $results; } function send($msg) { fwrite ( $this->sock, $msg . "\r\n" ); $reply = fread ( $this->sock, 2082 ); $this->debug ( ">>>\n$msg\n" ); $this->debug ( "<<<\n$reply" ); return $reply; } /** * Query DNS server for MX entries * @return */ function queryMX($domain) { $hosts = array (); $mxweights = array (); if (function_exists ( 'getmxrr' )) { getmxrr ( $domain, $hosts, $mxweights ); } else { // windows, we need Net_DNS require_once 'Net/DNS.php'; $resolver = new Net_DNS_Resolver ( ); $resolver->debug = $this->debug; // nameservers to query $resolver->nameservers = $this->nameservers; $resp = $resolver->query ( $domain, 'MX' ); if ($resp) { foreach ( $resp->answer as $answer ) { $hosts [] = $answer->exchange; $mxweights [] = $answer->preference; } } } return array ($hosts, $mxweights ); } /** * Simple function to replicate PHP 5 behaviour. http://php.net/microtime */ function microtime_float() { list ( $usec, $sec ) = explode ( " ", microtime () ); return (( float ) $usec + ( float ) $sec); } function debug($str) { if ($this->debug) { echo htmlentities ( $str ); } } } ?>
  9. As i said websmart_registeredmembers doesn't exist! can you give me an idea how your database are setup, as the code suggests 2 different things 1. 2 tables websmart_registeredmembers and websmart_tempmembersdb 2. 2 databases, both with websmart_registeredmembers
  10. backup your current Confirmation.php and try this one instead, i have added some debugging, and some markers <?php include('config.php'); // Passkey that got from link $passkey=$_GET['passkey']; $tbl_name1="websmart_tempmembersdb"; // Retrieve data from table where row that match this passkey $sql1="SELECT * FROM $tbl_name1 WHERE confirm_code ='$passkey'"; $result1=mysql_query($sql1) or die($sql1.mysql_error()); echo "#1: \n<br>"; // If successfully queried if($result1){ // Count how many row has this passkey $count=mysql_num_rows($result1); echo "#2: \n<br>"; // if found this passkey in our database, retrieve data from table "websmart_tempmembersdb" if($count==1){ $rows=mysql_fetch_array($result1); $name=$rows['name']; $email=$rows['email']; $password=$rows['password']; $country=$rows['country']; $tbl_name2="websmart_registeredmembers"; // Insert data that retrieves from "websmart_tempmembersdb" into table "websmart_registeredmembers" $sql2="INSERT INTO $tbl_name2(name, email, password, country)VALUES('$name', '$email', '$password', '$country')"; $result2=mysql_query($sql2)or die($sql2.mysql_error()); } // if not found passkey, display message "Wrong Confirmation code" else { echo "Wrong Confirmation code"; } echo "#3: \n<br>"; // if successfully moved data from table "websmart_tempmembersdb" to table "registered_members" displays message "Your account has been activated" and don't forget to delete confirmation code from table "temp_members_db" if($result2){ echo "Your account has been activated"; // Delete information of this user from table "websmart_tempmembersdb" that has this passkey $sql3="DELETE FROM $tbl_name1 WHERE confirm_code = '$passkey'"; $result3=mysql_query($sql3)or die($sql3.mysql_error()); } } ?> please note your code is vulnerable to SQL injections (we will get back to that)
  11. Please you the code tags # Also its been some years since I last used Novell, Can you please provide a list of errors your getting (PS a fix maybe a slow process as i don't have novell )
  12. Check your databases are setup correctly, check the table exists (see Line 28 of Confirmation.php) PS Pleasee use the code tags instead of images, as normally I would ignore this post for having an image for the code!
  13. Hi, What's the problem ? if you stuck with its usage, I would say your index.php should have the following code. include "parser.php"; $parser = new IAM_OPML_Parser(); $parser->displayOPMLContents('ocw.xml'); however your need to change line 29 back, probably to function getContent($url='')
  14. You define invalid as email doesn't exist, do you want to check if the email is A. a valid format ie myemail@mydomain.com = valid lollypop = invalid B. has a valid mail box ie IExist@hotmail.com = valid iDontExist@hotmail.com = invalid C. is actually someone who signed up ISignedup@hotmail.com = valid Ididnt@hotmail.com = invalid You could do all 3 BUT the for 6000 emails it will take awhile A. a simple regex B. use sockets to connect to domain and check mbox (takes a few seconds per mail box) C. send email to all emails with a link to confirm its their email.
  15. It does catch accents $fldVals = array("crêpes or café","test","Å=ångström"); foreach($fldVals as $fldVal) { echo $fldVal; if (preg_match('/^[\20-\x7E]+$/', $fldVal)) { echo ": valid<br>\n"; }else{ echo ": invalid<br>\n"; } } returns as test was the only one with standard characters, its the only valid one
  16. try this if (preg_match('/^[\20-\x7E]+$/', $fldVal)) { echo "valid"; }
  17. just add the ? to the end RewriteRule ^gallery/([^\.]*).\w{1,3} gallery/$1? if I'm reading that correctly, it would make site.com/paris/image-name.gif (no gallery) goto preview.php?cat=paris&img=image-name.gif
  18. Really need more info. define "incomplete" an example would really help us help you!
  19. Setting permissions to 0777 has no effect on a windows platform I would say change the files permissions to everyone, and re-try the script, but if you created the file via a php script it should be fine.. try rebooting windows then try a simple 1 line script to delete the file, if that works. then I would guess you have one of the following problems 1. the file has been opened and not closed. 2. the $file is empty and PHP is attempting to unlink a folder 3. you have some special permission set to stop the deleting process
  20. /*No Comment*/
  21. Topic Solved ? please click topic solved bottom left
  22. something like this RewriteEngine On RewriteRule ^gallery/([^\.]*).\w{1,3} gallery/$1
  23. The fact someone got a PHP file on your server proves you need to write some security,
  24. switch($_POST['name']) should be switch($_POST['emailto'])
×
×
  • 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.