PHP - How Do They Achieve These Effect
There are two effects that I have seen on website and keep wondering how they have been achieved. The first is when you go on Facebook and you type a link into your status bar. Then Facebook will automatically get some information about that article. The second effect is something I have seen on twitter and other websites. If you scroll down to the bottom of the page it will detect this and then load more content.
If anyone could link me to any article or tutorials explain how these effects have been done that would be great. Thanks for any help. Similar TutorialsI was thinking of ways I could use use PHP to make an iframe dissapear when the user has clicked the submit button in the iframe. I was thinking there is probably no way to tell if the user has submitted the form in the iframe? I tried using unset(), with the iframe code being a variable. I echoed the iframed form, and placed a submit button below the iframe. When the user is done with the iframe form, they click the submit button below it and it will dissapear. Ive done that, but I was wondering would it be possible at all to make the frame dissapear once the user has clicked the submit button IN the iframe? If not possible with PHP maybe javascript? IDK, suggestions would be appreciated. Thanks Hi, I have table called done in mysql and there is a row which is filled with the users id and another row with todays date. Now what I want to know which three users participated the most with filling out stuff on the website according to todays date. For instance First user filled out 5 2nd user filled out 3 3rd user filled out 2 You get the idea. I dont know what type of query should I write to extract the data based on the users id and how many times they participated on the particular day. Another example of the table is 1st column user id = 20 time= todays date 2nd column user id= 20 time = todays date Showing the user participated twice on the day. Thanks any help is appreciated. I have a form which has both radio buttons and textfields. Each individual radio button is associated with a form field. For this example, lets say the Radio button references a tool name and the form field represents a quantity, or number of tools needed for a certain job. So the form would look as follows: Quote o Some Tool Quantity ___ (<-- lets pretend thats a form field) The question is, how would I go about adding the tool and quantity to the same row in the database if I am creating a new row? The simple way would be have each radio button and quantity be its own entity in the HTML. For example: Code: [Select] <input name="tool1" type="radio" value="Hammer" /> <input name="tool_quantity1" type="text" /> <input name="tool2" type="radio" value="Wrench" /> <input name="tool_quantity2" type="text" /> However easy this method may be, and however functional it may work, it is not how I wish to achieve this because we are talking maybe 100 tools. I think it would be easier using some kind of loop function that goes through an array of anything that has some form of data stored in it. For example, instead of the code being the above, I would like to change it to the following: Code: [Select] <input name="tools[]" type="radio" value="Hammer" /> <input name="tools_quantity[]" type="text" /> I understand the basic foreach function Code: [Select] foreach ($_POST['tools'] as $someVariableName) { //do some stuff } But I don't understand how I can get the value of 2 different form fields and have them associated with one another. I want the tool and the quantity of tools to be stored in the same row. How is this done? Is this even possible using a loop function like foreach or while? Please help! As always, any help would be greatly appreciated!! Bl4ck Maj1k Hi, what i am after is for instance, the user is viewing my website. He is in a different section on my website and there is a sign in button. The user goes to the sign in page, now what i want is when the user logs in, the user to be redirected back to the section which he was viewing before signing in. Basically in more clear words, I want the user to return to the content he was viewing after logging in. Hello all, I'm looking for some advice on a problem. I have a very basic web page containing three section, the header, the content and the footer in that order. What I would like is the header and footer always on the page and only the content section change by means of links in a navigation bar. I've looked into iframes, php include, javascript and something called Ajax and must say I'm all a bit confused by it all. Which would be most advisable and how would I excecute it. My pages are as follows. Home page is. index.php Pages I would like to show in the content Div. about.php contact.php home.php If you need any more information, please let me know. Thank you in advance for your help.
I am following the below module, Okay, Earlier on I asked someone if they could show me a shorter way of making letters one higher, Like A becomes B and B becomes C in a string. I was wondering if using this code: for($i=0, $n=strlen($text); $i<$n; ++$i) { $val = ord($text[$i]); if(($val>=65 && $val<=90) || ($val>=97 && $val<=122)) { $base = ($val<=90) ? 65 : 97; $text[$i] = chr($base + ($val-$base+1)%26); } } I could reverse it's effect and make A become Z and B become A in a string. Thanks in advance! I want to link to a movie but I'd like to create an onrollover slideshow effect so that when the image that links to the movie is mouseover, it slowly slideshows each of the 4 images that I specify. Hi, I have this script which does what it is meant to do. I have assigned session_id() to the variable $sid so I can use it when logging in to a users account, however I get this error. How do I get around this? Warning: Unknown: Your script possibly relies on a session side-effect which existed until PHP 4.2.3. Please be advised that the session extension does not consider global variables as a source of data, unless register_globals is enabled. You can disable this functionality and this warning by setting session.bug_compat_42 or session.bug_compat_warn to off, respectively. in Unknown on line 0 As this is going to be installed on many servers, I do not want to have to edit the php.ini file on each one so as not to get this error. Is there an alternative way to assign the session_id() as so $sid = session_id(); so this doesnt happen? Code: [Select] <div id="pageNav"> <div id="sectionLinks"> <a href="admin.php?cmd=manage1&username=admin">Manage</a> <a href="admin.php?cmd=dashboard&username=admin">Dashboard</a> <a href="admin.php?cmd=msgcenter&username=admin">Message Center </a> <a href="admin.php?cmd=manage&username=logins">Logins</a> </div> </div> <div id="content"> <div class="page"> <table width="100%" border="1" align="center"> <td bgcolor="#99FF66"><div align="center"><span class="style3">Login</span></div></td> <td bgcolor="#99FF66"><div align="center"><span class="style3">Name</span></div></td> <td bgcolor="#99FF66"><div align="center"><span class="style3">Registration Date </span></div></td> <td bgcolor="#99FF66"><div align="center"><span class="style3">Approved </span></div></td> <td bgcolor="#99FF66"><div align="center"><span class="style3">Reset Password </span></div></td> <td bgcolor="#99FF66"><div align="center"><span class="style3">Delete</span></div></td> </tr> <?php session_start(); $sid = session_id(); session_register('sid'); include_once("data/mysql.php"); $mysqlPassword = (base64_decode($mysqlpword)); $db = mysql_connect("$localhost", "$mysqlusername", "$mysqlPassword") or die ("Error connecting to database"); mysql_select_db("$dbname", $db) or die ("An error occured when connecting to database"); $result = mysql_query("SELECT * FROM members"); while($row = mysql_fetch_assoc($result)){ echo "<tr><td><a href=templates/members/home.php?username=".$row['username']."&sid=$sid>".$row['username']."</a></td> <td>".$row['firstname']." ".$row['lastname']."</td> <td>".$row['registration_date']."</td> <td><a href=admin.php?cmd=approval&username=".$row['username']."&approved=".$row['approved'].">".$row['approved']."</a></td> <td><a href=templates/members/changepw.php?username=".$row['username']."&sid=$sid>Change Password</a></td> <td><a href=templates/members/delete.php?username=".$row['username']."&sid=$sid>Delete</a></td></tr>"; } ?> </div> </div> </div> <tr> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> </tr> </table> </div> </div> </div> Many Thanks Paul This topic has been moved to CSS Help. http://www.phpfreaks.com/forums/index.php?topic=359215.0 Why do I get the following results (specifically the second example)? I thought it would be documented under https://www.php.net/manual/en/language.types.string.php, however, the word "ampersand" doesn't appear. Also, looked at logical operators, but found nothing. Thanks function test(string $string){ printf('%s %s %s 0'.PHP_EOL, gettype($string), $string, $string==0?'==':'!='); } test('123'); test('@123'); test('1@23'); test('123@');Quote
string 123 != 0
Hello all, This topic has been moved to Miscellaneous. http://www.phpfreaks.com/forums/index.php?topic=357878.0 Hi, I have an old code from 2004 and I would like to update it to use new Session object. That means instead of session_register using the $_SESSION super global variable. The main reason for this change is that wheneve I logged out from the software I get: Warning: Unknown: Your script possibly relies on a session side-effect which existed until PHP 4.2.3. Please be advised that the session extension does not consider global variables as a source of data, unless register_globals is enabled. You can disable this functionality and this warning by setting session.bug_compat_42 or session.bug_compat_warn to off, respectively in Unknown on line 0 Spo I replace my old code: <?php session_name("MySite"); session_start(); reset ($_GET); session_register("ADMIN"); session_register("ADMINNAME"); session_register("MAIL") ; $USERCOOKIE_FOR_TRACKING = array(); //to get all session variables foreach ($_SESSION as $key => $value) { $value=stripslashes(trim($value)); $$key=$value; } ?> with this new code: <?php session_name("MySite"); session_start(); reset ($_GET); $_SESSION['ADMIN']=""; $_SESSION['ADMINNAME']=""; $_SESSION['MAIL']=""; $USERCOOKIE_FOR_TRACKING = array(); //to get all session variables foreach ($_SESSION as $key => $value) { $value=stripslashes(trim($value)); $$key=$value; } ?> BUT now I cannot login to the software any more. looks like I am doing something wrong here. please tell me how do I upgrade my code. Thank you. Hi all My code give this: <b>Warning</b>: file_exists(): open_basedir restriction in effect. File(/tmp) is not within the allowed path(s): (/home/clients/........ I get the tmp folder and check for its existanse and whether it is writeable
$t=sys_get_temp_dir(); Both gives no which is fine, I can process that. I do it to avoid the output above, but I still get that. How should I check for allowed paths? This runs on several systems where I cannot access php.ini or other system stuff.
Hi everybody. I use flash 8 and actionscript 2.0. I am trying to create a small program that needs communication between php / HTML and flash. I have found ( after much frustration and having wasted days on this ) that no matter what - if i make a change to my program and re publish the HTMl AND SWF files after I have deleted the old HTML and swf files , even then when i run the NEW PUBLISHED html / php file, the movie that runs is the old one. I have tried all that I know, like checking paths and stuff to ensure that everything is ok. I am unable to shed the chached old swf file and so the old movie continues to run. Is there any one who has encountered anything like this? Please help me. This is driving me nuts. Thanks loads in anticipation of a reply from the nerds on this ! Ok I am designing a php upload that will take a image file from a form and change the name of the file to the productnumber also recieved from the form. I had it working the otherday now it says Warning: copy() [function.copy]: open_basedir restriction in effect File() is not within the allowed path(s): (/home:/tmp:/usr) addpro.php on line 51. my files are attached.... note that $pnum is the product number gotten from my form and image is the image being uploaded gotten from the form also. The thing is it worked the other day but now it don't is it a change to the server ( I dont run the server) or did I mess up my code since then? I really need a code that will do this two time over once for a small image being put into a folder called small and once for a folder called large both images being uploaded and being changed to $pnum.ext so they will both be displayed when being called out by the product number. but I can work on that after I get this one working. line 51 is $copied = copy($_FILES['image']['tmp_name'], $newname); I have written code so that when something from a MySQL field equals 0, then PHP will take no action, and if the field equals anything else, then 'echo "foo"'. The problem I am having is that when PHP echo's nothing (echo ""), its still creating the effect of a HTML <BR>. Screen shots: 1. When the MySQL table contains something else than 0 (echo "foo"). http://i51.tinypic.com/2n7oxo1.png 2. When the table contains 0 (echo ""). http://i53.tinypic.com/2h5jg4k.png 3. What it should look like if the table were to contain 0 (echo ""). Note that their is no <BR> effect. http://i51.tinypic.com/2jdtaf.png Code: $query = "select sizes from products where id='$id'"; $result = mysql_query($query); $data = mysql_fetch_array($result); if ($data['sizes'] == 0) {echo "";} else {echo "Small - ".$data['sizes'];} Is it possible to make it so if a MySQL field result equals 0, then PHP will not produce the HTML <BR> effect when it echo's nothing (echo "")? |