Jump to content

merylvingien

Members
  • Posts

    267
  • Joined

  • Last visited

Everything posted by merylvingien

  1. Hi folks, just wondering if there is a quicker, shorter way of coding this: <p>Which of the following best describes your religion:<br> <select name="religious"> <option <?php if ($religious == 0) {echo 'selected="selected"';} ?> value="0">Non religious</option> <option <?php if ($religious == 1) {echo 'selected="selected"';} ?> value="1">Christianity</option> <option <?php if ($religious == 2) {echo 'selected="selected"';} ?> value="2">Hinduism</option> <option <?php if ($religious == 3) {echo 'selected="selected"';} ?> value="3">Buddhism</option> <option <?php if ($religious == 4) {echo 'selected="selected"';} ?> value="4">Chinese traditional religion</option> <option <?php if ($religious == 5) {echo 'selected="selected"';} ?> value="5">Judaism</option> <option <?php if ($religious == 6) {echo 'selected="selected"';} ?> value="6">Atheist</option> <option <?php if ($religious == 7) {echo 'selected="selected"';} ?> value="7">Other</option> </select></p> I have a page with a load of options and to go through all of these is making the code huge. Any quicker ways?
  2. Hi Folks, i have been at this for ages and its now depressing me as i cannot figure out why i cant get it to work. I am using a re-hashed version of a facebook style wall post system where it limits the amount of replies, you click a button and gets the next set and so on until there are no more results to get. The original script runs ok but is not really suitable for what i need So to my script which is based loosley on the same principal. Ok i have a veiwmember.php page which uses pagination to limit the amount of wall posts to 5. I have included the various javascript files jquery and another which is needed. The function used is this one: <script type="text/javascript" src="jquery.livequery.js"></script> <script type="text/javascript" src="jquery-1.2.6.min.js"></script> <script type="text/javascript"> //more records show $('a.more_records').livequery("click", function(e){ var next = $(this).attr('id').replace('more_',''); $.post("data.php?show_more_post="+next, { }, function(response){ $('#bottomMoreButton').remove(); $('#posting').append($(response).fadeIn('slow')); }); }); </script> The php code in veiwmember.php that gets the wall posts is: Pagination code here <?php $getwallposts= ("SELECT * FROM wallposts WHERE recipientid='$memberid' ORDER BY id DESC LIMIT $offset, $rowsperpage"); $result = mysql_query($getwallposts,$con); while ($row2 = mysql_fetch_assoc($result)) { $messageid= $row2['id']; $senderid= $row2['senderid']; $wallpost= $row2['wallpost']; $timesent= $row2['timesent']; $timestamp = strtotime($timesent); $likes= $row2['likes']; $getname= ("SELECT fname, lname, image1 FROM memocp WHERE unid='$senderid'"); $nameresult= mysql_query($getname,$con); while ($rowws = mysql_fetch_array($nameresult)) { $fname= $rowws['fname']; $lname= $rowws['lname']; $wallpostprofilethumb= "{$rowws['image1']}"; if (empty($wallpostprofilethumb)) {$wallpostprofilethumb= "noimage.png";} } ?> <div class="wallpost"><div class="from"><div class"profilethumb"><img src="profilethumb/<?php echo $wallpostprofilethumb; ?>"></div><a href="veiwmember.php?membid=<?php echo "$senderid"; ?>"><?php echo "$fname $lname"; ?></a></div><div class="postbody"><?php echo txt2link($wallpost) ?><div class="timesent"><?php echo date('l jS F Y @ H:i a', $timestamp); ?></div></div><div class="likes"><form action="like.php" method="post"><?php if (isset($_GET['currentpage'])) {$currentpage= $_GET['currentpage']; echo "<input name=\"currentpage\" type=\"hidden\" value=\"$currentpage\">";} ?><input name="messageid" type="hidden" value="<?php echo "$messageid"; ?>"><input name="base" type="hidden" value="<?php echo "$memberid"; ?>"><input name="like" type="image" src="ima/like.jpg"><?php echo " $likes people like this"; ?></form></div></div> <?php include_once('data.php'); ?> <?php } rest of pagination The pagination sort of works, but only displays one result per page when it should show 5 results plus how ever many replies, but i can sort that out later, would prefer to get the replies working first. You will see that data.php is included which gets the replies to the wall posts. It should limit the amount of replies shown to five, and then if there is more, it will show a link to get more. If that link is clicked it should get the next five results and show them. However it shows the first five and the link if there are more results, but if the link is clicked, nothing happens. data.php require ("database.php"); $next_records = 5; $show_more_button = 0; if(isset($_REQUEST['show_more_post'])) // more posting paging { // button has been clicked so we need to get next set of results $next_records = $_REQUEST['show_more_post'] + 5; $result = mysql_query("SELECT * FROM wallreplies2 WHERE messageid='$messageid' ORDER BY wallreplyid DESC limit ".$_REQUEST['show_more_post'].", 5"); // see if there are any more replies to get $check_res = mysql_query("SELECT * FROM wallreplies2 order by wallreplyid DESC limit ".$next_records.", 5"); $show_more_button = 0; // button in the end $check_result = mysql_num_rows($check_res); if($check_result > 0) { // if there any more results counted the button needs to be shown $show_more_button = 1; } } // if the button hasnt been clicked we need to get the first results else { // lets count the number of results that exist $countreplies= mysql_query("SELECT * FROM wallreplies2 WHERE messageid='$messageid'"); $countresult= mysql_num_rows($countreplies); // if there are more than 5 results if ($countresult > 5) { // the button needs to be shown $show_more_button = 1; } else { // if there are 5 or less replies in total, dont show the button $show_more_button = 0;} //there are only 5 or less replies to get so get the first results $result = mysql_query("SELECT * FROM wallreplies2 WHERE messageid='$messageid' ORDER BY wallreplyid DESC limit 0,5"); } //$replyresult = mysql_query($result,$con); while ($roww = mysql_fetch_array($result)) { $wallreplyid= $roww['wallreplyid']; $sendid= $roww['senderid']; $wallreply= $roww['wallreply']; $time= $roww['timesent']; $Timestamp = strtotime($time); $like= $roww['likes']; $getreplynames = ("SELECT fname, lname, image1 FROM memocp WHERE unid='$sendid'"); $nameresults = mysql_query($getreplynames,$con); while ($roww = mysql_fetch_array($nameresults)) { $fnames= $roww['fname']; $lnames= $roww['lname']; $wallreplyprofilethumb= "{$roww['image1']}"; if (empty($wallreplyprofilethumb)) {$wallreplyprofilethumb= "noimage.png";} } ?> <div class="wallreplies" id="record-<?php echo"$wallreplyid"; ?>"> <div class="wallreplywrap"> <div class="wallfrom"> <div class"profilethumb"><img src="profilethumb/<?php echo $wallreplyprofilethumb; ?>"></div> <a href="veiwmember.php?membid=<?php echo "$sendid"; ?>"><?php echo"$fnames $lnames"; ?></a> </div> <div class="wallmessbody"><?php echo txt2link($wallreply) ?></div> <div class="timesent"><?php echo date('l jS F Y @ H:i a', $Timestamp); ?></div> <div class="likes"><form action="like2.php" method="post"><?php if (isset($_GET['currentpage'])) {$currentpage= $_GET['currentpage']; echo "<input name=\"currentpage\" type=\"hidden\" value=\"$currentpage\">";} ?><input name="messageid" type="hidden" value="<?php echo "$wallreplyid"; ?>"><input name="base" type="hidden" value="<?php echo "$memberid"; ?>"><input name="like" type="image" src="ima/like2.jpg"><?php echo " $like people like this"; ?></form> </div> </div> </div> <?php } if($show_more_button == 1){ echo "<div class=\"bottomMoreButton\"> <a id=\"more_$next_records\" class=\"more_records\" href=\"javascript: void(0)\">Get more replies</a> </div>"; }?> <div class="wallreply"> <form action="wallreply.php" method="post"> <input name="sendrid" type="hidden" value="<?php echo "$loginuniqid"; ?>"> <input name="messageid" type="hidden" value="<?php echo "$messageid"; ?>"> <input name="base" type="hidden" value="<?php echo "$memberid"; ?>"> <?php if (isset($_GET['currentpage'])) {$currentpage= $_GET['currentpage']; echo "<input name=\"currentpage\" type=\"hidden\" value=\"$currentpage\">";} ?> <textarea class="newwallpostreply<?php echo $i++ ; ?>" name="wallreply" autocomplete="off" maxlength="1000" placeholder="Reply"></textarea> <span class="wallreply-holder<?php echo $p++; ?>"> <div class="button_block"> <input type="submit" class="post" value="Post"> <input type="submit" class="cancel" value="Cancel"> </div> </span> </form> </div> I know its a lot of info there, but if anyone can see the problem i would be greatful.
  3. Many thanks, that works a treat, i must admit that i need to really study up on regex stuff, its not my strong point.
  4. Hi Folks, ive run up against a bit of a problem that i cant fathom out I have a function that sorts links from a string and turns them into proper links to be displayed function txt2link($text){ $text = str_replace( "www.", "http://www.", $text ); $text = str_replace( "http://http://www.", "http://www.", $text ); $reg_exUrl = "/(http)\:\/\/[a-zA-Z0-9\-\.]+\.[a-zA-Z]{2,3}(\/\S*)?/"; if(preg_match($reg_exUrl, $text, $url)) { $text = preg_replace($reg_exUrl, '<a href="'.$url[0].'" rel="nofollow">'.$url[0].'</a>', $text); } return ($text); } However, when i post a image from say photobucket with the tags, i want to be able to sort those into <img> tags But this function interferes with the url as it finds the http://www. or the www. within the string Any ideas how to get round this?
  5. Thanks for the replies, the script will only run if there are matching id's in the database, or it will run a different script. That all works ok. This only happens every now and again, so trying to echo out the problem isnt really going to help. I have brain ache over this problem as 99% of the time it works just as it should do. On a semi ded server too, so there are no preformance problems etc...
  6. Hi Folks, wonder if anyone has any clue to what is happening here. 24. $sqlarray = ("SELECT * FROM table WHERE id='$id'"); 25. $resultarray = mysql_query($sqlarray,$con)or trigger_error('<p>There seems to be a problem, please try again soon.</p>'); 26. while($rowarray=mysql_fetch_assoc($resultarray)){ 27. $lat[] = $rowarray['lat']; 28. $long[] = $rowarray['long']; 29. } 30. $averagelat= array_sum($lat) / count($lat); 31. $averagelong= array_sum($long) / count($long); Every now and again i get an error with this code, but it is intermitent and doesnt always happen which is confusing when trying to work out why it is happening. PHP Warning: array_sum() expects parameter 1 to be array, null given in /home/blah/blah on line 30 PHP Warning: Division by zero in /home/blah/blah on line 30 PHP Warning: array_sum() expects parameter 1 to be array, null given in /home/blah/blah on line 31 PHP Warning: Division by zero in /home/blah/blah on line 31 I would assume that on some pages the array is empty but i have checked the database and all fields are occupied and i have also checked that none of them are null. Any ideas?
  7. Looks like your using the get method when a user logs in??? Dont do this, you need to rewrite your code using the POST method, select from your database where the username and password match, then set a session id. When you use the get method, the variables are stored in the url and can be changed by the user.
  8. Sorted it!!! Had to change the way that some other variables were defined which i still dont quite understand. But hey ho.
  9. if ($rememberme=="off"){ session_start(); $_SESSION['uniquelogon'] = "$uniquelogon";} header ("Location: index.php"); exit(); } else $output= '<span class="error">argh</span>'; } } } Like that you mean? which is what AbraCadaver suggested, which i have already tried. Ive tried all sorts of different combinations but nothing i do will display! I cant understand where i am going wrong here.
  10. Thanks for the reply, but ive tried that already, nothing i do will work! Zilch!
  11. What the hell am i missing here?? Trying to set the $output so if there are any errors it will display a message. If no email or password is entered the $output is echoed fine But if the wrong email or password is entered the $ouptut is not echoed at all??? if (loggedin()){ header ("Location: index.php"); exit(); } if (isset ($_POST['login'])) { $email= $_POST['email']; $password= $_POST['password']; if (isset ($_POST['rememberme'])) {$rememberme= $_POST['rememberme'];} if (isset($rememberme)) {$rememberme= "on";} else {$rememberme= "off";} if (empty($email)) {$output= "<span class='error'>Please enter a username or password</span>";} if (empty($password)) {$output= "<span class='error'>Please enter a username or password</span>";} if ($email&&$password) { $login= mysql_query ("SELECT * FROM user WHERE email='$email'"); while ($row= mysql_fetch_assoc($login)) { $passwordcheck = $row['password']; if (md5($password)==$passwordcheck) $loginok = true; else $loginok = false; if ($loginok==true) { $uniquelogon = "{$row['uniqlogon1']}"; if ($rememberme=="on"){ setcookie("uniquelogon", $uniquelogon, time()+2628000);} else if ($rememberme=="off"){ session_start(); $_SESSION['uniquelogon'] = "$uniquelogon";} header ("Location: index.php"); exit(); } else echo "<span class='error'>Your Email or Password do not match our records</span>"; } } } <?php if (!empty($output)) {echo $output;} ?> <form action"login.php" method="POST"> <p>Email:<br> <input type="text" name="email"> </p> <p>Password:<br> <input id="pwd" type="password" class="required lock pad" watermark="{html:'Password',cls:'pad empty'}" name="password"> </p> <p> <input type="checkbox" name="rememberme"> Remember Me!<br> </p> <input type="submit" name="login" value="Log In"> </form> Ive used all my special powers trying to get this to work, but i am missing something...
  12. merylvingien

    opacity

    I have two divs, both with id, outerbox and overlay overlay is inside the outerbox, and the outerbox has a opacity of 0.7 overlay has an opacity of 1.0 but overlay still shows as opacity of 0.7 here is the css: div#outerbox {position: absolute; top: 0; left: 0; z-index: 90;opacity:0.7; width: 100%;height:200%; background-color: #000;} div#overlay { position: relative; background-color: #ffffff; width: 500px; height: 250px; margin: 0 auto;z-index:100;opacity:0.7;border:3px solid #000;padding:10px;} anyone know why the overlay is picking up the outerbox style? when debugging with firebug, its saying that the overlay has an opacity of 1, but the display shows different.
  13. Ive actually nearly solved it myself, you dont need java, php is more than capable of handling this. header ("refresh:5;url=www.domain.com/url"); Just need to display it properly now.
  14. Hi guys and gals, i have two sites which interact with each other, if someone lands on my local site and searches, if the answer isnt found it will transfer them to my other site which has a wider range for what they are looking for. My question is, how would i go about delaying the transfer and displaying a message that the user is now being transfered to a different site? I was thinking something similar to one of those uploading please wait type overlays or somthing? Any ideas would be useful, at the moment its done with a simple form and php, but is instant.
  15. $today = date('y-m-d'); $secondpart= rand (1, 9999999999); $uniqueidcode= "$today $secondpart"; $uniqueidcode= md5($uniqueidcode); $uniqueidcode is your product id code
  16. ive just checked one of my sites and i have a working redirect setup as i posted above and it works ok.
  17. Surely its just a simple 301 redirect? redirect 301 /this_page.php?id= http://www.site.com/this_New_page.php?id=
  18. http://www.google.co.uk/images?hl=en&xhr=t&q=phone+icons&cp=11&um=1&ie=UTF-8&source=og&sa=N&tab=wi&biw=1264&bih=564 There is a little site called google! Its really helpful for this type of thing. Bookmark it: http://www.google.com
  19. Have you tried adding any spaces between your testestestestestestest... I dont know of any words that long lol supercalifragilisticexpialidocious is about the longest one i can remember...
  20. Sorry, i should have marked this topic as solved, its not really solved as its about IE. I resorted to changing the doctype for the pages that were affected then used an iframe.
  21. I thought i had this fixed already... I am trying to add a facebook like button to a few of my sites main pages. But ran into validation problems with the crap iframe code that they spurt out. So found a workaround that does validate and works great in firefox. Trouble starts when i dare open up internet exploder. Nothing, just a blank space which to be honest is more than i expected from such a shit peice of software! Unfortunatley the rest of the world appears to actually like it??? go figure... Anyway, i am trying to get this code to both validate and work in IE <object type="text/html" data="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.mysite.com&layout=button_count&show_faces=false&action=like" style="border:none; width:72px; height:20px;margin-left:1px;"> </object> Any clues would be great, or should i just ditch the whole idea and strangle myself with a print out of the microsoft logo?
  22. I think this shopping cart solution deals with downloads, will save a whole load of pissing about trying to code your own! http://www.opencart.com/
  23. As some of you will probably know already, the facebook like button will not validate under a strict doctype. I have done a few searches to see whats available and the best i have found is this: <object type="text/html" data="http://www.facebook.com/plugins/like.php?href=http://www.somesite.com/" style="border:none; width:25em; height:2.5em"></object> The only trouble is the display, does anyone know how to make the above code display without showing faces and instead of telling the world who likes the page, just show "like"? Any comments would be great, so long as they are helpful
  24. Can you clarify what you are trying to do? You want to update the user table with the $name variable. I get that, but whats "text"? Is text another variable?
  25. Looks good, professional! Not overdone just becuase you can LOL I would add a couple more rows of images on the right, there is a lot of emtpy space there, and i agree, make them all the same size, they look a bit odd with different heights and widths. Apart from that, good job and a good idea, hope it works out well.
×
×
  • 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.