Jump to content

A1SURF.us

Members
  • Posts

    35
  • Joined

  • Last visited

    Never

Everything posted by A1SURF.us

  1. Well I thought this was a PHP help forum but it's looking more like flame fest. Your either gonna help or your not. Smart ass replies are not helping. Every time I have a problem I try to get some help here and I usually get ignored or smart ass replies like this and I end up solving the problem on my own. My signature was not spam. According to rules, images and links are allowed. I wasn't posting and replying all over the place in some unnatural way.. According to the rules, Flaming and or Trolling is prohibited and will result in course of action to be taken by Staff members. But you are a staff member and I guess the rules do not apply to you?
  2. Why doesn't this work? or is their something similar like this that needs to be done with a call to the database? $id = $user_id
  3. Theirs actually only a few lines of code that need modified. I keep getting a blank page error when I try to modify it. There is also some dynamic javascript that might need modified. So I included it inside the class. I'm not sure if the java is relevant and if it contains actual data from the database. Their are 'id' tags inside the javascript and it is throwing me off. Let me know if you need the original.
  4. I attached a more cleaner version of the class. [attachment deleted by admin]
  5. I had to cut a bunch of the class out so that it would fit inside the post limit, but it wasn't important stuff I think..
  6. How do I designate or change 'id' in this class to 'user_id'? <?php include ("dbconnect.php"); include ("settings.php"); //make connection $server = mysql_connect($host, $user, $password); $connection = mysql_select_db($database, $server); // CUSTOM SQL FUNCTIONS function sql_quote($value) { $value = str_replace('<?','',$value); $value = str_replace('script','',$value); if (get_magic_quotes_gpc()) { $value = stripslashes($value); } if (!is_numeric($value)) { $value = "'" . mysql_real_escape_string($value) . "'"; } else { if ((string)$value[0] == '0') { $value = "'" . mysql_real_escape_string($value) . "'"; }} return $value; } function sql_lastinsertid() { $result = mysql_query("SELECT LAST_INSERT_ID()"); $row = mysql_fetch_row($result); return $row[0]; } function sql_getfield($table, $field, $where_cond = "") { $q = "SELECT ".$field." FROM ".$table." ".$where_cond; $r = mysql_query($q); $row = mysql_fetch_row($r); return $row[0]; } ?><?php // <!-- ========================= --> // <!-- = UNSUBSCRIBE ACTION ==== --> // <!-- ========================= --> if (isset($_GET['unsubscribe']) && sql_getfield($table_emails,'id','WHERE email = '.sql_quote($_GET['unsubscribe']))) { $q = "DELETE from $table_emails WHERE email = ".sql_quote($_GET['unsubscribe']); mysql_query($q); echo 'You have unsubscribed!'; exit(); } ?><?php // <!-- ======================= --> // <!-- = PASSWORD PROTECTION = --> // <!-- ======================= --> if ($password_protection == true) { session_name($session_name); session_start(); // if (isset($_SESSION['last_ts'])) {$_SESSION['last_ts'];} if (!isset($_SESSION['last_ts']) && !isset($_POST['login'])) { // LOGIN FORM echo ' <body style="background:url(images/background.png) repeat-x;"> <div style="position:fixed;top:35%;left:35%;width:50%"> <form action="index.php" method="post" accept-charset="utf-8"> <img src="images/logo.png" alt="logo" id="logo" name="logo" align="left" style="margin-right:20px;" /> <br /><h1 style="font-family: arial, verdana;font-size:20px;color:#222;margin:0;color:#777;display:inline;">Newsletter module </h1> <small> pre 0.9</small><br /> <br /><input type="password" name="login" id="login" style="padding:5px;display:inline;" /> <input type="submit" style="background-color:#E61056;color:#fff;border:0;padding:5px;-moz-border-radius:3px;" value="Login"> </form> </div> </body> '; exit(); } if ($_POST['login'] && sha1($_POST['login'])==$password_hash) { $_SESSION['auth'] = substr(md5(microtime(true).mt_rand()), 0, 16); $_SESSION['last_ts'] = time(); // to destroy the post variable header('Location: index.php'); } if ($_POST['login'] && sha1($_POST['login'])!=$password_hash) { header('Location: index.php?info=invalidlogin'); } else if ((time() - $_SESSION['last_ts'] > $session_timeout) || isset($_GET['logout'])) { session_destroy(); header('Location: index.php'); } else if ((time() - $_SESSION['last_ts'] < $session_timeout)) { $_SESSION['last_ts'] = time(); } } ?><?php // <!-- ========================= --> // <!-- = FILE: AJAX PROCESSING = --> // <!-- ========================= --> // Setup $error=''; // DELETE E-MAILS if ($_POST['action']=='delmail') { $count = 0; $category = $_POST["cat"]; $emails = $_POST["emails"]; if (!empty($emails)) { $email = explode("|",$emails); foreach ($email as $value) { if (!empty($value) && sql_getfield($table_emails,'id','WHERE id = '.sql_quote($value))) { $q = "DELETE from $table_emails WHERE id = ".sql_quote($value)." LIMIT 1"; mysql_query($q); $count+=1; } } } else { $error = 'No emails are selected !'; } echo "{"; echo "error: '" . $error . "',\n"; echo "count: '" . $count . "'\n"; echo "}"; exit(); } // *** // DELETE CATEGORY if ($_POST['action']=='delcat') { $kategorie = $_POST["categories"]; if (!empty($kategorie)) { $category = explode("|",$kategorie); foreach ($category as $value) { if (!empty($value) && sql_getfield($table_categories,'name','WHERE id = '.sql_quote($value))) { if (!in_array($value,$protected)) { $q = "DELETE from $table_categories WHERE id = ".sql_quote($value)." LIMIT 1"; mysql_query($q); $q = "DELETE from $table_emails WHERE category = ".sql_quote($value); mysql_query($q); } else { $error = 'This category is protected'; } } } } else { $error = 'Nie sú označené žiadne kategórie !'; } echo "{"; echo "error: '" . $error . "'\n"; echo "}"; exit(); } // *** // RENAME CATEGORY if ($_POST['action']=='rncat') { $category = $_POST["category"]; $newname = $_POST["newname"]; if (!empty($category) && !empty($newname) && sql_getfield($table_categories,'name','WHERE id = '.sql_quote($category)) ) { $q = "UPDATE $table_categories SET name = ".sql_quote($newname)." WHERE id = ".sql_quote($category)." LIMIT 1"; mysql_query($q); } else { $error = 'Chyba pri premenovaní !'; } echo "{"; echo "error: '" . $error . "'\n"; echo "}"; exit(); } // *** // NEW EMAIL if ($_POST['action']=='newemail') { $category = $_POST["cat"]; $emails = $_POST["emails"]; $append =''; if (!empty($emails)) { $emails = str_replace('"',"",$emails); $emails = str_replace(','," ",$emails); $emails = str_replace(';'," ",$emails); $emails = str_replace('<'," ",$emails); $emails = str_replace('>'," ",$emails); $emails = str_replace("\n"," ",$emails); $emails = str_replace("\t"," ",$emails); $emails = str_replace("\r"," ",$emails); $emails = str_replace("\0"," ",$emails); $email = explode(" ",$emails); foreach ($email as $value) { if (stristr($value,'@') && !sql_getfield($table_emails,'email','WHERE email = '.sql_quote($value).' AND category = '.sql_quote($category))) { $q = "INSERT into $table_emails (category,email) VALUES (".sql_quote($category).",".sql_quote($value).")"; if (!mysql_query($q)) { $error = 'ERR'; } else { $id = sql_lastinsertid(); $append.= '<div><input value="'.$id.'" id="'.$id.'" name="'.$id.'" type="checkbox" /> '.$value.'</div>'; } } } } else { $error = 'Zadajte emailové adresy'; } echo "{"; echo "error: '" . $error . "',\n"; echo "toappend: '" . $append . "'\n"; echo "}"; exit(); } // *** // NEW CATEGORY if ($_POST['action']=='newcategory') { $newcat = $_POST["catname"]; if (!empty($newcat)) { $q = "INSERT into $table_categories (name) VALUES (".sql_quote($newcat).")"; $result = mysql_query($q); if (!$result) { $error = 'ERR'; } else { $name = $newcat; $id = sql_lastinsertid(); } } else { $error = "Please, enter the name !"; } echo "{"; echo "error: '" . $error . "',\n"; echo "name: '" . $name . "',\n"; echo "id: '" . $id . "'\n"; echo "}"; exit(); } // *** // SENDMAIL if ($_POST['action']=='sendmail') { if ($use_template == false ) { $template_top = ''; $template_bottom = '';} $emails = $_POST['adresses']; $body = $_POST['ebody']; $subject = $_POST['subject']; $message = str_replace("\n","<br />",$body); /* ERRORS */ if ($message == '') {$error = 'Please, fill the message field !';} if ($subject == '') {$error = 'Please, fill the subject field !';} if (empty($emails)) {$error = 'No recipient defined ! ';} if (!empty($emails) && empty($error)) { /* ZAPIS DO ODOSLANÝCH NEWSLETTROV */ $q = "INSERT INTO $table_sent (time, subject, body, attachment) VALUES ( ".sql_quote(time()).", ".sql_quote($subject).", ".sql_quote($message).", ".sql_quote($_POST["attachment"]).")"; mysql_query($q); $from = "$your_name <$your_email>"; if (!empty($_POST["attachment"])) { $suffix =strtolower(substr($dir.$_POST["attachment"], -3)); switch($suffix) { case 'gif': $typ = "image/gif"; break; case 'jpg': $typ = "image/jpg"; break; case 'peg': $typ = "image/jpeg";break; case 'png': $typ = "image/png"; break; case 'pdf': $typ = "application/pdf"; break; case 'zip': $typ = "application/zip"; break; } $subject = $_POST['subject']; $fileatt = $dir.$_POST["attachment"]; $fileatttype = $typ; $fileattname = $_POST["attachment"]; $headers = "From: $from"; $file = fopen( $fileatt, 'rb' ); $data = fread( $file, filesize( $fileatt ) ); fclose( $file ); $semi_rand = md5( time() ); $mime_boundary = "==Multipart_Boundary_x{$semi_rand}x"; $headers .= "\nMIME-Version: 1.0\n" . "Content-Type: multipart/mixed;\n" . " boundary=\"{$mime_boundary}\""; $message = "This is a multi-part message in MIME format.\n\n" . "--{$mime_boundary}\n" . "Content-Type: text/html; charset=\"utf-8\"\n" . "Content-Transfer-Encoding: 7bit\n\n" . $template_top.$message.$template_bottom . "\n\n"; $data = chunk_split( base64_encode( $data ) ); $message .= "--{$mime_boundary}\n" . "Content-Type: {$fileatttype};\n" . " name=\"{$fileattname}\"\n" . "Content-Disposition: attachment;\n" . " filename=\"{$fileattname}\"\n" . "Content-Transfer-Encoding: base64\n\n" . $data . "\n\n" . "--{$mime_boundary}--\n"; } else { $subject = $subject." \n"; /* HEADERS */ $headers = "MIME-Version: 1.0\n"; $headers .= "Content-Type: text/html; charset=\"utf-8\"\n"; $headers .= "Content-Transfer-Encoding: 7bit \n"; $headers .= "From: ".$from." \n"; $headers .= "Return-Path: ".$from." \n"; $headers .= "X-Mailer: PHP/" . phpversion(); $message = $template_top.$message.$template_bottom; } if ($_POST['sendto']=='emails') { $email = explode(',',$emails); $email = array_unique($email); } else if ($_POST['sendto']=='categories') { $query = "SELECT * from $table_emails WHERE category IN (".$emails.")"; $select = mysql_query($query); while ($mail_row = mysql_fetch_assoc($select)) { $email[] = $mail_row['id']; } } /* ADMIN CHECK */ if ($mailcheck == true && !in_array($your_email,$email )) { $email[] = $your_email; } foreach ($email as $value) { $emailaddress = sql_getfield($table_emails,'email','WHERE id = '.sql_quote($value)); $unsubscribe_link = "<br /><br /><span style=\"font-size:14px;color:#000;\">If you prefer not to receive future promotional e-mails of this type, please click <a href=\"".$script_url."?unsubscribe=".$emailaddress."\" style=\"color:#ED008C;\">here</a> to unsubscribe."; mail($emailaddress, "=?UTF-8?B?".base64_encode($subject)."?=", $message.$unsubscribe_link, $headers); $count+=1; } } echo "{"; echo "error: '" . $error . "',\n"; echo "count: '" . $count . "'\n"; echo "}"; exit(); } // *** ?><?php // <!-- ======================= --> // <!-- = FILE: MAIN PHP FILE = --> // <!-- ======================= --> ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="Content-type" content="text/html; charset=utf-8" /> <meta http-equiv="expires" content="mon, 22 jul 2002 11:12:01 gmt" /> <title> Newsletter module </title> <!-- ================== --> <!-- = FILE: CSS FILE = --> <!-- ================== --> <style type="text/css" media="screen"> /*<![CDATA[*/ /* HERE GOES YOUR CUSTOM CSS */ <?php echo $css; ?> /* THIS PART OF CSS SHOULD STAY UNTOUCHED TO PRESERVE ORIGINAL LAYOUT BUT - FEEL FREE TO CHANGE IT IF YOU KNOW WHAT YOU'RE DOING */ body { cursor:default; } h1, h2, h3, h4 { margin:0; padding:0; } #logo {vertical-align:middle;cursor:pointer;} a { cursor:pointer; } a:hover{ text-decoration:underline; } input[type=password],input[type=text],textarea { padding:3px; } #categories{ padding:10px; } .tiny { font-size:xx-small;color:#222; text-decoration:none; border:none; } .sign { font-size:xx-large; vertical-align:absmiddle; text-align:center; font-size:xx-large; display:inline; width:20px; } #processing { display:none; position:fixed; top:45%; left:45%; padding:10px 20px 10px 20px; margin:0 auto; text-align:center; } #filename { background:transparent;border:0; } #about { display:none; border:1px dotted #CCC; -moz-border-radius:10px; background-color:#3D3435; color:#fff; z-index:2; position:fixed; top:20%; left:32%; width:30%; padding:2%; } /*]]>*/ </style> </head> <body> <!-- = PHP ARRAYS = --> <?php // LOAD DATA INTO ARRAYS $result = mysql_query("SELECT * from $table_categories"); while ($row = mysql_fetch_assoc($result)) { $emails_result = mysql_query("SELECT * from $table_emails WHERE category = ".$row['id']); while ($subrow = mysql_fetch_assoc($emails_result)) { $row['emails'][] = $subrow; } mysql_free_result($emails_result); $categories[] = $row; } mysql_free_result($result); $result = mysql_query("SELECT * from $table_sent"); while ($row = mysql_fetch_assoc($result)) { $sent[] = $row; } mysql_free_result($result); ?><!-- LOADING INDICATOR --> <div id="processing"> <img src="images/ajax-loader.gif" alt="loading" style="vertical-align:middle;margin-right:10px;" /> PROCESSING </div> <div style="clear:both;margin:0 auto;width:1000px;margin-top:60px;"> <!-- HEADER / SUBHEADER --> <img src="images/logo.png" alt="logo" id="logo" onclick="$('.maincontainers').hide(300);$('#newsletter').show(300)" /> <a class="button" id="sent_mails_link" onclick="$('.maincontainers').hide(200);$('#sent_mails').show(200);" name="sent_mails_link">SENT E-MAILS</a> | <a class="button" id="about_toggle" onclick="$('#about').fadeIn(300);">ABOUT</a> <?php if ($password_protection==true): ?> | <a class="button" id="logout" onclick="top.location.href='?logout=true'">LOGOUT</a><br /> <?php endif ?> </div> <br /> <div id="newsletter" class="maincontainers" style="clear:both;"> <!-- CATEFORIES CONTAINER --> <div id="categories_container" style="width:200px;float:left;margin-right:20px;"> <h2> CATEGORIES </h2><br /> <br /> <div id="categories"> <?php if (isset($categories) && is_array($categories)) { foreach ($categories as $key => $value) { echo ' <div id="cat_'.$value['id'].'"> <input type="checkbox" value="'.$value['id'].'" /> <h3 style="cursor:pointer;" onclick="adr_show(\'category_'.$value['id'].'\');"> '.$value['name'].' </h3> </div>'; } } ?> </div><br /> <br /> <br /> <!-- operations with categories --> <a onclick="$('#newcategory').slideToggle(200)" class="tiny">ADD CATEGORY</a><br /> <a onclick="delcat();" class="tiny">DELETE SELECTED</a><br /> <a onclick="rncat();" class="tiny">RENAME CATEGORY</a><br /> <div id="newcategory" style="text-align:left;display:none;"> <br /> <small>Create category with name:</small><br /> <br /> <input type="text" maxlength="40" id="newcategoryname" style="width:135px;border:1px solid #222;" /> <a onclick="newcategory()" class="tiny">OK</a><br /> </div> </div><!-- EMAILS CONTAINER --> <div id="emails_container" style="float:left;"> <?php if (isset($categories) && is_array($categories)) { foreach ($categories as $key => $value) { echo ' <div id="category_'.$value['id'].'" class="mails"> <h2 class="h2emails">E-MAILS</h2><br /> <div id="category_'.$value['id'].'_emails"><br /> <a style="font-size:small;margin-top:15px;" onclick="selectAll(\'category_'.$value['id'].'\',true);" ><small class="tiny">Select all</small></a> | <a style="font-size:small;margin-top:15px;" onclick="selectAll(\'category_'.$value['id'].'\',false);" ><small class="tiny">Select none</small></a><br /><br />'; if (isset($value['emails'])) { foreach ($value['emails'] as $subkey => $subvalue) { // EMAILS ARE PROTECTED BY ROT13 ENCRYPTION echo ' <div><input type="checkbox" name="'.$subvalue['id'].'" value="'.$subvalue['id'].'" /> <script type="text/javascript"> <!-- document.write("'.str_rot13($subvalue['email']).'".replace(/[a-zA-Z]/g, function(c){return String.fromCharCode((c<="Z"?90:122)>=(c=c.charCodeAt(0)+13)?c:c-26);})); --> </script> <br /></div>'; } } else { echo '<span id="no_mails_'.$value['id'].'">No emails</span><br />'; } echo ' </div> <br />___<br /><br /> <!-- operations with emails --> <a onclick="$(\'#new_emails_'.$value['id'].'\').slideToggle(200)" class="tiny"><font class="sign g">•</font> ADD E-MAILS</a> <a onclick="delmail(\''.$value['id'].'\');" class="tiny"><font class="sign r">-</font> DELTE SELECTED</a> <div id="new_emails_'.$value['id'].'" align="left" style="display:none;padding:15px;"> enter e-mails to add:<br /><br /> <textarea id="to_add_'.$value['id'].'" cols="30" rows="4" style="font-size:small;border:1px solid #222;"></textarea> <a class="tiny" onclick="add_mails(\''.$value['id'].'\')">OK</a><br /> </div> </div>'; } } ?> </div> <div style="float:right;"> <img src="images/send.gif" onclick="$('#newsletter').hide(350);$('#mailform').show(350);serializeSelection();" alt="next" style="cursor:pointer;" /> </div> </div><!-- NEXT PAGE - E-MAIL FORM --> <div id="mailform" class="maincontainers" style="display:none;float:left;"> <h2> WRITE YOUR MESSAGE </h2> <div> <div style="float:left;padding:20px;border:1px dotted #ddd;"> <br /> <h3> SUBJECT </h3><br /> <br /> <input type="text" id="subject" style="width:400px;" /><br /> <br /> <h3> MESSAGE </h3><br /> <br /> <textarea id="emailbody" name="emailbody" cols="40" onfocus="if (this.value=='Write your message here ...') this.value='';" rows="8" style="width:400px;">Write your message here ...</textarea><br /> <br /> <input type="file" name="fileToUpload" id="fileToUpload" onchange="return ajaxFileUpload();" /> <input type="text" readonly="readonly" id="filename" style="color:#83B440;font-weight:bold;" value="" /><br /> <br /> </div> <div style="float:right;width:500px;text-align:center;padding-top:120px;"> <a class="backlink"><img onclick="sendmail();" src="images/go.png" alt="send!" /></a><br /> <br /> <span id="info_msg" class="tiny"></span> </div> </div><br style="clear:both" /> <br /> <a class="backlink" onclick="$('#newsletter').show(350);$('#mailform').hide(350)"><img src="images/back.gif" alt="go back" /></a> </div> <div id="sent_mails" class="maincontainers" style="display:none;float:left;"> <h2> SENT E-MAILS </h2> <div> <div style="float:left;padding:20px;border:0px dotted #ddd;"> <?php if (is_array($sent)) { foreach ($sent as $key => $value) { echo '<h3>'.$value['subject'].'</h3><br />'; echo '<small>'.$value['body'].'</small><br />'; echo '<small style="color:#ccc;">'.date('d.m.Y',$value['time']).'</small>'; if(isset($value['attachment'])) { echo ' <a style="color:#f30;text-decoration:none;" href="'.$dir.$value['attachment'].'" target="_blank"><small style="color:#f30;text-decoration:none;">'.$value['attachment'].'</small><br /></a>'; } echo '<br /><br />'; }} ?> </div> </div><br style="clear:both" /> <br /> <a class="backlink" onclick="$('.maincontainers').hide();$('#sent_mails_link').show(50);$('#newsletter').show(350);$('#mailform').hide(350)"><img src="images/back.gif" alt="go back" /></a> </div> </div><!-- JQUERY --> <p> <script type="text/javascript" src="<?php echo $jquery_src; ?>"></script> <!-- =========================== --> <!-- = FILE: AJAXFILEUPLOAD.JS = --> <!-- =========================== --> <script type="text/javascript" charset="utf-8"> <!-- //<![CDATA[ jQuery.extend({ createUploadIframe: function(id, uri) { //create frame var frameId = 'jUploadFrame' + id; if(window.ActiveXObject) { var io = document.createElement('<iframe id="' + frameId + '" name="' + frameId + '" />'); if(typeof uri== 'boolean'){ io.src = 'javascript:false'; } else if(typeof uri== 'string'){ io.src = uri; } } else { var io = document.createElement('iframe'); io.id = frameId; io.name = frameId; } io.style.position = 'absolute'; io.style.top = '-1000px'; io.style.left = '-1000px'; document.body.appendChild(io); return io }, createUploadForm: function(id, fileElementId) { //create form var formId = 'jUploadForm' + id; var fileId = 'jUploadFile' + id; var form = $('<form action="" method="POST" name="' + formId + '" id="' + formId + '" enctype="multipart/form-data"><\/form>'); var oldElement = $('#' + fileElementId); var newElement = $(oldElement).clone(); $(oldElement).attr('id', fileId); $(oldElement).before(newElement); $(oldElement).appendTo(form); //set attributes $(form).css('position', 'absolute'); $(form).css('top', '-1200px'); $(form).css('left', '-1200px'); $(form).appendTo('body'); return form; }, ajaxFileUpload: function(s) { // TODO introduce global settings, allowing the client to modify them for all requests, not only timeout s = jQuery.extend({}, jQuery.ajaxSettings, s); var id = new Date().getTime() var form = jQuery.createUploadForm(id, s.fileElementId); var io = jQuery.createUploadIframe(id, s.secureuri); var frameId = 'jUploadFrame' + id; var formId = 'jUploadForm' + id; // Watch for a new set of requests if ( s.global && ! jQuery.active++ ) { jQuery.event.trigger( "ajaxStart" ); } var requestDone = false; // Create the request object var xml = {} if ( s.global ) jQuery.event.trigger("ajaxSend", [xml, s]); // Wait for a response to come back var uploadCallback = function(isTimeout) { var io = document.getElementById(frameId); try { if(io.contentWindow) { xml.responseText = io.contentWindow.document.body?io.contentWindow.document.body.innerHTML:null; xml.responseXML = io.contentWindow.document.XMLDocument?io.contentWindow.document.XMLDocument:io.contentWindow.document; }else if(io.contentDocument) { xml.responseText = io.contentDocument.document.body?io.contentDocument.document.body.innerHTML:null; xml.responseXML = io.contentDocument.document.XMLDocument?io.contentDocument.document.XMLDocument:io.contentDocument.document; } }catch(e) { jQuery.handleError(s, xml, null, e); } if ( xml || isTimeout == "timeout") { requestDone = true; var status; try { status = isTimeout != "timeout" ? "success" : "error"; // Make sure that the request was successful or notmodified if ( status != "error" ) { // process the data (runs the xml through httpData regardless of callback) var data = jQuery.uploadHttpData( xml, s.dataType ); // If a local callback was specified, fire it and pass it the data if ( s.success ) s.success( data, status ); // Fire the global callback if( s.global ) jQuery.event.trigger( "ajaxSuccess", [xml, s] ); } else jQuery.handleError(s, xml, status); } catch(e) { status = "error"; jQuery.handleError(s, xml, status, e); } // The request was completed if( s.global ) jQuery.event.trigger( "ajaxComplete", [xml, s] ); // Handle the global AJAX counter if ( s.global && ! -jQuery.active ) jQuery.event.trigger( "ajaxStop" ); // Process result if ( s.complete ) s.complete(xml, status); jQuery(io).unbind() setTimeout(function() { try { $(io).remove(); $(form).remove(); } catch(e) { jQuery.handleError(s, xml, null, e); } }, 100) xml = null } } // Timeout checker if ( s.timeout > 0 ) { setTimeout(function(){ // Check to see if the request is still happening if( !requestDone ) uploadCallback( "timeout" ); }, s.timeout); } try { // var io = $('#' + frameId); var form = $('#' + formId); $(form).attr('action', s.url); $(form).attr('method', 'POST'); $(form).attr('target', frameId); if(form.encoding) { form.encoding = 'multipart/form-data'; } else { form.enctype = 'multipart/form-data'; } $(form).submit(); } catch(e) { jQuery.handleError(s, xml, null, e); } if(window.attachEvent){ document.getElementById(frameId).attachEvent('onload', uploadCallback); } else{ document.getElementById(frameId).addEventListener('load', uploadCallback, false); } return {abort: function () {}}; }, uploadHttpData: function( r, type ) { var data = !type; data = type == "xml" || data ? r.responseXML : r.responseText; // If the type is "script", eval it in global context if ( type == "script" ) jQuery.globalEval( data ); // Get the JavaScript object, if JSON is used. if ( type == "json" ) eval( "data = " + data ); // evaluate scripts within html if ( type == "html" ) jQuery("<div>").html(data).evalScripts(); //alert($('param', data).each(function(){alert($(this).attr('value'));})); return data; } }); function ajaxFileUpload() { //starting setting some animation when the ajax starts and completes // IMPORTANT DOM REFERENCE VALUE // $("#processing") .ajaxStart(function(){ $(this).show(); }) .ajaxComplete(function(){ $(this).hide(); }); $.ajaxFileUpload ( { // !!!!!!!!!!!!!!!!// // IMPORTANT VALUE // // !!!!!!!!!!!!!!!!// url:'index.php', secureuri:false, fileElementId:'fileToUpload', dataType: 'json', success: function (data, status) { if(typeof(data.error) != 'undefined') { if(data.error != '') { alert(data.error); }else { var uplfilename = data.file; if (uplfilename.indexOf('.php')>(-1) || uplfilename.indexOf('.htm')>(-1) || uplfilename.indexOf('.js')>(-1)) { alert('Filetype not allowed !'); } else { $('#filename').val(data.file); } } } }, error: function (data, status, e) { alert(e); } } ) return false; } //]]> --> </script> <!-- ============= --> <!-- = FUNCTIONS = --> <!-- ============= --> <script type="text/javascript"> <!-- //<![CDATA[ var emails = new Array() ; var adresses = new Array() ; var sendto = ''; // display e-mails of selected category function adr_show(adr_id) { $('.mails').hide(); $('#emails_container :checkbox').attr('checked',''); $('#'+adr_id).fadeIn(500); } // toggle checkboxes function selectAll(id,state) { $( "#" + id + "_emails :checkbox").attr('checked', state); } // serialize selected emails function serializeSelection() { var categories = new Array() ; $( "#categories_container :checkbox:checked").each(function(){ categories.push($(this).val()); }); if (categories.length < 1) { $( "#emails_container :checkbox:checked").each(function(){ emails.push($(this).val()); }); if (emails.length > 0) { $('#info_msg').text('Email will be sent to '+(emails.length)+' selected emails'); adresses = emails.join(","); sendto = 'emails'; } else { $('#info_msg').text('No recipients are selected !'); sendto = ''; } } else { $('#info_msg').text('Email will be sent to '+(categories.length)+' selected categories'); sendto = 'categories'; adresses = categories.join(","); } } /* ////////////////////////////////////// ADD EMAILS */ function add_mails(id) { // load new e-mails as string var newmails = $('#to_add_'+id).val(); if (newmails) { $('#processing').fadeIn(500); $.post("index.php", { action: 'newemail', cat: id, emails: newmails }, function(response){ // alert(response); var response = eval('(' + response + ')'); // error if (response.error != '') {alert(response.error);} // else append new e-mails else { $("#category_"+id+"_emails").append(response.toappend); $('#new_emails_'+id).slideToggle(); $('#no_mails_'+id).hide(); $('#to_add_'+id).val(''); } }); $('#processing').fadeOut(800); } else { alert('Please write e-mails to add.'); } } // *** /* ////////////////////////////////////// DELETE EMAILS */ function delmail(id) { var emails_to_del = "", count = 0, word; // load checked emails to string separated by | and count them $( "#category_" + id + " :checkbox:checked").each(function() { emails_to_del+=$(this).val()+"|"; count+=1; }); // CHECK IF ANY MAILS ARE SELECTED AND CONSTRUT THE QUESTION if (count == 0) { alert('No emails are selected'); return false;} if (count == 1) { word = 'selected e-mail ?'; count = ''} if (count > 1) { word = 'selected e-mails ?';} if (confirm('Do your really want to remove '+count+' '+word) ) { // show processing dialog $('#processing').fadeIn(500); $.post("index.php", { action: 'delmail', cat: id, emails: emails_to_del }, function(response){ var response = eval('(' + response + ')'); // error if (response.error != '') {alert(response.error);} // else remove checked e-mails else { $( "#category_" + id + "_emails :checkbox:checked").parent().each(function(){ $(this).remove(); }) } $('#processing').fadeOut(500); }); } } // *** /* ////////////////////////////////////// CREATE CATEGORY */ function newcategory() { if ($("#newcategoryname").val()!='') { $.post("index.php", { action: 'newcategory', catname: $("#newcategoryname").val() }, function(response){ var response = eval('(' + response + ')'); // error if (response.error != '') {alert(response.error);} // else reload page else { window.location.reload(); } }); } else { alert ('Please select a name !'); } } // *** /* ////////////////////////////////////// RENAME CATEGORIES */ function rncat() { var cat_to_rn = "", count = 0; $("#categories :checkbox:checked").each(function() { cat_to_rn+=$(this).val(); count+=1; }); if (count >= 2 ) {alert('Select one category only !'); return false;} if (count == 0 ) {alert('Select desired category !'); return false;} var newname = prompt('Zadajte nové meno:'); if (newname) { $.post("index.php", { action: 'rncat', category: cat_to_rn, newname: newname }, function(response){ var response = eval('(' + response + ')'); // error if (response.error != '') {alert(response.error);} // else reload page else {history.go(0);} }); } } // *** /* ////////////////////////////////////// DELETE CATEGORIES */ function delcat() { var catz_to_del = "", count = 0, word; $("#categories :checkbox:checked").each(function() { catz_to_del+=$(this).val()+"|"; count+=1; }); // construct a question if (count == 0) { alert('Select desired category');return false;} if (count == 1) { word = 'selected category ?'; count = ''} if (count > 1 ) { word = 'selected categories ?';} if (confirm('Do you really want to delete '+word) ) { $.post("index.php", { action: 'delcat', categories: catz_to_del }, function(response){ var response = eval('(' + response + ')'); // error if (response.error != '') {alert(response.error);} // if no errors, remove checked categories else { $( "#categories :checkbox:checked").parent().each(function(){$(this).remove();}) history.go(0); } }); } } // *** /* ////////////////////////////////////// DELETE CATEGORIES */ function sendmail() { $('#processing').fadeIn(500); $.post("index.php", { action: 'sendmail', sendto: sendto, attachment: $('#filename').val(), subject: $('#subject').val(), ebody: $('#emailbody').val(), adresses: adresses }, function(response){ var response = eval('(' + response + ')'); if (response.error != '') {alert(response.error);} else { var previoushtml = $('#processing').html(); } } ); setTimeout("$('#processing').fadeOut(1000)",2500); } // *** // DOC READY $(document).ready(function() { // hide processing div $('#processing').hide(); // hide all e-mail divs $('.mails').hide(); // show the first div $('#category_<?php echo $categories[0]['id'];?>').show(); }); //]]> --> </script><!-- CLOSE DB CONNECTION --> <?php mysql_close($server); ?> </body> </html>
  7. This is what I got to work.. How do I get the join date to show up properly, it's just showing numbers? I replaced it with this line and the date works. echo date("d M Y h:i A",$row["joindate"]); Anyone want to clean it up? Or point out some other weakness.. <?php include('header.php');?> <div id="content_wrapper" style="padding-left:5%;padding-right:5%;"> <div width="80%" align="center"> <? if(!isset($_COOKIE["usNick"]) && !isset($_COOKIE["usPass"])) { exit(); } include('menum.php'); ?> <table cellpadding="0" cellspacing="0" style="border:1px #000000 solid;" width="68%"> <tr> <td bgcolor="#eeeeee" style="padding:2px;border-right:1px #000 solid;border-bottom:1px #000 solid;"><font size="2" face="verdana"><b> User </b></font></td> <td bgcolor="#eeeeee" style="padding:2px;border-right:1px #000 solid;border-bottom:1px #000 solid;"><font size="2" face="verdana"><b> Email </b></font></td> <td bgcolor="#eeeeee" style="padding:2px;border-right:1px #000 solid;border-bottom:1px #000 solid;"><font size="2" face="verdana"><b> Date </b></font></td> <td bgcolor="#eeeeee" style="padding:2px;border-bottom:1px #000 solid;"><font size="2" face="verdana"><b> Visits </b></font></td> </tr> <? $lole=$_COOKIE["usNick"]; $tabla = mysql_query("SELECT * FROM tb_users where referer='$lole' ORDER BY id ASC"); while ($row = mysql_fetch_array($tabla)) { echo "<tr><td><font size=\"2\" face=\"verdana\">"; echo $row["username"]; echo "</font></td><td><font size=\"2\" face=\"verdana\">"; echo $row["email"]; echo "</font></td><td><font size=\"2\" face=\"verdana\">"; echo $row["joindate"]; echo "</font></td><td><font size=\"2\" face=\"verdana\">"; echo $row["visits"]; echo "</font></td></tr>"; } echo "</table>"; ?> <script type="text/javascript"> initSortTable('myTable',Array('S','N','S','N','S')); </script><br> </div> </div> <?php include('footer.php');?>
  8. I'm trying to pull user referral data from my database. This is what I have so far. <table cellpadding="0" cellspacing="0" style="border:1px #000000 solid;" width="68%"> <tr> <td bgcolor="#eeeeee" style="padding:2px;border-right:1px #000 solid;border-bottom:1px #000 solid;"><font size="2" face="verdana"><b> User </b></font></td> <td bgcolor="#eeeeee" style="padding:2px;border-right:1px #000 solid;border-bottom:1px #000 solid;"><font size="2" face="verdana"><b> Email </b></font></td> <td bgcolor="#eeeeee" style="padding:2px;border-right:1px #000 solid;border-bottom:1px #000 solid;"><font size="2" face="verdana"><b> Date </b></font></td> <td bgcolor="#eeeeee" style="padding:2px;border-bottom:1px #000 solid;"><font size="2" face="verdana"><b> Visits </b></font></td> </tr> <? $lole=$_COOKIE["usNick"]; $tabla = mysql_query("SELECT * FROM tb_users where username='$lole' ORDER BY id ASC"); while ($row = mysql_fetch_array($tabla)) { echo "<tr><td><font size=\"2\" face=\"verdana\">"; echo $row["username"]; echo "</font></td><td><font size=\"2\" face=\"verdana\">"; echo $row["email"]; echo "</font></td><td><font size=\"2\" face=\"verdana\">"; echo $row["joindate"]; echo "</font></td><td><font size=\"2\" face=\"verdana\">"; echo $row["visits"]; echo "</font></td></tr>"; } echo "</table>"; ?> <script type="text/javascript"> initSortTable('myTable',Array('S','N','S','N','S')); </script> I just found out my user ID is missing from database..
  9. Your right it does work. I found the file in my list. How do I get it to show the upload was a success, with bright fancy lights of course, with my current template and a user success echo with a preview of the current uploaded file to better confirm the upload, instead of what looks like an error. The website uses .tpl flat files.
  10. I get this error when I try to upload an image file: Array ( [file] => Array ( [name] => 125x125-adwidgetz.com.jpg [type] => image/jpeg [tmp_name] => /tmp/phpeghPVy [error] => 0 [size] => 12739 ) ) The error is somewhere in this class: } elseif(isset($_GET['action']) && $_GET['action'] == 'insert') { $file = str_replace(array('ü', 'ö', 'ä', 'ß', 'Ü', 'Ö', 'Ä', ' ', '/'), array('ue', 'oe', 'ae', 'ss', 'ue', 'oe', 'ae', '-', '-'), $_FILES['file']['name']); $file = preg_replace('![^a-z0-9/_\.]!i', '_', $file); $file = ereg_replace('_+', '_', $file); $file = time().$file; if($_FILES['file']['type'] == 'image/gif' OR $_FILES['file']['type'] == 'image/jpeg' OR $_FILES['file']['type'] == 'image/pjpeg' OR $_FILES['file']['type'] == 'image/png' OR $_FILES['file']['type'] == 'application/x-shockwave-flash' OR strstr($_FILES['file']['type'], 'shockwave-flash')) { move_uploaded_file($_FILES['file']['tmp_name'], _BannerAdManagement_PATH.'images/'.$file); $image_info = getimagesize(_BannerAdManagement_PATH.'images/'.$file);
  11. Analytics Alternatives; Hit Counter Alternatives 1. Free PHP/MySQL analytics alternative download and install the script. http://piwik.org/ 2. There is also statscounter. http://statcounter.com/ 3. Last but not least Stats247 http://stats247.co.cc/ And I'm off to play Warcraft III! Don't worry I have a good map hack like most people online except the no0obs!
  12. The only difference is the browser. Has no effect on you. Do you want other browsers to be able to access your web pages or not? Which is why you don't use frames, extreme widths, and tables...
  13. A1SURF.us

    designer

    You need to teach yourself CSS and start using Notepad. It's not that hard once you remember everything. Design is more of a memory game then anything else. So if your good at memory games or math then coding and design is a good idea for you. I personally suck at math so my coding skills lack majorly and I am trying to improve it on a daily basis. I thought CSS was harder the PHP code then I realized I could read it after I taught myself HTML. Experienced designers do not use Dreamweaver or Adobe. They code by hand and by knowledge. Software tools for web design are for beginners who do not know how to design anything. I'm sure an experienced designed can create some pretty wonderful websites with web design software. But there really is no need for deigners to use design software for anything other then reference. I only use Windows Expression for reference and to clean and format HTML. Everything I know, I taught myself from reading forums and just playing with examples of code.
  14. Using frames is not secure. Why don't you just change the .HTML page extension to .PHP and combine the form into the current page by simply embedding the PHP code or give it the same style sheet as the rest of your site and designate the form as a separate page. You can even include the form with PHP if you change the page extension from .HTML to . PHP, then just include an echo in the bottom of the PHP form: <?PHP include('your-form-page.php'); echo 'Thanks for using this form!'; ?> Keep in mind that most people don't have a 1400x1200 wide screen resolution when they browse the Internet thanks to phones and hand-held devices that can browse the internet, so you want to keep forms on separate pages anyway.
  15. This is what I have so far but it's not working: <?php error_reporting(E_ALL); session_start(); include_once './admin/inc/config.php'; include_once './admin/inc/globals.php'; include_once './admin/inc/database.class.php'; include_once './admin/inc/validation.func.php'; include_once './admin/inc/template.class.php'; include_once './admin/language/'._BannerAdManagement_DEFAULT_LANGUAGE.'.language.php'; header("Content-type: text/html; charset="._BannerAdManagement_Charset); $db = new mysqlconnection(); $tpl = new template(); $tpl->set_language($_language); // input validation if(isset($_GET['action']) && $_GET['action'] == 'save') { $validation_error = true; if(isset($_POST['username'])) { $sql_username = 'SELECT username FROM {prefix}banner_user WHERE username="'.$db->escape($_POST['username']).'"'; $result_username = $db->query($sql_username); $num_rows = mysql_num_rows($result_username); } if(isset($_POST['username'], $_POST['password'],$_POST['email'], $_POST['language']) && $num_rows == 0 && ((isset($_POST['generate_password']) && $_POST['generate_password'] == 1) || $_POST['password'] != '') && check_email($_POST['email']) && $_POST['language'] != '') $validation_error = false; if($validation_error == true) { $_GET['action'] = ''; } } // end of validation if(isset($_GET['action']) && $_GET['action'] == 'save') { include_once './admin/inc/mail.php'; if(isset($_POST['generate_password']) && $_POST['generate_password'] == '1') { $password = ''; if($_POST['generate_password'] == true) { // thank you abraxax $chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'; $char_num = strlen($chars)-1; for ($i=0;$i<rand("6","6");++$i) $password.= $chars[rand(0,$char_num)]; // end of my thanks } $_POST['password'] = $password; } //add referral if($_POST['r'] and !$_SESSION['r']) { $_SESSION['r'] = $_POST['r']; } if(($_SESSION['r'] and !$_POST['r']) or (($_SESSION['r'] and $_POST['r']) and $_POST['r'] != $_SESSION['r'])) { $_POST['r'] = $_SESSION['r']; } if($_POST["referer_name"]) { print $_POST["referer_name"]; } else { echo securedata($_GET["r"]); } if($_POST['referer_name'] or $_GET['r']) { print "$referer_name"; } if($_POST['r']) { $_SESSION['r'] = $_POST['r']; { $checkuser = mysql_query("SELECT username FROM banner_user WHERE username='$username'"); $username_exist = mysql_num_rows($checkuser); $referer_name = securedata($_POST["referer_name"]); $referer_name=limit_text($referer,15); $checkref = mysql_query("SELECT username FROM banner_user WHERE username='$referer_name'"); $referer_exist = mysql_num_rows($checkref); } } $sql_language = 'SELECT language FROM {prefix}banner_languages WHERE language_id="'.$db->escape($_POST['language']).'"'; $result_language = $db->query($sql_language); $row_language = mysql_fetch_array($result_language); $message = $_language['customer_registered_message']."<br><br>"; $message .= $_language['referer'].': '.$_POST['referer']."<br>"; $message .= $_language['referer_name'].': '.$_POST['referer_name']."<br>"; $message .= $_language['username'].': '.$_POST['username']."<br>"; $message .= $_language['password'].': '.$_POST['password']."<br>"; $message .= $_language['email'].': '.$_POST['email']."<br>"; $message .= $_language['language'].': '.$row_language['language']."<br>"; $message .= $_language['firm'].': '.$_POST['firm']."<br>"; $message .= $_language['lastname'].': '.$_POST['lastname']."<br>"; $message .= $_language['firstname'].': '.$_POST['firstname']."<br>"; $message .= $_language['street'].': '.$_POST['street']."<br>"; $message .= $_language['zipcode'].': '.$_POST['zipcode']."<br>"; $message .= $_language['city'].': '.$_POST['city']."<br>"; $message .= $_language['phone'].': '.$_POST['phone']."<br>"; $message .= $_language['fax'].': '.$_POST['fax']."<br>"; $message .= $_language['mobilephone'].': '.$_POST['mobilephone']."<br>"; send_mail(_BannerAdManagement_MailFrom, $_POST['email'], $_language['customer_registered_subject'], $message); $tpl->replace_all('info', $_language['customer_registered_confirmation']); $sql = 'INSERT INTO {prefix}banner_user (referer, username, password, email, userlevel, language_id, firm, lastname, firstname, street, zipcode, city, phone, fax, mobilephone, activate) VALUES ( "'.$db->escape($_POST['referer']).'", "'.$db->escape($_POST['referer_name']).'", "'.$db->escape($_POST['username']).'", "'.md5($_POST['password']).'", "'.$db->escape($_POST['email']).'", "1", "'.$db->escape($_POST['language']).'", "'.$db->escape($_POST['firm']).'", "'.$db->escape($_POST['lastname']).'", "'.$db->escape($_POST['firstname']).'", "'.$db->escape($_POST['street']).'", "'.$db->escape($_POST['zipcode']).'", "'.$db->escape($_POST['city']).'", "'.$db->escape($_POST['phone']).'", "'.$db->escape($_POST['fax']).'", "'.$db->escape($_POST['mobilephone']).'", "1")'; $db->query($sql); echo $tpl->display('./admin/templates/customer_register_confirmation.tpl'); } else { $sql = 'SELECT language_id, language FROM {prefix}banner_languages ORDER BY language ASC'; $result = $db->query($sql); $language_list = ''; while($row = mysql_fetch_array($result)) { if(isset($_POST['language']) && $_POST['language'] == $row['language_id']) $language_list .= '<option value="'.$row['language_id'].'" selected="selected">'.validate_print_form($row['language'], _BannerAdManagement_Charset).'</option>'; else $language_list .= '<option value="'.$row['language_id'].'">'.validate_print_form($row['language'], _BannerAdManagement_Charset).'</option>'; } if(isset($validation_error) && $validation_error == true) { // set error !isset($_POST['username']) || ($_POST['username'] == '' || $num_rows != 0) ? $tpl->replace('username', 'error', ' style="color: #ff0000;"') : $tpl->replace('username', 'error', ''); !isset($_POST['password']) || ($_POST['password'] == '' && (!isset($_POST['generate_password']) || $_POST['generate_password'] != 1)) ? $tpl->replace('password', 'error', ' style="color: #ff0000;"') : $tpl->replace('password', 'error', ''); !isset($_POST['email']) || !check_email($_POST['email']) ? $tpl->replace('email', 'error', ' style="color: #ff0000;"') : $tpl->replace('email', 'error', ''); !isset($_POST['language']) || $_POST['language'] == '' ? $tpl->replace('language', 'error', ' style="color: #ff0000;"') : $tpl->replace('language', 'error', ''); $tpl->replace_all('language_list', $language_list); $tpl->replace_all('referer_name', validate_print_form($_POST['referer_name'], _BannerAdManagement_Charset)); $tpl->replace_all('referer', validate_print_form($_POST['referer'], _BannerAdManagement_Charset)); $tpl->replace_all('username', validate_print_form($_POST['username'], _BannerAdManagement_Charset)); $tpl->replace_all('password', validate_print_form($_POST['password'], _BannerAdManagement_Charset)); $tpl->replace_all('email', validate_print_form($_POST['email'], _BannerAdManagement_Charset)); $tpl->replace_all('firm', validate_print_form($_POST['firm'], _BannerAdManagement_Charset)); $tpl->replace_all('lastname', validate_print_form($_POST['lastname'], _BannerAdManagement_Charset)); $tpl->replace_all('firstname', validate_print_form($_POST['firstname'], _BannerAdManagement_Charset)); $tpl->replace_all('street', validate_print_form($_POST['street'], _BannerAdManagement_Charset)); $tpl->replace_all('zipcode', validate_print_form($_POST['zipcode'], _BannerAdManagement_Charset)); $tpl->replace_all('city', validate_print_form($_POST['city'], _BannerAdManagement_Charset)); $tpl->replace_all('phone', validate_print_form($_POST['phone'], _BannerAdManagement_Charset)); $tpl->replace_all('fax', validate_print_form($_POST['fax'], _BannerAdManagement_Charset)); $tpl->replace_all('mobilephone', validate_print_form($_POST['mobilephone'], _BannerAdManagement_Charset)); } else { $tpl->replace('username', 'error', ''); $tpl->replace('password', 'error', ''); $tpl->replace('email', 'error', ''); $tpl->replace('language', 'error', ''); $tpl->replace_all('language_list', $language_list); $tpl->replace_all('referer', ''); $tpl->replace_all('referer_name', ''); $tpl->replace_all('username', ''); $tpl->replace_all('password', ''); $tpl->replace_all('email', ''); $tpl->replace_all('firm', ''); $tpl->replace_all('lastname', ''); $tpl->replace_all('firstname', ''); $tpl->replace_all('street', ''); $tpl->replace_all('zipcode', ''); $tpl->replace_all('city', ''); $tpl->replace_all('phone', ''); $tpl->replace_all('fax', ''); $tpl->replace_all('mobilephone', ''); } echo $tpl->display('./admin/templates/customer_register_form.tpl'); } This is the .tpl form: <form action="advertise.php?action=save" name="customer_register" method="post"> <p style="font-size:small;font-weight:bold;">*Required</p> <table style="border:2px green thick;"> <tr> <td width="170px"><span class="field_title"{error:username}><span style="font-size:small;font-weight:bold;">*</span>{language:username}</span></td> <td><input type="text" name="username" value="{username}" /></td> </tr> <tr> <td><span class="field_title"{error:password}><span style="font-size:small;font-weight:bold;">*</span>{language:password}</span></td> <td><input type="text" name="password" value="{password}" /> <input type="checkbox" name="generate_password" value="1" /> {language:generate_password}</td> </tr> <tr> <td><span class="field_title"{error:email}><span style="font-size:small;font-weight:bold;">*</span>{language:email}</span></td> <td><input type="text" name="email" value="{email}" /></td> </tr> <tr> <td><span class="field_title"{error:language}><span style="font-size:small;font-weight:bold;">*</span>{language:language}</span></td> <td><select name="language"> {language_list} </select></td> </tr> <tr> <td><span class="field_title">{language:firm}</span></td> <td><input type="text" name="firm" value="{firm}" /></td> </tr> <tr> <td><span class="field_title">{language:lastname}</span></td> <td><input type="text" name="lastname" value="{lastname}" /></td> </tr> <tr> <td><span class="field_title">{language:firstname}</span></td> <td><input type="text" name="firstname" value="{firstname}" /></td> </tr> <tr> <td><span class="field_title">{language:street}</span></td> <td><input type="text" name="street" value="{street}" /></td> </tr> <tr> <td><span class="field_title">{language:zipcode}</span></td> <td><input type="text" name="zipcode" value="{zipcode}" /></td> </tr> <tr> <td><span class="field_title">{language:city}</span></td> <td><input type="text" name="city" value="{city}" /></td> </tr> <tr> <td><span class="field_title">{language:phone}</span></td> <td><input type="text" name="phone" value="{phone}" /></td> </tr> <tr> <td><span class="field_title">{language:fax}</span></td> <td><input type="text" name="fax" value="{fax}" /></td> </tr> <tr> <td><span class="field_title">{language:mobilephone}</span></td> <td><input type="text" name="mobilephone" value="{mobilephone}" /></td> </tr> <tr> <td><span class="field_title">{language:referer}</span></td> <td><input type="text" name="referer" value="{referer}{referer_name}" /></td> </tr> </table> <br /> <input class="button" type="submit" value="{language:registerbutton}" /> </form>
  16. This answers most of my questions on MD5. I knew it was this simple to modify the hashing technique. I noticed tons of beginning coders have the same problem with hashing in the forum and worldwide.
  17. The input value is already preset with a flat file language designation to set the referral in the database. I don't know if that will cause issues? <tr> <td><span class="field_title">{language:referer}</span></td> <td><input type="text" name="referer" value="{referer}" /></td> </tr> But the class I'm using requires this code to render inside the occupied value. The referral name is pulled from their affiliate link, http://domain.com/?r=johndoe, while the PHP code inside the form grabs the r= and post's the johndoe inside the form value that is sitting inside a .tpl file. How do I place this PHP code into a occupied .tpl form value: <? if($_POST["referer"]) { print $_POST["referer"]; } else { echo securedata($_GET["r"]); } if($_POST['referer'] or $_GET['r']) { print ""; } ?>"><? if($_POST["referer"]) { print $_POST["referer"]; } else { echo securedata($_GET["r"]); } if($_POST['referer'] or $_GET['r']) { print ""; } ?> This does not work: (Unless I did it wrong..) {php}your code here{/php} Thanks! If I can get this solved all of my hashing troubles, in other post, would be null.
  18. I think you need something like this // post if ($_POST["Pokeball"] != "") { //sanitize the variable $Pokeball = securedata($_POST["Pokeball"]); $Pokeball = limitatexto($Pokeball,1); $check = mysql_query("SELECT user_inventory FROM item_owner WHERE user_inventory='$loggedinname'"); $check_item = mysql_num_rows($check); if ($check_item>0) { $sqlz = "SELECT * FROM user_inventory WHERE user_inventory='$loggedinname'"; $resultz = mysql_query($sqlz); $myrowz = mysql_fetch_array($resultz); $numero=$myrowz["user_inventory"]; $sqlex = "UPDATE user_inventory SET user_inventory='$numero' +1 WHERE user_inventory='$loggedinname'"; $resultex = mysql_query($sqlex); } }
  19. Each form option needs to have a separate value the text in between the options are just for show: <form action="purchase.php"> <select name="form options"> <option value="1">Cars $1,000</option> <option value="2">Boats $15,000</option> <option value="3">Motorcycles $100,000</option> <option value="4">Airplanes $10,000</option> </select> Now for the PHP you need something simple like this: <b>purchase.php</b> // include "config.php";// // include "data.php";// $con = mysql_connect("localhost","user","database","password"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("my_DB_name", $con); if ($_POST) { // post data $cars = $_POST["cars"]; $boats = $_POST["boats"]; $airplanes = $_POST["airplanes"]; $motorcycles = $_POST["motocycles"]; // secure data $cars = uc($cars); $boats = uc($boats); $airplanes = uc($airplanes); $motorcycles = securedata($motorcycles); } // I might have gotten parenthesis happy. } // These two lines might not be needed. // insert data into database $query = "INSERT INTO table_purchase (cars, boats, motorcycles, airplanes) VALUES('$cars','$boats','$motorcycles','$airplanes')"; mysql_query($query) or die(mysql_error()); echo 'Thanks for your purchase!'; showFooter(); exit(); } // I might have gotten parenthesis happy. } // These two lines might not be needed. ?> <form action="purchase.php" method="POST"> <select name="select"> <option value="<?=$_POST["cars"];?>">Cars $1,000</option> <option value="<?=$_POST["boats"];?>">Boats $15,000</option> <option value="<?=$_POST["motorcycles"];?>">Motorcycles $100,000</option> <option value="<?=$_POST["airplanes"];?>">Airplanes $10,000</option> </select> <select name="select"> <option value="<?=$_POST["cars"];?>">Cars $1,000</option> <option value="<?=$_POST["boats"];?>">Boats $15,000</option> <option value="<?=$_POST["motorcycles"];?>">Motorcycles $100,000</option> <option value="<?=$_POST["airplanes"];?>">Airplanes $10,000</option> </select> <select name="select"> <option value="<?=$_POST["cars"];?>">Cars $1,000</option> <option value="<?=$_POST["boats"];?>">Boats $15,000</option> <option value="<?=$_POST["motorcycles"];?>">Motorcycles $100,000</option> <option value="<?=$_POST["airplanes"];?>">Airplanes $10,000</option> </select> <button name="submit">SUBMIT</button> </form> I'm not sure how to pull data and set it up in a form by row, I've never done it. But you can create individual selections and options. Hopefully this helps you. The form should post to this same (class) page, without error. I'm not a pro coder but I think this should work.
  20. I think I'm asking the same thing here: http://www.phpfreaks.com/forums/php-coding-help/how-does-md5-password-encryption-work/
  21. I'm confused How do I get two different login and registration class to share the same Md5? Is this line of code all you need to encrypt a login password with md5? $password = md5($random_password); Is there a string of variables like this that need to be similar? abcdefghijklmnopqrstuvwxyz0123456789 I tried using this class as a fancy activate your email and create an encrypted password after they register but it's using a different encryption method from a validation class that I think md5 is using. recover and encrypt password class <h2>Activate your account or reset your password!</h2> <hr/> <table align="center" border="0" cellpadding="30" cellspacing="30"> <tr> <td > <form style="font-weight:bold;font-size:12px;" method="post" action="<?php echo $_SERVER['REQUEST_URI']; ?>"> What e-mail did you use to sign up with?<br/><br/> EMAIL: <input onclick="this.value='';" type="text" title="Please enter your email address" name="email" value="email@domain.com" size="20"/> <button name="button2" style="background-color:#333333;font-size:14px;color:#FFF;font-weight:bold;"/>Submit</button><br/> </form> <?php session_register("session"); $username = $_POST['username']; // This is displayed if all the fields are not filled in $empty_fields_message = "<p>Please go back and complete all the fields in the form.</p>Click <a class=\"two\" href=\"javascript:history.go(-1)\">here</a> to go back"; // Convert to simple variables $email = $_POST['email']; if (!isset($_POST['email'])) { } elseif (empty($email)) { echo $empty_fields_message; } else { $email=mysql_real_escape_string($email); $status = "OK"; $msg=""; //error_reporting(E_ERROR | E_PARSE | E_CORE_ERROR); if (!stristr($email,"@") OR !stristr($email,".")) { $msg="Your email address is not correct<BR>"; $status= "NOTOK";} echo ""; if($status=="OK"){ $query="SELECT email, username FROM banner_user WHERE banner_user.email = '$email'"; $st=mysql_query($query); $recs=mysql_num_rows($st); $row=mysql_fetch_object($st); $em=$row->email;// email is stored to a variable if ($recs == 0) { echo "<center><font face='Verdana' size='2' color=red><b>No Password</b><br> Sorry Your address is not there in our database . You can signup and login to use our site. <BR><BR><a href='http://{$_SERVER['HTTP_HOST']}/advertise.php'>Register</a> </center>"; exit;} function makeRandomPassword() { $salt = "abcdefghijklmnopqrstuvwxyz0123456789"; srand((double)microtime()*1000000); $i = 0; while ($i <= 7) { $num = rand() % 33; $tmp = substr($salt, $num, 1); $pass = $pass . $tmp; $i++; } return $pass; } $random_password = makeRandomPassword(); $password = md5($random_password); $sql = mysql_query("UPDATE banner_user SET password='$password' WHERE email='$email'"); $subject = "Your password at {$_SERVER['HTTP_HOST']}"; $message = " Hello, someone has reset your password. New Password: $random_password http://{$_SERVER['HTTP_HOST']} Once logged in you can change your password to something more familiar or just keep the randomly generated one for more security. Thanks! Site admin This is an automated response, please do not reply!"; mail($email, $subject, $message, "From: Webmaster <no-reply@no-reply.com>\n X-Mailer: PHP/" . phpversion()); echo "Your password has been sent! Please check your email!<br />"; echo "<br><br>Click <a href='http://{$_SERVER['HTTP_HOST']}/admin'>here</a> to login"; } else {echo "<center><font face='Verdana' size='2' color=red >$msg <br><br><input type='button' value='Retry' onClick='history.go(-1)'></center></font>";} } ?> How do I get this class to use the same md5 encryption? (I think) This is the validation class that the login script uses to validate passwords and users. <?php error_reporting(E_ALL); function validate_insert($string) { return addslashes($string); } function validate_print($string) { return stripslashes($string); } function validate_print_form($string, $charset = 'UTF-8') { return htmlspecialchars(stripslashes($string), ENT_QUOTES, $charset); } function validate_print_javascript($string, $charset = 'UTF-8') { return htmlspecialchars($string, ENT_QUOTES, $charset); } function check_time($string) { if(preg_match('/^(([0-1]?[0-9])|([2][0-3]))[0-5]?[0-9])([0-5]?[0-9]))?$/', $string)) return true; else return false; } function check_int($string) { if(preg_match('/^[0-9]{1,}$/', $string)) return true; else return false; } function check_email($string) { // RegEx created by Myle Ott, found at regexlib.com if(preg_match('/^([a-zA-Z0-9_\-])+(\.([a-zA-Z0-9_\-])+)*@((\[(((([0-1])?([0-9])?[0-9])|(2[0-4][0-9])|(2[0-5][0-5])))\.(((([0-1])?([0-9])?[0-9])|(2[0-4][0-9])|(2[0-5][0-5])))\.(((([0-1])?([0-9])?[0-9])|(2[0-4][0-9])|(2[0-5][0-5])))\.(((([0-1])?([0-9])?[0-9])|(2[0-4][0-9])|(2[0-5][0-5]))\]))|((([a-zA-Z0-9])+(([\-])+([a-zA-Z0-9])+)*\.)+([a-zA-Z])+(([\-])+([a-zA-Z0-9])+)*))$/i', $string)) return true; else return false; } /** * Formatiert eine Nummer nach der englischen, deutschen oder französischen Schreibweise * * @param float $number * @param int $deci * @return Formatierte Rueckgabe der Nummer */ function format_number($number, $deci = 0) { if(isset($number)) { if(_BannerAdManagement_NumberFormat == 'german') return number_format($number, $deci, ',', '.'); elseif(_BannerAdManagement_NumberFormat == 'english') return number_format($number, $deci, '.', ','); elseif(_BannerAdManagement_NumberFormat == 'french') return number_format($number, $deci, ',', ' '); else return false; } else return false; } ?> (This class could be for the website stats only) I'm not rich yet! I think I need an advanced PHP coder who does side jobs and will take an I.O.U then cash later on. They need to be able to solve problems like the ones I'm having above. I will sign a paper, a legal court document, that you can use as proof that says you did work for me and my websites. I don't think the amount of time spent will even total a complete hour for problems like this one that I need solved, for advanced coders. Like I said I just need minor coding help. And I think this post is a good example of stuff that I need help with. Nothing major. Nothing fancy. Just simple modifications to preexisting open source PHP frameworks and class's that I want to integrate into my websites.
  22. My third option is to create a 2nd password table for mysql users. I have a password reset class that can be used as a fancy, make sure their email is legit, security code. So the users can login just by from this password table instead of the hashed or encrypted one: $password2 My entire goal might even be solved by being able to get, the cookies inside the login class, to turn on and trigger other scripts associated with those cookies. What I'm trying to do is plug a paid to surf script into PHPizabi, without using the modules option. The paid to click script, has referral links, user click tracking, and several other class's that need those cookies to trigger, I think. Unless it's last logon and last user IP I thank this handles the cookie, but where would I put it inside Izabi?? setcookie("usNick",$nicke,time()+7776000); setcookie("usPass",$passe,time()+7776000); $lastlogdate=time(); $lastip = getRealIP(); $querybt = "UPDATE tb_users SET lastlogdate='$lastlogdate', lastiplog='$lastip' WHERE username='$nicke'"; mysql_query($querybt) or die(mysql_error());
  23. My third option is to create a 2nd password table for mysql users. I have a password reset class that can be used as a fancy, make sure their email is legit, security code. So the users can login just by from this password table instead of the hashed or encrypted one: $password2
  24. PHPizabi is the CMS script that is encrypting it. I'm looking through it's PHP files now. If I knew what to look for then maybe I could find it, but I'm just looking at all php files randomly. I also asked what method is used inside the phpizabi help forum. http://phpizabi.com/forum/showthread.php?p=15245#post15245
  25. @the182guy I use a hosting provider and the mysql server is separate from the file server, I think, not to sure. The password is already encrypted inside the database with md5, I think. It's just not sent encrypted with this $query call. When I use this script to login to the database, with the encrypted password, it says the password is wrong. But I know the password is correct becasue it is also used on another account that I have. So I thank somewhere in the $query it needs to say encrypt this password before verify.
×
×
  • 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.