runnerjp
-
Posts
2,214 -
Joined
-
Last visited
Posts posted by runnerjp
-
-
im looking to creat like a diary for my users... they will each have a diary where they can record the training (running)... i dont know what to do, be it a calander or a simple form ???
any suggestions?
-
LOVE IT! lol
-
how could i make the bleow code show radon friends??
<? $sql="SELECT friends.friendname, users.image FROM friends INNER JOIN users ON (users.Username=friends.friendname) WHERE friends.username='Admin' GROUP BY friends.friendname ORDER BY users.Username limit 9 "; $res = mysql_query($sql) or die(mysql_error()); echo "<table>"; $i = 0; while($row = mysql_fetch_assoc($res)){ $i++; if ($i % 3 == 0) echo '<tr>'; echo "<td><a href=\"http://www.runningprofiles.com/members/". $row['friendname'] ."\"><img src=\"http://www.runningprofiles.com/members/images/mini/" . $row['image'] . "\" /></a><br /> </td>"; if ($i % 3 == 0) echo '</tr>'; if( $i == 9 ) break; } echo "</table>"; ?>
-
im looking for more of a
name name
picture picture
name name
picture picture
name name
picture picture
-
here is my script
<? include'../../settings.php'; $sql="SELECT friends.friendname, users.image FROM friends INNER JOIN users ON (users.friendname=friends.friendname) WHERE friends.username='Admin' GROUP BY friends.friendname ORDER BY users.friendname "; // Showing $res = mysql_query($sql) or die(mysql_error()); echo '<table><tr><th>Name</th><th>Picture</th></tr>'; while($row = mysql_fetch_assoc($res)){ echo "<tr><td>" . $row['friendname'] . "</td><td><td>". $row['image"] ."</td></tr>"; } echo "</table>"; ?>
but i would like to change it as users only have 1 profile picture and i would like to have it like this
-
select friends.friendname,users.image from friends JOIN users where users.friendname=friendname.friendname order by friendname
but where do u find out what the username='Admin'
-
<?php $sql = "Select foo FROM bar"; $postsresult = mysql_query($sql) or die("Could not get threads"); $num = mysql_num_rows($postsresult); if($num < 1){echo 'is empty';}else{ echo 'show graph';} ?>
-
where are you setting the values?
-
how could i join these 2 querys
$result1=mysql_query ("SELECT friendname FROM friends WHERE username='Admin' ORDER BY friendname"); $myrow1 = mysql_fetch_array ($result); $friendname=$myrow1[friendname]; $result=mysql_query ("SELECT image FROM users WHERE friendname='$friendname'"); //loop statement while ($myrow = mysql_fetch_array ($result)) { // this is the column 1 if ($column == 1) { printf("<tr><td><b></b>%s</td>",$myrow[image]); } else{ //this is the column 2 printf("<td><b></b>%s</td></tr>",$myrow[image]); } //increment the count $count += 1; // this is a modulus operator it gets the remainder of the equation $column = $count % 2; } ?>
so then i can echo out image??
-
ok i did this
<?php require_once '../settings.php'; $q = mysql_query("SELECT friendname FROM friends WHERE username='Admin' ORDER BY friendname"); $count = mysql_num_rows($q); $results = array(); while ($line = mysql_fetch_array($q)) $results[] = $line; $split = ceil($count / 2); // then you can display it in a table echo "<table>"; for ($i = 1; $i <= $split; $i++) { $left = $i; $right = $i + $split; echo "<tr>"; echo "<td>{$results[$left][friendname]}</td>"; if ($right == $count) { // odd number of results (left column has the extra) echo "<td></td>"; } else { echo "<td>{$results[$right][friendname]}</td>"; } echo "</tr>\n"; } echo "</table>"; ?>
but i only get runnerjp putputted even though my db loos like this
id friendname username
Edit Delete 25 runnerjp Admin
Edit Delete 24 Admin runnerjp
Edit Delete 23 Princessemma Admin
Edit Delete 22 Admin Princessemma
-
im making a friends list for my profile page and want to display random friends on there profile like so
1 2
3 4
5 6
but i have no idea how to do this.... can any 1 help?
-
im presuming this is login.php?
try that..sometime spaces cause the error!...also is thius included on any page or are you looking at this directly?
<?php session_start(); // Starts the session. // Includes the db and form info. include("conf.inc.php");?> <center>try me</center> <? if ($_SESSION['logged'] == 1) { // User is already logged in. header("Location: main.php"); // Goes to main page. exit(); // Stops the rest of the script. } else { if (!isset($_POST['submit'])) { // The form has not been submitted. echo "<form action=\"login.php\" method=\"POST\">"; echo "<table>"; echo "<tr>"; echo "<td colspan=\"2\">Login:</td>"; echo "</tr>"; echo "<tr>"; echo "<td width=\"50%\">Username:</td><td width=\"50%\"><input name=\"username\" size=\"18\" type=\"text\" />"; echo "</tr>"; echo "<tr>"; echo "<td width=\"50%\">Password:</td><td width=\"50%\"><input name=\"password\" size=\"18\" type=\"text\" />"; echo "</tr>"; echo "<tr>"; echo "<td colspan=\"2\"><input type=\"submit\" name=\"submit\" value=\"Submit\"</td>"; echo "</tr>"; echo "</table>"; echo "</form>"; } else { $username = form($_POST['username']); $password = md5($_POST['password']); // Encrypts the password. $q = mysql_query("SELECT * FROM `users` WHERE username = '$username' AND password = '$password'") or die (mysql_error()); // mySQL query $r = mysql_num_rows($q); // Checks to see if anything is in the db if ($r == 1) { // There is something in the db. The username/password match up. $_SESSION['logged'] = 1; // Sets the session. header("Location: main.php"); // Goes to main page. exit(); // Stops the rest of the script. } else { // Invalid username/password. exit("Incorrect username/password!"); // Stops the script with an error message. } } } mysql_close($db_connect); // Closes the connection. ?>
-
i have a popup window where users can upload there profile picture... is there anyway in which when a users closes the popup window , it could refresh the main window and show their new avatar ???
-
-
ok you would have to have ur db filled with ip and locations ect... so a quick way is to use anouther site and pull there results like so
<? $ip = '59.93.196.219'; $url = "http://www.ipmango.com/api.php?ip=".$ip; $xml = simplexml_load_file($url); echo "IP address : {$xml->ipaddress} <br />"; echo "City : {$xml->city} <br />"; echo "Region : {$xml->region} <br />"; echo "Country Name : {$xml->countryname} <br />"; echo "Latitude : {$xml->latitude} <br />"; echo "Longitude : {$xml->longitude} <br />"; ?>
-
ok iv tried this
<?php error_reporting(E_ALL); session_start(); require_once '../settings.php'; include "../info.php"; // sets username/id ect ?><form action="<?php echo $_server['php-self']; ?>" method="post" enctype="multipart/form-data" id="something" class="uniForm"> <input name="new_image" id="new_image" size="30" type="file" class="fileUpload" /> <button name="submit" type="submit" class="submitButton">Upload/Resize Image</button> </form> <?php if(isset($_POST['submit'])){ if (isset ($_FILES['new_image'])){ $file_name = $_FILES['new_image']['name']; $getExt = explode ('.', $file_name); $file_ext = $getExt[count($getExt)-1]; // Adding extension verification $allowed_ext = "|jpg|png|gif|jpeg|svg|bmp|"; if (!strpos($allowed_ext, "|".$file_ext."|")) die("Extension: $file_ext is not allowed!"); // End extension verification $imagename = "$id.$file_ext"; $source = $_FILES['new_image']['tmp_name']; $target = "images/$id.$file_ext"; move_uploaded_file($source, $target); $imagepath = $imagename; $save = "images/thumbs/" . $imagepath; //This is the new file you saving $file = "images/" . $imagepath; //This is the original file list($width, $height) = getimagesize($file) ; // Adding proportionate image resizing, with max values /* $modwidth = 200; $diff = $width / $modwidth; $modheight = $height / $diff; */ $max_w = 200; $max_h = 200; if($width <= $max_w && $height <= $max_h){ // if it fits $modheight = $height; $modwidth = $width; }else{ // Then resize $diff = ($width > $height) ? ($width/$max_w) : ($height/$max_h); // Check which is bigger, and fit it to that max value. This will prevent stretching (80x800) $modheight = $height / $diff; $modwidth = $width / $diff; } // End $tn = imagecreatetruecolor($modwidth, $modheight) ; $image = imagecreatefromjpeg($file) ; imagecopyresampled($tn, $image, 0, 0, 0, 0, $modwidth, $modheight, $width, $height) ; imagejpeg($tn, $save, 100) ; $imagepath = $imagename; $save = "images/mini/" . $imagepath; //This is the new file you saving $file = "images/" . $imagepath; //This is the original file list($width, $height) = getimagesize($file) ; $modwidth = 80; $diff = $width / $modwidth; $modheight = $height / $diff; $tn = imagecreatetruecolor($modwidth, $modheight) ; $image = imagecreatefromjpeg($file) ; imagecopyresampled($tn, $image, 0, 0, 0, 0, $modwidth, $modheight, $width, $height) ; imagejpeg($tn, $save, 100) ; $imagepath = $imagename; $save = "images/tiny/" . $imagepath; //This is the new file you saving $file = "images/" . $imagepath; //This is the original file list($width, $height) = getimagesize($file) ; $modwidth = 40; $diff = $width / $modwidth; $modheight = $height / $diff; $tn = imagecreatetruecolor($modwidth, $modheight) ; $image = imagecreatefromjpeg($file) ; imagecopyresampled($tn, $image, 0, 0, 0, 0, $modwidth, $modheight, $width, $height) ; imagejpeg($tn, $save, 100) ; $sql = "UPDATE `users` SET image = '".$id.".".$file_ext."' WHERE ID=$id"; mysql_query($sql) or die(mysql_error()); echo "Large image: <img src='images/thumbs/".$imagepath."'><br>"; echo "MINI: <img src='images/mini/".$imagepath."'>"; echo "TINY: <img src='images/tiny/".$imagepath."'><br>"; } } ?>
Extension: jpg is not allowed! --- this is what i get though :S strange
how is this wrong?>??
$allowed_ext = "|jpg|png|gif|jpeg|svg|bmp|";
if (!strpos($allowed_ext, "|".$file_ext."|")) die("Extension: $file_ext is not allowed!");
-
i have a few questions... below is my current code for resizing my images
<?php error_reporting(E_ALL); session_start(); require_once '../settings.php'; include "../info.php"; // sets username/id ect ?><form action="<?php echo $_server['php-self']; ?>" method="post" enctype="multipart/form-data" id="something" class="uniForm"> <input name="new_image" id="new_image" size="30" type="file" class="fileUpload" /> <button name="submit" type="submit" class="submitButton">Upload/Resize Image</button> </form> <?php if(isset($_POST['submit'])){ if (isset ($_FILES['new_image'])){ $file_name = $_FILES['new_image']['name']; $getExt = explode ('.', $file_name); $file_ext = $getExt[count($getExt)-1]; $imagename = "$id.$file_ext"; $source = $_FILES['new_image']['tmp_name']; $target = "images/$id.$file_ext"; move_uploaded_file($source, $target); $imagepath = $imagename; $save = "images/thumbs/" . $imagepath; //This is the new file you saving $file = "images/" . $imagepath; //This is the original file list($width, $height) = getimagesize($file) ; $modwidth = 200; $diff = $width / $modwidth; $modheight = $height / $diff; $tn = imagecreatetruecolor($modwidth, $modheight) ; $image = imagecreatefromjpeg($file) ; imagecopyresampled($tn, $image, 0, 0, 0, 0, $modwidth, $modheight, $width, $height) ; imagejpeg($tn, $save, 100) ; $imagepath = $imagename; $save = "images/mini/" . $imagepath; //This is the new file you saving $file = "images/" . $imagepath; //This is the original file list($width, $height) = getimagesize($file) ; $modwidth = 80; $diff = $width / $modwidth; $modheight = $height / $diff; $tn = imagecreatetruecolor($modwidth, $modheight) ; $image = imagecreatefromjpeg($file) ; imagecopyresampled($tn, $image, 0, 0, 0, 0, $modwidth, $modheight, $width, $height) ; imagejpeg($tn, $save, 100) ; $imagepath = $imagename; $save = "images/tiny/" . $imagepath; //This is the new file you saving $file = "images/" . $imagepath; //This is the original file list($width, $height) = getimagesize($file) ; $modwidth = 40; $diff = $width / $modwidth; $modheight = $height / $diff; $tn = imagecreatetruecolor($modwidth, $modheight) ; $image = imagecreatefromjpeg($file) ; imagecopyresampled($tn, $image, 0, 0, 0, 0, $modwidth, $modheight, $width, $height) ; imagejpeg($tn, $save, 100) ; $sql = "UPDATE `users` SET image = '".$id.".".$file_ext."' WHERE ID=$id"; mysql_query($sql) or die(mysql_error()); echo "Large image: <img src='images/thumbs/".$imagepath."'><br>"; echo "MINI: <img src='images/mini/".$imagepath."'>"; echo "TINY: <img src='images/tiny/".$imagepath."'><br>"; } } ?>
my first question would be what would be the best size to use for a profile picture/avator ?? at the moment is have $modwidth = 200; but if i have a long picture then it looks too big..if you upload a picure nearly in all perportions then it looks great... is there anyway to make it more perpotionate or anything?
my second question would be how could i stop anything but images beeing uploaded?
-
tut i was echoing within an echo ...doh lol ty though
-
where have i made an error here??
<?php echo(" <img src='http://www.runningprofiles.com/members/images/thumbs/<?php echo $getuserimage['image'];?>' border=\"1\" align=\"middle\" /> $result[by_user] wants to be friends with you. <br/> <a href='newfriends.php?friends=accept&user=$result[by_user]'>Accept</a> or <a href='newfriends.php?friends=delete&user=$result[by_user]'>Delete</a><br/> ");?>
-
i really dont understand the j coming 1st :S
-
ok i came up with an idea... i have made it so the input into the db looks like this
<select name="distance" onchange="setDistance(this.value)"> <option value="#|Distance">Select the distance</option> <option value='withoutMinutes|C:100m' >100m</option> <option value='withoutMinutes|E:200m'>200m</option> <option value='withoutMinutes|F:400m'>400m</option> <option value='withoutHours|H:800m'>800m</option> <option value='withoutHours|I:1500m'>1500m</option> <option value='withoutHours|J:3000m'>3000m</option> <option value='withoutHours|L:5000m'>5000m</option> <option value='withoutHours|N:10,000m'>10,000m</option> <option value='withoutHours|M:5k Road'>5k Road</option> <option value='withoutHours|O:10k Road'>10k Road</option> <option value='withHours|P:H Marathon'>H Marathon</option> <option value='withHours|Q:Marathon'>Marathon</option> <option value='withoutHours|K:3k S/Chase'>3k S/Chase</option> <option value='withoutMinutes|D:110m Hurdles'>110m Hurdles</option> <option value='withoutMinutes|G:400m Hurdles'>400m Hurdles</option> <option value='withoutMinutes|A:60m (I)'>60m (I)</option> <option value='withoutMinutes|2B:60m Hurdles'>60m Hurdles</option> </select>
so when i run an my script it should show reults in dec order..
a
b
c
d
e
ect
so i ran the script
<?php $result = mysql_query("SELECT * FROM pb where uid='".$getuser['ID']."' Order by pb DESC") or die(mysql_error()); $num2 = mysql_num_rows($result); echo "<table class=\"profilepbs\" width=195 align=\"center\" cellpadding=\"0\" cellspacing=\"0\"> <tr><td width=105 ><div align=\"center\">Distance</div></td><td width=125><div align=\"center\">Pb</div></td></tr> <tr> <td height=\"1\" colspan=\"2\" bgcolor=\"#000000\"></td> <td height=\"1\" colspan=\"2\" bgcolor=\"#000000\"></td> </tr> "; while ( $row = mysql_fetch_array($result) ) {echo "<tr><td bgcolor=\"#FFFFFF\"><center>" . $row["distance"] . "</center></td><td bgcolor=\"#FFFFFF\"><center>" . $row["pb"] . "</center></td></tr>"; } if($num2 < 1) {echo "<tr><td bgcolor=\"#FFFFFF\" ><center> N/A </center></td><td bgcolor=\"#FFFFFF\"><center> N/A </center></td></tr>";} echo "</table> <p>"; ?>
the confusing thing is this is my output
why is J 1st :S
also i cant rember but whats the function so i can get rid of the 1st 2 thing so A:100m will become 100m
-
ok i used this
<?php if ($username != $profilesname) {echo '<div align=\"center\"><a href=include/friendrequest.php?username='.$profilename.' class="popup">Add to frinds list</a></div>';}?>
then i included a file <script type="text/javascript" src="http://www.runningprofiles.com/popup.js"></script>
on this is
var newWin = null; function popUp(strURL, strType, strHeight, strWidth) { if (newWin != null && !newWin.closed) newWin.close(); var strOptions=""; if (strType=="console") strOptions="resizable,height="+ strHeight+",width="+strWidth; if (strType=="fixed") strOptions="status,height="+ strHeight+",width="+strWidth; if (strType=="elastic") strOptions="toolbar,menubar,scrollbars,"+ "resizable,location,height="+ strHeight+",width="+strWidth; newWin = window.open(strURL, 'newWin', strOptions); newWin.focus(); } $("a.popup").click(function{window.open($(this).attribute("href")); return false;} // jquery // non jquery solution. function popUps() { var links = document.getElementsByTagName('a'); for(var i = 0; i < links.length; i++) { if (links[i].className && links[i].className == 'popup') { links[i].onclick = function () { window.open(this.href); return false; } } } window.onload = popUps;
but no pop up happens...just a normal page redirect
-
how would i display thins link using php echo
<?php if ($username != $profilesname) echo { '<div align=\"center\"><a href=\"http://www.runningprofiles.com/members/include/friendrequest.php?username=$profilename\" onclick=\"popUp(this.href,'console',200,500);return false;\" target=\"_blank\">Add to frinds list</a></div>';?>
-
completed it .... this is what i did!
<?php $result = mysql_query("SELECT * FROM pb where uid='".$getuser['ID']."' Order by pb") or die(mysql_error()); $num2 = mysql_num_rows($result); if($num2 < 1) {echo 'what ever';}
suggestions for a diary
in PHP Coding Help
Posted
sounds good to me...do you know where i could get code to make a calander... never done that and seems way out my league... i would be able to edit it then to meet the demands lol