Jump to content

premiso

Members
  • Posts

    6,951
  • Joined

  • Last visited

  • Days Won

    2

Everything posted by premiso

  1. Honestly, it looks as efficient as it can be. Simple as that.
  2. That is what I figured. He wants SEO Friendly urls. Simple Mod rewrite Tutorial Read through that, as that is what you need to do.
  3. [quote author=-null- link=topic=54859.msg1169714#msg1169714 date=1240681822] I've been using Dreamweaver for editing and have recently started using Eclipse for debugging. I find Eclipse really really slow however and now it's started throwing errors everytime I do anything.  Can anyone recommend any other free editors that allow debugging control. [/quote] NetBeans, I just found out, is a really good editor that is fast (a lot faster than eclipse) and works well. I would have to recommend that one.
  4. <?php $key = "ASHD77278qu389*A*S*D0a)))(ASdjuio!\$^\$RHF"; // escpaped the $ function xor_crypt($input, $key) { $input_l = strlen($input); $key_l = strlen($key); for ($i=0;$i<$input_l;$i++) { $pos = $i % $key_l; $input[$i] = chr(ord($input[$i]) ^ ord($key[$pos])); } return $input; } function do_encrypt($input, $key) { $input = trim($input); $input = xor_crypt($input, $key); $input = base64_encode($input); return $input; } function do_decrypt($input, $key) { $input = trim($input); $input = base64_decode($input); $input = xor_crypt($input, $key); return $input; } if(isset($_REQUEST['url'])) { $encurl = do_encrypt($_REQUEST['url'], $key); $encurl = "http://misc.dev/test.php?encurl=" . $encurl; echo "<meta http-equiv=\"refresh\" content=\"0;url=$encurl\">"; } if(isset($_REQUEST['encurl'])) { $backurl = do_decrypt($_REQUEST['encurl'], $key); echo $backurl; //Output nothing (?) } ?> I just ran that on my box and received the URL put in there...so it works as far as I know. The only thing I changed, was the trim (which it worked without but decided it was a good idea) and I escaped the two $ in the $key code, as that might have been causing an issue. Edit: Here is the output after I ran that on my box: Input is (decrypt func): KSc8NA0YHUBPBltHUFxfM0YnQiVECF5IR1w1PAEEFhsWUVBwRz0laSg9LCFPGUJfSE4cVwUM Input is after bse64 (decrypt func): )'<4 @O[GP\_3F'B%D^HG\5<QPpG=%i(=,!OB_HNW Output Was: http://www.theurlthatiwanttoencrypt.com/index.php?id=5 (Note I left the debug stuff out in the version posted above). EDIT EDIT: The only issue I saw, is that I actually had an id=5&th=6 for the url and it chopped off everything after the & sign for some reason. Something to look into.
  5. I honestly cannot spot anything wrong, other than can there be a url and encurl request at the same time? If so it is fine, if it is either or, why not use if/elseif ??? Try this for some debugging: function do_decrypt($input, $key) { echo "Start Do Decrypt Debug:<br />Key Passed: {$key}<br />Input Passed: {$input}<br /><br />"; $input = base64_decode($input); echo "Input after base64 decode: {$input}<br /><br />"; $input = xor_crypt($input, $key); echo "Input after base64 and xor_crypt: {$input}"; return $input; } And see what is returned and where it is failing. Do the same for the xoc_crypt if after the base64 it returns fine.
  6. $ally = str_replace("H","<p color= #FF0000 >H</p>",$row['ally']); $ally = str_replace("A","<p color='green'>A</p>",$ally); That should work, if it is going to be either an H or an A you can do this: if (strstr($row['ally'], 'A') !== false) { $color = "green"; $letter = "A"; }else { $color = "#FF0000"; $letter = "H"; } $ally = str_replace($letter, "<p color='{$color}'>{$letter}</p>", $row['ally']); echo $ally; You could even do an array setup: $letterColor = array("A" => "green", "H" => "#FF0000"); $letter = (strstr($row['ally'], "A") !== false)?"A":"H"; $ally = str_replace($letter, "<p color='{$letterColor[$letter]}'>{$letter}</p>", $row['ally']); echo $ally; Or if you want both to be replaced regardless. $replace = array("A", "H"); $replaceWith = array("<p color='green'>A</p>", "<p color='#FF0000'>H</p>"); $ally = str_replace($replace, $replaceWith, $row['ally']); echo $ally; Hopefully one of those answers your question
  7. Remove the <body> as wildteen said, that was my mistake. I did not notice you had that up top. Just for clarification, this should work: <?php ini_set("display_errors",1); ERROR_REPORTING(E_ALL); session_start(); require_once('Connections/Login.php'); //You will need to update all the below variables $mysqlhost = "localhost"; $mysqluser = "guntmar"; $mysqlpass = "je20sa05"; $mysqldb = "guntmar"; $mysqltable = "users"; $username = "username"; $currentpo = "resultspo"; $currentmo = "resultsmo"; $id = $_SESSION['id']; $url = "http://www.guntmarwolff.com/passiontest2.php" ; // End Variables mysql_connect($mysqlhost, $mysqluser, $mysqlpass); mysql_select_db($mysqldb); $query = "SELECT * FROM " . $mysqltable . " WHERE username='" . $username . "'"; $result = mysql_query($query) or die("There was a mysql error"); while($row = mysql_fetch_array($result)){ $currentpo = $row['resultspo']; $currentmo = $row['resultsmo']; } function showForm () { echo <<<SHOWFORM <form id="form1" name="form1" method="post" action=""> <table width="699" border="0" align="center" cellspacing="5" class="style1"> <tr> <td colspan="3"><div align="center"><span class="style4">Your Passion Test</span></div></td> </tr> <tr> <td width="24"> </td> <td width="429"> </td> <td width="220"><div align="right">Saturday, 03/28/09</div></td> </tr> <tr> <td> </td> <td> </td> <td><div align="right">$_SESSION[MM_firstname]</div></td> </tr> <tr> <td> </td> <td> </td> <td><div align="right"></div></td> </tr> <tr> <td> </td> <td> </td> <td> </td> </tr> <tr> <td>1</td> <td><strong>I like talking to people. </strong><br /> </b></td> <td><div align="left"> <input name="po1" type="radio" value="0" /> 0 <input name="po1" type="radio" value="1" /> 1 <input name="po1" type="radio" value="2" /> 2 <input name="po1" type="radio" value="3" /> 3 <input name="po1" type="radio" value="4" /> 4 <input name="po1" type="radio" value="5" /> 5</div></td> </tr> <tr> <td>2</td> <td>It is important for me what other people think. </td> <td><p> <label></label> <label></label> <input name="mo2" type="radio" value="0" /> 0 <input name="mo2" type="radio" value="1" /> 1 <input name="mo2" type="radio" value="2" /> 2 <input name="mo2" type="radio" value="3" /> 3 <input name="mo2" type="radio" value="4" /> 4 <input name="mo2" type="radio" value="5" /> 5<br /> <br /> </p></td> </tr> <tr> <td>3</td> <td class="style1">My level of excitement is high right now. </td> <td><p> <label></label> <input name="mo3" type="radio" value="0" /> 0 <input name="mo3" type="radio" value="1" /> 1 <input name="mo3" type="radio" value="2" /> 2 <input name="mo3" type="radio" value="3" /> 3 <input name="mo3" type="radio" value="4" /> 4 <input name="mo3" type="radio" value="5" /> 5<br /> </p></td> </tr> <tr> <td>4</td> <td>I like solving mathematical tasks. </td> <td><input name="po4" type="radio" value="0" /> 0 <input name="po4" type="radio" value="1" /> 1 <input name="po4" type="radio" value="2" /> 2 <input name="po4" type="radio" value="3" /> 3 <input name="po4" type="radio" value="4" /> 4 <input name="po4" type="radio" value="5" /> 5</td> </tr> </table> <p align="center"> <input name="Submit" type="submit" class="style1" value="go on" /> </p> </form> SHOWFORM; }//Close showForm() if (isset($_POST['Submit'])) { $pagepo = ($_POST['po1'] + $_POST['po4']); $pagemo = ($_POST['mo2'] + $_POST['mo3']); $newpo = ($currentpo + $pagepo); $newmo = ($currentmo + $pagemo); $query = "Update ".$mysqltable." SET resultspo = resultspo + '".$newpo."', resultsmo = resultsmo + '".$newmo."' WHERE id = '".$_SESSION['id']."'"; mysql_query($query) or die("There was a mysql error<br />Query: {$query}<br />Error Returned: " . mysql_error()); header("Locaton: passiontest2.php"); } ?> <html> <body> <?php showform(); ?> </body> </html> Would be a better way to structure your PHP code. This way you can use the header function.
  8. window.location or location.href is what you need. But why not use header instead: <body> <?php if (!isset($_POST['Submit'])) { showForm(); } else { $pagepo = ($_POST['po1'] + $_POST['po4']); $pagemo = ($_POST['mo2'] + $_POST['mo3']); $newpo = ($currentpo + $pagepo); $newmo = ($currentmo + $pagemo); $query = "Update ".$mysqltable." SET resultspo = resultspo + '".$newpo."', resultsmo = resultsmo + '".$newmo."' WHERE id = '".$_SESSION['id']."'"; mysql_query($query) or die("There was a mysql error<br />Query: {$query}<br />Error Returned: " . mysql_error()); header("Locaton: passiontest2.php"); } ?> And the second if was not needed, it did the same as the first if. So just put that inside there.
  9. We are not here to do your work for you. Either post in freelancing and offer payment or start googling for tutorials and start writing the code and when you get a bump in the road post here with the code for some assistance. To me it smells like a homework assignment.
  10. Not unless you use a form to POST the ID. What is the reasoning for changing this?
  11. Can you post an updated version of the code you are using now?
  12. Absolutely nothing. Funny. function Escape($text) { if (!is_numeric($text)) { return $text; } return $text; } Can you see anything special happening there? >
  13. Have you tried and asking the actual makers of the script? They would know better than we would.
  14. Ultimately the header issue in it's self is a good reason. The other options is that you do not have control of the data in a sense. Also it makes it a pain if you want to implement "templating". If you store your output in variables you can easily template your system, where as if they are all in echos, you now have to re-do your logic/go back through and put all echo's into variables to be echo'd out. Doing it this way makes it easier for templating, modifying down the road and solves the issues of header errors, session_start errors and other items. There is no real reason to just echo items out while it is processing. Also think that 1 echo vs 100 echo's will be much faster and less processing time. So aside from the errors it improves efficiency of the script. Process the script where it needs to process, display data where it needs to be displayed. Simple as that. If you want more examples, I would suggest creating a thread in the Misc section to get examples and other's explanation. Sorry to the OP for thread hijacking =\
  15. If you code right, not just echoing output as you go instead storing them in a variable(s) and then outputting those variables at the end you will be fine. It is not good practice to just echo stuff out through out the script. Execute the script first then output the items generated by the script.
  16. 30 seconds. But it will show a timestamp of the time - 30 seconds. Use date to display it in a readable format.
  17. Nope. I am a fan of coding it right and using the header. Due to the simple fact JS can be disabled/turned off.
  18. Yes, you can use UPDATE as long as the full record is there. (Even if some fields were not filled in the first time around).
  19. $email_address = isset($_POST['email_address'])?mysql_real_escape_string($_POST['email_address'])?''; $sql = "SELECT activated FROM table_name WHERE `email_address` = '{$email_address}' LIMIT 1"; $result = mysql_query($sql); $activated = mysql_result($result, 0, 0); if ($activated == "no") { header("Location: login.php"); }else { header("Location: loggedin.php"); } Just a rough example of how it could be done. Hopefully that gets you going on your feet. If not google PHP Login Tutorial and you should find plenty of full out examples of how to do a login system.
  20. http://www.kingcomputerservices.com/unix_101/search_and_replace_with_vi_part_1.htm May help you out.
  21. I would avoid using eregi as it is depreciated in PHP6. Use preg_match instead. $string = "First Last Name <Email@TheirEmail.com>"; preg_match("~<(.*?)>~i", $string, $match); echo $match[1]; Outputs: Email@TheirEmail.com
  22. Maybe use the full absolute path instead of just that. You can try using $_SERVER['DOCUMENT_ROOT'] to get that and see if that helps you make the directory or give an accurate test if that directory exists.
  23. A few pointers, avoid using short tags <? as they are not compatible in all systems. Use <?php instead. <html> <head> <title>CD Database Search Application</title> </head> <body> <?php $searchType = (isset($_GET['searchtype']))?$_GET['searchtype']:''; $Search = new Search($searchType);?> <h2>Search Database:</h2> <div id="search"> <form action="<?php echo $_SERVER['PHP_SELF'] . "?searchtype=search"; ?>" method="post"> <select name="searchtype"> <?php $Search->SaveSearchType();?> </select> <?php $Search->SaveSearchBar();?> <input type="submit" value="Search" /> </form> </div> <?php if(isset($_GET['searchtype'])) { echo "<div id=\"searchresults\">\n"; $Search->SearchBar($_POST['searchtype'], $_POST['value'], "ASC"); echo "</div><br />\n"; } ?> </body> <div><em>© Ryan Forsyth <?php echo date("Y");?><em></div> </html> As far as the save search bar not having the value, you do not pass it into the constructor, like your class is setup. And you do not call searchBar first to set the value. So it is being initiated as empty and does not get set until the SearchBar function is called. EDIT: The above code sets the searchtype in the constructor if it is set. Hope that helps you understand.
  24. Are you calling the file from http://localhost/test.php (I take it you are). And if it shows just plain text, it seems the Apache is not setup to parse php files. You will need to add the type handler I believe. Apache 2 Install on Windows Look at the AddType section, depending if you are running it as CGI or not make sure either of those values are in the httpd.conf if they are not add them then restart apache and see if it works.
  25. Do you have a file in that directory that is just the username? If you put this in: if (is_dir('perm_images/$User')) { // Where the file is going o be placed $target_path = "perm_images/$User"; // Add the original filename to our target path Result is "perm_images/filenae.extension" $target_path = $target_path . basename($_FILES['formUploadFile']['name']); } else { die("The is_dir returned false on perm_images/{$User} again, so it is not a DIR...but mkdir will not make the dir."); //header ("Location: http://www.thegayestcommunityever.com/dev/index.php?section=denied"); } My bet is that die statement echo's out. It would seem to me either a file is there with the $User as the name, or something else is going on, what I do not know.
×
×
  • 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.