Jump to content

adrek

Members
  • Posts

    25
  • Joined

  • Last visited

    Never

Everything posted by adrek

  1. The "or" operator worked like a charm. Thanks for all of your help.
  2. Good question, I don't own the webpage that I will be scrapping this data off of. It is a greasemonkey script that will pull the data for me so I can make a contact List from it. I did not know about that I will defiantly give that a try and let you guys know. . This is a possibility. It doesn't need to be 100% accurate. Just accurate enough to make it worth while. Thanks for all of the replies!
  3. Hi, I have a page that has a name on it and all associated email addresses for this name. I am making a javascript that can pull the name and email address from the page to make a contact list from it however these pages are not formated in any particular way. The email addresses are easy to pull but the names are not. A typical page looks something like this Hi, my name is [name] The only problem is the name line can look like Hi, im [name] or Name: [name] The name is not necessarly on the first line of the page either. is there a way i can use regular expressions to get pull the name from these pages?
  4. I got this figured out. I used an easier script to implement based off of slow aes. its called ecmaScrypt if anyone is interested. http://www.josh-davis.org/ecmaScrypt
  5. I am making a greasemokey script that gets information from the current webpage, creates an invisible form and submits it automattically. The problem I am running into is getting the form to submit. I get an error saying that submitForm does not exist. I did some searching around and could not find much other than the default submit function does not work with greasemonkey. does anyone know how to acheive this?
  6. Hi, Im trying to make an application that encrypts a string using the implementation of javascript and i need this string to be decrypted using the php mcrypt module. I know that client side encryption is not secure at all but unfortunately my script requires it. The problem that i am having is that i am getting two different outputs when using slowAES and mcrypt. I am using CBC mode. Can anyone help me out.? Thanks! this is how I cam calling slowAES. var cipher = slowAES.encrypt(cryptoHelpers.convertStringToByteArray("asdf"), 2, cryptoHelpers.toNumbers(stringToHex("1234567890987654")), 16, cryptoHelpers.toNumbers(stringToHex("1234567890987654"))); here is the PHP code function base16Encode($arg){ $ret=""; for($i=0;$i<strlen($arg);$i++){ $tmp=ord(substr($arg,$i,1)); $ret.=dechex($tmp); } return $ret; } $key="1234567890987654"; $transmitKey=base16Encode($key); $link="asdf"; $cp = mcrypt_module_open(MCRYPT_RIJNDAEL_128, '', 'cbc', ''); @mcrypt_generic_init($cp, $key,$key); $enc = mcrypt_generic($cp, $link); mcrypt_generic_deinit($cp); mcrypt_module_close($cp);
  7. i should prolly show more code. this is the auth.php page <?php require_once "includes/core.php"; require_once "includes/user.class.php"; $user = new User($_POST['email'], $_POST['password']); $auth = $user->getAuth(); if($auth)$string = "<font color=\"green\" face=\"Verdana\" size=\"2\">Access Approved</font>"; else $string = "<font color=\"red\" face=\"Verdana\" size=\"2\">Access Denied</font>"; setcookie("auth", $auth); print $string."<div style=\"display:none\" id=\"status\">$auth</div>"; ?> i was trying to play around with setting the values of cookies and divs to see if i could read one of those with the javascript login function but for some reason the js function will not read the cookie or div until the second time it is run through. any ideas?
  8. is it creating a row in the guestbook table with all blank values or is it just not doing anything?
  9. you never connect to the database or choose your database. add this before your mysql query. //connect to the database $DBConn = mysql_connect($DBhost, $DBuser, $DBpass); //Check the connection but is not necessary if(!DBConn) die("Could not connect"); //choose the database $db_selected = mysql_select_db($DBName, $DBConn); this should work
  10. Hi, I have an ajax login form that, when submitted, will take the users credentials, send them to my ajax script which will use my php script to authenticate it. My problem is that once the authentication has passed the page will stay the same. I was able to isolate it to this function. If the login is correct it should update the page to say "you are logged in" but you have to submit the form again for it to do anything. I got it to work by adding an alert in there but ideally it should just update the page with out this alert. Does anyone have any suggestions. Thanks function login(){ xmlhttpPost("auth.php"); document.getElementById('password').value = ""; alert(""); //Will not work with out this. if(document.getElementById('status').innerHTML == "1"){ alert('asdf'); document.getElementById('content').innerHTML='<font color=\"white\">you are logged in</font>'; } }
  11. $badinput = "<h2>Feedback was NOT submitted</h2>\n"; echo $badinput; die ("Go back! ! "); } if(empty($visitor) || empty($visitormail) || empty($notes )) { echo "<h2>Use Back - fill in all fields</h2>\n"; die ("Use back! ! "); } you are using die() which will print out the string in the parentheses and exit out of the script so anything after that does not get processed, html or php. if you want it to show your foot just change die to echo.
  12. wow im stupid. your function works great. thanks alot. i just didnt rewrite the charPlace function to work right with it. thanks alot i appreciate your help.
  13. sorry if im not clear. no i didnt change the problem. ive got the script removing the dots. but in the database the title is with the dots so in order me for me to get the result that im looking for i need to put the dots back. here is the psuedocode for what should be happening loop: get article title get the placement of the dots in the title and store them in a cookie generate links based off the titles and make them search engine friendly. ex: "Dr. Sues" becomes "dr-sues" when link is clicked add the dots to "dr-sues" based off values from the cookie restore spaces get results from database using the string "dr. sues". if it helps ill just post all relevant code <?php // adds the dots to the title that were previouly taken out function addDot($string, $csv){ $array = explode(",", $csv); $init = strlen($string); if($init < $array[sizeof($array)-1]) $init = $array[sizeof($array)-1]; $k=0; print $init; for($i=0; $i<=$init; $i++){ if($i == $array[$k]){ $string2 .= "."; $k++; } $string2 .= $string[$i]; } return $string2; } // gets the pace of the specified character function charPlace($string, $char){ for($i=0; $i<strlen($string); $i++){ if($string[$i] == $char) $value .= $i.","; } $value = substr($value, 0, strlen($value)-1); return $value; } // creates cleaner URIs based of the article title function createLink($title){ $link = strtolower(str_replace(" ", "-", $title)); $link = str_replace(".", "", $link); return $link; } // get the articles from the database $sql = "SELECT * FROM articles"; // if an article title is set then find that specified article if (!empty($_GET['title'])) { $csv = addslashes($_COOKIE['csv']); $title = addslashes($_GET['title']); $title = str_replace("-", " ", $title); $title = addDot($title, $csv); $sql .= " WHERE title='$title"; $article = true; } $query = mysql_query($sql); if(!$article){ // print out links while($array = mysql_fetch_array($query)){ $title = $array['title']; $csv = charPlace($title, "."); $uri = createLink($title); $link .= "<a href=\"http://mysite.com/$uri/\" onClick=\"createCookie('csv', '$csv');\">$title</a>"; } echo $link; } elseif ($article){ //Display Article } ?> createCookie() is a javascript function im using to create the cookie with the csv varibles
  14. i have a site with a series of articles and what im trying to do is strip out the punctuation so that the urls are easier to read. A.B.C. is the orginal name of the article so i convert that to abc for the url. i pass it through a function to get the place of the characters <?php function charPlace($string, $char){ for($i=0; $i<strlen($string); $i++){ if($string[$i] == $char) $value .= $i.","; } $value = substr($value, 0, strlen($value)-1); return $value; } ?> so executing charPlace("A.B.C.", "."); would return 1,3,5 and i store those values in a cookie. after doing that i strip the punctation. so the final url will be http://mysite.com/articles/2009/abc/ when the page is accessed the cookie with the charPlace values will be read and the addDot function would be called to restore the punctuation and turning it back into A.B.C. to get the article from the database. the problem that im running into is the string is not restored to what it was, thus not returning any results.
  15. the numbers are the spot of the string where the period would go. and since strings are an array of characters the index starts at 0. so basically the 2nd, 4th, 6th characters should be periods which would be represented like so respectively string[1], string[3], string[5]
  16. u can use strip tags and that will remove any html tags. instead of strip slashes you want to use addslashes that way it will put an escape character in front of quotes. ie turning 'hello world' into \'hello world\'. another alternative is using htmlspecialchars or htmlentities if you want to keep the tags intact. these will just change the html characters into there respective character codes.
  17. sorry this was a type. if i put in ("Dr No", "2") i get Dr. No but if i put in addChar("ABC", "1,3,5") i get "A.BC.."
  18. i have this function that takes a a series of numbers serpearted by a comma and inserts a period into that place in a string. function addChar($string, $csv){ $array = explode(",", $csv); $init = strlen($string); if($init < $array[sizeof($array)-1]) $init = $array[sizeof($array)-1]; $k=0; for($i=0; $i<=$init; $i++){ if($i == $array[$k]){ $string2 .= "."; $k++; } $string2 .= $string[$i]; } return $string2; } like if i input addChar("Dr No", "2") that works fine but if i do addChar("A.B.C.", "1,3,5") i get "A.BC..". anyone know what might be wrong?
  19. you would have to post a little bit more information my guess is that there is something wrong with the way you are handling the the y parameter. try posting some of the code.
  20. im already stripping out the punctuation and the final string is in the url so when it gets put through the sql query its already stripped of its punctation. should i replace the spaces with the %? EDIT: ok nvm. i got it. thanks alot for your help!!
  21. i have a script that will get artciles based of a title from a database. i tried to use easy to remember urls so my page looks like this http://example.com/title-of-article/ which works fine. I want to avoid using any symbols other than the dash, to represent the space, in the url. Some of the articles of periods or other punctuation in the title. is there a way to ignore that in a query. so like /title-of-this-article/ could return "Title. of This. Article" or something like that? i tried using the LIKE statement but then it returns any titles that are similar and i want it to just return that one. any ideas?
  22. yea thats what i did. i used substrings to check if the title started with 'the' and just put it at the end and seperate it with a comma. thanks
  23. Ok here is my problem. I need to pull values from a database starting with a letter. here is my query SELECT * FROM titles WHERE name LIKE '%$letter' i have a couple names that start with 'the' and other common words. is there any way to ignore that? like for example. "The Lord of the Rings" would show up under 'L' as oppose to 'T'.
×
×
  • 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.