-
Posts
9,409 -
Joined
-
Last visited
-
Days Won
1
Everything posted by MadTechie
-
basically it replaces the letters and the dot with nothing thus leaving the number only the first code should start like this list_files("data/myimages/") function list_files($dir) { //...snip
-
Filter out being remove.. so try this $data= preg_replace('/\b[A-Z0-9._%+-]+\s?(@|#|at)\s?[A-Z0-9.-]+\s?\.\s?[A-Z]{2,4}\b/si', '', $data); please note this is the wrong section, we have a regex section
-
you may want to post the way your using the list_files function as for the 2nd question replace print"$file <br />"; with $filedisplay = preg_replace('/[a-z.]/si', '', $file); print"$filedisplay <br />";
-
in which case the reply would be from "appinclude.php", remember if you assume something you make an ass out of u and me lol
-
[SOLVED] Invalid argument supplied for foreach()
MadTechie replied to bronzemonkey's topic in PHP Coding Help
for small sections on HTML i use the echo, i wouldn't go as far as saying it better but i find it easier to read anything over about 10 lines of static html i'll probably use the php close tag ?> then reopen it after the html EDIT: just noticed a mistake change echo " <li>' . $value . '</li>\n"; to echo " <li>$value</li>\n"; -
[SOLVED] Dynamic drop down menu from sql with "add", how?
MadTechie replied to felipeebs's topic in PHP Coding Help
OK some basic html/JS heres an example ValidateForm <script language = "Javascript"> function ValidateForm(){ var emailID=document.frmSample.txtEmail if ((emailID.value==null)||(emailID.value=="")){ alert("Please Enter your Email ID") emailID.focus() return false } return true } </script> <form name="frmSample" method="post" action="#" onSubmit="return ValidateForm()"> <p>Enter an Email Address : <input type="text" name="txtEmail"> </p> <p> <input type="submit" name="Submit" value="Submit"> </p> </form> i think thats what your after! -
personally i think you mean break for a loops, switch or if, but if you just want to exit the funtion why not use return ?
-
i'm sure AndyB was talking about the script of the file in question.. not the script to the whole project!
-
[SOLVED] Dynamic drop down menu from sql with "add", how?
MadTechie replied to felipeebs's topic in PHP Coding Help
this may help Dynamic DropDown PHP/AJAX $NewData = ""; while ($row = mysql_fetch_array($result,MYSQL_ASSOC)) { $NewData .= "<option value='".$row['ID']."'>".$row['Name']."</option>\n"; } echo '<select name="select">'; echo $NewData; echo '</select>'; -
OK, if were done, can you click topic solved (bottom left) again sorry (will try think before posting)
-
[SOLVED] Invalid argument supplied for foreach()
MadTechie replied to bronzemonkey's topic in PHP Coding Help
OK. cool, maybe this would be a better solution .. <?php switch(strtolower($page)) { default: //break; //not using break here to the default will be home case "/home.php": $links[] = '<a href="#">#</a>'; $links[] = '<a href="#">#</a>'; $links[] = '<a href="#">#</a>'; break; case "/about.php": $links[] = '<a href="#">#</a>'; $links[] = '<a href="#">#</a>'; $links[] = '<a href="#">#</a>'; break; } echo ' <div id="links">\n'; echo ' <h3>#</h3>\n'; echo " <ul>\n"; //don't need to check to see if its an array as the default create the array foreach ($links as $value) { echo " <li>' . $value . '</li>\n"; } echo " </ul>\n"; echo " </div>"; ?> -
I was not aimed solely at you, i have had a lot of post and PM's asking how do in intergreat this and that.. and i seams to of targetted you.. i apologise for my last post (just a stressful week) lots on and no one was helping you so i updated the script but as i was posting it i thought why the hell am i doing this i have too much to do already..
-
[SOLVED] Invalid argument supplied for foreach()
MadTechie replied to bronzemonkey's topic in PHP Coding Help
for the newlines (\n) see below (basically how i would would do it) if you do a var_dump($page); what is returned? <?php if(strpos($page, 'home.php') !== false) { $links[] = '<a href="#">#</a>'; $links[] = '<a href="#">#</a>'; $links[] = '<a href="#">#</a>'; }elseif(strpos($page, 'about.php') !== false){ $links[] = '<a href="#">#</a>'; $links[] = '<a href="#">#</a>'; $links[] = '<a href="#">#</a>'; } echo ' <div id="links">\n'; echo ' <h3>#</h3>\n'; if(is_array($links)) { echo " <ul>\n"; foreach ($links as $value) { echo " <li>' . $value . '</li>\n"; } echo " </ul>\n"; } echo " </div>"; ?> -
[SOLVED] Invalid argument supplied for foreach()
MadTechie replied to bronzemonkey's topic in PHP Coding Help
their can be times when the links isn't an array.. (ie $page = "") so change <?php foreach ($links as $value) { echo '<li>' . $value . '</li> '; } ?> to <?php if(is_array($links)) { foreach ($links as $value) { echo '<li>' . $value . '</li><br>'; //added <br> to put the break inn } } ?> as a side note try this $links[] = "<a href=\"/#.php\">#</a>"; $links[] = "<a href=\"/#.php\">#</a>"; $links[] = "<a href=\"/#.php\">#</a>"; $links[] = "<a href=\"/#.php\">#</a>"; will all of them as it will build the array (no sense adding the numbers when PHP will do it for you) -
as i said its a heres a complete solution <?php $data = file_get_contents ("data.txt"); $IPArray = explode("\n",$data); $IPcounter = array(); foreach($IPArray as $IPS) { list($Time, $IP) = explode(",",$IPS); if(array_key_exists($IP, $IPcounter)) { $IPcounter[$IP]['IP'] = $IPcounter[$IP]['IP'] +1; }else{ $IPcounter[$IP]['IP'] = 1; } $IPcounter[$IP]['Times'][] = $Time; } $search = "65.32.58.50"; echo "$search found {$IPcounter[$search]['IP']} times, at the follow times<br>"; foreach($IPcounter[$search]['Times'] as $times) { echo date ("F j, Y, g:i a", $times); echo "<br>"; } ?> 1188345112,65.32.58.50 1188345256,65.32.58.50 1188345514,65.32.58.50 1188345605,65.32.58.50 1188345676,65.32.58.50 1188345751,65.32.58.50 1188345794,65.32.58.50 1188345805,65.32.58.50 1188346081,65.32.58.50 1188346182,65.32.58.50 1188346237,65.32.58.50 1188346257,65.32.58.50 1188346291,65.32.58.50 1188346322,65.32.58.50 1188346424,65.32.58.50 1188346454,65.32.58.50 1188346498,65.32.58.50 1188346535,65.32.58.50 1188346705,65.32.58.50 1188346784,65.32.58.50 1188346810,65.32.58.50 1188346826,65.32.58.50 1188346849,65.32.58.50 1188347022,65.32.58.50 1188347111,65.32.58.50 1188347429,65.32.58.50 1188347452,65.32.58.50 1188387152,65.32.58.50 1188387162,65.32.58.50 1188387230,65.32.58.50 1188387663,65.32.58.50 1188512902,65.32.58.50 As a side note, were here to help, not write the code for you.. personally it depends on the day i have had (today: full of stress)
-
Yes thats insecure but i don't want to say much more.. i don't think cracking is approved by this site..!
-
You need to click new topic from here you would need to create either a FlatFile storage or MySQL to store the downloads MySQL would be better.. please start the new thread..
-
try reading the logic....! Sighs.. <?php $username = $_POST['username']; $password = $_POST['password']; $username = strtolower($username); $password = strtolower($password); $all_users = file("users.db.php"); $freeuser = true; foreach($all_users as $user_line) { $user_arr = explode(" | ", $user_line); if($user_arr[0] == $username) { echo 'This username has already been taken! <a href="register.php">Try again</a>'; $freeuser = false; break; } } if($freeuser) { $File = "users.db.php"; $Handle = fopen($File, 'a'); $Data = $username; fwrite($Handle, $Data); $Data = ' | '; fwrite($Handle, $Data); $Data = md5($password); fwrite($Handle, $Data); $Data = ' | '; fwrite($Handle, $Data); $Data = "4\n"; fwrite($Handle, $Data); print "You have registered successfully! click <a href=index.htm>here</a> to return to the login screen"; fclose($Handle); mkdir("$username", 0700); } ?>
-
After some tests, it seams there is no workaround. The automatic login option in IE works with integrated authentication only. This is because basic authentication, exposes the password (at both the network and application layers)
-
1. its the same as a text file, just need to make it executale 2. if thats codes at fault then wheres the fault /problem?
-
i wouldn't worry too much.. but unless you go over 255 chars (some old clients may fail) well you asked so
-
do var_dump function storeNewCookie($session_id) { var_dump($this->cookie_expire_length); die; setcookie ($this->cookie_name, $session_id, $this->cookie_expire_length); } see whats returned.. this may fix it (its a total guess) function storeNewCookie($session_id) { $x = (int)$this->cookie_expire_length; $x = time()+$x; setcookie ($this->cookie_name, $session_id, $x); }
-
OK heres a basic example <form method="post" enctype="multipart/form-data" > <input name="images[]" type="file" /><br /> <input name="images[]" type="file" /><br /> <input name="images[]" type="file" /><br /> <input name="submit" type="submit" value="sumit" /> </form> <?php upload(); function upload() { if( isset($_FILES) ) { foreach($_FILES['images']['name'] as $K => $V) { if(!empty($V)) { $target_path = "uploads/"; $target_path = $target_path . basename($V); if(@move_uploaded_file($_FILES['images']['tmp_name'][$K], $target_path)) { echo "The file ".basename($V)." has been uploaded<br />"; } else{ echo "There was an error uploading the file '".basename($V)."', please try again!<br />"; } } } } } ?> NOTE: remove the @ from "@move_uploaded_file" if you have problems (it will show the error)
-
simple script, http://www.phpfreaks.com/forums/index.php/topic,156653.msg681151.html#msg681151
-
I'm not 100% sure what your looking for.. but if you wish to check if the regex was valid then maybe use preg_last_error, example <?php $RegEx = "/\s/si"; $String = "testing"; $data = @preg_replace($RegEx, $String); switch(preg_last_error()) { case 0: //no error break; case 1: echo "PREG_INTERNAL_ERROR"; break; case 2: echo "PREG_BACKTRACK_LIMIT_ERROR"; break; case 3: echo "PREG_RECURSION_LIMIT_ERROR"; break; case 4: echo "PREG_BAD_UTF8_ERROR"; break; } ?>