Jump to content

dsp77

Members
  • Posts

    143
  • Joined

  • Last visited

Everything posted by dsp77

  1. Hello, what i try to accomplish is to force the bigger picture(726px) to go/hide under the div(500px) but display the first 500px. Any advise? <div style="width:500px;"><a href="#"><img width="726" height="199" src="images/pic1.jpg"></a></div>
  2. @MrAdam there will be around 100-150 accounts per day @ManiacDan i need them in this way because another program connects to the mysql and it needs the data to be stored in a single table for analysis.
  3. to be more clear ill create the table with 500 empty cols id=>primary auto increment INT(11), data1 ......... data500=>varchar(255). The query's will be like: insert into table data1....data500 update based on id and select based on id that's all no joins or other complex query's
  4. i'm not using indexes i have just one id primary auto increment and the rest its just data
  5. Hello, I'm working with an application that needs to create around 500 columns in a table. My question is what will happen when some dozen people will select/insert into the table, does it affects performance (the server has big amount of resources 6core 5gigs ram and the mysql version is 5.0.90), does it crash. I know that the limit is 4096 according to mysql documentation. I know this isn't a practical solution but there is another app (that i cannot modify) witch requires to read the table with all columns. Thank you
  6. Hello, i'm using a custom cms in aspx and i need to implement a slider but the dollar sign gets filtered from all 3 "$." remaining the dot ".". I cannot do nothing to the asp script because i cannot modify it the only solution i found is to rewrite the code so here the javascript code using jquery: <script type="text/javascript"> /* * FeatureList - simple and easy creation of an interactive "Featured Items" widget * Examples and documentation at: http://jqueryglobe.com/article/feature_list/ * Version: 1.0.0 (01/09/2009) * Copyright (c) 2009 jQueryGlobe * Licensed under the MIT License: http://en.wikipedia.org/wiki/MIT_License * Requires: jQuery v1.3+ */ ;(function($) { $.fn.featureList = function(options) { var tabs = $(this); var output = $(options.output); new jQuery.featureList(tabs, output, options); return this; }; $.featureList = function(tabs, output, options) { function slide(nr) { if (typeof nr == "undefined") { nr = visible_item + 1; nr = nr >= total_items ? 0 : nr; } tabs.removeClass('current').filter(":eq(" + nr + ")").addClass('current'); output.stop(true, true).filter(":visible").fadeOut(); output.filter(":eq(" + nr + ")").fadeIn(function() { visible_item = nr; }); } var options = options || {}; var total_items = tabs.length; var visible_item = options.start_item || 0; options.pause_on_hover = options.pause_on_hover || true; options.transition_interval = options.transition_interval || 5000; output.hide().eq( visible_item ).show(); tabs.eq( visible_item ).addClass('current'); tabs.click(function() { if ($(this).hasClass('current')) { return false; } slide( tabs.index( this) ); }); if (options.transition_interval > 0) { var timer = setInterval(function () { slide(); }, options.transition_interval); if (options.pause_on_hover) { tabs.mouseenter(function() { clearInterval( timer ); }).mouseleave(function() { clearInterval( timer ); timer = setInterval(function () { slide(); }, options.transition_interval); }); } } }; })(jQuery); </script> <script language="javascript"> $(document).ready(function() { $.featureList( $("#tabs li a"), $("#output li"), { start_item : 1 } ); /* // Alternative $('#tabs li a').featureList({ output : '#output li', start_item : 1 }); */ }); </script> Thank you in advance.
  7. Hello, i want to reproduce a content switcher based on drop-down menu (example: http://www.infocercetare.ro/index.php) anyone can help me with the logic of the function the rest i think i can handle. best regards
  8. It works with your last suggestion even both are jquery. Thanks a lot
  9. Hello, I have 2 java scripts that don't work together i tried to combine them but no success the first script is for the menu: <script type = "text/javascript" > var $jq = jQuery.noConflict(); $jq(document).ready(function() { // default behavior $jq(".blink").cyclicFade(); $jq("#blink2").cyclicFade({ repeat: 0, params: [ {fadeout:100, stayout:300, opout:0, fadein:100, stayin:3000, opin:0.5}, {fadeout:100, stayout:300, opout:0, fadein:100, stayin:300, opin:0.75}, {fadeout:100, stayout:300, opout:0, fadein:100, stayin:300, opin:1.0} ] }); $jq("#blink3").cyclicFade({ repeat: 4, params: [ {fadeout:2000, stayout:300, opout:0, fadein:2000, stayin:300, opin:1.0} ] }); }); </script> and the second is for a image slider: <script type="text/javascript"> $(window).load(function(){ var options = { delay: 3000, type:['fade','columnflyin','rowgrowin','blockshrink','columndropin','rowslideleft','blockgrow','columnfade','blockrandomin','rowthin','blockdrop','columnrandom','rowrandom','blockflyout','columnthin','blockdropin'], controls:'.controls.first_example', next:'.next', prev:'.prev' }; $('.container.first_example').svUltimateSlider(options); }); </script> Any advise to make them work together?
  10. Hello, I'm working on a project and at some point ill need to save user specific settings ex: show/hide email etc... configuration file is not the case i thin because there are specific to every user, database will be the choice but what practice(logic) is the best to save these settings? Thank you!
  11. Hello, I'm using 2 java scripts that use function init() {} and they don't work together, i'm not that good on js please advise me how to make them work together. There are the scripts: window.onload = init; var interval; function init() { interval = setInterval(trackLogin,1000); } function trackLogin() { var xmlReq = false; try { xmlReq = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { xmlReq = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e2) { xmlReq = false; } } if (!xmlReq && typeof XMLHttpRequest != 'undefined') { xmlReq = new XMLHttpRequest(); } xmlReq.open('get', 'check.php', true); xmlReq.setRequestHeader("Connection", "close"); xmlReq.send(null); xmlReq.onreadystatechange = function(){ if(xmlReq.readyState == 4 && xmlReq.status==200) { if(xmlReq.responseText == 1) { clearInterval(interval); alert('You have been logged out due to inactivity. You will now be redirected to home page.'); document.location.href = "index.php"; } } } } and var clip = null; function init() { // setup single ZeroClipboard object for all our elements clip = new ZeroClipboard.Client(); clip.setHandCursor( true ); clip.addEventListener( 'complete', function(client, text) { alert("The password is now copied to your clipboard."); } ); // assign a common mouseover function for all elements using jQuery $('div.multiple').mouseover( function() { // set the clip text to our innerHTML clip.setText( this.innerHTML ); // reposition the movie over our element // or create it if this is the first time if (clip.div) { clip.receiveEvent('mouseout', null); clip.reposition(this); } else clip.glue(this); // gotta force these events due to the Flash movie // moving all around. This insures the CSS effects // are properly updated. clip.receiveEvent('mouseover', null); } ); }
  12. in fact i need to clean the password because i insert it into the log file and the script can be vulnerable.
  13. the password stored in logs was not intended i just copied the line and forgot 2 remove it, now i have it like this $query_login_ok = "INSERT INTO logs (`username`, `password`, `result`, `ip`) VALUES ('$username', '*******', 'SUCCESS', '$ip');"; i changed the if (isset($_POST['submit'])) {} to if($_SERVER['REQUEST_METHOD'] == 'POST') Thank you for the help guys, i'm happy now because my script is secure
  14. Thank you for the answers. I forgot to remove the $password from succes login. Removed the clean from password you're right there is no need 2 clean. why is bad using if (isset($_POST['submit'])) {} i replaced the function clean with: function clean($str) { $str = @trim($str); if(get_magic_quotes_gpc()) { $str = stripslashes($str); } return mysql_real_escape_string($str); }
  15. Hello, I made an login script, it works but i want to be sure if its secure to use in everyday use, here is the script: <?php session_start(); require_once('include/config.inc.php'); require_once('include/functions.php'); function clean($str, $encode_ent = false) { $str = @trim($str); if ($encode_ent) { $str = htmlentities($str); } if (version_compare(phpversion(),'4.3.0') >= 0) { if (get_magic_quotes_gpc()) { $str = stripslashes($str); } if (@mysql_ping()) { $str = mysql_real_escape_string($str); } else { $str = addslashes($str); } } else { if (!get_magic_quotes_gpc()) { $str = addslashes($str); } } return $str; } if (isset($_POST['submit'])) { if ($_POST['code'] == $_SESSION['rand_code']) { //Sanitize the POST values $username = clean($_POST['username']); $password = clean($_POST['password']); $ip = clean($_SERVER['REMOTE_ADDR']); $query="SELECT * FROM user WHERE username='$username' AND password='".md5($_POST['password'])."'"; $result=mysql_query($query); //Check whether the query was successful or not if ($result) { if (mysql_num_rows($result) == 1) { //Login Successful session_regenerate_id(); $user = mysql_fetch_assoc($result); $_SESSION['SESS_MEMBER_ID'] = $user['username']; session_write_close(); $query_login_ok = "INSERT INTO logs (`username`, `password`, `result`, `ip`) VALUES ('$username', '$password', 'SUCCESS', '$ip');"; $result_query_login_ok = mysql_query($query_login_ok) or die('MYSQL ERROR'); header("location: pmt.php"); exit(); } else { //Login failed $query_login_fail = "INSERT INTO logs (`username`, `password`, `result`, `ip`) VALUES ('$username', '$password', 'FAILED', '$ip');"; $result_query_login_fail = mysql_query($query_login_fail) or die('MYSQL ERROR'); header("location: index.php"); exit(); } } else { die("ERROR"); } } } ?> <form id="login" name="login" method="post" action=""> <table width="300" border="0" align="center" cellpadding="2" cellspacing="0"> <tr> <td width="112"><b>Username</b></td> <td width="188"><input name="username" type="text" class="textfield" id="username" value="admin" /></td> </tr> <tr> <td><b>Password</b></td> <td><input name="password" type="password" class="textfield" id="password" value="qazwsx" /></td> </tr> <img src="include/captcha.php"/> <tr> <td><b>Code</b></td> <td><input type="text" name="code" /></td> </tr> <tr> <td> </td> <td><input type="submit" name="submit" value="Login" /></td> </tr> </table> </form>
  16. the error is generated inside the code you provided function getLinks($url,&$links) { // do the lookup and extract the link // if (FOUND_LINK == INTERNAL) { //at the line below getLinks(FOUND_LINK,$links); } else { $links[] = FOUND_LINK; } }
  17. thanks for the advise, i tried but still not working (Cannot redeclare getlinks() (previously declared in) or i cannot include well dunno.
  18. I'm trying to crawl for links in a specific website and show them at the end. The problem i'm facing is that it only show the links from the specific page not the whole pages in the website. I tried several loops with no success please give some advise. Here is the code: <?php if (isset($_POST['Submit'])) { function getLinks($link) { /*** return array ***/ $ret = array(); /*** a new dom object ***/ $dom = new domDocument; /*** get the HTML (suppress errors) ***/ @$dom->loadHTML(file_get_contents($link)); /*** remove silly white space ***/ $dom->preserveWhiteSpace = false; /*** get the links from the HTML ***/ $links = $dom->getElementsByTagName('a'); /*** loop over the links ***/ foreach ($links as $tag) { $ret[$tag->getAttribute('href')] = $tag->childNodes->item(0)->nodeValue; } return $ret; } /*** a link to search ***/ $link = $_POST['address']; /*** get the links ***/ $urls = getLinks($link); /*** check for results ***/ if(sizeof($urls) > 0) { foreach($urls as $key=>$value) { if (preg_match('/^(http|https):\/\/([a-z0-9-]\.+)*/i',$key)) { echo '<span style="color:RED;">' . $key .' - external</span><br >'; } else { echo '<span style="color:BLUE;">' . $link . $key . ' - internal</span><br >'; } } } else { echo "No links found at $link"; } } ?> <br /><br /> <form action="" method="post" enctype="multipart/form-data" name="link"> <input name="address" type="text" value="" /> <input name="Submit" type="Submit" /> </form>
  19. Thank you for your quick responses i found that i didn't added the !validateCaptcha($_POST['code']) on if(isset($_POST['send']. Ill take in consideration your suggestions and about MrAdam's logic i agree but i waned to try something else. Thank you again and good luck
  20. Hello, I have created a sing up form with email, password and captcha. I verify at submit all the possible errors and it works except one, for example you fill the email field with non existing email in db, the 2 password field with same pass and fill the captcha field wrong. In this example it will proceed inserting the data in the db, i cannot figure what is wrong please advise. register.php <?php session_start(); include('include/config.php'); include('include/validation.php'); include('include/header.php'); ?> <div id="register"> <h1>Inregistrare</h1> <?php if(isset($_POST['send']) && (!validateEmail($_POST['email']) || !validatePasswords($_POST['pass1'], $_POST['pass2']) || !validateRegister())): ?> <div id="error"> <ul> <?php if(!validateEmail($_POST['email'])): ?> <li><strong>E-mail invalid:</strong> Introduceti o adresa de email valida.</li> <?php endif ?> <?php if(!validatePasswords($_POST['pass1'], $_POST['pass2'])): ?> <li><strong>Parole invalide:</strong> Parolele nu se potrivesc sau sunt mai mici de 5 caractere!</li> <?php endif ?> <?php if(!validateCaptcha($_POST['code'])): ?> <li><strong>Cod invalid:</strong> Cod invalid.</li> <?php endif ?> <?php if(!validateRegister()): ?> <li><strong>Exista:</strong> exista.</li> <?php endif ?> </ul> </div> <form method="post" id="register" action="<?php echo $_SERVER['SCRIPT_NAME']; ?>"> <div> <label for="email">E-mail</label> <input id="email" name="email" type="text" /> <span id="emailInfo">Adresa Dvs. de email va fi folosita pentru login.</span> </div> <div> <label for="pass1">Parola</label> <input id="pass1" name="pass1" type="password" /> <span id="pass1Info">Parola trebuie sa contina cel putin 5 caractere.</span> </div> <div> <label for="pass2">Confirma Parola</label> <input id="pass2" name="pass2" type="password" /> <span id="pass2Info">Confirma parola</span> </div> <div><img src="include/captcha.php" /></div> <div> <label for="code">Introduceti codul de mai sus</label> <input id="code" type="text" name="code" /> <span id="codeInfo">Sunteti om?</span> </div> <div> <input id="send" name="send" type="submit" value="Inregistrare" /> </div> </form> <?php elseif(isset($_POST['send'])):?> <div id="error" class="valid"> <ul> <li><strong>Felicitari!</strong> Datele de login au fost trimise la adresa <?php echo $_POST['email']; ?></li> </ul> </div> <?php $email=trim($_POST['email']); $password=md5($_POST['pass1']); $query="INSERT INTO users (email, password) VALUES ('$email', '$password')"; $result_query=mysql_query($query) or die('EROARE MYSQL'); ?> <?php endif ?> <?php if(!isset($_POST['send'])):?> <form method="post" id="register" action="<?php echo $_SERVER['SCRIPT_NAME']; ?>"> <div> <label for="email">E-mail</label> <input id="email" name="email" type="text" /> <span id="emailInfo">Adresa Dvs. de email va fi folosita pentru login.</span> </div> <div> <label for="pass1">Parola</label> <input id="pass1" name="pass1" type="password" /> <span id="pass1Info">Parola trebuie sa contina cel putin 5 caractere.</span> </div> <div> <label for="pass2">Confirma Parola</label> <input id="pass2" name="pass2" type="password" /> <span id="pass2Info">Confirma parola</span> </div> <div><img src="include/captcha.php" /></div> <div> <label for="code">Introduceti codul de mai sus</label> <input id="code" type="text" name="code" /> <span id="codeInfo">Sunteti om?</span> </div> <div> <input id="send" name="send" type="submit" value="Inregistrare" /> </div> </form> <?php endif ?> </div> <?php include('include/footer.php'); ?> validation.php <?php function validateName($name){ //if it's NOT valid if(strlen($name) < 4) return false; //if it's valid else return true; } function validateEmail($email){ return ereg("^[a-zA-Z0-9]+[a-zA-Z0-9_-]+@[a-zA-Z0-9]+[a-zA-Z0-9.-]+[a-zA-Z0-9]+.[a-z]{2,4}$", $email); } function validatePasswords($pass1, $pass2) { //if DOESN'T MATCH if(strpos($pass1, ' ') !== false) return false; //if are valid return $pass1 == $pass2 && strlen($pass1) > 4; } function validateMessage($message){ //if it's NOT valid if(strlen($message) < 10) return false; //if it's valid else return true; } function validateCaptcha($code) { if($code == $_SESSION['rand_code']) //if it's valid return true; else //if it's NOT valid return false; } function validateRegister() { $query_check_login="SELECT email FROM users WHERE email='".$_POST['email']."' LIMIT 1"; $result_check_login=mysql_query($query_check_login) or die('MYSQL ERROR'); $row_check = mysql_num_rows($result_check_login); if($row_check == 1){ //if it's NOT valid return false; } else { //if it's valid return true; } } ?>
  21. in fact i need to implement this code in the other one... <?phpfunction mail_attachment($filename, $path, $mailto, $from_mail, $from_name, $replyto, $subject, $message) { $file = $path.$filename; $file_size = filesize($file); $handle = fopen($file, "r"); $content = fread($handle, $file_size); fclose($handle); $content = chunk_split(base64_encode($content)); $uid = md5(uniqid(time())); $name = basename($file); $header = "From: ".$from_name." <".$from_mail.">\r\n"; $header .= "Reply-To: ".$replyto."\r\n"; $header .= "MIME-Version: 1.0\r\n"; $header .= "Content-Type: multipart/mixed; boundary=\"".$uid."\"\r\n\r\n"; $header .= "This is a multi-part message in MIME format.\r\n"; $header .= "--".$uid."\r\n"; $header .= "Content-type:text/html; charset=iso-8859-1\r\n"; $header .= "Content-Transfer-Encoding: 7bit\r\n\r\n"; $header .= $message."\r\n\r\n"; $header .= "--".$uid."\r\n"; $header .= "Content-Type: application/octet-stream; name=\"".$filename."\"\r\n"; // use diff. tyoes here $header .= "Content-Transfer-Encoding: base64\r\n"; $header .= "Content-Disposition: attachment; filename=\"".$filename."\"\r\n\r\n"; $header .= $content."\r\n\r\n"; $header .= "--".$uid."--"; if (mail($mailto, $subject, "", $header)) { echo "mail send OK"; // or use booleans here echo $mailto; } else { echo "mail send ERROR!"; }}?><?php$my_file = "letter.pdf";$my_path = $_SERVER['DOCUMENT_ROOT']."/admin/email/";$my_name = "name";$my_mail = "mail.@mail.com";$my_replyto = "mail.@mail.com";$my_subject = "subject";$my_message = "message";mail_attachment($my_file, $my_path, "mail@mail.com", $my_mail, $my_name, $my_replyto, $my_subject, $my_message);?>
  22. Hello, i have this code for sending email it works great but i don't know where to start in sending emails with a pdf file attached ex: test.pdf. Any suggestions? <?php session_start(); require_once('framework/framework.php'); include('framework/class.smtp.inc');//--- databse settings $dsn = array( 'dbtype' => 'mysql', 'username' => '', 'password' => '', 'host' => '', 'database' => '' ); try { $db = db::connect($dsn); } catch (Exception $e) { die($e->getMessage()); } //--- $subject="Formular online pentru participantii Diaspora Stiintifica 2010";// +-------------- BEGIN ---- Functia de trimitere mail prin smtp -------------------+ */ function trimite($destinatar='', $subiect='', $mesaj='') {//--- mail settings $smtp_server_host="mail.server.com"; $smtp_server_port="25"; $sender="email@email.com"; $return_path="email@email.com"; $smtp_username="email@email.com"; $smtp_pswd="123"; /*************************************** ** Setup some parameters which will be ** passed to the smtp::connect() call. ***************************************/ $params['host'] = $smtp_server_host; // The smtp server host/ip $params['port'] = $smtp_server_port; // The smtp server port $params['helo'] = exec('hostname'); // What to use when sending the helo command. Typically, your domain/hostname $params['auth'] = false; // Whether to use basic authentication or not// $params['user'] = $smtp_username; // Username for authentication// $params['pass'] = $smtp_pswd; // Password for authentication $params['timeout'] = '60'; /*************************************** ** These parameters get passed to the ** smtp->send() call. ***************************************/ $send_params['recipients'] = $destinatar; // The recipients (can be multiple) $send_params['headers'] = array( "MIME-Version: 1.0", "X-Mailer: PHP/" . phpversion(), "Return-Path: ".$return_path, "From: ".$sender, "To: ".$destinatar, "Subject: ".$subiect, "Content-type: text/html; charset=UTF-8", "Content-Transfer-Encoding: 8bit"); $send_params['from'] = $sender; // This is used as in the MAIL FROM: cmd // It should end up as the Return-Path: header $send_params['body'] = $mesaj; /*************************************** ** The code that creates the object and ** sends the email. ***************************************/ $smtp = new smtp($params); $smtp->connect(); $trimis=$smtp->send($send_params); $raspuns=array($destinatar, $trimis, $smtp->errors); // $smtp->rset(); //--- Bcc:/* $send_params['recipients'] = $sender; $trimisi=$smtp->send($send_params); $errmsgi=$smtp->errors; print "<br>bcc: ".$send_params['recipients']."; ".$trimisi."<br>"; for ($n = 0 ; $n <= count($errmsgi) - 1; $n++) { print "<br>"." bccerr: <strong>".$errmsgi[$n]."</strong><br>"; }*/ $smtp->quit(); return $raspuns; }// +-------------- END ---- Functia de trimitere mail prin smtp -------------------+ */// +---------------------------------------------------------------------------+ $afisez = ""; $cond=0; $query = "SELECT email_1 FROM inregistrari WHERE `completat`=0"; $useri = $db->getAll($query); $i=0; $j=0; $k=0; foreach ($useri as $row) { $tpl = new HTML_Template_Sigma('mesaj'); $tpl->loadTemplateFile("mesaj.html"); $tpl->setVariable($row); $html=$tpl->get(); //*/ $html=nl2br($html); $html=str_replace(chr(10), "", $html); $html=str_replace(chr(13), "", $html); // */// +----------------------+ $subiect = $subject; if (!empty($row['email_1'])) { $subelements=preg_split("/, /", $row['email_1'], -1, PREG_SPLIT_NO_EMPTY); for ($m = 0 ; $m <= count($subelements) - 1; $m++) { $rez = trimite($subelements[$m], $subiect, $html); if ($rez[1]==true) { $afisez .= $rez[0].";1<br>"; $i++; } else { $afisez .= $rez[0].";0<br>"; $errmsg=$rez[2]; for ($n = 0 ; $n <= count($errmsg) - 1; $n++) { $afisez .= " <strong>".$errmsg[$n]."</strong><br>"; } $j++; } } } else { $afisez .= $row['email_1'].";no email;n<br>"; $k++; } }$afisez .= "<br>{$i} mesaje Trimise<br>";$afisez .= "{$j} mesaje Netrimise<br>";$afisez .= "{$k} mesaje fara adresa<br>";print $afisez;?>
  23. yes it works thanks but as mjdamato says in IE does not work damn Webpage error details Message: Could not get the type property. This command is not supported. Line: 263 Char: 4 Code: 0 <?php for($i=1;$i<=$num_rows;$i++) { echo " <script type=\"text/javascript\"> function togglePass".$i."() { var obj = document.getElementById('pass".$i."'); if (obj.type == 'text') { obj.type = 'password'; } else { obj.type = 'text'; } } </script> "; } ?> <?php
  24. i have field like <input type="password" value="123" class="pass" id="pass1"> <input type="password" value="123" class="pass" id="pass2"> and so on until pass9. I have this javascript code function togglePass() { var obj = document.getElementById('pass1'); if (obj.type == 'text') { obj.type = 'password'; } else { obj.type = 'text'; } } it only works with id=pass1 and i dont know how to make it work with all generated passn. i tried function togglePass() { var obj = document.getElementById('pass1'); var obj = document.getElementById('pass2'); etc... if (obj.type == 'text') { obj.type = 'password'; } else { obj.type = 'text'; } }
×
×
  • 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.