Jump to content

RussellReal

Members
  • Posts

    1,773
  • Joined

  • Last visited

Everything posted by RussellReal

  1. impossible.. you're probably gonna be more interested in the HTML's <iframe> or <frameset> tags
  2. This will be my last post on this topic, I just want you to know you have egged me into posting countless meaningless posts. Before this topic all or 99.9% of my posts were aimed at helping somebody or suggesting something. Now I'm feeling more and more retarded and less helpful and more of a spammer. Thanks for wasting my time, and valuable database space on this EXTREMELY helpful forum. In all seriousness though, I hope your topic gets solved soon, but as humbly as possible I am suggesting you create a topic in the javascript section of this forum, you will have this topic solved waaay faster. Russell
  3. the last step is to be used in the flash file.. or bgsound tag lol you could PROBABLY do all of this with AJAX and (googled, although coulda figured it out ) <OBJECT ID="Player" height="0" width="0" CLASSID="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6"> <PARAM name="autoStart" value="True"> <PARAM name="URL" value="play.php?key={THE KEY}"> </OBJECT>
  4. o sweet I never knew that most of my hosting plans and my php installation I really never had that problem, but I'll remember that kudos
  5. 19, your point is? I am really not interested in getting into fights on a forum which I highly enjoy being a part of. I tried to help you above and told you how you'd achieve what you were intending to achieve, it is not my fault you're gonna need someone to re-create your whole code because you're not up to par with your JavaScript. As far as my age goes, being 19 does not make me any different than any other web developer, the years I've invested into it is the difference, My skills is what makes the difference. Please don't try and egg me into giving you something which will not make you any smarter, will actually do the complete opposite, and arguing with me HERE in PHP Help is not getting your topic solved any faster.
  6. one way to do so, is to create a somewhat ticket like system.. and how you expect to PLAY these mp3s without flash is beyond me (unless you plan to use bgsound but thats quite lame) here is a basic interface you'd be wanting to create: step 1. request song list step 2. send song list back to the mp3 player (or interface you create to work without flash) step 3. when a user chooses to PLAY a song, request a KEY from generateKey.php or whatever. in generateKey.php give a random key and store the key inside a session var for this user. like this: <?php // generate $random key session_start(); $_SESSION[$random] = "path/to/the/mp3/file"; ?> step 4. THEN send the key back to play.php and inside play.php return the CONTENT of the song: <?php session_start(); if (isset($_SESSION[$_GET['key']])) { $file = $_SESSION[$_GET['key']]; header("Content-Length: ".filesize($file)); header("Content-Type: audio/mpeg"); readfile($file); unset($_SESSION[$_GE['key']]); } ?> step 5. use the content returned to play the file.. following the above 5 steps will only show the user play.php generateKey.php and a key which will never be used more than once.. everything else is masked from the end user
  7. Excuse me, first of all, I been web developing for 5 years now, and a simple iteration of inputs is not exactly a HARD subject for me, its actually quite easy. I was simply saying this question (judging by your knowledge level) I will be here for hours trying to guide you in the right direction. Now, I could just give you code that will work good for you, but that defeats the purpose of "HELP". Also, this IS NOT the right forum for this question, so if you WANT to get helped, post in the APPROPRIATE forum. As I stated before a mod should move this. Also, I take offense to the youtube pun. Youtube is really lame for documentaries and other educational media. Its mostly for fart humor and pitch impaired 12 year-olds with fictional crack-whore parents. Best Wishes, Russell
  8. you're gonna want this function to also validate the form.. I can't camp here all day when I'm mostly here for php.. also I'm watching UFO Files and stuff and its interesting I advise some mod or something on these forums here to move this to the javascript forum, because this is in no way a PHP question, and people more interested in PHP will be more than happy to help (and they're probably also not watching UFO Files, since UFO Files is mostly for PHP Pros )
  9. strtotime($_POST['date']." ".$_POST['time']);
  10. why do you dislike array_map.. all it really is is a foreach loop and setting a new array from the values of the function you specify.. which to me is quite nice, however, I could probably have done both array_map's in 1 array_map but I'm just thinkin of that now.. also, I prefer strlen. empty works also but its just a preference <3 I appreciate the feedback though.
  11. nopes just start the session if their username and userID is in the session than they're logged in? lol, however, this isn't THE MOST secure but its the BARE BONES of any login script
  12. return true; for TRUE and.. return false; for FALSE
  13. SIMPLE! <?php $func = (($lang == "en")? "f1"($lang == "ar")? "f2":"en")); // now you use $func as if it was your function $func("whatever"); ?>
  14. continue is for loops.. e.g. $i = 0; while ($i >= 10) { $i++; echo $i."<br>"; if ($i == 11) continue; } that will give you an extra loop by continuing the loop. where exactly do you use check_auth and why are you going to such an extreme for login? and you're handling it quite wrong aswell.. logins are VERY simple you start with ofcourse.. a database connection. pretend we started one in "config.php"; <?php session_start(); include("config.php"); function passThru($x) { return ((magic_quotes_gpc())? stripslashes($x):$x); } if (strlen($_POST['username']) && strlen($_POST['password'])) { // this means the user successfully sent you the user and pass. list($user,$pass) = array_map("mysql_real_escape_string",array_map("passThru",array($_POST['username'],$_POST['password']))); // mysql_real_escape both strings AFTER we remove the slashes from magicquote. $pass = md5($pass); // md5 hash the password because security is KEY.. so when a user registers md5 hash the password $q = mysql_query("SELECT * FROM table WHERE username = '{$user}' AND password = '{$pass}'"); // execute the query to see if the user and pass exist in the database if ($row = mysql_fetch_assoc($q)) { // hes passed authorization... now you set your sessions.. $_SESSION['username'] = $row['username']; $_SESSION['userID'] = $row['userID']; } else { // he is not in the database.. deny him! header("Location: DENIED.html"); } } else { // missing a field username or password deny him! header("Location: DENIED.html"); } ?>
  15. onsubmit="return false;" in the form tag change that to: onsubmit="return theJSFunction();" and make theJSFunction() return true or false.. true to submit.. false to not submit
  16. <?php $read_path="../public_html/picture/index/original/"; $save_path="../public_html/picture/index/publish/"; $files = glob($read_path."*"); $pics = array(); while ($file = each($files)) { if (is_file($file = $file['value'])) { echo "\n$file"; $pics[]=$file; } } print_r($pics); echo '<br />count of pics:'.count($pics); ?>
  17. how canyou confirm its happening to your users? #2 I don't see the point in the redundancy here: $filename = $_FILES['uploadedfile']['name']; $pattern = '/^[a-zA-Z0-9_.-]{4,60}$/'; $valid = TRUE; $valid = $cp = checkLength($_FILES['uploadedfile']['name'], 1, 60); $em = preg_match($pattern, $filename); $valid = $valid && $em; they both do the same stuff.. what you SHOULD do is this: $filename = $_FILES['uploadedfile']['name']; if (preg_match("/^[a-z0-9_.-]*?\.[a-z0-1]{1,4}$/i", $filename)) { // everything else } and honestly why re-declare $filename like 3 times? just use 1 and to be honest try this: <?php // The Upload file script/// if (isset($maxsize)) { $filename = $_FILES['uploadedfile']['name']; if (preg_match("/^[a-z0-9_.-]*?\.[a-z0-1]{1,4}$/i", $filename)) { $newdir2 = $final_dir."/"; $newdir = "dropbox/".$classid."/".$studentid."/"; $target_path = "$newdir2$filename"; $target_path2 = "$newdir$filename"; if (file_exists($target_path)){ $error[] = "I am sorry, you allready have a file by that name uploaded."; $smarty->assign('error', $error);// Display Template $smarty->display('studrop.tpl'); } else { if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) { $up = true; } else{ $error[] = "There was an error uploading your file."; } } } } unlink($_FILES['uploadedfile']['tmp_name']); ?>
  18. mine replaces {abc(0)} with $abc[0] and {wfg} with $wfg.. whatever variables you have in the string have those variables in php variables, and it'll work just fine. theres no reason this post should have 14 posts (considering mine) and regex will not give you any advantage over plain old php, more than likely will just slow your script down as it goes back and forward and never just left to right
  19. excuse me.. this is NOT a regex question my answer does everything he needed it to do, hes just overlooking mine lol
  20. <?php $string = "this time, I eat this"; $string = preg_replace("/[^a-z1-0 ]/i",'',$string); $a = explode(' ',$string); $words = array(); while ($word = each($a)) { if (!array_key_exists($word,$words)) $words[$word] = 1; else $words[$word]++; } foreach ($words as $word => $count) { echo "$word appears $count time".(($count > 1)? 's':'')."\n<br>\n"; } ?>
  21. sorry I'm about to go to sleep, however, I can tell you for a fact it is not an error in your PHP it is the way you send your html, try validating your html with w3c's online html validator, and it will show you plenty errors that your code has that shouldn't be there, more than likely fixing the errors will fix your problem. link to validator: http://validator.w3.org/ wish you the best
  22. <?php ob_start(); $file = fopen("Inwine.txt", "r") or exit("Unable to open file!"); while(!feof($file)) { echo fgets($file). "<br />"; } fclose($file); $wine; $wine["Angove's LTD__Producer- Sherrey"] = "5.75"; $wine["Gravida__Wine Name- Claret"]= "9.50"; $wine["Mildara Wines PTY LTD__Wine Name- White Port"] = "8.69"; $wine["Angove's LTD__Wine Name- Claret"] = "11.30"; $wine["Penfolds Wine PTY__Wine Name- Riesling"] = "10.45"; $wine["Best's Wine PTY LTD__Wine Name- White Burgundy"] = "12.90"; $wine["Lake's Folly__Wine Name- Chardonnay"] = "15.70"; $wine["Chateau Yeildara__Wine Name- Rose"] = "8.50"; $wine["Coolabah__Wine Name- Lumbrussco"] = "4.90"; $wine["Barossa Valley__Wine Name- Cuvee"] = "6.75"; sort($wine); echo "----------------------------------------------<br/>"; echo "<br/>"; echo "Cheapest : \$" . $wine[0] ; echo "<br/>\n"; echo "Most expensive : \$" . $wine[count($wine)-1]; echo "<br/>"; echo "<br/>"; echo "----------------------------------------------<br/>"; $average = array_sum($wine) / count($wine); echo "<br/>"; echo "Average wine price is $$average<br/>"; echo "<br/>"; echo "----------------------------------------------<br/>"; echo "<br/>"; $out = fopen("Outwine.txt",'w'); fwrite($out,ob_get_flush()); fclose($out); echo "Created Outwine.txt file!"; ?>
×
×
  • 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.