PHP - $_get Command Help
I am having difficulty working out how to grab from a URL within a URL a link to an image and display this image on a webpage.
example: http://domainA.com/page1.php?file_image=http://domainB.com/image.jpg I know little of this the code below but this is not working: <?php echo $_GET['file_image']; ?> this just copies the url, whereas I want to display this image.jpg from domainB using image source by grabing it. <img src=" "> I hope you understand me. Similar TutorialsA few months ago, and a good amount of time before that, I had people telling me to use isset() instead of performing to see if the variable is empty, such as: !$_GET[''] I know the differences in the function and what they do, but when could isset() be used in a situation where it's better/more efficient then: !$_GET[''] I do use isset(), though. I have a shoutbox my friend made, and I'm just adding onto it. I have command that are like @prune, @prunelogs, @logout, etc.. I am tying to make it so you can type @ban username, @unban username, etc.. Here is my command that my friend came up with. if($_POST['text'] == '@ban'.$username.'') { $unn=$idk['username']; mysql_query("UPDATE users SET banned = '1' WHERE usernane='$unn'") or die(mysql_error()); mysql_query("INSERT INTO chat (`log`, `date` ,`username` ,`text`) VALUES (1, NOW( ) , '".stripslashes($_SESSION['user'])."', 'has banned '$unn'.');") or die(mysql_error()); I have created a tar file with my site backup and I assume it is the full backup. Not sure becasue I can't "un"-tar the file. I have tried several ways to "unzip" or untar the file but can not come up with anything. here is how I had created the tar file: Code: [Select] $date = date("m-d-Y"); // repeat this command for multiple backups, changing the path - e.g. you can have a backup for email, another for files, etc. shell_exec("tar cvfz file_backup_$date.tar.gz mydir/ "); now how do extract it? I've created a login page in Dreamweaver and there is a redirect page for login success and login fail. What I want to have is a selection of screens based on a data field held in the user security table. Each security record will have up to 5 different security codes e.g. code1, code2 etc. If a code e.g. TA40, appears in any of the 5 code fields then I want the user directed to one page, if code TA41 appears in any of the 5 code fields then I want them directed to another page. The user code will only appear in one of the fields, but can appear in any of the 5 code fields.. How can I incorporate this in to the login screen logic, as currently it will just show the follwoing if (isset($_POST['opno'])) { $loginUsername=$_POST['opno']; $password=$_POST['pass_word']; $MM_fldUserAuthorization = ""; $MM_redirectLoginSuccess = "/menu.php"; $MM_redirectLoginFailed = "/loginform.php"; $MM_redirecttoReferrer = false; mysql_select_db($database_Hanson, $Hanson); Hi.. I have a php file where i have only one line which says header('Location: index.php'); How do i run this php file in the terminal on fedora 14? Thanks, Rohit Hi, I'm having a weird issue when I try to run PHP scripts from the command line on my server. I'm trying to just run a very simple script to test it out: #!/usr/bin/php-cgi -q echo "Hello terminal\n"; And I get the following error in the terminal.. Code: [Select] Error in argument 1, char 3: option not found Usage: php-cgi [-q] [-h] [-s] [-v] [-i] [-f <file>] php-cgi <file> [args...] When I try taking out the quiet (-q) parameter, I get the following error.. Code: [Select] -bash: ./socket_server.php: /usr/bin/php-cgi^M: bad interpreterNo such file or directory As you can see, in the second example, a rogue "^M" was appended to the end of the first line of my socket_server.php file. What does ^M correlate to? I realize it is a character code for something that can't be represented with an actual character, but I don't know what it is, and I'm not sure why it is being appended to the end of my first line. My assumption is that this is happening in the first example too, which is why I get the "error in argument 1" message, since undoubtedly -q^M is an invalid argument... Any help is greatly appreciated! nethnet It was suggested that I add a ‘report’ parameter to the code, after revising with the ‘scale2ref’ code which appears to prevent the video from uploading/proceeding: $ffmpegCommand =''.$ffmpeg_b.' -y -i '.$video_file_full_path.' -i '.$watermark_image_full_path.' -filter_complex "[0]scale=426:-2[vid];[1][vid]scale2ref='oh*mdar':'ih/10'[wm][vid];[vid][wm]overlay=5:5:format=rgb,format=yuv420p" -vcodec libx264 -preset '.$pt->config->convert_speed.' -crf 26 -report'.$video_output_full_path_240.' 2>&1'; $shell = shell_exec($ffmpegCommand); I couldn’t see where the -report parameter was supposed to output (error.log has a filesize of 0). So I was asked to “run command from the shell and check”? But, I’m not sure what command and where/how to do that. I tried adding this to the php code, and attempted to upload again, same result echo shell_exec("/usr/local/bin/ffmpeg -report log.txt 2>&1");
any additional help is appreciated
hello, i was wondering if there is a way to have a link do a command, but not to goto a page. my reason being is that the music player software i use has a built in web server and if you goto a certain page, it will process that command. so right now, i have an iframe that i do a target to. its pretty mickey mouse, but its what i knew how to do. thanks I know that php has a function that can execute ping command but i'm not sure how it works. I am trying to get the result of the ping command to determine: IP address has a reply (PC/device is turned on) IP address has no reply (ip address is vacant and not assigned to any pc/device IP address has a response (PC/device is turned off) is this "do-able" in php?? this is my script: Code: [Select] function ping($ip){ // #5882FA blue color indicates Fiber Module // #FACC2E orange color indicates cascade/uplink cable // #81F781 Green color indicates connected/turned on // #FE2E2E Red color indicates disconnected/turned off // #585858 dark gray color indicates connected patch panel port is vacant at user side if($ip=="Cascade" OR $ip=="Uplink"){ return $status="style=\"background-color:#FACC2E;cursor:pointer;\""; /* orange */ }elseif ($ip=="Fibre Module"){ return $status="style=\"background-color:#5882FA;cursor:pointer;\""; /* blue */ }elseif ($ip==null or $ip==""){ return $status="style=\"cursor:pointer;background-image:url(images/x.gif);\""; /* dark gray */ }else{ $str = exec("ping -n 1 -w 1 $ip", $input, $result); if ($result == 0){ return $status="style=\"background-color:#81F781;cursor:pointer;\""; /* green */ //return "on"; }else{ return $status="style=\"background-color:#FE2E2E;cursor:pointer;\""; /* red */ //return "off"; } } } i can get it display on or off and i've tested it working. but i just can't figure out if i could use this command to determine if the IP address is vacant or unassigned. I'm using this for a IP list inventory system built in PHP. I have careted a page where the the 3com switch is drawn in tabulated format with each port assigned (via PHP) to the corresponding IP address of the device/PC and indicates the port color as described in the above function. Surprisingly it works well for this switch inventory. I just want to create another page for IP address inventory using the same function. To put is simple i want to have the same function as the sofware "Advance IP-Scanner" which does the same thing as well only thing is my resources are limited to PHP (WAMP). any help guys? Is there anything in php that let's me SWAP 2 arrays? like let's say I have 3,2,1 in a array, is there a way I can swap the 2 and 1 if a statement is true? This topic has been moved to mod_rewrite. http://www.phpfreaks.com/forums/index.php?topic=326238.0 Commands out of sync; you can't run this command now Query: DELETE FROM case_ref WHERE user_id='3';DELETE FROM updates WHERE user_id='3' php]<?php // Check if the form has been submitted: if (isset($_POST['delete'])) { if ($_POST['sure'] == 'Yes') { // Delete the record. // Make the query: $query = "DELETE FROM case_ref WHERE user_id='$id';"; $query .= "DELETE FROM updates WHERE user_id='$id'"; $r = mysqli_multi_query ($dbc, $query); if (mysqli_affected_rows($dbc) >= 1) { // If it ran OK. echo '<h3>All cases & updates associated with user have been deleted</h3>'; } // Make the query: $q = "DELETE FROM users WHERE user_id='$id' LIMIT 1"; $r = $r = mysqli_query ($dbc, $q); if (mysqli_affected_rows($dbc) == 1) { // If it ran OK. echo '<h3>User has been deleted</h3>'; } else { // If the query did not run OK. $errors[] = '<p class="error">The user could not be deleted due to a system error.</p>'; // Public message. $errors[] = '<p>' . mysqli_error($dbc) . '<br />Query: ' . $query . '</p>'; // Debugging message. } } else { // No confirmation of deletion. $errors[] = '<p class="error">The user has NOT been deleted.</p>'; } }else{ //show the form echo '<form id="form1" name="form1" method="post" action="delete_user.php?user_id=' . $id . '"> <table width="100%" border="1" cellpadding="5" cellspacing="5"> <tr> <td width="30%">Do you wish to delete this user?</td> <td width="19%"><input type="radio" name="sure" value="Yes" /> Yes </td> <td width="17%"><input type="radio" name="sure" value="No" checked="checked" /> No</td> <td width="34%"> <input type="submit" name="button" id="button" value="Submit" /> <input name="delete" type="hidden" id="delete" value="1" /></td> </tr> </table>'; } // Print any error messages, if they exist: if (!empty($errors)) { foreach ($errors as $msg) { echo "$msg\n"; } } mysqli_close($dbc); ?>[/php] Hello people, At the moment I am really desperate. I've done this script over 20 times now, always with the same script but all of a suddon, it doesn't work anymore. heres the problem: I made a very simple "patient database" for a doctor. Where he can upload patients, alter and delete them. The script to add the patients works fine. now im trying to make a script where he can alter the variables agian, using the UPDATE command. but instead of updating the variables it cleares all the date in the row. can someone help me? here s the entire code: Code: [Select] <?PHP include'connect.php'; ?> <?PHP $SQL = mysql_query("SELECT * FROM leys_patienten WHERE patientid='".$_REQUEST['patientid']."'"); while ($row = mysql_fetch_array($SQL)) { ?> <?PHP if ($_POST[submit]) { if (!$_POST[volgnummer]) { echo "<font size=\"2\" color=\"#990000\"><b>--> Vul een volgnummer in a.u.b. <--</b></font>"; } elseif (!$_POST[naam]) { echo "<font size=\"2\" color=\"#990000\"><b>--> Vul een naam in a.u.b. <--</b></font>"; } elseif (!$_POST[voornaam]) { echo "<font size=\"2\" color=\"#990000\"><b>--> Vul een voornaam in a.u.b.! <--</b></font>"; } else { mysql_query("UPDATE leys_patienten SET volgnummer='$volgnummer',naam='$naam',voornaam='$voornaam',adres='$adres',postcode='$postcode',plaats='$plaats',telefoon='$telefoon',email='$email',geboortedatum='$geboortedatum',geboorteplaats='$geboorteplaats',opmerkingen='$opmerkingen' WHERE patientid='".$_REQUEST['patientid']."'") or die(mysql_error()); echo "Het patientendossier is succesvol gewijzigd, let op doorschakeling.";?> <meta http-equiv="Refresh" content="1; url=patient.php?patientid=<?PHP echo $row['patientid']?>" /> <? } } ?></p> <form action="<?$PHP_SELF?>" method="post" name="post" id="post"> <table width="805" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td class="table_forms">Volgnummer*</td> <td class="table_forms"><label><input name="volgnummer" type="text" id="volgnummer" value="<?PHP echo $row['volgnummer']?>" size="40" /></label></td> </tr> <tr> <td width="146" class="table_forms">Naam*</td> <td width="659" class="table_forms"><label><input name="naam" type="text" id="naam" value="<?PHP echo $row['naam']?>" size="40" /></label></td> </tr> <tr> <td class="table_forms">Voornaam*</td> <td class="table_forms"><font color="#FFFFFF" size="2"> <label><input name="voornaam" type="text" id="voornaam" value="<?PHP echo $row['voornaam']?>" size="40" /></label> </font></td> </tr> <tr> <td class="table_forms">Adres </td> <td><font color="#FFFFFF" size="2"> <label><input name="adres" type="text" id="adres" value="<?PHP echo $row['adres']?>" size="40" /></label> </font></td> </tr> <tr> <td class="table_forms">Postcode</td> <td><font color="#FFFFFF" size="2"> <label><input name="postcode" type="text" id="postcode" value="<?PHP echo $row['postcode']?>" size="6" /></label> </font></td> </tr> <tr> <td class="table_forms">Plaats</td> <td><font color="#FFFFFF" size="2"> <label><input name="plaats" type="text" id="plaats" value="<?PHP echo $row['plaats']?>" size="40" /></label> </font></td> </tr> <tr> <td class="table_forms">Telefoon</td> <td><font color="#FFFFFF" size="2"> <label><input name="telefoon" type="text" id="telefoon" value="<?PHP echo $row['telefoon']?>" size="40" /></label> </font></td> </tr> <tr> <td class="table_forms">E-mail</td> <td><font color="#FFFFFF" size="2"> <label><input name="email" type="text" id="email" value="<?PHP echo $row['email']?>" size="40" /></label> </font></td> </tr> <tr> <td class="table_forms">Geboortedatum</td> <td><font color="#FFFFFF" size="2"> <label><input name="geboortedatum" type="text" id="geboortedatum" value="<?PHP echo $row['geboortedatum']?>" size="40" /></label> </font></td> </tr> <tr> <td class="table_forms">Geboorteplaats</td> <td><font color="#FFFFFF" size="2"> <label><input name="geboorteplaats" type="text" id="geboorteplaats" value="<?PHP echo $row['geboorteplaats']?>" size="40" /></label> </font></td> </tr> <tr> <td valign="top" class="table_forms">Opmerkingen</td> <td><font color="#FFFFFF" size="2"> <label><textarea name="opmerkingen" cols="40" rows="4" id="opmerkingen"><?PHP echo $row['opmerkingen']?></textarea></label> </font></td> </tr> <tr> <td valign="top" class="table_forms"> </td> <td><span class="body_tekst"> <input type="submit" id="submit" name="submit" value="verstuur" /> </span></td> </tr> </table> <p class="body_tekst"> </p> </form> <? } ?> is there a way to excute the system() command here but not wait for it and just let it go in the background? And something that wont boggle down the system too much? Thanks! Code: [Select] $this->db->insert('jukebox', $data); echo '1'; system('ffmpeg -i ' . $id . '.mp3 -acodec libvorbis -aq 60 ' . $id . '.ogg'); hey guys m using STDIN as input stream in php command line my problem is that some time i get this error Warning: fgets(): supplied argument is not a valid stream resource in D:\myquery \test.php on line 16 $number=fgets(STDIN); anyone knows solution hello, I have this problem in running a specific command after using shell_exec or exec to execute a certain process. The process I am running is unimrcpclient, after initialization, it expects some command to be entered in order to communicate with the mrcp server. however, passing the command as an attribute is not an option. Is there a way in PHP to execute a process, wait for initialization and then pass the command automatically? thank you. I am trying to execute a command line tool, but am having a problem adding a variable to the line. Here is the code Code: [Select] $filename = "devices.txt"; $handle = fopen($filename, 'r'); while (!feof($handle)) { $devices = fgets($handle, 4096); $query = 'ipmitool -I lanplus -H 192.168.1.1 -U admin -P adminpass sdr list'; passthru($query); } flcose($handle); On this line I don't want to have the IP manually added like so. Code: [Select] $query = 'ipmitool -I lanplus -H 192.168.1.1 -U admin -P adminpass sdr list'; Instead I want to be able to insert the $devices variable which contains the values from the text file so it would look something like this: Code: [Select] $query = 'ipmitool -I lanplus -H $devices -U admin -P adminpass sdr list'; Problem is the command line tool does not run this way. How do I properly add the $devices variable so the command line tool ipmitool will run with its value? Thanks, I have PHP and MYSQL Web Development Fourth Edition by Luke Welling and Laura Thompson I am on Chapter 9 Creating Your Web Database on Page 230 my -h host -u bookorama -D boos -p < bookorama.sql I have been tring to make this code work for 3 weeks and no luck. Can anybody Help Me on this line. They are not clear enough on this line but the book is an awesome book, learning alot. Hi, I am trying to use php to pass some commands to my linux box.From my webpage I am using the shell_exec function which is working OK but for some administrative tasks in linux I must have root access. As I am sending the commands from the webpage the apache user is used and so I am not allowed to do several tasks. I have also tried to use a bash script to pass the commands but with no result. Any ideas ? Hi I've got a qry that selects 100 questions one at a time from tblquestions. When the users have answered q100 I want them to be able to come out of the post-process-post loop that has taken them through the survey. My idea is that I could put an IF requirement in before the qry runs each time it selects the next question i.e. if $nextq <101 $result = mysql_query("SELECT oid,psc9 FROM tblquestions WHERE oid = $nextq"); if (!$result) { echo 'Could not run query: ' . mysql_error(); exit; }; else echo "thanks you've finished now"; Two Questions: Is this the way I should be going about this problem? Have I got the syntax right? Many thanks! Nick |